Title: [207177] trunk/Source/WebCore
- Revision
- 207177
- Author
- achristen...@apple.com
- Date
- 2016-10-11 16:24:46 -0700 (Tue, 11 Oct 2016)
Log Message
Fix assertion when creating first WebCore::URL from non-main thread after r207162
https://bugs.webkit.org/show_bug.cgi?id=163304
Reviewed by Filip Pizlo.
This fixes assertions when running UserContentWorld.NormalWorld API tests.
* platform/text/TextEncodingRegistry.cpp:
(WebCore::buildBaseTextCodecMaps):
(WebCore::atomicCanonicalTextEncodingName):
The new URLParser requires a TextEncoding& in its constructor, which defaults to UTF8Encoding.
When creating the first TextEncoding in a process, it calls buildBaseTextCodecMaps which asserts
it's on the main thread because it initializes static variables. Since we are getting a lock right
after this call anyway, just put this function call inside the lock.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (207176 => 207177)
--- trunk/Source/WebCore/ChangeLog 2016-10-11 23:20:39 UTC (rev 207176)
+++ trunk/Source/WebCore/ChangeLog 2016-10-11 23:24:46 UTC (rev 207177)
@@ -1,3 +1,20 @@
+2016-10-11 Alex Christensen <achristen...@webkit.org>
+
+ Fix assertion when creating first WebCore::URL from non-main thread after r207162
+ https://bugs.webkit.org/show_bug.cgi?id=163304
+
+ Reviewed by Filip Pizlo.
+
+ This fixes assertions when running UserContentWorld.NormalWorld API tests.
+
+ * platform/text/TextEncodingRegistry.cpp:
+ (WebCore::buildBaseTextCodecMaps):
+ (WebCore::atomicCanonicalTextEncodingName):
+ The new URLParser requires a TextEncoding& in its constructor, which defaults to UTF8Encoding.
+ When creating the first TextEncoding in a process, it calls buildBaseTextCodecMaps which asserts
+ it's on the main thread because it initializes static variables. Since we are getting a lock right
+ after this call anyway, just put this function call inside the lock.
+
2016-10-11 Dean Jackson <d...@apple.com>
color-gamut media query shouldn't ASSERT on invalid values
Modified: trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp (207176 => 207177)
--- trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp 2016-10-11 23:20:39 UTC (rev 207176)
+++ trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp 2016-10-11 23:24:46 UTC (rev 207177)
@@ -197,9 +197,8 @@
}
}
-static void buildBaseTextCodecMaps()
+static void buildBaseTextCodecMaps(const std::lock_guard<StaticLock>&)
{
- ASSERT(isMainThread());
ASSERT(!textCodecMap);
ASSERT(!textEncodingNameMap);
@@ -320,11 +319,11 @@
if (!name || !name[0])
return nullptr;
+ std::lock_guard<StaticLock> lock(encodingRegistryMutex);
+
if (!textEncodingNameMap)
- buildBaseTextCodecMaps();
+ buildBaseTextCodecMaps(lock);
- std::lock_guard<StaticLock> lock(encodingRegistryMutex);
-
if (const char* atomicName = textEncodingNameMap->get(name))
return atomicName;
if (didExtendTextCodecMaps)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes