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

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

Issue 1190883003: Set HistogramEnumerationFunction even when Partitions are initialized (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « no previous file | Source/wtf/Partitions.cpp » ('j') | Source/wtf/Partitions.cpp » ('J')
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 21 matching lines...) Expand all
32 #define Partitions_h 32 #define Partitions_h
33 33
34 #include "wtf/PartitionAlloc.h" 34 #include "wtf/PartitionAlloc.h"
35 #include "wtf/WTF.h" 35 #include "wtf/WTF.h"
36 #include "wtf/WTFExport.h" 36 #include "wtf/WTFExport.h"
37 37
38 namespace WTF { 38 namespace WTF {
39 39
40 class WTF_EXPORT Partitions { 40 class WTF_EXPORT Partitions {
41 public: 41 public:
42 static void initialize(HistogramEnumerationFunction = nullptr); 42 static void initialize();
43 // TODO(bashi): Remove this function and make initialize() take
44 // HistogramEnumerationFunction when we can make sure that WTF::initialize()
45 // is called before using this class.
46 static void setHistogramEnumeration(HistogramEnumerationFunction);
43 static void shutdown(); 47 static void shutdown();
44 ALWAYS_INLINE static PartitionRootGeneric* bufferPartition() 48 ALWAYS_INLINE static PartitionRootGeneric* bufferPartition()
45 { 49 {
46 // TODO(haraken): This check is needed because some call sites allocate 50 // TODO(haraken): This check is needed because some call sites allocate
47 // Blink things before WTF::initialize(). We should fix those call sites 51 // Blink things before WTF::initialize(). We should fix those call sites
48 // and remove the check. 52 // and remove the check.
49 if (UNLIKELY(!s_initialized)) 53 if (UNLIKELY(!s_initialized))
50 initialize(); 54 initialize();
51 return m_bufferAllocator.root(); 55 return m_bufferAllocator.root();
52 } 56 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 93 }
90 94
91 static void decommitFreeableMemory(); 95 static void decommitFreeableMemory();
92 96
93 static void reportMemoryUsageHistogram(); 97 static void reportMemoryUsageHistogram();
94 98
95 static void dumpMemoryStats(PartitionStatsDumper*); 99 static void dumpMemoryStats(PartitionStatsDumper*);
96 100
97 private: 101 private:
98 static bool s_initialized; 102 static bool s_initialized;
103 static int s_lock; // Used for spin lock.
99 static PartitionAllocatorGeneric m_fastMallocAllocator; 104 static PartitionAllocatorGeneric m_fastMallocAllocator;
100 static PartitionAllocatorGeneric m_bufferAllocator; 105 static PartitionAllocatorGeneric m_bufferAllocator;
101 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; 106 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator;
102 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator; 107 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator;
103 static HistogramEnumerationFunction m_histogramEnumeration; 108 static HistogramEnumerationFunction m_histogramEnumeration;
104 }; 109 };
105 110
106 } // namespace WTF 111 } // namespace WTF
107 112
108 #endif // Partitions_h 113 #endif // Partitions_h
OLDNEW
« no previous file with comments | « no previous file | Source/wtf/Partitions.cpp » ('j') | Source/wtf/Partitions.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698