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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 (*s_callOnMainThreadFunction)(function, context); | 53 (*s_callOnMainThreadFunction)(function, context); |
54 } | 54 } |
55 | 55 |
56 } // namespace internal | 56 } // namespace internal |
57 | 57 |
58 bool isMainThread() { | 58 bool isMainThread() { |
59 return currentThread() == s_mainThreadIdentifier; | 59 return currentThread() == s_mainThreadIdentifier; |
60 } | 60 } |
61 | 61 |
62 void initialize(void (*callOnMainThreadFunction)(MainThreadFunction, void*)) { | 62 void initialize(void (*callOnMainThreadFunction)(MainThreadFunction, void*)) { |
63 // WTF, and Blink in general, cannot handle being re-initialized, even if shut
down first. | 63 // WTF, and Blink in general, cannot handle being re-initialized, even if |
64 // Make that explicit here. | 64 // shutdown first. Make that explicit here. |
65 RELEASE_ASSERT(!s_initialized); | 65 RELEASE_ASSERT(!s_initialized); |
66 RELEASE_ASSERT(!s_shutdown); | 66 RELEASE_ASSERT(!s_shutdown); |
67 s_initialized = true; | 67 s_initialized = true; |
68 initializeThreading(); | 68 initializeThreading(); |
69 | 69 |
70 s_callOnMainThreadFunction = callOnMainThreadFunction; | 70 s_callOnMainThreadFunction = callOnMainThreadFunction; |
71 s_mainThreadIdentifier = currentThread(); | 71 s_mainThreadIdentifier = currentThread(); |
72 AtomicString::init(); | 72 AtomicString::init(); |
73 StringStatics::init(); | 73 StringStatics::init(); |
74 } | 74 } |
75 | 75 |
76 void shutdown() { | 76 void shutdown() { |
77 RELEASE_ASSERT(s_initialized); | 77 RELEASE_ASSERT(s_initialized); |
78 RELEASE_ASSERT(!s_shutdown); | 78 RELEASE_ASSERT(!s_shutdown); |
79 s_shutdown = true; | 79 s_shutdown = true; |
80 } | 80 } |
81 | 81 |
82 bool isShutdown() { | 82 bool isShutdown() { |
83 return s_shutdown; | 83 return s_shutdown; |
84 } | 84 } |
85 | 85 |
86 } // namespace WTF | 86 } // namespace WTF |
OLD | NEW |