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

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: 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 11 matching lines...) Expand all
22 targetAdded: function(target) 22 targetAdded: function(target)
23 { 23 {
24 this._targetToTargetInfo.put(target, new WebInspector.CSSWorkspaceBindin g.TargetInfo(target, WebInspector.workspace, WebInspector.networkWorkspaceBindin g)); 24 this._targetToTargetInfo.put(target, new WebInspector.CSSWorkspaceBindin g.TargetInfo(target, WebInspector.workspace, WebInspector.networkWorkspaceBindin g));
25 }, 25 },
26 26
27 /** 27 /**
28 * @param {!WebInspector.Target} target 28 * @param {!WebInspector.Target} target
29 */ 29 */
30 targetRemoved: function(target) 30 targetRemoved: function(target)
31 { 31 {
32 this._targetToTargetInfo.remove(target)._dispose(); 32 this._targetToTargetInfo.remove(target);
vsevik 2014/07/29 16:48:14 Let's keep it here.
33 }, 33 },
34 34
35 /** 35 /**
36 * @param {!WebInspector.CSSStyleSheetHeader} header 36 * @param {!WebInspector.CSSStyleSheetHeader} header
37 * @param {!WebInspector.SourceMapping} mapping 37 * @param {!WebInspector.SourceMapping} mapping
38 */ 38 */
39 pushSourceMapping: function(header, mapping) 39 pushSourceMapping: function(header, mapping)
40 { 40 {
41 this._ensureInfoForHeader(header)._pushSourceMapping(mapping); 41 this._ensureInfoForHeader(header)._pushSourceMapping(mapping);
42 }, 42 },
(...skipping 21 matching lines...) Expand all
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 _ensureInfoForHeader: function(header) 222 _ensureInfoForHeader: function(header)
226 { 223 {
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 _reset: function()
236 { 233 {
237 this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetAdded, this._styleSheetAdded, this); 234 this._headerInfoById.clear();
238 this._target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Eve nts.StyleSheetRemoved, this._styleSheetRemoved, this);
239 } 235 }
240 } 236 }
241 237
242 /** 238 /**
243 * @constructor 239 * @constructor
244 * @param {!WebInspector.CSSStyleSheetHeader} header 240 * @param {!WebInspector.CSSStyleSheetHeader} header
245 */ 241 */
246 WebInspector.CSSWorkspaceBinding.HeaderInfo = function(header) 242 WebInspector.CSSWorkspaceBinding.HeaderInfo = function(header)
247 { 243 {
248 this._header = header; 244 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); 385 this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.Sty leSheetRemoved, this._styleSheetRemoved, this);
390 }, 386 },
391 387
392 __proto__: WebInspector.LiveLocation.prototype 388 __proto__: WebInspector.LiveLocation.prototype
393 } 389 }
394 390
395 /** 391 /**
396 * @type {!WebInspector.CSSWorkspaceBinding} 392 * @type {!WebInspector.CSSWorkspaceBinding}
397 */ 393 */
398 WebInspector.cssWorkspaceBinding; 394 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