Summary: | Create a TextResourceDecoder on the BackgroundHTMLParser | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Tony Gentilcore <tonyg> | ||||
Component: | New Bugs | Assignee: | Tony Gentilcore <tonyg> | ||||
Status: | RESOLVED WONTFIX | ||||||
Severity: | Normal | CC: | abarth, ap, ojan.autocc, webkit.review.bot | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 106127, 107603 | ||||||
Attachments: |
|
Description
Tony Gentilcore
2013-02-04 17:13:40 PST
Created attachment 186504 [details]
Patch
Comment on attachment 186504 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=186504&action=review > Source/WebCore/html/parser/HTMLParserOptions.h:44 > + String mimeType; > + String defaultTextEncodingName; Now HTMLParserOption isn't thread-safe. Presumably we need to account for that somewhere. I don't think that this is safe. atomicCanonicalTextEncodingName() calls functions like buildBaseTextCodecMaps() and extendTextCodecMaps(), which are main thread only. Comment on attachment 186504 [details] Patch Attachment 186504 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/16373569 Comment on attachment 186504 [details] Patch Attachment 186504 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/16369663 (In reply to comment #3) > I don't think that this is safe. atomicCanonicalTextEncodingName() calls functions like buildBaseTextCodecMaps() and extendTextCodecMaps(), which are main thread only. Is MutexLocker lock(encodingRegistryMutex()); not sufficient? buildBaseTextCodecMaps() has an ASSERT(isMainThread()) in it, so no, not quite sufficient. I don't remember much detail, but this code is a bit more fragile than it should be. It was particularly easy to get into a recursive deadlock by adding too many locks. We only have a mutex around codec registry - but actual codecs do interesting things threading-wise - see e.g. cachedConverterICU() in TextCodecICU.cpp. The idea here is that we have non-WebCore callers on secondary threads, but callers are tightly bound to their thread. > buildBaseTextCodecMaps() has an ASSERT(isMainThread()) in it, so no, not quite sufficient.
From reading the code, it seems like that ASSERT just ensures that we build the codec map on the main thread. After it is built, it looks to be useable from any thread. I haven't studied the code in detail, however.
I'm not going to do this as a separate patch after all. Please see the complete thing on bug 107603. Can you respond to my comments? The patch in bug 107603 is large, and I'm unsure how it answers them. > Can you respond to my comments? The patch in bug 107603 is large, and I'm unsure how it answers them. The patch in bug 107603 calls TextResourceDecoder::create on the main thread. Thank you for the explanation, that certainly resolves the concern. I misread comment 9 as implying that the same approach is part of the patch in bug 107603. There's some further discussion in bug 107603 that might interest you as well. |