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

Unified Diff: Source/heap/ThreadState.h

Issue 113693002: [oilpan] Remove ThreadAffinity::MainThreadOnly Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Remove threading affinity Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/heap/ThreadState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/ThreadState.h
diff --git a/Source/heap/ThreadState.h b/Source/heap/ThreadState.h
index 2f92dbd49c344d8cf8f1ceb07827083630681468..fd1ba4e1977c0cbbc7196ee2ec0ba9a7eb1089eb 100644
--- a/Source/heap/ThreadState.h
+++ b/Source/heap/ThreadState.h
@@ -52,7 +52,7 @@ enum ThreadAffinity {
// By default all types are considered to be used on the main thread only.
template<typename T>
struct ThreadingTrait {
- static const ThreadAffinity Affinity = MainThreadOnly;
+ static const ThreadAffinity Affinity = AnyThread;
};
// Marks specified class as requiring thread safe handles which can be used from any thread.
@@ -225,7 +225,13 @@ public:
static void attach(intptr_t* startOfStack);
static void detach();
- static ThreadState* Current() { return **s_threadSpecific; }
+ static ThreadState* Current()
+ {
+ intptr_t dummy;
+ if (LIKELY(s_mainThreadStackTop < &dummy && &dummy <= s_mainThreadStackBottom))
haraken 2013/12/12 06:33:47 Of a couple of approaches I have tried, this is th
Mads Ager (chromium) 2013/12/12 06:51:56 I find this rather nasty. It is probably true that
+ return MainThreadState();
+ return **s_threadSpecific;
+ }
static ThreadState* MainThreadState() { return &s_mainThreadState; }
static bool IsMainThread() { return Current() == MainThreadState(); }
@@ -274,6 +280,8 @@ public:
Interruptor* interruptor() const { return m_interruptor; }
private:
+ static intptr_t* s_mainThreadStackBottom;
+ static intptr_t* s_mainThreadStackTop;
static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific;
static ThreadState s_mainThreadState;
static SafePointBarrier* s_safePointBarrier;
« no previous file with comments | « no previous file | Source/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698