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

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

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 | « Source/wtf/Partitions.h ('k') | Source/wtf/WTF.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 27 matching lines...) Expand all
38 namespace WTF { 38 namespace WTF {
39 39
40 bool Partitions::s_initialized; 40 bool Partitions::s_initialized;
41 41
42 PartitionAllocatorGeneric Partitions::m_fastMallocAllocator; 42 PartitionAllocatorGeneric Partitions::m_fastMallocAllocator;
43 PartitionAllocatorGeneric Partitions::m_bufferAllocator; 43 PartitionAllocatorGeneric Partitions::m_bufferAllocator;
44 SizeSpecificPartitionAllocator<3328> Partitions::m_objectModelAllocator; 44 SizeSpecificPartitionAllocator<3328> Partitions::m_objectModelAllocator;
45 SizeSpecificPartitionAllocator<1024> Partitions::m_layoutAllocator; 45 SizeSpecificPartitionAllocator<1024> Partitions::m_layoutAllocator;
46 HistogramEnumerationFunction Partitions::m_histogramEnumeration = nullptr; 46 HistogramEnumerationFunction Partitions::m_histogramEnumeration = nullptr;
47 47
48 void Partitions::initialize(HistogramEnumerationFunction histogramEnumeration) 48 void Partitions::initialize()
49 { 49 {
50 static int lock = 0;
51 // Guard against two threads hitting here in parallel.
52 spinLockLock(&lock);
53 if (!s_initialized) { 50 if (!s_initialized) {
54 m_fastMallocAllocator.init(); 51 m_fastMallocAllocator.init();
55 m_bufferAllocator.init(); 52 m_bufferAllocator.init();
56 m_objectModelAllocator.init(); 53 m_objectModelAllocator.init();
57 m_layoutAllocator.init(); 54 m_layoutAllocator.init();
58 m_histogramEnumeration = histogramEnumeration;
59 s_initialized = true; 55 s_initialized = true;
60 } 56 }
61 spinLockUnlock(&lock); 57 }
58
59 void Partitions::setHistogramEnumeration(HistogramEnumerationFunction histogramE numeration)
60 {
61 ASSERT(!m_histogramEnumeration);
62 m_histogramEnumeration = histogramEnumeration;
62 } 63 }
63 64
64 void Partitions::shutdown() 65 void Partitions::shutdown()
65 { 66 {
66 // We could ASSERT here for a memory leak within the partition, but it leads 67 // We could ASSERT here for a memory leak within the partition, but it leads
67 // to very hard to diagnose ASSERTs, so it's best to leave leak checking for 68 // to very hard to diagnose ASSERTs, so it's best to leave leak checking for
68 // the valgrind and heapcheck bots, which run without partitions. 69 // the valgrind and heapcheck bots, which run without partitions.
69 (void) m_layoutAllocator.shutdown(); 70 (void) m_layoutAllocator.shutdown();
70 (void) m_objectModelAllocator.shutdown(); 71 (void) m_objectModelAllocator.shutdown();
71 (void) m_bufferAllocator.shutdown(); 72 (void) m_bufferAllocator.shutdown();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // accessed only on the main thread. 111 // accessed only on the main thread.
111 ASSERT(isMainThread()); 112 ASSERT(isMainThread());
112 113
113 partitionDumpStatsGeneric(fastMallocPartition(), "fast_malloc_partition", pa rtitionStatsDumper); 114 partitionDumpStatsGeneric(fastMallocPartition(), "fast_malloc_partition", pa rtitionStatsDumper);
114 partitionDumpStatsGeneric(bufferPartition(), "buffer_partition", partitionSt atsDumper); 115 partitionDumpStatsGeneric(bufferPartition(), "buffer_partition", partitionSt atsDumper);
115 partitionDumpStats(objectModelPartition(), "object_model_partition", partiti onStatsDumper); 116 partitionDumpStats(objectModelPartition(), "object_model_partition", partiti onStatsDumper);
116 partitionDumpStats(layoutPartition(), "layout_partition", partitionStatsDump er); 117 partitionDumpStats(layoutPartition(), "layout_partition", partitionStatsDump er);
117 } 118 }
118 119
119 } // namespace WTF 120 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/Partitions.h ('k') | Source/wtf/WTF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698