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

Unified Diff: base/allocator/partition_allocator/partitions.h

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Created 4 years, 1 month 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: base/allocator/partition_allocator/partitions.h
diff --git a/third_party/WebKit/Source/wtf/allocator/Partitions.h b/base/allocator/partition_allocator/partitions.h
similarity index 64%
rename from third_party/WebKit/Source/wtf/allocator/Partitions.h
rename to base/allocator/partition_allocator/partitions.h
index 8fd74a3f73dc8bc2b0495b9a52a4108cdeff02fc..1891bb00e25f9cbf0589a7edae65ba99be67f160 100644
--- a/third_party/WebKit/Source/wtf/allocator/Partitions.h
+++ b/base/allocator/partition_allocator/partitions.h
@@ -1,44 +1,18 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef Partitions_h
-#define Partitions_h
-
-#include "wtf/WTF.h"
-#include "wtf/WTFExport.h"
-#include "wtf/allocator/PartitionAlloc.h"
+// Copyright (c) 2013 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_PARTITIONS_H
+#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITIONS_H
+
#include <string.h>
-namespace WTF {
+#include "base/allocator/partition_allocator/partition_alloc.h"
+#include "base/base_export.h"
+
+namespace base {
-class WTF_EXPORT Partitions {
+class BASE_EXPORT Partitions {
public:
typedef void (*ReportPartitionAllocSizeFunction)(size_t);
@@ -49,27 +23,27 @@ class WTF_EXPORT Partitions {
static void initialize(ReportPartitionAllocSizeFunction);
static void shutdown();
ALWAYS_INLINE static PartitionRootGeneric* bufferPartition() {
haraken 2016/11/22 03:55:11 These methods are Blink-specific things, so I'd ke
palmer 2016/11/24 01:05:56 Done.
- ASSERT(s_initialized);
+ DCHECK(s_initialized);
return m_bufferAllocator.root();
}
ALWAYS_INLINE static PartitionRootGeneric* fastMallocPartition() {
- ASSERT(s_initialized);
+ DCHECK(s_initialized);
return m_fastMallocAllocator.root();
}
ALWAYS_INLINE static PartitionRoot* nodePartition() {
- ASSERT_NOT_REACHED();
+ NOTREACHED();
return nullptr;
}
ALWAYS_INLINE static PartitionRoot* layoutPartition() {
- ASSERT(s_initialized);
+ DCHECK(s_initialized);
return m_layoutAllocator.root();
}
static size_t currentDOMMemoryUsage() {
- ASSERT(s_initialized);
- ASSERT_NOT_REACHED();
+ DCHECK(s_initialized);
+ NOTREACHED();
return 0;
}
@@ -121,7 +95,7 @@ class WTF_EXPORT Partitions {
static void handleOutOfMemory();
private:
- static SpinLock s_initializationLock;
+ static subtle::SpinLock s_initializationLock;
static bool s_initialized;
// We have the following four partitions.
@@ -142,6 +116,6 @@ class WTF_EXPORT Partitions {
static ReportPartitionAllocSizeFunction m_reportSizeFunction;
};
-} // namespace WTF
+} // namespace base
-#endif // Partitions_h
+#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITIONS_H

Powered by Google App Engine
This is Rietveld 408576698