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

Side by Side Diff: Source/wtf/Partitions.h

Issue 1044143002: Oilpan: Centralize Partition allocators into Partitions.h (part 2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/FastMalloc.cpp ('k') | Source/wtf/Partitions.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 #include "wtf/WTFExport.h" 35 #include "wtf/WTFExport.h"
36 36
37 namespace WTF { 37 namespace WTF {
38 38
39 class WTF_EXPORT Partitions { 39 class WTF_EXPORT Partitions {
40 public: 40 public:
41 static void initialize(); 41 static void initialize();
42 static void shutdown(); 42 static void shutdown();
43 ALWAYS_INLINE static PartitionRootGeneric* getBufferPartition() 43 ALWAYS_INLINE static PartitionRootGeneric* getBufferPartition()
44 { 44 {
45 // TODO(haraken): This check is needed because some call sites allocate
46 // Blink things before WTF::initialize(). We should fix those call sites
47 // and remove the check.
45 if (UNLIKELY(!s_initialized)) 48 if (UNLIKELY(!s_initialized))
46 initialize(); 49 initialize();
47 return m_bufferAllocator.root(); 50 return m_bufferAllocator.root();
48 } 51 }
49 52
50 ALWAYS_INLINE static PartitionRoot* getObjectModelPartition() { return m_obj ectModelAllocator.root(); } 53 ALWAYS_INLINE static PartitionRootGeneric* getFastMallocPartition()
51 ALWAYS_INLINE static PartitionRoot* getRenderingPartition() { return m_rende ringAllocator.root(); } 54 {
55 // TODO(haraken): This check is needed because some call sites allocate
56 // Blink things before WTF::initialize(). We should fix those call sites
57 // and remove the check.
58 if (UNLIKELY(!s_initialized))
59 initialize();
60 return m_fastMallocAllocator.root();
61 }
62
63 ALWAYS_INLINE static PartitionRoot* getObjectModelPartition()
64 {
65 ASSERT(s_initialized);
66 return m_objectModelAllocator.root();
67 }
68 ALWAYS_INLINE static PartitionRoot* getRenderingPartition()
69 {
70 ASSERT(s_initialized);
71 return m_renderingAllocator.root();
72 }
52 73
53 static size_t currentDOMMemoryUsage() 74 static size_t currentDOMMemoryUsage()
54 { 75 {
76 ASSERT(s_initialized);
55 return m_objectModelAllocator.root()->totalSizeOfCommittedPages; 77 return m_objectModelAllocator.root()->totalSizeOfCommittedPages;
56 } 78 }
57 79
58 private: 80 private:
59 static bool s_initialized; 81 static bool s_initialized;
82 static PartitionAllocatorGeneric m_fastMallocAllocator;
60 static PartitionAllocatorGeneric m_bufferAllocator; 83 static PartitionAllocatorGeneric m_bufferAllocator;
61 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; 84 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator;
62 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator; 85 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator;
63 }; 86 };
64 87
65 } // namespace WTF 88 } // namespace WTF
66 89
67 #endif // Partitions_h 90 #endif // Partitions_h
OLDNEW
« no previous file with comments | « Source/wtf/FastMalloc.cpp ('k') | Source/wtf/Partitions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698