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

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

Issue 464963002: DevTools: Make UISourceCode Target-agnostic (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments 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 | « Source/devtools/front_end/sources/JavaScriptSourceFrame.js ('k') | 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.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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
314 for (var i = 0; i < uiSourceCodes.length; ++i) { 314 for (var i = 0; i < uiSourceCodes.length; ++i) {
315 uiSourceCodes[i].setSourceMappingForTarget(target, null); 315 WebInspector.debuggerWorkspaceBinding.setSourceMapping(target, uiSou rceCodes[i], null);
316 var formatData = this._formatData.get(uiSourceCodes[i]); 316 var formatData = this._formatData.get(uiSourceCodes[i]);
317 var scripts = []; 317 var scripts = [];
318 for (var j = 0; j < formatData.scripts.length; ++j) { 318 for (var j = 0; j < formatData.scripts.length; ++j) {
319 if (formatData.scripts[j].target() === target) 319 if (formatData.scripts[j].target() === target)
320 this._uiSourceCodes.remove(formatData.scripts[j]); 320 this._uiSourceCodes.remove(formatData.scripts[j]);
321 else 321 else
322 scripts.push(formatData.scripts[j]); 322 scripts.push(formatData.scripts[j]);
323 } 323 }
324 324
325 if (scripts.length) 325 if (scripts.length)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) { 359 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) {
360 var scripts = []; 360 var scripts = [];
361 var targets = WebInspector.targetManager.targets(); 361 var targets = WebInspector.targetManager.targets();
362 for (var i = 0; i < targets.length; ++i) 362 for (var i = 0; i < targets.length; ++i)
363 scripts.pushAll(targets[i].debuggerModel.scriptsForSourceURL(uiS ourceCode.url)); 363 scripts.pushAll(targets[i].debuggerModel.scriptsForSourceURL(uiS ourceCode.url));
364 return scripts.filter(isInlineScript); 364 return scripts.filter(isInlineScript);
365 } 365 }
366 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) { 366 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) {
367 var rawLocations = (uiSourceCode.uiLocationToRawLocations(0, 0)); 367 var rawLocations = WebInspector.debuggerWorkspaceBinding.uiLocationT oRawLocations(uiSourceCode, 0, 0);
368 return rawLocations.map(function(rawLocation) { return rawLocation.s cript()}); 368 return rawLocations.map(function(rawLocation) { return rawLocation.s cript()});
369 } 369 }
370 return []; 370 return [];
371 }, 371 },
372 372
373 /** 373 /**
374 * @param {!WebInspector.UISourceCode} uiSourceCode 374 * @param {!WebInspector.UISourceCode} uiSourceCode
375 */ 375 */
376 _formatUISourceCodeScript: function(uiSourceCode) 376 _formatUISourceCodeScript: function(uiSourceCode)
377 { 377 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(scripts[ i], 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 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping);
431 } 431 }
432 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping); 432 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
433 } 433 }
434 } 434 }
435 } 435 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/JavaScriptSourceFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698