Title: [211344] trunk/Source/_javascript_Core
Revision
211344
Author
commit-qu...@webkit.org
Date
2017-01-28 16:39:45 -0800 (Sat, 28 Jan 2017)

Log Message

Remote Inspector: Listing should be updated when a target gains or loses a debugger session
https://bugs.webkit.org/show_bug.cgi?id=167449

Patch by Joseph Pecoraro <pecor...@apple.com> on 2017-01-28
Reviewed by Brian Burg.

* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::setupFailed):
(Inspector::RemoteInspector::updateTargetListing):
(Inspector::RemoteInspector::receivedSetupMessage):
(Inspector::RemoteInspector::receivedDidCloseMessage):
(Inspector::RemoteInspector::receivedConnectionDiedMessage):
Whenever we add/remove a connection we should update the listing properties
for that target that corresponded to that connection. In this way group
updating active sessions, the target, and pushing listing together.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (211343 => 211344)


--- trunk/Source/_javascript_Core/ChangeLog	2017-01-29 00:16:51 UTC (rev 211343)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-01-29 00:39:45 UTC (rev 211344)
@@ -1,3 +1,21 @@
+2017-01-28  Joseph Pecoraro  <pecor...@apple.com>
+
+        Remote Inspector: Listing should be updated when a target gains or loses a debugger session
+        https://bugs.webkit.org/show_bug.cgi?id=167449
+
+        Reviewed by Brian Burg.
+
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::setupFailed):
+        (Inspector::RemoteInspector::updateTargetListing):
+        (Inspector::RemoteInspector::receivedSetupMessage):
+        (Inspector::RemoteInspector::receivedDidCloseMessage):
+        (Inspector::RemoteInspector::receivedConnectionDiedMessage):
+        Whenever we add/remove a connection we should update the listing properties
+        for that target that corresponded to that connection. In this way group
+        updating active sessions, the target, and pushing listing together.
+
 2017-01-27  Yusuke Suzuki  <utatane....@gmail.com>
 
         Lift template escape sequence restrictions in tagged templates

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h (211343 => 211344)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2017-01-29 00:16:51 UTC (rev 211343)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2017-01-29 00:39:45 UTC (rev 211344)
@@ -102,6 +102,9 @@
     void pushListingsNow();
     void pushListingsSoon();
 
+    void updateTargetListing(unsigned targetIdentifier);
+    void updateTargetListing(const RemoteControllableTarget&);
+
     void updateHasActiveDebugSession();
     void updateClientCapabilities();
 

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm (211343 => 211344)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2017-01-29 00:16:51 UTC (rev 211343)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2017-01-29 00:39:45 UTC (rev 211344)
@@ -319,11 +319,11 @@
 
     m_targetConnectionMap.remove(targetIdentifier);
 
-    updateHasActiveDebugSession();
-
     if (targetIdentifier == m_automaticInspectionCandidateTargetIdentifier)
         m_automaticInspectionPaused = false;
 
+    updateHasActiveDebugSession();
+    updateTargetListing(targetIdentifier);
     pushListingsSoon();
 }
 
@@ -615,6 +615,26 @@
     });
 }
 
+#pragma mark - Update Listing with lock
+
+void RemoteInspector::updateTargetListing(unsigned targetIdentifier)
+{
+    auto target = m_targetMap.get(targetIdentifier);
+    if (!target)
+        return;
+
+    updateTargetListing(*target);
+}
+
+void RemoteInspector::updateTargetListing(const RemoteControllableTarget& target)
+{
+    RetainPtr<NSDictionary> targetListing = listingForTarget(target);
+    if (!targetListing)
+        return;
+
+    m_targetListingMap.set(target.targetIdentifier(), targetListing);
+}
+
 #pragma mark - Active Debugger Sessions
 
 void RemoteInspector::updateHasActiveDebugSession()
@@ -629,7 +649,6 @@
     // Legacy iOS WebKit 1 had a notification. This will need to be smarter with WebKit2.
 }
 
-
 #pragma mark - Received XPC Messages
 
 void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo)
@@ -666,7 +685,6 @@
             return;
         }
         m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
-        updateHasActiveDebugSession();
     } else if (is<RemoteAutomationTarget>(target)) {
         if (!connectionToTarget->setup()) {
             connectionToTarget->close();
@@ -673,10 +691,11 @@
             return;
         }
         m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
-        updateHasActiveDebugSession();
     } else
         ASSERT_NOT_REACHED();
 
+    updateHasActiveDebugSession();
+    updateTargetListing(*target);
     pushListingsSoon();
 }
 
@@ -716,7 +735,7 @@
     m_targetConnectionMap.remove(targetIdentifier);
 
     updateHasActiveDebugSession();
-
+    updateTargetListing(targetIdentifier);
     pushListingsSoon();
 }
 
@@ -792,10 +811,13 @@
         return;
 
     auto connection = it->value;
+    unsigned targetIdentifier = connection->targetIdentifier().value_or(0);
     connection->close();
     m_targetConnectionMap.remove(it);
 
     updateHasActiveDebugSession();
+    updateTargetListing(targetIdentifier);
+    pushListingsSoon();
 }
 
 void RemoteInspector::receivedAutomaticInspectionConfigurationMessage(NSDictionary *userInfo)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to