Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js

Issue 2421913003: DevTools: allow reattaching main target live. (Closed)
Patch Set: same Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
index 39c039703e2b9a2a135a39253a766bcf76e65f74..06736ed6fe73e46542367db6bfe195f9306a81a5 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
@@ -235,6 +235,32 @@ WebInspector.TargetManager.prototype = {
},
/**
+ * @param {function()} factory
+ */
+ setMainTargetFactory: function(factory)
+ {
+ this._mainTargetFactory = factory;
+ },
+
+ /**
+ * @param {function(string)} dispatch
+ * @return {!Promise<!WebInspector.RawProtocolConnection>}
+ */
+ interceptMainConnection: function(dispatch)
dgozman 2016/10/15 00:26:26 Let's rework TargetDisposed event.
+ {
+ var targets = this._targets.slice();
+ for (var i = targets.length - 1; i >=0 ; --i)
+ targets[i].connection().close();
+
+ var yeld = InspectorFrontendHost.reattach.bind(InspectorFrontendHost, this._mainTargetFactory);
dgozman 2016/10/15 00:26:26 yield
+
+ var fulfill;
+ var result = new Promise(resolve => fulfill = resolve);
+ InspectorFrontendHost.reattach(() => fulfill(new WebInspector.RawProtocolConnection(dispatch, yeld)));
+ return result;
+ },
+
+ /**
* @param {!WebInspector.Target} target
* @return {!Array<!WebInspector.TargetManager.Observer>}
*/
@@ -288,6 +314,8 @@ WebInspector.TargetManager.prototype = {
*/
removeTarget: function(target)
{
+ if (!this._targets.includes(target))
dgozman 2016/10/15 00:26:26 Let's try to only remove main.
+ return;
this._targets.remove(target);
var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
var treeModelListeners = resourceTreeModel && resourceTreeModel[WebInspector.TargetManager._listenersSymbol];

Powered by Google App Engine
This is Rietveld 408576698