Title: [244861] trunk/Source/_javascript_Core
Revision
244861
Author
[email protected]
Date
2019-05-01 17:25:46 -0700 (Wed, 01 May 2019)

Log Message

RemoteInspector::updateAutomaticInspectionCandidate should have a default implementation.
https://bugs.webkit.org/show_bug.cgi?id=197439

Reviewed by Devin Rousso.

On non-Cocoa platforms, automatic inspection is not currently implemented,
so updateAutomaticInspectionCandidate falls back to the logic of updateTarget.
This logic already existed in three places, so refactor it into a common private method
and allow our websocket-based RWI implementation to make use of it too.

* inspector/remote/RemoteInspector.cpp:
(Inspector::RemoteInspector::updateTarget):
(Inspector::RemoteInspector::updateTargetMap):
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
* inspector/remote/RemoteInspector.h:
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
* inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate): Deleted.
* inspector/remote/socket/RemoteInspectorSocket.cpp:
(Inspector::RemoteInspector::updateAutomaticInspectionCandidate): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (244860 => 244861)


--- trunk/Source/_javascript_Core/ChangeLog	2019-05-02 00:20:38 UTC (rev 244860)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-05-02 00:25:46 UTC (rev 244861)
@@ -1,3 +1,27 @@
+2019-05-01  Ross Kirsling  <[email protected]>
+
+        RemoteInspector::updateAutomaticInspectionCandidate should have a default implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=197439
+
+        Reviewed by Devin Rousso.
+
+        On non-Cocoa platforms, automatic inspection is not currently implemented,
+        so updateAutomaticInspectionCandidate falls back to the logic of updateTarget.
+        This logic already existed in three places, so refactor it into a common private method
+        and allow our websocket-based RWI implementation to make use of it too.
+
+        * inspector/remote/RemoteInspector.cpp:
+        (Inspector::RemoteInspector::updateTarget):
+        (Inspector::RemoteInspector::updateTargetMap):
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/cocoa/RemoteInspectorCocoa.mm:
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
+        * inspector/remote/glib/RemoteInspectorGlib.cpp:
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate): Deleted.
+        * inspector/remote/socket/RemoteInspectorSocket.cpp:
+        (Inspector::RemoteInspector::updateAutomaticInspectionCandidate): Deleted.
+
 2019-05-01  Darin Adler  <[email protected]>
 
         WebKit has too much of its own UTF-8 code and should rely more on ICU's UTF-8 support

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.cpp (244860 => 244861)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.cpp	2019-05-02 00:20:38 UTC (rev 244860)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.cpp	2019-05-02 00:25:46 UTC (rev 244861)
@@ -104,14 +104,22 @@
 
     LockHolder lock(m_mutex);
 
+    if (!updateTargetMap(target))
+        return;
+
+    pushListingsSoon();
+}
+
+bool RemoteInspector::updateTargetMap(RemoteControllableTarget* target)
+{
+    ASSERT(m_mutex.isLocked());
+
     auto targetIdentifier = target->targetIdentifier();
     if (!targetIdentifier)
-        return;
+        return false;
 
-    {
-        auto result = m_targetMap.set(targetIdentifier, target);
-        ASSERT_UNUSED(result, !result.isNewEntry);
-    }
+    auto result = m_targetMap.set(targetIdentifier, target);
+    ASSERT_UNUSED(result, !result.isNewEntry);
 
     // If the target has just allowed remote control, then the listing won't exist yet.
     // If the target has no identifier remove the old listing.
@@ -120,9 +128,17 @@
     else
         m_targetListingMap.remove(targetIdentifier);
 
-    pushListingsSoon();
+    return true;
 }
 
