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

Side by Side Diff: third_party/WebKit/Source/wtf/allocator/PartitionAllocator.cpp

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Move OOM_CRASH into its own, more specific header. Fixes Windows build. Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be
3 * 3 // found in the LICENSE file.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 4
31 #include "wtf/allocator/PartitionAllocator.h" 5 #include "wtf/allocator/PartitionAllocator.h"
32 6
33 #include "wtf/allocator/PartitionAlloc.h" 7 #include "base/allocator/partition_allocator/partition_alloc.h"
34 #include "wtf/allocator/Partitions.h" 8 #include "wtf/allocator/Partitions.h"
35 9
36 namespace WTF { 10 namespace WTF {
37 11
38 void* PartitionAllocator::allocateBacking(size_t size, const char* typeName) { 12 void* PartitionAllocator::allocateBacking(size_t size, const char* typeName) {
39 return Partitions::bufferMalloc(size, typeName); 13 return Partitions::bufferMalloc(size, typeName);
40 } 14 }
41 15
42 void PartitionAllocator::freeVectorBacking(void* address) { 16 void PartitionAllocator::freeVectorBacking(void* address) {
43 Partitions::bufferFree(address); 17 Partitions::bufferFree(address);
44 } 18 }
45 19
46 void PartitionAllocator::freeHashTableBacking(void* address) { 20 void PartitionAllocator::freeHashTableBacking(void* address) {
47 Partitions::bufferFree(address); 21 Partitions::bufferFree(address);
48 } 22 }
49 23
50 template <> 24 template <>
51 char* PartitionAllocator::allocateVectorBacking<char>(size_t size) { 25 char* PartitionAllocator::allocateVectorBacking<char>(size_t size) {
52 return reinterpret_cast<char*>( 26 return reinterpret_cast<char*>(
53 allocateBacking(size, "PartitionAllocator::allocateVectorBacking<char>")); 27 allocateBacking(size, "PartitionAllocator::allocateVectorBacking<char>"));
54 } 28 }
55 29
56 template <> 30 template <>
57 char* PartitionAllocator::allocateExpandedVectorBacking<char>(size_t size) { 31 char* PartitionAllocator::allocateExpandedVectorBacking<char>(size_t size) {
58 return reinterpret_cast<char*>(allocateBacking( 32 return reinterpret_cast<char*>(allocateBacking(
59 size, "PartitionAllocator::allocateExpandedVectorBacking<char>")); 33 size, "PartitionAllocator::allocateExpandedVectorBacking<char>"));
60 } 34 }
61 35
62 } // namespace WTF 36 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698