Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into master.lion
  • Loading branch information
bluebox authored and bluebox committed Jun 26, 2020
2 parents 454878b + b722095 commit ff0dad2
Show file tree
Hide file tree
Showing 322 changed files with 2,701 additions and 3,780 deletions.
16 changes: 8 additions & 8 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling ANGLE
# and whatever else without interference from each other.
'angle_revision': 'c81da1c809fed1f5f0f7ced07584f1dca4d3f7dc',
'angle_revision': 'c9f311e46255f65f5aa72beee8c70dca515f10d3',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling SwiftShader
# and whatever else without interference from each other.
Expand Down Expand Up @@ -259,7 +259,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling devtools-frontend
# and whatever else without interference from each other.
'devtools_frontend_revision': '82270c608217db40144b95d6c016780cdd663647',
'devtools_frontend_revision': 'bf571219978d7234cd562875df312d9a3490c02d',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling libprotobuf-mutator
# and whatever else without interference from each other.
Expand Down Expand Up @@ -311,7 +311,7 @@ vars = {
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
'dawn_revision': '2a6cc4f8fb40beb27a3542528955df7790a42116',
'dawn_revision': 'ff90599cdf600e48d5868f8b3d35698686f5b161',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling feed
# and whatever else without interference from each other.
Expand Down Expand Up @@ -534,7 +534,7 @@ deps = {
},

'src/ios/third_party/material_components_ios/src': {
'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '39de3e3efbabda3e20aabf14485f872979b8d230',
'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '87422cf14f454ce8c0c9f4a9c3233f2aa73ef6b4',
'condition': 'checkout_ios',
},

Expand Down Expand Up @@ -1230,7 +1230,7 @@ deps = {
},

'src/third_party/perfetto':
Var('android_git') + '/platform/external/perfetto.git' + '@' + 'c84119493b9c8e2058f5359908c073faa0faf248',
Var('android_git') + '/platform/external/perfetto.git' + '@' + '55be03a1e00161bb91f55545abe45fbe89ad364c',

'src/third_party/perl': {
'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3',
Expand Down Expand Up @@ -1308,7 +1308,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/third_party/aemu/linux-amd64',
'version': 'YFi4RbbToiNVSl0eKxjhhhAElSEXx2Y9i-5Q4eBGkUwC'
'version': 'FN-ckx_oV2JTqPuW3iMG50qdN5FgGqm-4XP9AkoLwPUC'
},
],
'condition': 'host_os == "linux" and checkout_fuchsia',
Expand Down Expand Up @@ -1458,7 +1458,7 @@ deps = {
},

'src/third_party/webrtc':
Var('webrtc_git') + '/src.git' + '@' + 'b19cfeeb5c668bea40fed33628ebf1ec1eeb9c6e',
Var('webrtc_git') + '/src.git' + '@' + 'c403081641a89853043ee3cd55ab1d04e2f4b47e',

'src/third_party/libgifcodec':
Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'),
Expand Down Expand Up @@ -1530,7 +1530,7 @@ deps = {
Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'),

'src-internal': {
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@7be9918fef159ee5934df59d5c49824b16fe9d92',
'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@4b4651dbc2554afbd5359c6b0bf31d5a0c6000b1',
'condition': 'checkout_src_internal',
},

Expand Down
2 changes: 1 addition & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5174,7 +5174,7 @@ def _ParseIcuVariants(text, offset=0):
'screenshots check.'))

