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

Side by Side Diff: Source/devtools/front_end/sources/ScriptFormatterEditorAction.js

Issue 299443016: DevTools: Decouple debugger model from UI entities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge DebuggerScriptMapping into DebuggerWorkspaceBinding 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
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.SourceMapping} 7 * @implements {WebInspector.SourceMapping}
8 * @param {!WebInspector.Target} target 8 * @param {!WebInspector.Target} target
9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction
10 */ 10 */
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 var formatData = this._formatData.get(formattedUISourceCode); 293 var formatData = this._formatData.get(formattedUISourceCode);
294 if (!formatData) 294 if (!formatData)
295 return; 295 return;
296 296
297 this._formatData.remove(formattedUISourceCode); 297 this._formatData.remove(formattedUISourceCode);
298 var path = formatData.projectId + ":" + formatData.path; 298 var path = formatData.projectId + ":" + formatData.path;
299 this._formattedPaths.remove(path); 299 this._formattedPaths.remove(path);
300 this._pathsToFormatOnLoad.remove(path); 300 this._pathsToFormatOnLoad.remove(path);
301 for (var i = 0; i < formatData.scripts.length; ++i) { 301 for (var i = 0; i < formatData.scripts.length; ++i) {
302 this._uiSourceCodes.remove(formatData.scripts[i]); 302 this._uiSourceCodes.remove(formatData.scripts[i]);
303 formatData.scripts[i].popSourceMapping(); 303 WebInspector.debuggerWorkspaceBinding.popSourceMapping(formatData.sc ripts[i]);
304 } 304 }
305 this._projectDelegate._removeFormatted(formattedUISourceCode.path()); 305 this._projectDelegate._removeFormatted(formattedUISourceCode.path());
306 }, 306 },
307 307
308 /** 308 /**
309 * @param {!WebInspector.Target} target 309 * @param {!WebInspector.Target} target
310 */ 310 */
311 _cleanForTarget: function(target) 311 _cleanForTarget: function(target)
312 { 312 {
313 var uiSourceCodes = this._formatData.keys(); 313 var uiSourceCodes = this._formatData.keys();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 formattedPath = this._projectDelegate._addFormatted(name, uiSourceCo de.url, uiSourceCode.contentType(), formattedContent); 414 formattedPath = this._projectDelegate._addFormatted(name, uiSourceCo de.url, uiSourceCode.contentType(), formattedContent);
415 var formattedUISourceCode = /** @type {!WebInspector.UISourceCode} * / (this._workspace.uiSourceCode(this._projectId, formattedPath)); 415 var formattedUISourceCode = /** @type {!WebInspector.UISourceCode} * / (this._workspace.uiSourceCode(this._projectId, formattedPath));
416 var formatData = new WebInspector.FormatterScriptMapping.FormatData( uiSourceCode.project().id(), uiSourceCode.path(), formatterMapping, scripts); 416 var formatData = new WebInspector.FormatterScriptMapping.FormatData( uiSourceCode.project().id(), uiSourceCode.path(), formatterMapping, scripts);
417 this._formatData.put(formattedUISourceCode, formatData); 417 this._formatData.put(formattedUISourceCode, formatData);
418 var path = uiSourceCode.project().id() + ":" + uiSourceCode.path(); 418 var path = uiSourceCode.project().id() + ":" + uiSourceCode.path();
419 this._formattedPaths.put(path, formattedPath); 419 this._formattedPaths.put(path, formattedPath);
420 this._pathsToFormatOnLoad.add(path); 420 this._pathsToFormatOnLoad.add(path);
421 for (var i = 0; i < scripts.length; ++i) { 421 for (var i = 0; i < scripts.length; ++i) {
422 this._uiSourceCodes.put(scripts[i], formattedUISourceCode); 422 this._uiSourceCodes.put(scripts[i], formattedUISourceCode);
423 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(scripts[i].target())); 423 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(scripts[i].target()));
424 scripts[i].pushSourceMapping(scriptMapping); 424 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(scripts[ i], scriptMapping);
425 } 425 }
426 426
427 var targets = WebInspector.targetManager.targets(); 427 var targets = WebInspector.targetManager.targets();
428 for (var i = 0; i < targets.length; ++i) { 428 for (var i = 0; i < targets.length; ++i) {
429 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i])); 429 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i]));
430 formattedUISourceCode.setSourceMappingForTarget(targets[i], scri ptMapping); 430 formattedUISourceCode.setSourceMappingForTarget(targets[i], scri ptMapping);
431 } 431 }
432 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping); 432 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
433 } 433 }
434 } 434 }
435 } 435 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698