| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool s_shutdown; | 46 bool s_shutdown; |
| 47 void (*s_callOnMainThreadFunction)(MainThreadFunction, void*); | 47 void (*s_callOnMainThreadFunction)(MainThreadFunction, void*); |
| 48 ThreadIdentifier s_mainThreadIdentifier; | 48 ThreadIdentifier s_mainThreadIdentifier; |
| 49 | 49 |
| 50 namespace internal { | 50 namespace internal { |
| 51 | 51 |
| 52 void callOnMainThread(MainThreadFunction* function, void* context) { | 52 void callOnMainThread(MainThreadFunction* function, void* context) { |
| 53 (*s_callOnMainThreadFunction)(function, context); | 53 (*s_callOnMainThreadFunction)(function, context); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool isMainThreadSyscall() { |
| 57 return internal::currentThreadSyscall() == s_mainThreadIdentifier; |
| 58 } |
| 59 |
| 56 } // namespace internal | 60 } // namespace internal |
| 57 | 61 |
| 58 bool isMainThread() { | 62 bool isMainThread() { |
| 59 return currentThread() == s_mainThreadIdentifier; | 63 return currentThread() == s_mainThreadIdentifier; |
| 60 } | 64 } |
| 61 | 65 |
| 62 void initialize(void (*callOnMainThreadFunction)(MainThreadFunction, void*)) { | 66 void initialize(void (*callOnMainThreadFunction)(MainThreadFunction, void*)) { |
| 63 // WTF, and Blink in general, cannot handle being re-initialized, even if | 67 // WTF, and Blink in general, cannot handle being re-initialized, even if |
| 64 // shutdown first. Make that explicit here. | 68 // shutdown first. Make that explicit here. |
| 65 RELEASE_ASSERT(!s_initialized); | 69 RELEASE_ASSERT(!s_initialized); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 77 RELEASE_ASSERT(s_initialized); | 81 RELEASE_ASSERT(s_initialized); |
| 78 RELEASE_ASSERT(!s_shutdown); | 82 RELEASE_ASSERT(!s_shutdown); |
| 79 s_shutdown = true; | 83 s_shutdown = true; |
| 80 } | 84 } |
| 81 | 85 |
| 82 bool isShutdown() { | 86 bool isShutdown() { |
| 83 return s_shutdown; | 87 return s_shutdown; |
| 84 } | 88 } |
| 85 | 89 |
| 86 } // namespace WTF | 90 } // namespace WTF |
| OLD | NEW |