Bug 1936728 - Use standard data types for MozVirtualAlloc() r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D235724
This commit is contained in:
Paul Bone
2025-01-29 09:29:24 +00:00
parent 6ac9f66aa8
commit 9e26a1600f
2 changed files with 7 additions and 9 deletions

View File

@@ -1985,8 +1985,8 @@ StallSpecs GetAllocatorStallSpecs() {
//
// Ref:
// https://docs.microsoft.com/en-us/troubleshoot/windows-client/performance/slow-page-file-growth-memory-allocation-errors
void* MozVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType,
DWORD flProtect) {
void* MozVirtualAlloc(void* lpAddress, size_t dwSize, uint32_t flAllocationType,
uint32_t flProtect) {
using namespace MozAllocRetries;
DWORD const lastError = ::GetLastError();

View File

@@ -11,7 +11,6 @@
#include <type_traits>
#if defined(MOZ_MEMORY) && defined(XP_WIN)
# include <wtypes.h>
# include "mozmemory_wrap.h"
#endif
@@ -46,8 +45,8 @@ struct StallSpecs {
// ```
//
template <typename DelayFunc, typename OpFunc>
auto StallAndRetry(DelayFunc&& aDelayFunc,
OpFunc&& aOperation) const -> decltype(aOperation()) {
auto StallAndRetry(DelayFunc&& aDelayFunc, OpFunc&& aOperation) const
-> decltype(aOperation()) {
{
// Explicit typecheck for OpFunc, to provide an explicit error message.
using detail::is_std_optional;
@@ -69,10 +68,9 @@ struct StallSpecs {
#if defined(MOZ_MEMORY) && defined(XP_WIN)
MOZ_JEMALLOC_API StallSpecs GetAllocatorStallSpecs();
MOZ_JEMALLOC_API_NODISCARD void* MozVirtualAlloc(LPVOID lpAddress,
SIZE_T dwSize,
DWORD flAllocationType,
DWORD flProtect);
MOZ_JEMALLOC_API_NODISCARD void* MozVirtualAlloc(void* lpAddress, size_t dwSize,
uint32_t flAllocationType,
uint32_t flProtect);
#endif
} // namespace mozilla