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