RESOLVED FIXED 217980
Merge WorkerScriptController and WorkletScriptController into WorkerOrWorkletScriptController
https://bugs.webkit.org/show_bug.cgi?id=217980
Summary Merge WorkerScriptController and WorkletScriptController into WorkerOrWorklet...
Chris Dumez
Reported 2020-10-20 12:37:03 PDT
Merge WorkerScriptController and WorkletScriptController into WorkerOrWorkletScriptController, to share more code.
Attachments
Patch (108.80 KB, patch)
2020-10-20 13:07 PDT, Chris Dumez
no flags
Patch (108.86 KB, patch)
2020-10-20 13:12 PDT, Chris Dumez
no flags
Patch (109.74 KB, patch)
2020-10-20 15:14 PDT, Chris Dumez
no flags
Patch (109.73 KB, patch)
2020-10-20 15:17 PDT, Chris Dumez
no flags
Patch (109.80 KB, patch)
2020-10-20 15:20 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-10-20 13:07:02 PDT
Chris Dumez
Comment 2 2020-10-20 13:12:18 PDT
Darin Adler
Comment 3 2020-10-20 14:43:32 PDT
Comment on attachment 411905 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=411905&action=review > Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:299 > + auto guardedObjects = m_guardedObjects; We are copying this so it does the right thing even if some objects are removed while we iterate. Three questions: 1) Can we make clearer that this is a copy, perhaps by including copy in the name of the local variable or adding a comment? 2) Is it OK to call clear if this object is removed and then perhaps reused in some way? 3) Is it OK that this does not clear objects that are added during the iteration? Looks like this code was just moved, so none of this is new. > Source/WebCore/bindings/js/JSDOMGlobalObject.h:87 > + JSC::JSProxy* proxy() const { ASSERT(m_proxy); return m_proxy.get(); } If we can assert this, it seems we should return a reference, not a pointer. > Source/WebCore/bindings/js/JSDOMWindowBase.cpp:253 > JSWindowProxy* JSDOMWindowBase::proxy() const Reference?
Chris Dumez
Comment 4 2020-10-20 14:48:49 PDT
(In reply to Darin Adler from comment #3) > Comment on attachment 411905 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=411905&action=review > > > Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:299 > > + auto guardedObjects = m_guardedObjects; > > We are copying this so it does the right thing even if some objects are > removed while we iterate. Three questions: > > 1) Can we make clearer that this is a copy, perhaps by including copy in the > name of the local variable or adding a comment? Will add "Copy" suffix. > 2) Is it OK to call clear if this object is removed and then perhaps reused > in some way? > 3) Is it OK that this does not clear objects that are added during the > iteration? I am actually not familiar with this code. However, looking at it, it seems that calling clear() on the DOMGuardedObjects is not a complex operation and from my glancing at it, I do not believe it can cause objects to get added to the list. Pretty much all clear() does it grab a lock and remove the object from the list. > > Looks like this code was just moved, so none of this is new. Correct, I merely moved it. > > > Source/WebCore/bindings/js/JSDOMGlobalObject.h:87 > > + JSC::JSProxy* proxy() const { ASSERT(m_proxy); return m_proxy.get(); } > > If we can assert this, it seems we should return a reference, not a pointer. > > > Source/WebCore/bindings/js/JSDOMWindowBase.cpp:253 > > JSWindowProxy* JSDOMWindowBase::proxy() const > > Reference? Ok, will do.
Chris Dumez
Comment 5 2020-10-20 15:14:09 PDT
Chris Dumez
Comment 6 2020-10-20 15:17:24 PDT
Chris Dumez
Comment 7 2020-10-20 15:20:38 PDT
EWS
Comment 8 2020-10-20 17:00:48 PDT
Committed r268775: <https://trac.webkit.org/changeset/268775> All reviewed patches have been landed. Closing bug and clearing flags on attachment 411928 [details].
Radar WebKit Bug Importer
Comment 9 2020-10-20 17:01:29 PDT
Note You need to log in before you can comment on or make changes to this bug.