Skip to content

Commit

Permalink
Updating to 60.0.3100.0 (google#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpwarres authored May 15, 2017
1 parent 6bbf013 commit 0f30d66
Show file tree
Hide file tree
Showing 5,622 changed files with 206,530 additions and 305,322 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions proto_quic_tools/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'third_party/ced',
'third_party/closure_compiler',
'third_party/drmemory',
'third_party/googletest',
'third_party/icu',
'third_party/instrumented_libraries',
'third_party/libxml/',
Expand Down
26 changes: 23 additions & 3 deletions src/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ component("base") {
"memory/scoped_vector.h",
"memory/shared_memory.h",
"memory/shared_memory_android.cc",
"memory/shared_memory_handle.cc",
"memory/shared_memory_handle.h",
"memory/shared_memory_handle_mac.cc",
"memory/shared_memory_handle_win.cc",
Expand Down Expand Up @@ -579,6 +580,8 @@ component("base") {
"metrics/sample_map.h",
"metrics/sample_vector.cc",
"metrics/sample_vector.h",
"metrics/single_sample_metrics.cc",
"metrics/single_sample_metrics.h",
"metrics/sparse_histogram.cc",
"metrics/sparse_histogram.h",
"metrics/statistics_recorder.cc",
Expand Down Expand Up @@ -693,6 +696,7 @@ component("base") {
"process/process_win.cc",
"profiler/native_stack_sampler.cc",
"profiler/native_stack_sampler.h",
"profiler/native_stack_sampler_mac.cc",
"profiler/native_stack_sampler_posix.cc",
"profiler/native_stack_sampler_win.cc",
"profiler/scoped_profile.cc",
Expand Down Expand Up @@ -843,6 +847,7 @@ component("base") {
"task_scheduler/sequence.h",
"task_scheduler/sequence_sort_key.cc",
"task_scheduler/sequence_sort_key.h",
"task_scheduler/single_thread_task_runner_thread_mode.h",
"task_scheduler/task.cc",
"task_scheduler/task.h",
"task_scheduler/task_scheduler.cc",
Expand Down Expand Up @@ -955,6 +960,8 @@ component("base") {
"trace_event/heap_profiler_event_filter.h",
"trace_event/heap_profiler_heap_dump_writer.cc",
"trace_event/heap_profiler_heap_dump_writer.h",
"trace_event/heap_profiler_serialization_state.cc",
"trace_event/heap_profiler_serialization_state.h",
"trace_event/heap_profiler_stack_frame_deduplicator.cc",
"trace_event/heap_profiler_stack_frame_deduplicator.h",
"trace_event/heap_profiler_type_name_deduplicator.cc",
Expand All @@ -976,8 +983,6 @@ component("base") {
"trace_event/memory_dump_request_args.h",
"trace_event/memory_dump_scheduler.cc",
"trace_event/memory_dump_scheduler.h",
"trace_event/memory_dump_session_state.cc",
"trace_event/memory_dump_session_state.h",
"trace_event/memory_infra_background_whitelist.cc",
"trace_event/memory_infra_background_whitelist.h",
"trace_event/memory_peak_detector.cc",
Expand Down Expand Up @@ -1469,6 +1474,10 @@ component("base") {
"strings/sys_string_conversions_posix.cc",
"threading/platform_thread_internal_posix.cc",
]

if (is_mac) {
sources -= [ "profiler/native_stack_sampler_posix.cc" ]
}
} else {
# Non-Mac/ios.
sources -= [
Expand Down Expand Up @@ -1840,7 +1849,9 @@ if (is_win) {
"//base/win:base_win_features",
]
}
}

if (is_win || is_mac) {
if (current_cpu == "x64") {
# Must be a shared library so that it can be unloaded during testing.
shared_library("base_profiler_test_support_library") {
Expand Down Expand Up @@ -2048,6 +2059,7 @@ test("base_unittests") {
"metrics/persistent_sample_map_unittest.cc",
"metrics/sample_map_unittest.cc",
"metrics/sample_vector_unittest.cc",
"metrics/single_sample_metrics_unittest.cc",
"metrics/sparse_histogram_unittest.cc",
"metrics/statistics_recorder_unittest.cc",
"native_library_unittest.cc",
Expand Down Expand Up @@ -2133,6 +2145,7 @@ test("base_unittests") {
"test/histogram_tester_unittest.cc",
"test/mock_callback_unittest.cc",
"test/scoped_mock_time_message_loop_task_runner_unittest.cc",
"test/scoped_task_environment_unittest.cc",
"test/scoped_task_scheduler_unittest.cc",
"test/test_pending_task_unittest.cc",
"test/test_reg_util_win_unittest.cc",
Expand Down Expand Up @@ -2304,6 +2317,9 @@ test("base_unittests") {
"CoreFoundation.framework",
"Foundation.framework",
]
if (current_cpu == "x64") {
data_deps += [ ":base_profiler_test_support_library" ]
}
}

if (is_linux) {
Expand Down Expand Up @@ -2342,7 +2358,7 @@ test("base_unittests") {
deps += [ "//base:scoped_handle_test_dll" ]
if (current_cpu == "x64") {
sources += [ "profiler/win32_stack_frame_unwinder_unittest.cc" ]
deps += [ ":base_profiler_test_support_library" ]
data_deps += [ ":base_profiler_test_support_library" ]
}
}

Expand Down Expand Up @@ -2493,6 +2509,7 @@ if (is_android) {
"android/java/src/org/chromium/base/ContentUriUtils.java",
"android/java/src/org/chromium/base/ContextUtils.java",
"android/java/src/org/chromium/base/CpuFeatures.java",
"android/java/src/org/chromium/base/DiscardableReferencePool.java",
"android/java/src/org/chromium/base/EarlyTraceEvent.java",
"android/java/src/org/chromium/base/EventLog.java",
"android/java/src/org/chromium/base/FieldTrialList.java",
Expand Down Expand Up @@ -2599,6 +2616,7 @@ if (is_android) {
"//third_party/android_tools:android_support_compat_java",
"//third_party/hamcrest:hamcrest_core_java",
"//third_party/junit",
"//third_party/ub-uiautomator:ub_uiautomator_java",
]
java_files = [
"test/android/javatests/src/org/chromium/base/test/BaseActivityInstrumentationTestCase.java",
Expand All @@ -2608,6 +2626,7 @@ if (is_android) {
"test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java",
"test/android/javatests/src/org/chromium/base/test/BaseChromiumRunnerCommon.java",
"test/android/javatests/src/org/chromium/base/test/BaseTestResult.java",
"test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java",
"test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java",
"test/android/javatests/src/org/chromium/base/test/SetUpStatement.java",
"test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java",
Expand Down Expand Up @@ -2649,6 +2668,7 @@ if (is_android) {
junit_binary("base_junit_tests") {
java_files = [
"android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java",
"android/junit/src/org/chromium/base/DiscardableReferencePoolTest.java",
"android/junit/src/org/chromium/base/LogTest.java",
"android/junit/src/org/chromium/base/NonThreadSafeTest.java",
"android/junit/src/org/chromium/base/PromiseTest.java",
Expand Down
123 changes: 62 additions & 61 deletions src/base/allocator/partition_allocator/PartitionAlloc.md
Original file line number Diff line number Diff line change
@@ -1,97 +1,98 @@
# PartitionAlloc Design

This document explains a high-level design of PartitionAlloc.
If you're interested in its in-depth implementation, see comments
in partition_alloc.h.
This document describes PartitionAlloc at a high level. For documentation about
its implementation, see the comments in `partition_alloc.h`.

[TOC]

## Overview

PartitionAlloc is a memory allocator optimized for performance and security
in Blink. All objects in Blink are expected to be allocated with
PartitionAlloc or Oilpan (but not yet done).
PartitionAlloc is a memory allocator optimized for security, low allocation
latency (when called appropriately), and good space efficiency (when called
appropriately). This document aims to help you understand how PartitionAlloc
works so that you can use it effectively.

## Partitions and buckets
## Partitions And Buckets

PartitionAlloc has three partitions. A partition is a heap that contains
certain types of objects. Specifically, PartitionAlloc allocates objects
on either of the following three partitions depending on their types:
A *partition* is a heap that contains certain object types, objects of certain
sizes, or objects of a certain lifetime (as the caller prefers). Callers can
create as many partitions as they need. Each partition is separate and protected
from any other partitions.

* LayoutObject partition: A partition to allocate LayoutObjects.
Each partition holds multiple buckets. A *bucket* is a region in a partition
that contains similar-sized objects.

* Buffer partition: A partition to allocate objects that have a strong risk
that the length and/or the contents are exploited by user scripts.
Specifically, Vectors, HashTables, ArrayBufferContents and Strings are
allocated on the Buffer partition.
PartitionAlloc aligns each object allocation with the closest bucket size. For
example, if a partition has 3 buckets for 64 bytes, 256 bytes, and 1024 bytes,
then PartitionAlloc will satisfy an allocation request for 128 bytes by rounding
it up to 256 bytes and allocating from the second bucket.

* FastMalloc partition: A partition to allocate all other objects.
Objects marked with USING_FAST_MALLOC are allocated on the FastMalloc partition.
The special allocator class `template <size_t N> class
SizeSpecificPartitionAllocator` will satisfy allocations only of size
`kMaxAllocation = N - kAllocationGranularity` or less, and contains buckets for
all `n * kAllocationGranularity` (n = 1, 2, ..., `kMaxAllocation`). Attempts to
allocate more than `kMaxAllocation` will fail.

Each partition holds multiple buckets. A bucket is a region in a partition
that contains similar-sized objects. Each object allocation must be aligned
with the closest bucket size. For example, if a partition has three buckets
for 64 bytes, 256 bytes and 1024 bytes, then an object of 128 bytes is
rounded up to 256 bytes and allocated on the second bucket.
## Performance

The LayoutObject partition has buckets for all N * sizeof(void*) (N = 1, 2, ..., N_max).
This means that no extra padding is needed to allocate a LayoutObject object.
Different sizes of LayoutObjects are allocated in different buckets.
The current implementation is optimized for the main thread use-case. For
example, PartitionAlloc doesn't have threaded caches.

The Buffer partition and the FastMalloc partition have many buckets.
They support any arbitrary size of allocations but padding may be added
to align the allocation with the closest bucket size. The bucket sizes are
chosen to keep the worst-case memory overhead less than 10%.
PartitionAlloc is designed to be extremely fast in its fast paths. The fast
paths of allocation and deallocation require just 2 (reasonably predictable)
branches. The number of operations in the fast paths is minimal, leading to the
possibility of inlining.

Large allocations (> 1 MB) are realized by direct memory mmapping.
For an example of how to use partitions to get good performance and good safety,
see Blink's usage, as described in `wtf/allocator/Allocator.md`.

## Performance
Large allocations (> 1 MB) are realized by direct memory mmapping.

PartitionAlloc doesn't acquire a lock when allocating on the LayoutObject
partition, because it's guaranteed that LayoutObjects are allocated
only by the main thread.
`PartitionAllocGeneric` acquires a lock for thread safety. (The current
implementation uses a spin lock on the assumption that thread contention will be
rare in its callers. The original caller was Blink, where this is generally
true. Spin locks also have the benefit of simplicity.)

PartitionAlloc acquires a lock when allocating on the Buffer partition and
the FastMalloc partition. PartitionAlloc uses a spin lock because thread contention
would be rare in Blink.
Callers can get thread-unsafe performance using a
`SizeSpecificPartitionAllocator` or otherwise using `PartitionAlloc` (instead of
`PartitionAllocGeneric`). Callers can also arrange for low contention, such as
by using a dedicated partition for single-threaded, latency-critical
allocations.

PartitionAlloc is designed to be extremely fast in fast paths. Just two
(reasonably predictable) branches are required for the fast paths of an
allocation and deallocation. The number of operations in the fast paths
is minimized, leading to the possibility of inlining.
Because PartitionAlloc guarantees that address space regions used for one
partition are never reused for other partitions, partitions can eat a large
amount of virtual address space (even if not of actual memory).

Having a dedicated partition for LayoutObjects is helpful to improve cache
locality and thus help improve performance.
Mixing various random objects in the same partition will generally lead to lower
efficiency. For good performance, group similar objects into the same partition.

## Security

Security is one of the most important goals of PartitionAlloc.

Different partitions are guaranteed to exist in separate address spaces.
When objects contained in a page in a partition are all freed,
the physical memory is returned to the system but the address space
remains reserved. The address space may be reused later only for the partition.
Remember that PartitionAlloc puts LayoutObjects into a dedicated partition.
This is because LayoutObjects are likely to be a source of use-after-free.
Similarly, PartitionAlloc puts Strings, Vectors etc into the Buffer partition
because the length and/or contents may be exploited by user scripts.
This means that PartitionAlloc greedily uses virtual address spaces in favor of
security hardening.
PartitionAlloc guarantees that different partitions exist in different regions
of the process' address space. When the caller has freed all objects contained
in a page in a partition, PartitionAlloc returns the physical memory to the
operating system, but continues to reserve the region of address space.
PartitionAlloc will only reuse an address space region for the same partition.

Also the following security properties are provided:
PartitionAlloc also guarantees that:

* Linear overflows cannot corrupt into the partition.
* Linear overflows cannot corrupt into the partition. (There is a guard page at
the beginning of each partition.)

* Linear overflows cannot corrupt out of the partition.
* Linear overflows cannot corrupt out of the partition. (There is a guard page
at the end of each partition.)

* Metadata is recorded in a dedicated region (not next to each object).
Linear overflow or underflow cannot corrupt the metadata.
* Linear overflow or underflow cannot corrupt the allocation metadata.
PartitionAlloc records metadata in a dedicated region out-of-line (not adjacent
to objects).

* Buckets are helpful to allocate different-sized objects on different addresses.
One page can contain only similar-sized objects.
* Objects of different sizes will likely be allocated in different buckets, and
hence at different addresses. One page can contain only similar-sized objects.

* Dereference of a freelist pointer should fault.

* Partial pointer overwrite of freelist pointer should fault.

* Large allocations are guard-paged at the beginning and end.
* Large allocations have guard pages at the beginning and end.
3 changes: 0 additions & 3 deletions src/base/allocator/partition_allocator/partition_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,6 @@ ALWAYS_INLINE size_t PartitionAllocGetSize(void* ptr) {
return PartitionCookieSizeAdjustSubtract(size);
}

// N (or more accurately, N - sizeof(void*)) represents the largest size in
// bytes that will be handled by a SizeSpecificPartitionAllocator.
// Attempts to partitionAlloc() more than this amount will fail.
template <size_t N>
class SizeSpecificPartitionAllocator {
public:
Expand Down
22 changes: 10 additions & 12 deletions src/base/android/java/src/org/chromium/base/ActivityState.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,37 @@
/**
* A set of states that represent the last state change of an Activity.
*/
public interface ActivityState {

@Retention(RetentionPolicy.SOURCE)
@IntDef({CREATED, STARTED, RESUMED, PAUSED, STOPPED, DESTROYED})
public @interface ActivityStateEnum {}

@Retention(RetentionPolicy.SOURCE)
@IntDef({ActivityState.CREATED, ActivityState.STARTED, ActivityState.RESUMED, ActivityState.PAUSED,
ActivityState.STOPPED, ActivityState.DESTROYED})
public @interface ActivityState {
/**
* Represents Activity#onCreate().
*/
public final int CREATED = 1;
int CREATED = 1;

/**
* Represents Activity#onStart().
*/
public final int STARTED = 2;
int STARTED = 2;

/**
* Represents Activity#onResume().
*/
public final int RESUMED = 3;
int RESUMED = 3;

/**
* Represents Activity#onPause().
*/
public final int PAUSED = 4;
int PAUSED = 4;

/**
* Represents Activity#onStop().
*/
public final int STOPPED = 5;
int STOPPED = 5;

/**
* Represents Activity#onDestroy(). This is also used when the state of an Activity is unknown.
*/
public final int DESTROYED = 6;
int DESTROYED = 6;
}
Loading

0 comments on commit 0f30d66

Please sign in to comment.