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 15 matching lines...) Expand all Loading... |
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 Loading... |
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 |
OLD | NEW |