if icu_syntax_errors:
results.append(output_api.PresubmitError(
results.append(output_api.PresubmitPromptWarning(
'ICU syntax errors were found in the following strings (problems or '
'feedback? Contact [email protected]):', items=icu_syntax_errors))

Expand Down
23 changes: 12 additions & 11 deletions base/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,18 @@ def _CheckNoTraceEventInclude(input_api, output_api):
to maintain compatibility with the gn flag "enable_base_tracing = false".
"""
discouraged_includes = [
r'^#include "base/trace_event/blame_context.h"$',
r'^#include "base/trace_event/memory_allocator_dump_guid.h"$',
r'^#include "base/trace_event/memory_dump_provider.h"$',
r'^#include "base/trace_event/trace_event.h"$',
r'^#include "base/trace_event/traced_value.h"$',
r'^#include "base/trace_event/(?!base_tracing\.h)',
]

white_list = [
r".*\.(h|cc|mm)$",
]
black_list = [
r".*[\\/]test[\\/].*",
r".*[\\/]trace_event[\\/].*",
r".*[\\/]tracing[\\/].*",
]
no_presubmit = r"// no-presubmit-check"

def FilterFile(affected_file):
return input_api.FilterSourceFile(
Expand All @@ -65,16 +63,19 @@ def FilterFile(affected_file):
for f in input_api.AffectedSourceFiles(FilterFile):
for line_num, line in f.ChangedContents():
for include in discouraged_includes:
if input_api.re.search(include, line):
if (input_api.re.search(include, line) and
not input_api.re.search(no_presubmit, line)):
locations.append(" %s:%d" % (f.LocalPath(), line_num))
break

if locations:
return [ output_api.PresubmitPromptWarning(
'Consider replacing includes to trace_event implementation headers\n' +
'in //base with "base/trace_event/base_tracing.h" and/or verify\n' +
'that base_unittests still passes with gn arg\n' +
'enable_base_tracing = false.\n' + '\n'.join(locations)) ]
return [ output_api.PresubmitError(
'Base code should include "base/trace_event/base_tracing.h" instead\n' +
'of trace_event implementation headers. If you need to include an\n' +
'implementation header, verify that base_unittests still passes\n' +
'with gn arg "enable_base_tracing = false" and add\n' +
'"// no-presubmit-check" after the include. \n' +
'\n'.join(locations)) ]
return []


Expand Down
16 changes: 14 additions & 2 deletions base/allocator/partition_allocator/page_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Lock& GetReserveLock() {
return *lock;
}

std::atomic<size_t> g_total_mapped_address_space;

// We only support a single block of reserved address space.
void* s_reservation_address GUARDED_BY(GetReserveLock()) = nullptr;
size_t s_reservation_size GUARDED_BY(GetReserveLock()) = 0;
Expand Down Expand Up @@ -97,8 +99,12 @@ void* SystemAllocPages(void* hint,
PA_DCHECK(!(reinterpret_cast<uintptr_t>(hint) &
kPageAllocationGranularityOffsetMask));
PA_DCHECK(commit || accessibility == PageInaccessible);
return SystemAllocPagesInternal(hint, length, accessibility, page_tag,
commit);
void* ptr =
SystemAllocPagesInternal(hint, length, accessibility, page_tag, commit);
if (ptr)
g_total_mapped_address_space.fetch_add(length, std::memory_order_relaxed);

return ptr;
}

void* AllocPages(void* address,
Expand Down Expand Up @@ -188,6 +194,8 @@ void FreePages(void* address, size_t length) {
kPageAllocationGranularityOffsetMask));
PA_DCHECK(!(length & kPageAllocationGranularityOffsetMask));
FreePagesInternal(address, length);
PA_DCHECK(g_total_mapped_address_space.load(std::memory_order_relaxed) > 0);
g_total_mapped_address_space.fetch_sub(length, std::memory_order_relaxed);
}

bool TrySetSystemPagesAccess(void* address,
Expand Down Expand Up @@ -261,4 +269,8 @@ uint32_t GetAllocPageErrorCode() {
return s_allocPageErrorCode;
}

size_t GetTotalMappedSize() {
return g_total_mapped_address_space;
}

} // namespace base
5 changes: 5 additions & 0 deletions base/allocator/partition_allocator/page_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ BASE_EXPORT bool HasReservationForTesting();
// (POSIX) or |VirtualAlloc| (Windows) fails.
BASE_EXPORT uint32_t GetAllocPageErrorCode();

// Returns the total amount of mapped pages from all clients of
// PageAllocator. These pages may or may not be committed. This is mostly useful
// to assess address space pressure.
BASE_EXPORT size_t GetTotalMappedSize();

} // namespace base

#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PAGE_ALLOCATOR_H_
42 changes: 20 additions & 22 deletions base/allocator/partition_allocator/page_allocator_internals_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,6 @@ void* SystemAllocPagesInternal(void* hint,
return ret;
}

void* TrimMappingInternal(void* base,
size_t base_length,
size_t trim_length,
PageAccessibilityConfiguration accessibility,
bool commit,
size_t pre_slack,
size_t post_slack) {
void* ret = base;
// We can resize the allocation run. Release unneeded memory before and after
// the aligned range.
if (pre_slack) {
int res = munmap(base, pre_slack);
PCHECK(!res);
ret = reinterpret_cast<char*>(base) + pre_slack;
}
if (post_slack) {
int res = munmap(reinterpret_cast<char*>(ret) + trim_length, post_slack);
PCHECK(!res);
}
return ret;
}

bool TrySetSystemPagesAccessInternal(
void* address,
size_t length,
Expand All @@ -195,6 +173,26 @@ void FreePagesInternal(void* address, size_t length) {
PCHECK(!munmap(address, length));
}

void* TrimMappingInternal(void* base,
size_t base_length,
size_t trim_length,
PageAccessibilityConfiguration accessibility,
bool commit,
size_t pre_slack,
size_t post_slack) {
void* ret = base;
// We can resize the allocation run. Release unneeded memory before and after
// the aligned range.
if (pre_slack) {
FreePages(base, pre_slack);
ret = reinterpret_cast<char*>(base) + pre_slack;
}
if (post_slack) {
FreePages(reinterpret_cast<char*>(ret) + trim_length, post_slack);
}
return ret;
}

void DecommitSystemPagesInternal(void* address, size_t length) {
// In POSIX, there is no decommit concept. Discarding is an effective way of
// implementing the Windows semantics where the OS is allowed to not swap the
Expand Down
21 changes: 21 additions & 0 deletions base/allocator/partition_allocator/page_allocator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,31 @@ TEST(PageAllocatorTest, DecommitErasesMemory) {
sum += recommitted_buffer[i];
}
EXPECT_EQ(0u, sum) << "Data was not erased";

FreePages(buffer, size);
}

#endif // defined(OS_MACOSX)

TEST(PageAllocatorTest, MappedPagesAccounting) {
size_t size = kPageAllocationGranularity;
size_t mapped_size_before = GetTotalMappedSize();

// Ask for a large alignment to make sure that trimming doesn't change the
// accounting.
void* data = AllocPages(nullptr, size, 128 * kPageAllocationGranularity,
PageInaccessible, PageTag::kChromium, true);
ASSERT_TRUE(data);

EXPECT_EQ(mapped_size_before + size, GetTotalMappedSize());

DecommitSystemPages(data, size);
EXPECT_EQ(mapped_size_before + size, GetTotalMappedSize());

FreePages(data, size);
EXPECT_EQ(mapped_size_before, GetTotalMappedSize());
}

} // namespace base

#endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

#include "base/command_line.h"
#include "base/time/time.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_manager.h" // no-presubmit-check
#include "base/trace_event/memory_dump_provider.h" // no-presubmit-check
#endif // BUILDFLAG(DEVTOOLS_INSTRUMENTATION_DUMPING)

#if !BUILDFLAG(SUPPORTS_CODE_ORDERING)
Expand Down
4 changes: 2 additions & 2 deletions base/android/orderfile/orderfile_instrumentation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

#include "base/command_line.h"
#include "base/time/time.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_manager.h" // no-presubmit-check
#include "base/trace_event/memory_dump_provider.h" // no-presubmit-check
#endif // BUILDFLAG(DEVTOOLS_INSTRUMENTATION_DUMPING)

#if !BUILDFLAG(SUPPORTS_CODE_ORDERING)
Expand Down
2 changes: 1 addition & 1 deletion base/android/trace_event_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "base/tracing_buildflags.h"

#if BUILDFLAG(ENABLE_BASE_TRACING)
#include "base/trace_event/trace_event_impl.h"
#include "base/trace_event/trace_event_impl.h" // no-presubmit-check
#endif // BUILDFLAG(ENABLE_BASE_TRACING)

namespace base {
Expand Down
2 changes: 1 addition & 1 deletion base/containers/mru_cache_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(ENABLE_BASE_TRACING)
#include "base/trace_event/memory_usage_estimator.h"
#include "base/trace_event/memory_usage_estimator.h" // no-presubmit-check
#endif // BUILDFLAG(ENABLE_BASE_TRACING)

namespace base {
Expand Down
Loading

0 comments on commit ff0dad2

Please sign in to comment.