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

Unified Diff: Source/heap/ThreadState.h

Issue 182733003: Oilpan: mark ThreadAffinity as MainThreadOnly for Node or CSSValue inheriting classes. Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 80a80afe0c7dd4e3b7a1547342d8a6e4088875f3..4760129d0a927f51816d4971a1aa8c085eb1a372 100644
--- a/Source/heap/ThreadState.h
+++ b/Source/heap/ThreadState.h
@@ -71,12 +71,26 @@ enum ThreadAffinity {
MainThreadOnly,
};
-// By default all types are considered to be used on the main thread only.
+class Node;
+class CSSValue;
+
+template<typename T, bool derivesNodeOrCSSValue = WTF::IsSubclass<T, Node>::value || WTF::IsSubclass<T, CSSValue>::value > struct DefaultThreadingTrait;
+
template<typename T>
-struct ThreadingTrait {
+struct DefaultThreadingTrait<T, false> {
+ static const ThreadAffinity Affinity = AnyThread;
+};
+
+template<typename T>
+struct DefaultThreadingTrait<T, true> {
static const ThreadAffinity Affinity = MainThreadOnly;
};
+template<typename T>
+struct ThreadingTrait {
+ static const ThreadAffinity Affinity = DefaultThreadingTrait<T>::Affinity;
+};
+
// Marks the specified class as being used from multiple threads. When
// a class is used from multiple threads we go through thread local
// storage to get the heap in which to allocate an object of that type
@@ -545,43 +559,6 @@ public:
static ThreadState* state() { return ThreadState::current(); }
};
-// FIXME: Experiment if the threading affinity really matters for performance.
-// FIXME: Move these macros and other related structures to a separate file.
-USED_FROM_MULTIPLE_THREADS(Crypto);
-USED_FROM_MULTIPLE_THREADS(DOMParser);
-USED_FROM_MULTIPLE_THREADS(DOMURL);
-USED_FROM_MULTIPLE_THREADS(DeprecatedStorageQuota);
-USED_FROM_MULTIPLE_THREADS(Event);
-USED_FROM_MULTIPLE_THREADS(EventSource);
-USED_FROM_MULTIPLE_THREADS(EventTarget);
-USED_FROM_MULTIPLE_THREADS(Key);
-USED_FROM_MULTIPLE_THREADS(KeyAlgorithm);
-USED_FROM_MULTIPLE_THREADS(KeyPair);
-USED_FROM_MULTIPLE_THREADS(MemoryInfo);
-USED_FROM_MULTIPLE_THREADS(MessageEvent);
-USED_FROM_MULTIPLE_THREADS(Notification);
-USED_FROM_MULTIPLE_THREADS(NotificationCenter);
-USED_FROM_MULTIPLE_THREADS(Performance);
-USED_FROM_MULTIPLE_THREADS(PerformanceEntry);
-USED_FROM_MULTIPLE_THREADS(PerformanceMark);
-USED_FROM_MULTIPLE_THREADS(PerformanceNavigation);
-USED_FROM_MULTIPLE_THREADS(PerformanceResourceTiming);
-USED_FROM_MULTIPLE_THREADS(PerformanceTiming);
-USED_FROM_MULTIPLE_THREADS(SubtleCrypto);
-USED_FROM_MULTIPLE_THREADS(TextDecoder);
-USED_FROM_MULTIPLE_THREADS(TextEncoder);
-USED_FROM_MULTIPLE_THREADS(UserTiming);
-USED_FROM_MULTIPLE_THREADS(WebKitNotification);
-USED_FROM_MULTIPLE_THREADS(WorkerCrypto);
-USED_FROM_MULTIPLE_THREADS(WorkerPerformance);
-USED_FROM_MULTIPLE_THREADS(XMLHttpRequest);
-USED_FROM_MULTIPLE_THREADS(XMLSerializer);
-USED_FROM_MULTIPLE_THREADS(XPathEvaluator);
-USED_FROM_MULTIPLE_THREADS(XPathExpression);
-USED_FROM_MULTIPLE_THREADS(XPathNSResolver);
-USED_FROM_MULTIPLE_THREADS(XPathResult);
-USED_FROM_MULTIPLE_THREADS(XSLTProcessor);
-
}
#endif // ThreadState_h
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698