+#if !PLATFORM(COCOA)
+void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* target)
+{
+    // FIXME: Implement automatic inspection.
+    updateTarget(target);
+}
+#endif
+
 void RemoteInspector::updateClientCapabilities()
 {
     ASSERT(isMainThread());

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h (244860 => 244861)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2019-05-02 00:20:38 UTC (rev 244860)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2019-05-02 00:25:46 UTC (rev 244861)
@@ -180,6 +180,8 @@
     TargetListing listingForInspectionTarget(const RemoteInspectionTarget&) const;
     TargetListing listingForAutomationTarget(const RemoteAutomationTarget&) const;
 
+    bool updateTargetMap(RemoteControllableTarget*);
+
     void pushListingsNow();
     void pushListingsSoon();
 

Modified: trunk/Source/_javascript_Core/inspector/remote/cocoa/RemoteInspectorCocoa.mm (244860 => 244861)


--- trunk/Source/_javascript_Core/inspector/remote/cocoa/RemoteInspectorCocoa.mm	2019-05-02 00:20:38 UTC (rev 244860)
+++ trunk/Source/_javascript_Core/inspector/remote/cocoa/RemoteInspectorCocoa.mm	2019-05-02 00:25:46 UTC (rev 244861)
@@ -122,20 +122,9 @@
     {
         LockHolder lock(m_mutex);
 
-        auto targetIdentifier = target->targetIdentifier();
-        if (!targetIdentifier)
+        if (!updateTargetMap(target))
             return;
 
-        auto result = m_targetMap.set(targetIdentifier, target);
-        ASSERT_UNUSED(result, !result.isNewEntry);
-
-        // If the target has just allowed remote control, then the listing won't exist yet.
-        // If the target has no identifier remove the old listing.
-        if (RetainPtr<NSDictionary> targetListing = listingForTarget(*target))
-            m_targetListingMap.set(targetIdentifier, targetListing);
-        else
-            m_targetListingMap.remove(targetIdentifier);
-
         // Don't allow automatic inspection unless it is allowed or we are stopped.
         if (!m_automaticInspectionEnabled || !m_enabled) {
             pushListingsSoon();
@@ -142,6 +131,8 @@
             return;
         }
 
+        auto targetIdentifier = target->targetIdentifier();
+
         // FIXME: We should handle multiple debuggables trying to pause at the same time on different threads.
         // To make this work we will need to change m_automaticInspectionCandidateTargetIdentifier to be a per-thread value.
         // Multiple attempts on the same thread should not be possible because our nested run loop is in a special RWI mode.

Modified: trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorGlib.cpp (244860 => 244861)


--- trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorGlib.cpp	2019-05-02 00:20:38 UTC (rev 244860)
+++ trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorGlib.cpp	2019-05-02 00:25:46 UTC (rev 244861)
@@ -240,28 +240,6 @@
     });
 }
 
-void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget* target)
-{
-    LockHolder lock(m_mutex);
-
-    ASSERT(target);
-    auto targetIdentifier = target->targetIdentifier();
-    if (!targetIdentifier)
-        return;
-
-    auto result = m_targetMap.set(targetIdentifier, target);
-    ASSERT_UNUSED(result, !result.isNewEntry);
-
-    // If the target has just allowed remote control, then the listing won't exist yet.
-    // If the target has no identifier remove the old listing.
-    if (auto targetListing = listingForTarget(*target))
-        m_targetListingMap.set(targetIdentifier, targetListing);
-    else
-        m_targetListingMap.remove(targetIdentifier);
-    // FIXME: Implement automatic inspection.
-    pushListingsSoon();
-}
-
 void RemoteInspector::sendAutomaticInspectionCandidateMessage()
 {
     ASSERT(m_enabled);

Modified: trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorSocket.cpp (244860 => 244861)


--- trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorSocket.cpp	2019-05-02 00:20:38 UTC (rev 244860)
+++ trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorSocket.cpp	2019-05-02 00:25:46 UTC (rev 244861)
@@ -184,10 +184,6 @@
     });
 }
 
-void RemoteInspector::updateAutomaticInspectionCandidate(RemoteInspectionTarget*)
-{
-}
-
 void RemoteInspector::sendAutomaticInspectionCandidateMessage()
 {
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to