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

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

Issue 177213007: Simplify DefaultAllocator::Quantizer using partitionAllocActualSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased + adjusted PurgeableVector test Created 6 years, 10 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
« no previous file with comments | « Source/wtf/QuantizedAllocation.cpp ('k') | Source/wtf/wtf.gypi » ('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 15 matching lines...) Expand all
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 #include "config.h" 31 #include "config.h"
32 #include "WTF.h" 32 #include "WTF.h"
33 33
34 #include "wtf/DefaultAllocator.h" 34 #include "wtf/DefaultAllocator.h"
35 #include "wtf/FastMalloc.h" 35 #include "wtf/FastMalloc.h"
36 #include "wtf/QuantizedAllocation.h"
37 36
38 #ifndef NDEBUG 37 #ifndef NDEBUG
39 #include "wtf/MainThread.h" 38 #include "wtf/MainThread.h"
40 #endif 39 #endif
41 40
42 namespace WTF { 41 namespace WTF {
43 42
44 extern void initializeThreading(); 43 extern void initializeThreading();
45 44
46 bool s_initialized; 45 bool s_initialized;
(...skipping 27 matching lines...) Expand all
74 return s_shutdown; 73 return s_shutdown;
75 } 74 }
76 75
77 void Partitions::initialize() 76 void Partitions::initialize()
78 { 77 {
79 static int lock = 0; 78 static int lock = 0;
80 // Guard against two threads hitting here in parallel. 79 // Guard against two threads hitting here in parallel.
81 spinLockLock(&lock); 80 spinLockLock(&lock);
82 if (!s_initialized) { 81 if (!s_initialized) {
83 s_initialized = true; 82 s_initialized = true;
84 QuantizedAllocation::init();
85 m_bufferAllocator.init(); 83 m_bufferAllocator.init();
86 } 84 }
87 spinLockUnlock(&lock); 85 spinLockUnlock(&lock);
88 } 86 }
89 87
90 void Partitions::shutdown() 88 void Partitions::shutdown()
91 { 89 {
92 fastMallocShutdown(); 90 fastMallocShutdown();
93 m_bufferAllocator.shutdown(); 91 m_bufferAllocator.shutdown();
94 } 92 }
95 93
96 } // namespace WTF 94 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/QuantizedAllocation.cpp ('k') | Source/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698