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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2431223003: [DevTools]: Require explicit connection (Closed)
Patch Set: Reworked - again Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 this._liveLocationPool = new WebInspector.LiveLocationPool(); 101 this._liveLocationPool = new WebInspector.LiveLocationPool();
102 102
103 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); 103 this._setTarget(WebInspector.context.flavor(WebInspector.Target));
104 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is); 104 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is);
105 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); 105 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this);
106 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this); 106 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this);
107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this ); 107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this );
108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); 108 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); 109 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
110 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); 110 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this);
111 WebInspector.targetManager.addModelListener(WebInspector.SubTargetsManager, WebInspector.SubTargetsManager.Events.SubTargetConnectionCreated, this._connecti onAdded, this)
dgozman 2016/10/28 18:31:35 missing semicolon
eostroukhov 2016/11/01 20:28:15 Done.
111 new WebInspector.WorkspaceMappingTip(this, this._workspace); 112 new WebInspector.WorkspaceMappingTip(this, this._workspace);
112 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); 113 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded);
113 WebInspector.DataSaverInfobar.maybeShowInPanel(this); 114 WebInspector.DataSaverInfobar.maybeShowInPanel(this);
114 WebInspector.targetManager.observeTargets(this); 115 WebInspector.targetManager.observeTargets(this);
115 }; 116 };
116 117
117 WebInspector.SourcesPanel._lastModificationTimeout = 200; 118 WebInspector.SourcesPanel._lastModificationTimeout = 200;
118 119
119 WebInspector.SourcesPanel.minToolbarWidth = 215; 120 WebInspector.SourcesPanel.minToolbarWidth = 215;
120 121
121 WebInspector.SourcesPanel.prototype = { 122 WebInspector.SourcesPanel.prototype = {
122 /** 123 /**
123 * @override 124 * @override
124 * @param {!WebInspector.Target} target 125 * @param {!WebInspector.Target} target
125 */ 126 */
126 targetAdded: function(target) 127 targetAdded: function(target)
127 { 128 {
128 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target. Capability.JS).length > 1; 129 this._showThreadsIfNeeded();
129 if (hasThreads && !this._threadsSidebarPane) {
130 this._threadsSidebarPane = /** @type {!WebInspector.View} */ (WebIns pector.viewManager.view("sources.threads"));
131 if (this._sidebarPaneStack) {
132 this._sidebarPaneStack.showView(this._threadsSidebarPane, this._ splitWidget.isVertical() ? this._watchSidebarPane : this._callstackPane);
133 }
134 }
135 }, 130 },
136 131
137 /** 132 /**
138 * @override 133 * @override
139 * @param {!WebInspector.Target} target 134 * @param {!WebInspector.Target} target
140 */ 135 */
141 targetRemoved: function(target) 136 targetRemoved: function(target)
142 { 137 {
143 }, 138 },
144 139
140 _connectionAdded: function()
141 {
142 this._showThreadsIfNeeded();
143 },
144
145 /**
146 * @return {boolean}
147 */
148 _hasPendingConnections: function()
149 {
150 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Capability.Target))
dgozman 2016/10/28 18:31:36 {} around body
eostroukhov 2016/11/01 20:28:15 Done.
151 if (WebInspector.SubTargetsManager.fromTarget(target).targetConnecti ons().length > 0)
152 return true;
153 return false;
154 },
155
156 _showThreadsIfNeeded: function()
157 {
158 var hasThreads = WebInspector.targetManager.targets(WebInspector.Target. Capability.JS).length > 1 || this._hasPendingConnections();
dgozman 2016/10/28 18:31:35 I still believe that hasTreads logic belongs to Th
eostroukhov 2016/11/01 20:28:15 Agreed.
159 if (hasThreads && !this._threadsSidebarPane) {
160 this._threadsSidebarPane = /** @type {!WebInspector.View} */ (WebIns pector.viewManager.view("sources.threads"));
161 if (this._sidebarPaneStack) {
162 this._sidebarPaneStack.showView(this._threadsSidebarPane, this._ splitWidget.isVertical() ? this._watchSidebarPane : this._callstackPane);
163 }
164 }
165 },
166
145 /** 167 /**
146 * @param {?WebInspector.Target} target 168 * @param {?WebInspector.Target} target
147 */ 169 */
148 _setTarget: function(target) 170 _setTarget: function(target)
149 { 171 {
150 if (!target) 172 if (!target)
151 return; 173 return;
152 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 174 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
153 if (!debuggerModel) 175 if (!debuggerModel)
154 return; 176 return;
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 __proto__: WebInspector.VBox.prototype 1415 __proto__: WebInspector.VBox.prototype
1394 }; 1416 };
1395 1417
1396 /** 1418 /**
1397 * @return {boolean} 1419 * @return {boolean}
1398 */ 1420 */
1399 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1421 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1400 { 1422 {
1401 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1423 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1402 }; 1424 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698