Fix assertion when creating first WebCore::URL from non-main thread after r207162
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Oct 2016 23:24:46 +0000 (23:24 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Oct 2016 23:24:46 +0000 (23:24 +0000)
commit5c529b7bf24f6502dc3a09a9d95399cd2c9f2ff7
tree002487259217d3f49e7d3fb9bad63ecc8034ed08
parentc970e83d707f968677e80f1413ba0e9d863bc3ab
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/text/TextEncodingRegistry.cpp