Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: third_party/WebKit/Source/wtf/allocator/Partitions.h

Issue 2682943002: Create a dedicated partition for array buffers (Closed)
Patch Set: temp Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/allocator/Partitions.h
diff --git a/third_party/WebKit/Source/wtf/allocator/Partitions.h b/third_party/WebKit/Source/wtf/allocator/Partitions.h
index 159e011a0e01b5e2c306de223a9a4ae0af25b4d9..2aea9ecbc95862293c6b951e10bdbcb0994f8e0c 100644
--- a/third_party/WebKit/Source/wtf/allocator/Partitions.h
+++ b/third_party/WebKit/Source/wtf/allocator/Partitions.h
@@ -49,6 +49,11 @@ class WTF_EXPORT Partitions {
static const char* const kAllocatedObjectPoolName;
static void initialize(ReportPartitionAllocSizeFunction);
+ ALWAYS_INLINE static base::PartitionRootGeneric* arrayBufferPartition() {
+ DCHECK(s_initialized);
+ return m_arrayBufferAllocator.root();
+ }
+
ALWAYS_INLINE static base::PartitionRootGeneric* bufferPartition() {
DCHECK(s_initialized);
return m_bufferAllocator.root();
@@ -76,6 +81,7 @@ class WTF_EXPORT Partitions {
static size_t totalSizeOfCommittedPages() {
size_t totalSize = 0;
totalSize += m_fastMallocAllocator.root()->total_size_of_committed_pages;
+ totalSize += m_arrayBufferAllocator.root()->total_size_of_committed_pages;
totalSize += m_bufferAllocator.root()->total_size_of_committed_pages;
totalSize += m_layoutAllocator.root()->total_size_of_committed_pages;
return totalSize;
@@ -131,12 +137,14 @@ class WTF_EXPORT Partitions {
// is for performance: As LayoutObjects are guaranteed to only be used
// by the main thread, we can bypass acquiring a lock. Also we can
// improve memory locality by putting LayoutObjects together.
- // - Buffer partition: A partition to allocate objects that have a strong
- // risk where the length and/or the contents are exploited from user
- // scripts. Vectors, HashTables, ArrayBufferContents and Strings are
- // allocated in the buffer partition.
+ // - ArrayBuffer partition: A partition to allocate array buffers.
+ // - Buffer partition: A partition to allocate other buffers that have
+ // a strong risk where the length and/or the contents are exploited from
+ // user scripts. Vectors, HashTables and Strings are allocated in the
+ // buffer partition.
// - Fast malloc partition: A partition to allocate all other objects.
static base::PartitionAllocatorGeneric m_fastMallocAllocator;
+ static base::PartitionAllocatorGeneric m_arrayBufferAllocator;
static base::PartitionAllocatorGeneric m_bufferAllocator;
static base::SizeSpecificPartitionAllocator<1024> m_layoutAllocator;
static ReportPartitionAllocSizeFunction m_reportSizeFunction;
« no previous file with comments | « base/trace_event/memory_infra_background_whitelist.cc ('k') | third_party/WebKit/Source/wtf/allocator/Partitions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698