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 29 matching lines...) Expand all Loading... | |
| 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 if (UNLIKELY(!s_initialized)) | 45 if (UNLIKELY(!s_initialized)) |
| 46 initialize(); | 46 initialize(); |
| 47 return m_bufferAllocator.root(); | 47 return m_bufferAllocator.root(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 ALWAYS_INLINE static PartitionRoot* getObjectModelPartition() { return m_obj ectModelAllocator.root(); } | 50 ALWAYS_INLINE static PartitionRootGeneric* getFastMallocPartition() |
| 51 ALWAYS_INLINE static PartitionRoot* getRenderingPartition() { return m_rende ringAllocator.root(); } | 51 { |
| 52 if (UNLIKELY(!s_initialized)) | |
| 53 initialize(); | |
|
tkent
2015/04/01 01:26:09
Why is this necessary? Is it possible to call get
haraken
2015/04/01 01:33:07
Yes, it's possible. The fastmalloc allocator (and
tkent
2015/04/01 01:35:37
I see. Thanks.
Adding comments to getFastMallocP
Chris Evans
2015/04/01 01:38:48
Is that fixable I wonder? It'd be nice to remove t
| |
| 54 return m_fastMallocAllocator.root(); | |
| 55 } | |
| 56 | |
| 57 ALWAYS_INLINE static PartitionRoot* getObjectModelPartition() | |
| 58 { | |
| 59 ASSERT(s_initialized); | |
| 60 return m_objectModelAllocator.root(); | |
| 61 } | |
| 62 ALWAYS_INLINE static PartitionRoot* getRenderingPartition() | |
| 63 { | |
| 64 ASSERT(s_initialized); | |
| 65 return m_renderingAllocator.root(); | |
| 66 } | |
| 52 | 67 |
| 53 static size_t currentDOMMemoryUsage() | 68 static size_t currentDOMMemoryUsage() |
| 54 { | 69 { |
| 70 ASSERT(s_initialized); | |
| 55 return m_objectModelAllocator.root()->totalSizeOfCommittedPages; | 71 return m_objectModelAllocator.root()->totalSizeOfCommittedPages; |
| 56 } | 72 } |
| 57 | 73 |
| 58 private: | 74 private: |
| 59 static bool s_initialized; | 75 static bool s_initialized; |
| 76 static PartitionAllocatorGeneric m_fastMallocAllocator; | |
| 60 static PartitionAllocatorGeneric m_bufferAllocator; | 77 static PartitionAllocatorGeneric m_bufferAllocator; |
| 61 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; | 78 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; |
| 62 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator; | 79 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator; |
| 63 }; | 80 }; |
| 64 | 81 |
| 65 } // namespace WTF | 82 } // namespace WTF |
| 66 | 83 |
| 67 #endif // Partitions_h | 84 #endif // Partitions_h |
| OLD | NEW |