Cleanup: Use Ref instead of RefPtr to hold DOMWrapperWorld
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2017 17:54:11 +0000 (17:54 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2017 17:54:11 +0000 (17:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171988

Reviewed by Chris Dumez.

* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::JSCustomElementInterface):
(WebCore::JSCustomElementInterface::upgradeElement):
(WebCore::JSCustomElementInterface::invokeCallback):
* bindings/js/JSCustomElementInterface.h:
* bindings/js/JSMutationCallback.cpp:
(WebCore::JSMutationCallback::JSMutationCallback):
(WebCore::JSMutationCallback::call):
* bindings/js/JSMutationCallback.h:
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::ScheduledAction):
(WebCore::ScheduledAction::execute):
* bindings/js/ScheduledAction.h:
(WebCore::ScheduledAction::ScheduledAction):
* page/DOMWindowExtension.cpp:
(WebCore::DOMWindowExtension::DOMWindowExtension):
* page/DOMWindowExtension.h:
(WebCore::DOMWindowExtension::world):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCustomElementInterface.cpp
Source/WebCore/bindings/js/JSCustomElementInterface.h
Source/WebCore/bindings/js/JSMutationCallback.cpp
Source/WebCore/bindings/js/JSMutationCallback.h
Source/WebCore/bindings/js/ScheduledAction.cpp
Source/WebCore/bindings/js/ScheduledAction.h
Source/WebCore/page/DOMWindowExtension.cpp
Source/WebCore/page/DOMWindowExtension.h

index 2c10838..33f0dde 100644 (file)
@@ -1,5 +1,31 @@
 2017-05-12  Daniel Bates  <dabates@apple.com>
 
+        Cleanup: Use Ref instead of RefPtr to hold DOMWrapperWorld
+        https://bugs.webkit.org/show_bug.cgi?id=171988
+
+        Reviewed by Chris Dumez.
+
+        * bindings/js/JSCustomElementInterface.cpp:
+        (WebCore::JSCustomElementInterface::JSCustomElementInterface):
+        (WebCore::JSCustomElementInterface::upgradeElement):
+        (WebCore::JSCustomElementInterface::invokeCallback):
+        * bindings/js/JSCustomElementInterface.h:
+        * bindings/js/JSMutationCallback.cpp:
+        (WebCore::JSMutationCallback::JSMutationCallback):
+        (WebCore::JSMutationCallback::call):
+        * bindings/js/JSMutationCallback.h:
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::ScheduledAction):
+        (WebCore::ScheduledAction::execute):
+        * bindings/js/ScheduledAction.h:
+        (WebCore::ScheduledAction::ScheduledAction):
+        * page/DOMWindowExtension.cpp:
+        (WebCore::DOMWindowExtension::DOMWindowExtension):
+        * page/DOMWindowExtension.h:
+        (WebCore::DOMWindowExtension::world):
+
+2017-05-12  Daniel Bates  <dabates@apple.com>
+
         Cleanup: Make QueueTaskToEventLoopFunctionPtr take JSGlobalObject&
         https://bugs.webkit.org/show_bug.cgi?id=172021
 
index 793ecb8..8fd3646 100644 (file)
@@ -48,7 +48,7 @@ JSCustomElementInterface::JSCustomElementInterface(const QualifiedName& name, JS
     : ActiveDOMCallback(globalObject->scriptExecutionContext())
     , m_name(name)
     , m_constructor(constructor)
-    , m_isolatedWorld(&globalObject->world())
+    , m_isolatedWorld(globalObject->world())
 {
 }
 
@@ -182,7 +182,7 @@ void JSCustomElementInterface::upgradeElement(Element& element)
     if (!context)
         return;
     ASSERT(context->isDocument());
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, *m_isolatedWorld);
+    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld);
     ExecState* state = globalObject->globalExec();
     RETURN_IF_EXCEPTION(scope, void());
 
@@ -233,7 +233,7 @@ void JSCustomElementInterface::invokeCallback(Element& element, JSObject* callba
 
     ASSERT(context);
     ASSERT(context->isDocument());
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, *m_isolatedWorld);
+    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld);
     ExecState* state = globalObject->globalExec();
 
     JSObject* jsElement = asObject(toJS(state, globalObject, element));
index 8a3f656..ec84590 100644 (file)
@@ -34,7 +34,6 @@
 #include <wtf/Forward.h>
 #include <wtf/Function.h>
 #include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
 #include <wtf/text/AtomicStringHash.h>
 
 namespace JSC {
@@ -103,7 +102,7 @@ private:
     JSC::Weak<JSC::JSObject> m_disconnectedCallback;
     JSC::Weak<JSC::JSObject> m_adoptedCallback;
     JSC::Weak<JSC::JSObject> m_attributeChangedCallback;
-    RefPtr<DOMWrapperWorld> m_isolatedWorld;
+    Ref<DOMWrapperWorld> m_isolatedWorld;
     Vector<RefPtr<Element>, 1> m_constructionStack;
     HashSet<AtomicString> m_observedAttributes;
 };
