| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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/ArrayBufferContents.h" |
| 34 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
| 35 #include "wtf/FastMalloc.h" | 36 #include "wtf/FastMalloc.h" |
| 36 #include "wtf/Partitions.h" | 37 #include "wtf/Partitions.h" |
| 37 | 38 |
| 38 namespace WTF { | 39 namespace WTF { |
| 39 | 40 |
| 40 extern void initializeThreading(); | 41 extern void initializeThreading(); |
| 41 | 42 |
| 42 bool s_initialized; | 43 bool s_initialized; |
| 43 bool s_shutdown; | 44 bool s_shutdown; |
| 44 | 45 |
| 45 void initialize(TimeFunction currentTimeFunction, TimeFunction monotonicallyIncr
easingTimeFunction, TimeFunction systemTraceTimeFunction, HistogramEnumerationFu
nction histogramEnumerationFunction) | 46 void initialize(TimeFunction currentTimeFunction, TimeFunction monotonicallyIncr
easingTimeFunction, TimeFunction systemTraceTimeFunction, HistogramEnumerationFu
nction histogramEnumerationFunction, AdjustAmountOfExternalAllocatedMemoryFuncti
on adjustAmountOfExternalAllocatedMemoryFunction) |
| 46 { | 47 { |
| 47 // WTF, and Blink in general, cannot handle being re-initialized, even if sh
utdown first. | 48 // WTF, and Blink in general, cannot handle being re-initialized, even if sh
utdown first. |
| 48 // Make that explicit here. | 49 // Make that explicit here. |
| 49 ASSERT(!s_initialized); | 50 ASSERT(!s_initialized); |
| 50 ASSERT(!s_shutdown); | 51 ASSERT(!s_shutdown); |
| 51 s_initialized = true; | 52 s_initialized = true; |
| 52 setCurrentTimeFunction(currentTimeFunction); | 53 setCurrentTimeFunction(currentTimeFunction); |
| 53 setMonotonicallyIncreasingTimeFunction(monotonicallyIncreasingTimeFunction); | 54 setMonotonicallyIncreasingTimeFunction(monotonicallyIncreasingTimeFunction); |
| 54 setSystemTraceTimeFunction(systemTraceTimeFunction); | 55 setSystemTraceTimeFunction(systemTraceTimeFunction); |
| 55 Partitions::initialize(histogramEnumerationFunction); | 56 Partitions::initialize(histogramEnumerationFunction); |
| 57 ArrayBufferContents::setAdjustAmoutOfExternalAllocatedMemoryFunction(adjustA
mountOfExternalAllocatedMemoryFunction); |
| 56 initializeThreading(); | 58 initializeThreading(); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void shutdown() | 61 void shutdown() |
| 60 { | 62 { |
| 61 ASSERT(s_initialized); | 63 ASSERT(s_initialized); |
| 62 ASSERT(!s_shutdown); | 64 ASSERT(!s_shutdown); |
| 63 s_shutdown = true; | 65 s_shutdown = true; |
| 64 Partitions::shutdown(); | 66 Partitions::shutdown(); |
| 65 } | 67 } |
| 66 | 68 |
| 67 bool isShutdown() | 69 bool isShutdown() |
| 68 { | 70 { |
| 69 return s_shutdown; | 71 return s_shutdown; |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace WTF | 74 } // namespace WTF |
| OLD | NEW |