Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 10 matching lines...) Expand all Loading... | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WTF_h | 31 #ifndef Partitions_h |
| 32 #define WTF_h | 32 #define Partitions_h |
| 33 | 33 |
| 34 #include "wtf/Compiler.h" | 34 #include "wtf/Compiler.h" |
| 35 #include "wtf/CurrentTime.h" | 35 #include "wtf/CurrentTime.h" |
| 36 #include "wtf/PartitionAlloc.h" | 36 #include "wtf/PartitionAlloc.h" |
| 37 #include "wtf/WTFExport.h" | 37 #include "wtf/WTFExport.h" |
| 38 | 38 |
| 39 namespace WTF { | 39 namespace WTF { |
| 40 | 40 |
| 41 // This function must be called exactly once from the main thread before using a nything else in WTF. | 41 // This function must be called exactly once from the main thread before using a nything else in WTF. |
| 42 WTF_EXPORT void initialize(TimeFunction currentTimeFunction, TimeFunction monoto nicallyIncreasingTimeFunction); | 42 WTF_EXPORT void initialize(TimeFunction currentTimeFunction, TimeFunction monoto nicallyIncreasingTimeFunction); |
| 43 WTF_EXPORT void shutdown(); | 43 WTF_EXPORT void shutdown(); |
| 44 WTF_EXPORT bool isShutdown(); | 44 WTF_EXPORT bool isShutdown(); |
| 45 | 45 |
| 46 class WTF_EXPORT Partitions { | 46 class WTF_EXPORT Partitions { |
| 47 public: | 47 public: |
| 48 static void initialize(); | 48 static void initialize(); |
| 49 static void shutdown(); | 49 static void shutdown(); |
| 50 static ALWAYS_INLINE PartitionRootGeneric* getBufferPartition() | 50 static ALWAYS_INLINE PartitionRootGeneric* getBufferPartition() |
| 51 { | 51 { |
| 52 if (UNLIKELY(!s_initialized)) | 52 if (UNLIKELY(!s_initialized)) |
| 53 initialize(); | 53 initialize(); |
| 54 return m_bufferAllocator.root(); | 54 return m_bufferAllocator.root(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 ALWAYS_INLINE static PartitionRoot* getObjectModelPartition() { return m_obj ectModelAllocator.root(); } | |
|
Chris Evans
2015/03/30 18:41:36
Nit: "ALWAYS_INLINE static" is a different orderin
haraken
2015/03/30 23:06:18
Blink mixes both, but it seems 'ALWAYS_INLINE stat
| |
| 58 ALWAYS_INLINE static PartitionRoot* getRenderingPartition() { return m_rende ringAllocator.root(); } | |
| 59 | |
| 60 static size_t currentDOMMemoryUsage() | |
| 61 { | |
| 62 return m_objectModelAllocator.root()->totalSizeOfCommittedPages; | |
| 63 } | |
| 64 | |
| 57 private: | 65 private: |
| 58 static bool s_initialized; | 66 static bool s_initialized; |
| 59 static PartitionAllocatorGeneric m_bufferAllocator; | 67 static PartitionAllocatorGeneric m_bufferAllocator; |
| 68 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; | |
| 69 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator; | |
| 60 }; | 70 }; |
| 61 | 71 |
| 62 } // namespace WTF | 72 } // namespace WTF |
| 63 | 73 |
| 64 #endif // WTF_h | 74 #endif // Partitions_h |
| OLD | NEW |