RESOLVED FIXED 179161
Eliminate isMainThread() checks in most call sites of NoEventDispatchAssertion
https://bugs.webkit.org/show_bug.cgi?id=179161
Summary Eliminate isMainThread() checks in most call sites of NoEventDispatchAssertion
Ryosuke Niwa
Reported 2017-11-02 00:02:10 PDT
NoEventDispatchAssertion's constructor & destructor currently checks isMainThread() to make it work in non-main thread. However, this check is rather expensive and prevents us from converting this into a release assertion. Introduce NoEventDispatchAssertion::InMainThread which bypasses isMainThread() conditional whenever the code can only be executed in the main thread.
Attachments
Refactoring (28.57 KB, patch)
2017-11-02 00:16 PDT, Ryosuke Niwa
zalan: review+
Radar WebKit Bug Importer
Comment 1 2017-11-02 00:03:57 PDT
Ryosuke Niwa
Comment 2 2017-11-02 00:16:14 PDT
Created attachment 325694 [details] Refactoring
Build Bot
Comment 3 2017-11-02 00:18:37 PDT
Attachment 325694 [details] did not pass style-queue: ERROR: Source/WebCore/bindings/js/ScriptController.cpp:681: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Element.cpp:2478: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Element.cpp:2485: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Node.cpp:2329: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Node.cpp:2342: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/EventDispatcher.cpp:133: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/ContainerNode.cpp:127: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/ContainerNode.cpp:766: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/ContainerNode.cpp:783: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Document.cpp:4265: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Document.cpp:4273: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/dom/Document.cpp:5103: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] Total errors found: 12 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 4 2017-11-02 02:48:13 PDT
Yay, this one passed EWS!
Ryosuke Niwa
Comment 5 2017-11-02 14:56:32 PDT
David Kilzer (:ddkilzer)
Comment 6 2017-11-02 19:46:56 PDT
(In reply to Build Bot from comment #3) > Attachment 325694 [details] did not pass style-queue: > > ERROR: Source/WebCore/bindings/js/ScriptController.cpp:681: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Element.cpp:2478: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Element.cpp:2485: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Node.cpp:2329: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Node.cpp:2342: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/EventDispatcher.cpp:133: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/ContainerNode.cpp:127: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/ContainerNode.cpp:766: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/ContainerNode.cpp:783: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Document.cpp:4265: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Document.cpp:4273: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > ERROR: Source/WebCore/dom/Document.cpp:5103: Please replace > ASSERT_WITH_SECURITY_IMPLICATION() with > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] > Total errors found: 12 in 14 files Why was it not possible to change these? Is there concern that this would cause a performance regression?
Ryosuke Niwa
Comment 7 2017-11-02 20:21:29 PDT
(In reply to David Kilzer (:ddkilzer) from comment #6) > (In reply to Build Bot from comment #3) > > Attachment 325694 [details] did not pass style-queue: > > Why was it not possible to change these? Is there concern that this would > cause a performance regression? Because NoEventDispatchAssertion is a no-op in release builds right now. It's rather misleading to enable them for release because it always evaluates to true regardless. Furthermore, we can't enable NoEventDispatchAssertion::isEventDispatchAllowedInSubtree in any of interesting core DOM code since it's too expensive to do O(n) traversal.
Note You need to log in before you can comment on or make changes to this bug.