index afc422f..2480d56 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
 JSMutationCallback::JSMutationCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
     : ActiveDOMCallback(globalObject->scriptExecutionContext())
     , m_callback(callback)
-    , m_isolatedWorld(&globalObject->world())
+    , m_isolatedWorld(globalObject->world())
 {
 }
 
@@ -76,7 +76,7 @@ void JSMutationCallback::call(const Vector<Ref<MutationRecord>>& mutations, Muta
         return;
     ASSERT(context->isDocument());
 
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, *m_isolatedWorld);
+    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld);
     ExecState* exec = globalObject->globalExec();
 
     JSValue jsObserver = toJS(exec, globalObject, observer);
index 427d624..a5b391f 100644 (file)
@@ -30,7 +30,6 @@
 #include "MutationCallback.h"
 #include <heap/Weak.h>
 #include <runtime/JSObject.h>
-#include <wtf/Forward.h>
 
 namespace WebCore {
 
@@ -52,7 +51,7 @@ private:
     JSMutationCallback(JSC::JSObject* callback, JSDOMGlobalObject*);
 
     mutable JSC::Weak<JSC::JSObject> m_callback;
-    RefPtr<DOMWrapperWorld> m_isolatedWorld;
+    Ref<DOMWrapperWorld> m_isolatedWorld;
 };
 
 } // namespace WebCore
index 9333266..8e1b940 100644 (file)
@@ -65,7 +65,7 @@ std::unique_ptr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWra
 
 ScheduledAction::ScheduledAction(ExecState* exec, JSValue function, DOMWrapperWorld& isolatedWorld)
     : m_function(exec->vm(), function)
-    , m_isolatedWorld(&isolatedWorld)
+    , m_isolatedWorld(isolatedWorld)
 {
     // setTimeout(function, interval, arg0, arg1...).
     // Start at 2 to skip function and interval.
@@ -114,7 +114,7 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV
 
 void ScheduledAction::execute(Document& document)
 {
-    JSDOMWindow* window = toJSDOMWindow(document.frame(), *m_isolatedWorld);
+    JSDOMWindow* window = toJSDOMWindow(document.frame(), m_isolatedWorld);
     if (!window)
         return;
 
@@ -125,7 +125,7 @@ void ScheduledAction::execute(Document& document)
     if (m_function)
         executeFunctionInContext(window, window->shell(), document);
     else
-        frame->script().executeScriptInWorld(*m_isolatedWorld, m_code);
+        frame->script().executeScriptInWorld(m_isolatedWorld, m_code);
 }
 
 void ScheduledAction::execute(WorkerGlobalScope& workerGlobalScope)
index dac8579..7681181 100644 (file)
@@ -54,7 +54,7 @@ namespace WebCore {
         ScheduledAction(const String& code, DOMWrapperWorld& isolatedWorld)
             : m_function(isolatedWorld.vm())
             , m_code(code)
-            , m_isolatedWorld(&isolatedWorld)
+            , m_isolatedWorld(isolatedWorld)
         {
         }
 
@@ -65,7 +65,7 @@ namespace WebCore {
         JSC::Strong<JSC::Unknown> m_function;
         Vector<JSC::Strong<JSC::Unknown>> m_args;
         String m_code;
-        RefPtr<DOMWrapperWorld> m_isolatedWorld;
+        Ref<DOMWrapperWorld> m_isolatedWorld;
     };
 
 } // namespace WebCore
index 9c25e5d..80e21c2 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
 
 DOMWindowExtension::DOMWindowExtension(Frame* frame, DOMWrapperWorld& world)
     : DOMWindowProperty(frame)
-    , m_world(&world)
+    , m_world(world)
     , m_wasDetached(false)
 {
     ASSERT(this->frame());
index 842661f..dde0d6c 100644 (file)
@@ -48,12 +48,12 @@ public:
     void willDestroyGlobalObjectInFrame() override;
     void willDetachGlobalObjectFromFrame() override;
 
-    DOMWrapperWorld& world() const { return *m_world; }
+    DOMWrapperWorld& world() const { return m_world; }
 
 private:
     WEBCORE_EXPORT DOMWindowExtension(Frame*, DOMWrapperWorld&);
 
-    RefPtr<DOMWrapperWorld> m_world;
+    Ref<DOMWrapperWorld> m_world;
     RefPtr<Frame> m_disconnectedFrame;
     bool m_wasDetached;
 };