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