| 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 25 matching lines...) Expand all Loading... |
| 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 bool Partitions::s_initialized; | 43 bool Partitions::s_initialized; |
| 44 PartitionAllocatorGeneric Partitions::m_bufferAllocator; | 44 PartitionAllocatorGeneric Partitions::m_bufferAllocator; |
| 45 | 45 |
| 46 void initialize(TimeFunction currentTimeFunction, TimeFunction monotonicallyIncr
easingTimeFunction) | 46 void initialize() |
| 47 { | 47 { |
| 48 // 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. |
| 49 // Make that explicit here. | 49 // Make that explicit here. |
| 50 ASSERT(!s_initialized); | 50 ASSERT(!s_initialized); |
| 51 ASSERT(!s_shutdown); | 51 ASSERT(!s_shutdown); |
| 52 s_initialized = true; | 52 s_initialized = true; |
| 53 Partitions::initialize(); | 53 Partitions::initialize(); |
| 54 setCurrentTimeFunction(currentTimeFunction); | |
| 55 setMonotonicallyIncreasingTimeFunction(monotonicallyIncreasingTimeFunction); | |
| 56 initializeThreading(); | 54 initializeThreading(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void shutdown() | 57 void shutdown() |
| 60 { | 58 { |
| 61 ASSERT(s_initialized); | 59 ASSERT(s_initialized); |
| 62 ASSERT(!s_shutdown); | 60 ASSERT(!s_shutdown); |
| 63 s_shutdown = true; | 61 s_shutdown = true; |
| 64 Partitions::shutdown(); | 62 Partitions::shutdown(); |
| 65 } | 63 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 spinLockUnlock(&lock); | 79 spinLockUnlock(&lock); |
| 82 } | 80 } |
| 83 | 81 |
| 84 void Partitions::shutdown() | 82 void Partitions::shutdown() |
| 85 { | 83 { |
| 86 fastMallocShutdown(); | 84 fastMallocShutdown(); |
| 87 m_bufferAllocator.shutdown(); | 85 m_bufferAllocator.shutdown(); |
| 88 } | 86 } |
| 89 | 87 |
| 90 } // namespace WTF | 88 } // namespace WTF |
| OLD | NEW |