RESOLVED FIXED 109750
StartTagScanner should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=109750
Summary StartTagScanner should be thread-safe
Adam Barth
Reported 2013-02-13 14:34:16 PST
StartTagScanner should be thread-safe
Attachments
Patch (10.18 KB, patch)
2013-02-13 14:39 PST, Adam Barth
no flags
Patch for landing (10.17 KB, patch)
2013-02-13 18:02 PST, Adam Barth
no flags
Adam Barth
Comment 1 2013-02-13 14:39:06 PST
Eric Seidel (no email)
Comment 2 2013-02-13 15:00:14 PST
Comment on attachment 188186 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=188186&action=review > Source/WebCore/html/parser/HTMLPreloadScanner.cpp:109 > + if (m_tagId == UnknownTagId) > return; I think this is very clever. It's not clear to me that the HTMLTagIdentifier stuff needs to leak out of this class at all. It could just be private to StartTagScanner? I assume it's part of a larger plan you have for world domination, hence being separate? > Source/WebCore/html/parser/HTMLPreloadScanner.cpp:112 > AtomicString attributeName(iter->name); I believe this will crash on the background thread, no? It looks like you don't even use it as Atomic, but making it Atomic does prevent a copy in teh common case on the main thread.
Adam Barth
Comment 3 2013-02-13 15:04:02 PST
(In reply to comment #2) > (From update of attachment 188186 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=188186&action=review > > > Source/WebCore/html/parser/HTMLPreloadScanner.cpp:109 > > + if (m_tagId == UnknownTagId) > > return; > > I think this is very clever. It's not clear to me that the HTMLTagIdentifier stuff needs to leak out of this class at all. It could just be private to StartTagScanner? I assume it's part of a larger plan you have for world domination, hence being separate? It's going to leak out of the class, but hopefully not out of the file. For example, I plan to use it in processPossibleStyleTag as well. > > Source/WebCore/html/parser/HTMLPreloadScanner.cpp:112 > > AtomicString attributeName(iter->name); > > I believe this will crash on the background thread, no? It looks like you don't even use it as Atomic, but making it Atomic does prevent a copy in teh common case on the main thread. Yeah, processAttributes(const HTMLToken::AttributeList& attributes) is going to be main thread only. I plan to add a processAttributes that takes a CompactHTMLToken::AttributeList or whatever the actual type is called. I can add an ASSERT(isMainThread()) to this function if that would be helpful.
Adam Barth
Comment 4 2013-02-13 16:09:40 PST
Review ping. This patch is blocking this stack of patches. :)
Eric Seidel (no email)
Comment 5 2013-02-13 16:21:12 PST
Comment on attachment 188186 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=188186&action=review LGTM. >>> Source/WebCore/html/parser/HTMLPreloadScanner.cpp:112 >>> AtomicString attributeName(iter->name); >> >> I believe this will crash on the background thread, no? It looks like you don't even use it as Atomic, but making it Atomic does prevent a copy in teh common case on the main thread. > > Yeah, processAttributes(const HTMLToken::AttributeList& attributes) is going to be main thread only. I plan to add a processAttributes that takes a CompactHTMLToken::AttributeList or whatever the actual type is called. I can add an ASSERT(isMainThread()) to this function if that would be helpful. I think ASSERTing when we should be on the main thread is helpful, yes.
Adam Barth
Comment 6 2013-02-13 18:02:09 PST
Created attachment 188243 [details] Patch for landing
Adam Barth
Comment 7 2013-02-13 18:17:53 PST
Comment on attachment 188243 [details] Patch for landing Clearing flags on attachment: 188243 Committed r142840: <http://trac.webkit.org/changeset/142840>
Adam Barth
Comment 8 2013-02-13 18:17:55 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.