Title: [267030] trunk/Tools
Revision
267030
Author
[email protected]
Date
2020-09-14 12:50:06 -0700 (Mon, 14 Sep 2020)

Log Message

[TestRunnerShared] Make UIScriptContext not directly call UIScriptController::create which are defined in DRT and WTR
https://bugs.webkit.org/show_bug.cgi?id=216470

Reviewed by Simon Fraser.

UIScriptContext constructor directly called
UIScriptController::create which are defined in DRT and WTR. I'd
like to make TestRunnerShared as a stand alone library which
doesn't depend on DRT and WTR (Bug 216465). Make UIScriptContext
take a factory function to create UIScriptController.

* DumpRenderTree/TestRunner.cpp:
(TestRunner::runUIScript):
* DumpRenderTree/TestRunner.h:
* TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::UIScriptContext):
* TestRunnerShared/UIScriptContext/UIScriptContext.h:
* TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
(WTR::UIScriptController::create): Deleted.
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::runUISideScript):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (267029 => 267030)


--- trunk/Tools/ChangeLog	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/ChangeLog	2020-09-14 19:50:06 UTC (rev 267030)
@@ -1,3 +1,27 @@
+2020-09-14  Fujii Hironori  <[email protected]>
+
+        [TestRunnerShared] Make UIScriptContext not directly call UIScriptController::create which are defined in DRT and WTR
+        https://bugs.webkit.org/show_bug.cgi?id=216470
+
+        Reviewed by Simon Fraser.
+
+        UIScriptContext constructor directly called
+        UIScriptController::create which are defined in DRT and WTR. I'd
+        like to make TestRunnerShared as a stand alone library which
+        doesn't depend on DRT and WTR (Bug 216465). Make UIScriptContext
+        take a factory function to create UIScriptController.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (TestRunner::runUIScript):
+        * DumpRenderTree/TestRunner.h:
+        * TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
+        (UIScriptContext::UIScriptContext):
+        * TestRunnerShared/UIScriptContext/UIScriptContext.h:
+        * TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
+        (WTR::UIScriptController::create): Deleted.
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::runUISideScript):
+
 2020-09-14  Jonathan Bedard  <[email protected]>
 
         [webkitcorepy] Log autoinstall details even without a logger configured

Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (267029 => 267030)


--- trunk/Tools/DumpRenderTree/TestRunner.cpp	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp	2020-09-14 19:50:06 UTC (rev 267030)
@@ -2467,7 +2467,7 @@
     cacheTestRunnerCallback(callbackID, callback);
 
     if (!m_UIScriptContext)
-        m_UIScriptContext = makeUniqueWithoutFastMallocCheck<WTR::UIScriptContext>(*this);
+        m_UIScriptContext = makeUniqueWithoutFastMallocCheck<WTR::UIScriptContext>(*this, WTR::UIScriptController::create);
 
     String scriptString(reinterpret_cast<const UChar*>(JSStringGetCharactersPtr(script)), JSStringGetLength(script));
     m_UIScriptContext->runUIScript(scriptString, callbackID);

Modified: trunk/Tools/DumpRenderTree/TestRunner.h (267029 => 267030)


--- trunk/Tools/DumpRenderTree/TestRunner.h	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/DumpRenderTree/TestRunner.h	2020-09-14 19:50:06 UTC (rev 267030)
@@ -29,6 +29,7 @@
 #pragma once
 
 #include "UIScriptContext.h"
+#include "UIScriptController.h"
 #include <_javascript_Core/JSObjectRef.h>
 #include <map>
 #include <set>

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp (267029 => 267030)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp	2020-09-14 19:50:06 UTC (rev 267030)
@@ -38,11 +38,11 @@
     return callbackID < firstNonPersistentCallbackID;
 }
 
-UIScriptContext::UIScriptContext(UIScriptContextDelegate& delegate)
+UIScriptContext::UIScriptContext(UIScriptContextDelegate& delegate, UIScriptControllerFactory factory)
     : m_context(adopt(JSGlobalContextCreate(nullptr)))
     , m_delegate(delegate)
 {
-    m_controller = UIScriptController::create(*this);
+    m_controller = factory(*this);
 
     JSObjectRef globalObject = JSContextGetGlobalObject(m_context.get());
 

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h (267029 => 267030)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.h	2020-09-14 19:50:06 UTC (rev 267030)
@@ -30,7 +30,7 @@
 
 #include <_javascript_Core/JSRetainPtr.h>
 #include <wtf/HashMap.h>
-#include <wtf/RefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -72,7 +72,9 @@
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(UIScriptContext);
 public:
-    UIScriptContext(UIScriptContextDelegate&);
+    using UIScriptControllerFactory = Ref<UIScriptController> (*)(UIScriptContext&);
+
+    UIScriptContext(UIScriptContextDelegate&, UIScriptControllerFactory);
     ~UIScriptContext();
 
     void runUIScript(const String& script, unsigned scriptCallbackID);

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp (267029 => 267030)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp	2020-09-14 19:50:06 UTC (rev 267030)
@@ -58,13 +58,6 @@
     return nullptr;
 }
 
-#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WIN) && !PLATFORM(WPE)
-Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
-{
-    return adoptRef(*new UIScriptController(context));
-}
-#endif
-
 UIScriptController::UIScriptController(UIScriptContext& context)
     : m_context(&context)
 {

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (267029 => 267030)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2020-09-14 19:49:01 UTC (rev 267029)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2020-09-14 19:50:06 UTC (rev 267030)
@@ -1895,7 +1895,7 @@
     m_pendingUIScriptInvocationData = nullptr;
 
     if (!m_UIScriptContext)
-        m_UIScriptContext = makeUnique<UIScriptContext>(*this);
+        m_UIScriptContext = makeUnique<UIScriptContext>(*this, UIScriptController::create);
     
     m_UIScriptContext->runUIScript(toWTFString(script), scriptCallbackID);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to