Commit 22034ca8 authored by Mostyn Bramley-Moore's avatar Mostyn Bramley-Moore Committed by Commit Bot

[jumbo] don't #include inside namespaces

Speculative mac jumbo fix after this CL:
https://chromium-review.googlesource.com/c/chromium/src/+/978860/

TBR=palmer@chromium.org

Bug: 766882
Change-Id: I673edfd250987cd654e45c13b749f800438e2313
Reviewed-on: https://chromium-review.googlesource.com/979806
Commit-Queue: Mostyn Bramley-Moore <mostynb@vewd.com>
Reviewed-by: default avatarDaniel Bratell <bratell@opera.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545761}
parent 15c90de6
......@@ -1421,6 +1421,7 @@ jumbo_component("base") {
"allocator/partition_allocator/oom.h",
"allocator/partition_allocator/page_allocator.cc",
"allocator/partition_allocator/page_allocator.h",
"allocator/partition_allocator/page_allocator_internal.h",
"allocator/partition_allocator/partition_alloc.cc",
"allocator/partition_allocator/partition_alloc.h",
"allocator/partition_allocator/spin_lock.cc",
......
......@@ -7,6 +7,7 @@
#include <limits.h>
#include "base/allocator/partition_allocator/address_space_randomization.h"
#include "base/allocator/partition_allocator/page_allocator_internal.h"
#include "base/allocator/partition_allocator/spin_lock.h"
#include "base/base_export.h"
#include "base/compiler_specific.h"
......@@ -21,10 +22,6 @@
#include <windows.h>
#endif
namespace base {
namespace {
#if defined(OS_POSIX)
#include "base/allocator/partition_allocator/page_allocator_internals_posix.h"
#elif defined(OS_WIN)
......@@ -33,6 +30,10 @@ namespace {
#error Platform not supported.
#endif
namespace base {
namespace {
// We may reserve/release address space on different threads.
LazyInstance<subtle::SpinLock>::Leaky s_reserveLock = LAZY_INSTANCE_INITIALIZER;
......@@ -40,19 +41,6 @@ LazyInstance<subtle::SpinLock>::Leaky s_reserveLock = LAZY_INSTANCE_INITIALIZER;
void* s_reservation_address = nullptr;
size_t s_reservation_size = 0;
void* SystemAllocPages(void* hint,
size_t length,
PageAccessibilityConfiguration accessibility,
PageTag page_tag,
bool commit) {
DCHECK(!(length & kPageAllocationGranularityOffsetMask));
DCHECK(!(reinterpret_cast<uintptr_t>(hint) &
kPageAllocationGranularityOffsetMask));
DCHECK(commit || accessibility == PageInaccessible);
return SystemAllocPagesInternal(hint, length, accessibility, page_tag,
commit);
}
void* AllocPagesIncludingReserved(void* address,
size_t length,
PageAccessibilityConfiguration accessibility,
......@@ -95,6 +83,19 @@ void* TrimMapping(void* base,
} // namespace
void* SystemAllocPages(void* hint,
size_t length,
PageAccessibilityConfiguration accessibility,
PageTag page_tag,
bool commit) {
DCHECK(!(length & kPageAllocationGranularityOffsetMask));
DCHECK(!(reinterpret_cast<uintptr_t>(hint) &
kPageAllocationGranularityOffsetMask));
DCHECK(commit || accessibility == PageInaccessible);
return SystemAllocPagesInternal(hint, length, accessibility, page_tag,
commit);
}
void* AllocPages(void* address,
size_t length,
size_t align,
......
// Copyright (c) 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNAL_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNAL_H_
namespace base {
void* SystemAllocPages(void* hint,
size_t length,
PageAccessibilityConfiguration accessibility,
PageTag page_tag,
bool commit);
} // namespace base
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNAL_H_
......@@ -25,6 +25,8 @@
#define MAP_ANONYMOUS MAP_ANON
#endif
namespace base {
// |mmap| uses a nearby address if the hint address is blocked.
const bool kHintIsAdvisory = true;
std::atomic<int32_t> s_allocPageErrorCode{0};
......@@ -173,4 +175,6 @@ void DiscardSystemPagesInternal(void* address, size_t length) {
CHECK(!ret);
}
} // namespace base
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_POSIX_H_
......@@ -5,6 +5,10 @@
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
#include "base/allocator/partition_allocator/page_allocator_internal.h"
namespace base {
// |VirtualAlloc| will fail if allocation at the hint address is blocked.
const bool kHintIsAdvisory = false;
std::atomic<int32_t> s_allocPageErrorCode{ERROR_SUCCESS};
......@@ -39,13 +43,6 @@ void* SystemAllocPagesInternal(void* hint,
return ret;
}
// page_allocator.cc defines this function.
void* SystemAllocPages(void* hint,
size_t length,
PageAccessibilityConfiguration accessibility,
PageTag page_tag,
bool commit);
void* TrimMappingInternal(void* base,
size_t base_length,
size_t trim_length,
......@@ -117,4 +114,6 @@ void DiscardSystemPagesInternal(void* address, size_t length) {
}
}
} // namespace base
#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_INTERNALS_WIN_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment