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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/snippets/ScriptSnippetModel.js

Issue 2931773002: DevTools: kill DebuggerWorkspaceBinding.{push,pop,set}SourceMapping (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 */ 347 */
348 constructor(debuggerModel, scriptSnippetModel) { 348 constructor(debuggerModel, scriptSnippetModel) {
349 this._debuggerModel = debuggerModel; 349 this._debuggerModel = debuggerModel;
350 this._scriptSnippetModel = scriptSnippetModel; 350 this._scriptSnippetModel = scriptSnippetModel;
351 /** @type {!Object.<string, !Workspace.UISourceCode>} */ 351 /** @type {!Object.<string, !Workspace.UISourceCode>} */
352 this._uiSourceCodeForScriptId = {}; 352 this._uiSourceCodeForScriptId = {};
353 /** @type {!Map.<!Workspace.UISourceCode, !SDK.Script>} */ 353 /** @type {!Map.<!Workspace.UISourceCode, !SDK.Script>} */
354 this._scriptForUISourceCode = new Map(); 354 this._scriptForUISourceCode = new Map();
355 /** @type {!Map.<!Workspace.UISourceCode, number>} */ 355 /** @type {!Map.<!Workspace.UISourceCode, number>} */
356 this._evaluationIndexForUISourceCode = new Map(); 356 this._evaluationIndexForUISourceCode = new Map();
357 Bindings.debuggerWorkspaceBinding.addSourceMapping(this);
dgozman 2017/06/08 19:12:00 Move this to ScriptSnippetModel instead.
lushnikov 2017/06/08 21:14:34 Done.
357 debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared, this._reset, this); 358 debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared, this._reset, this);
358 } 359 }
359 360
360 /** 361 /**
361 * @param {!Workspace.UISourceCode} uiSourceCode 362 * @param {!Workspace.UISourceCode} uiSourceCode
362 */ 363 */
363 _releaseSnippetScript(uiSourceCode) { 364 _releaseSnippetScript(uiSourceCode) {
364 var script = this._scriptForUISourceCode.get(uiSourceCode); 365 var script = this._scriptForUISourceCode.get(uiSourceCode);
365 if (!script) 366 if (!script)
366 return; 367 return;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 431
431 return this._debuggerModel.createRawLocation(script, lineNumber, columnNumbe r); 432 return this._debuggerModel.createRawLocation(script, lineNumber, columnNumbe r);
432 } 433 }
433 434
434 /** 435 /**
435 * @param {!SDK.Script} script 436 * @param {!SDK.Script} script
436 * @param {!Workspace.UISourceCode} uiSourceCode 437 * @param {!Workspace.UISourceCode} uiSourceCode
437 */ 438 */
438 _addScript(script, uiSourceCode) { 439 _addScript(script, uiSourceCode) {
439 console.assert(!this._scriptForUISourceCode.get(uiSourceCode)); 440 console.assert(!this._scriptForUISourceCode.get(uiSourceCode));
440 Bindings.debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSo urceCode, this);
441 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode; 441 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode;
442 this._scriptForUISourceCode.set(uiSourceCode, script); 442 this._scriptForUISourceCode.set(uiSourceCode, script);
443 Bindings.debuggerWorkspaceBinding.pushSourceMapping(script, this); 443 Bindings.debuggerWorkspaceBinding.updateLocations(script);
444 } 444 }
445 445
446 /** 446 /**
447 * @param {!Workspace.UISourceCode} uiSourceCode 447 * @param {!Workspace.UISourceCode} uiSourceCode
448 * @param {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLoc ation: !Workspace.UILocation}>} breakpointLocations 448 * @param {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLoc ation: !Workspace.UILocation}>} breakpointLocations
449 */ 449 */
450 _restoreBreakpoints(uiSourceCode, breakpointLocations) { 450 _restoreBreakpoints(uiSourceCode, breakpointLocations) {
451 var script = this._scriptForUISourceCode.get(uiSourceCode); 451 var script = this._scriptForUISourceCode.get(uiSourceCode);
452 if (!script) 452 if (!script)
453 return; 453 return;
454 var rawLocation = 454 var rawLocation =
455 /** @type {!SDK.DebuggerModel.Location} */ (this._debuggerModel.createRa wLocation(script, 0, 0)); 455 /** @type {!SDK.DebuggerModel.Location} */ (this._debuggerModel.createRa wLocation(script, 0, 0));
456 var scriptUISourceCode = Bindings.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation).uiSourceCode; 456 var scriptUISourceCode = Bindings.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation).uiSourceCode;
457 if (scriptUISourceCode) 457 if (scriptUISourceCode)
458 this._scriptSnippetModel._restoreBreakpoints(scriptUISourceCode, breakpoin tLocations); 458 this._scriptSnippetModel._restoreBreakpoints(scriptUISourceCode, breakpoin tLocations);
459 } 459 }
460
461 /**
462 * @override
463 * @return {boolean}
464 */
465 isIdentity() {
466 return false;
467 }
468
469 /**
470 * @override
471 * @param {!Workspace.UISourceCode} uiSourceCode
472 * @param {number} lineNumber
473 * @return {boolean}
474 */
475 uiLineHasMapping(uiSourceCode, lineNumber) {
476 return true;
477 }
478 }; 460 };
479 461
480 /** 462 /**
481 * @implements {Common.ContentProvider} 463 * @implements {Common.ContentProvider}
482 * @unrestricted 464 * @unrestricted
483 */ 465 */
484 Snippets.SnippetContentProvider = class { 466 Snippets.SnippetContentProvider = class {
485 /** 467 /**
486 * @param {!Snippets.Snippet} snippet 468 * @param {!Snippets.Snippet} snippet
487 */ 469 */
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 */ 591 */
610 deleteFile(uiSourceCode) { 592 deleteFile(uiSourceCode) {
611 this._model.deleteScriptSnippet(uiSourceCode); 593 this._model.deleteScriptSnippet(uiSourceCode);
612 } 594 }
613 }; 595 };
614 596
615 /** 597 /**
616 * @type {!Snippets.ScriptSnippetModel} 598 * @type {!Snippets.ScriptSnippetModel}
617 */ 599 */
618 Snippets.scriptSnippetModel = new Snippets.ScriptSnippetModel(Workspace.workspac e); 600 Snippets.scriptSnippetModel = new Snippets.ScriptSnippetModel(Workspace.workspac e);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698