Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: third_party/WebKit/Source/wtf/WTF.cpp

Issue 2646003003: Avoid checking for WTFThreadData::staticData in wtfThreadData() (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698