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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 2931773002: DevTools: kill DebuggerWorkspaceBinding.{push,pop,set}SourceMapping (Closed)
Patch Set: address comments 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 /** @type {!Map.<!SDK.DebuggerModel, !Bindings.ResourceScriptFile>}*/ 88 /** @type {!Map.<!SDK.DebuggerModel, !Bindings.ResourceScriptFile>}*/
89 this._scriptFileForDebuggerModel = new Map(); 89 this._scriptFileForDebuggerModel = new Map();
90 90
91 Common.moduleSetting('skipStackFramesPattern').addChangeListener(this._showB lackboxInfobarIfNeeded, this); 91 Common.moduleSetting('skipStackFramesPattern').addChangeListener(this._showB lackboxInfobarIfNeeded, this);
92 Common.moduleSetting('skipContentScripts').addChangeListener(this._showBlack boxInfobarIfNeeded, this); 92 Common.moduleSetting('skipContentScripts').addChangeListener(this._showBlack boxInfobarIfNeeded, this);
93 93
94 /** @type {!Map.<number, !Element>} */ 94 /** @type {!Map.<number, !Element>} */
95 this._valueWidgets = new Map(); 95 this._valueWidgets = new Map();
96 this.onBindingChanged(); 96 this.onBindingChanged();
97 Bindings.debuggerWorkspaceBinding.addEventListener(
98 Bindings.DebuggerWorkspaceBinding.Events.SourceMappingChanged, this._onS ourceMappingChanged, this);
99 /** @type {?Map<!Object, !Function>} */ 97 /** @type {?Map<!Object, !Function>} */
100 this._continueToLocationDecorations = null; 98 this._continueToLocationDecorations = null;
101 } 99 }
102 100
103 /** 101 /**
104 * @override 102 * @override
105 * @return {!Array<!UI.ToolbarItem>} 103 * @return {!Array<!UI.ToolbarItem>}
106 */ 104 */
107 syncToolbarItems() { 105 syncToolbarItems() {
108 var result = super.syncToolbarItems(); 106 var result = super.syncToolbarItems();
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 var breakpointLocations = this._breakpointManager.breakpointLocationsForUISo urceCode(this._debuggerSourceCode); 1342 var breakpointLocations = this._breakpointManager.breakpointLocationsForUISo urceCode(this._debuggerSourceCode);
1345 for (var breakpointLocation of breakpointLocations) 1343 for (var breakpointLocation of breakpointLocations)
1346 this._addBreakpoint(breakpointLocation.uiLocation, breakpointLocation.brea kpoint); 1344 this._addBreakpoint(breakpointLocation.uiLocation, breakpointLocation.brea kpoint);
1347 } 1345 }
1348 1346
1349 _updateDebuggerSourceCode() { 1347 _updateDebuggerSourceCode() {
1350 var binding = Persistence.persistence.binding(this.uiSourceCode()); 1348 var binding = Persistence.persistence.binding(this.uiSourceCode());
1351 this._debuggerSourceCode = binding ? binding.network : this.uiSourceCode(); 1349 this._debuggerSourceCode = binding ? binding.network : this.uiSourceCode();
1352 } 1350 }
1353 1351
1354 /** 1352 _updateLinesWithoutMappingHighlight() {
1355 * @param {!Common.Event} event 1353 var isSourceMapSource = !!Bindings.CompilerScriptMapping.uiSourceCodeOrigin( this._debuggerSourceCode);
1356 */ 1354 if (!isSourceMapSource)
1357 _onSourceMappingChanged(event) {
1358 var data = /** @type {{debuggerModel: !SDK.DebuggerModel, uiSourceCode: !Wor kspace.UISourceCode}} */ (event.data);
1359 if (this._debuggerSourceCode !== data.uiSourceCode)
1360 return; 1355 return;
1361 this._updateScriptFile(data.debuggerModel);
1362 this._updateLinesWithoutMappingHighlight();
1363 }
1364
1365 _updateLinesWithoutMappingHighlight() {
1366 var linesCount = this.textEditor.linesCount; 1356 var linesCount = this.textEditor.linesCount;
1367 for (var i = 0; i < linesCount; ++i) { 1357 for (var i = 0; i < linesCount; ++i) {
1368 var lineHasMapping = Bindings.debuggerWorkspaceBinding.uiLineHasMapping(th is._debuggerSourceCode, i); 1358 var lineHasMapping = Bindings.CompilerScriptMapping.uiLineHasMapping(this. _debuggerSourceCode, i);
1369 if (!lineHasMapping) 1359 if (!lineHasMapping)
1370 this._hasLineWithoutMapping = true; 1360 this._hasLineWithoutMapping = true;
1371 if (this._hasLineWithoutMapping) 1361 if (this._hasLineWithoutMapping)
1372 this.textEditor.toggleLineClass(i, 'cm-line-without-source-mapping', !li neHasMapping); 1362 this.textEditor.toggleLineClass(i, 'cm-line-without-source-mapping', !li neHasMapping);
1373 } 1363 }
1374 } 1364 }
1375 1365
1376 _updateScriptFiles() { 1366 _updateScriptFiles() {
1377 for (var debuggerModel of SDK.targetManager.models(SDK.DebuggerModel)) { 1367 for (var debuggerModel of SDK.targetManager.models(SDK.DebuggerModel)) {
1378 var scriptFile = Bindings.debuggerWorkspaceBinding.scriptFile(this._debugg erSourceCode, debuggerModel); 1368 var scriptFile = Bindings.debuggerWorkspaceBinding.scriptFile(this._debugg erSourceCode, debuggerModel);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 this._toggleBreakpoint(selection.startLine, false); 1573 this._toggleBreakpoint(selection.startLine, false);
1584 } 1574 }
1585 1575
1586 /** 1576 /**
1587 * @param {number} lineNumber 1577 * @param {number} lineNumber
1588 * @param {number} columnNumber 1578 * @param {number} columnNumber
1589 * @param {string} condition 1579 * @param {string} condition
1590 * @param {boolean} enabled 1580 * @param {boolean} enabled
1591 */ 1581 */
1592 _setBreakpoint(lineNumber, columnNumber, condition, enabled) { 1582 _setBreakpoint(lineNumber, columnNumber, condition, enabled) {
1593 if (!Bindings.debuggerWorkspaceBinding.uiLineHasMapping(this._debuggerSource Code, lineNumber)) 1583 if (!Bindings.CompilerScriptMapping.uiLineHasMapping(this._debuggerSourceCod e, lineNumber))
1594 return; 1584 return;
1595 1585
1596 this._breakpointManager.setBreakpoint(this._debuggerSourceCode, lineNumber, columnNumber, condition, enabled); 1586 this._breakpointManager.setBreakpoint(this._debuggerSourceCode, lineNumber, columnNumber, condition, enabled);
1597 this._breakpointWasSetForTest(lineNumber, columnNumber, condition, enabled); 1587 this._breakpointWasSetForTest(lineNumber, columnNumber, condition, enabled);
1598 } 1588 }
1599 1589
1600 /** 1590 /**
1601 * @param {number} lineNumber 1591 * @param {number} lineNumber
1602 * @param {number} columnNumber 1592 * @param {number} columnNumber
1603 * @param {string} condition 1593 * @param {string} condition
1604 * @param {boolean} enabled 1594 * @param {boolean} enabled
1605 */ 1595 */
1606 _breakpointWasSetForTest(lineNumber, columnNumber, condition, enabled) { 1596 _breakpointWasSetForTest(lineNumber, columnNumber, condition, enabled) {
1607 } 1597 }
1608 1598
1609 /** 1599 /**
1610 * @override 1600 * @override
1611 */ 1601 */
1612 dispose() { 1602 dispose() {
1613 Bindings.debuggerWorkspaceBinding.removeEventListener(
1614 Bindings.DebuggerWorkspaceBinding.Events.SourceMappingChanged, this._onS ourceMappingChanged, this);
1615 this._breakpointManager.removeEventListener( 1603 this._breakpointManager.removeEventListener(
1616 Bindings.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded , this); 1604 Bindings.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded , this);
1617 this._breakpointManager.removeEventListener( 1605 this._breakpointManager.removeEventListener(
1618 Bindings.BreakpointManager.Events.BreakpointRemoved, this._breakpointRem oved, this); 1606 Bindings.BreakpointManager.Events.BreakpointRemoved, this._breakpointRem oved, this);
1619 this.uiSourceCode().removeEventListener( 1607 this.uiSourceCode().removeEventListener(
1620 Workspace.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChang ed, this); 1608 Workspace.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChang ed, this);
1621 this.uiSourceCode().removeEventListener( 1609 this.uiSourceCode().removeEventListener(
1622 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCom mitted, this); 1610 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCom mitted, this);
1623 this.uiSourceCode().removeEventListener( 1611 this.uiSourceCode().removeEventListener(
1624 Workspace.UISourceCode.Events.TitleChanged, this._showBlackboxInfobarIfN eeded, this); 1612 Workspace.UISourceCode.Events.TitleChanged, this._showBlackboxInfobarIfN eeded, this);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 return; 1679 return;
1692 this.bookmark.clear(); 1680 this.bookmark.clear();
1693 this.bookmark = null; 1681 this.bookmark = null;
1694 } 1682 }
1695 }; 1683 };
1696 1684
1697 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book mark'); 1685 Sources.JavaScriptSourceFrame.BreakpointDecoration.bookmarkSymbol = Symbol('book mark');
1698 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo l('element'); 1686 Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymbolForTest = Symbo l('element');
1699 1687
1700 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm ark'); 1688 Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol = Symbol('bookm ark');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698