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

Side by Side Diff: Source/devtools/front_end/sdk/CSSWorkspaceBinding.js

Issue 429593006: DevTools: Do not re-create CSSWorkspaceBinding TargetInfo on MainFrameNavigated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert _dispose() Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TargetManager.Observer} 7 * @implements {WebInspector.TargetManager.Observer}
8 */ 8 */
9 WebInspector.CSSWorkspaceBinding = function() 9 WebInspector.CSSWorkspaceBinding = function()
10 { 10 {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 return targetInfo._ensureInfoForHeader(header); 65 return targetInfo._ensureInfoForHeader(header);
66 }, 66 },
67 67
68 /** 68 /**
69 * @param {!WebInspector.Event} event 69 * @param {!WebInspector.Event} event
70 */ 70 */
71 _mainFrameCreatedOrNavigated: function(event) 71 _mainFrameCreatedOrNavigated: function(event)
72 { 72 {
73 var target = /** @type {!WebInspector.ResourceTreeModel} */ (event.targe t).target(); 73 var target = /** @type {!WebInspector.ResourceTreeModel} */ (event.targe t).target();
74 var info = this._targetToTargetInfo.remove(target); 74 this._targetToTargetInfo.get(target)._reset();
75 if (info)
76 info._dispose();
77 this._targetToTargetInfo.put(target, new WebInspector.CSSWorkspaceBindin g.TargetInfo(target, WebInspector.workspace, WebInspector.networkWorkspaceBindin g));
78 }, 75 },
79 76
80 /** 77 /**
81 * @param {!WebInspector.CSSStyleSheetHeader} header 78 * @param {!WebInspector.CSSStyleSheetHeader} header
82 */ 79 */
83 updateLocations: function(header) 80 updateLocations: function(header)
84 { 81 {
85 var info = this._headerInfo(header); 82 var info = this._headerInfo(header);
86 if (info) 83 if (info)
87 info._updateLocations(); 84 info._updateLocations();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 var info = this._headerInfoById.get(header.id); 224 var info = this._headerInfoById.get(header.id);
228 if (!info) { 225 if (!info) {
229 info = new WebInspector.CSSWorkspaceBinding.HeaderInfo(header); 226 info = new WebInspector.CSSWorkspaceBinding.HeaderInfo(header);
230 this._headerInfoById.put(header.id, info); 227 this._headerInfoById.put(header.id, info);
231 } 228 }
232 return info; 229 return info;
233 }, 230 },
234 231
235 _dispose: function() 232 _dispose: function()
236 { 233 {
234 this._reset();
237 this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetAdded, this._styleSheetAdded, this); 235 this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetAdded, this._styleSheetAdded, this);
238 this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetRemoved, this._styleSheetRemoved, this); 236 this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetRemoved, this._styleSheetRemoved, this);
237 },
238
239 _reset: function()
240 {
241 this._headerInfoById.clear();
239 } 242 }
240 } 243 }
241 244
242 /** 245 /**
243 * @constructor 246 * @constructor
244 * @param {!WebInspector.CSSStyleSheetHeader} header 247 * @param {!WebInspector.CSSStyleSheetHeader} header
245 */ 248 */
246 WebInspector.CSSWorkspaceBinding.HeaderInfo = function(header) 249 WebInspector.CSSWorkspaceBinding.HeaderInfo = function(header)
247 { 250 {
248 this._header = header; 251 this._header = header;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, this._styleSheetRemoved, this); 392 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, this._styleSheetRemoved, this);
390 }, 393 },
391 394
392 __proto__: WebInspector.LiveLocation.prototype 395 __proto__: WebInspector.LiveLocation.prototype
393 } 396 }
394 397
395 /** 398 /**
396 * @type {!WebInspector.CSSWorkspaceBinding} 399 * @type {!WebInspector.CSSWorkspaceBinding}
397 */ 400 */
398 WebInspector.cssWorkspaceBinding; 401 WebInspector.cssWorkspaceBinding;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698