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

Unified Diff: third_party/WebKit/Source/core/css/CSSValuePool.cpp

Issue 1870503002: Making CSSValue Pool thread local (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change based on eugenis's feedback Created 4 years, 8 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 | « build/sanitizers/lsan_suppressions.cc ('k') | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSValuePool.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSValuePool.cpp b/third_party/WebKit/Source/core/css/CSSValuePool.cpp
index 58102f2c9de0d8aae9a10852a487d39f4ab6a7cd..976975491817808808a111829a18feb2ba3473eb 100644
--- a/third_party/WebKit/Source/core/css/CSSValuePool.cpp
+++ b/third_party/WebKit/Source/core/css/CSSValuePool.cpp
@@ -28,14 +28,20 @@
#include "core/css/CSSValueList.h"
#include "core/css/parser/CSSParser.h"
#include "core/style/ComputedStyle.h"
+#include "platform/heap/Handle.h"
#include "wtf/Threading.h"
namespace blink {
CSSValuePool& cssValuePool()
{
- DEFINE_STATIC_LOCAL(CSSValuePool, pool, (new CSSValuePool));
- return pool;
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<Persistent<CSSValuePool>>, threadSpecificPool, new ThreadSpecific<Persistent<CSSValuePool>>());
+ Persistent<CSSValuePool>& poolHandle = *threadSpecificPool;
+ if (!poolHandle) {
+ poolHandle = new CSSValuePool();
+ poolHandle.clearOnThreadShutdown();
+ }
+ return *poolHandle;
}
CSSValuePool::CSSValuePool()
@@ -79,14 +85,6 @@ CSSColorValue* CSSValuePool::createColorValue(RGBA32 rgbValue)
if (rgbValue == Color::black)
return m_colorBlack;
- if (!isMainThread()) {
- // TODO (crbug.com/599659): Make CSS color parsing work properly in a
- // worker thread.
- // Currently, ColorValueCache is not thread-safe; so we avoid interacting
- // with it on a non-main thread.
- return CSSColorValue::create(rgbValue);
- }
-
// Just wipe out the cache and start rebuilding if it gets too big.
const unsigned maximumColorCacheSize = 512;
if (m_colorValueCache.size() > maximumColorCacheSize)
« no previous file with comments | « build/sanitizers/lsan_suppressions.cc ('k') | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698