Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| index 030602f53d91557ec67d3c810f3d2016b71d33f6..2ccf7c7f3dfa0be8c038bd39b07590c1124bb385 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| @@ -89,6 +89,11 @@ Sources.SourcesView = class extends UI.VBox { |
| this._shortcuts = {}; |
| this.element.addEventListener('keydown', this._handleKeyDown.bind(this), false); |
| + |
| + Persistence.persistence.addEventListener( |
| + Persistence.Persistence.Events.BindingCreated, this._onBindingChanged, this); |
| + Persistence.persistence.addEventListener( |
| + Persistence.Persistence.Events.BindingRemoved, this._onBindingChanged, this); |
| } |
| /** |
| @@ -394,25 +399,55 @@ Sources.SourcesView = class extends UI.VBox { |
| /** @type {!Sources.UISourceCodeFrame} */ (sourceView).dispose(); |
| } |
| + /** |
| + * @param {!Common.Event} event |
| + */ |
| + _onBindingChanged(event) { |
| + if (!this._executionLocation) |
| + return; |
| + var oldBinding = /** @type {!Persistence.PersistenceBinding} */ (event.data); |
|
dgozman
2016/12/06 01:14:27
binding
lushnikov
2016/12/06 02:21:05
Done.
|
| + var uiSourceCode = this._executionLocation.uiSourceCode; |
| + if (oldBinding.network !== uiSourceCode && oldBinding.fileSystem !== uiSourceCode) |
|
dgozman
2016/12/06 01:14:27
binding.fileSystem doesn't ever equal to uiSourceC
lushnikov
2016/12/06 02:21:05
Done.
dgozman
2016/12/06 22:01:03
Not really :-)
lushnikov
2016/12/06 22:14:04
Now, done!
|
| + return; |
| + this.setExecutionLocation(this._executionLocation); |
| + this.showSourceLocation( |
| + this._executionLocation.uiSourceCode, this._executionLocation.lineNumber, this._executionLocation.columnNumber); |
| + } |
| + |
| clearCurrentExecutionLine() { |
| if (this._executionSourceFrame) |
| this._executionSourceFrame.clearExecutionLine(); |
| - delete this._executionSourceFrame; |
| + this._executionSourceFrame = null; |
| + this._executionLocation = null; |
| } |
| /** |
| * @param {!Workspace.UILocation} uiLocation |
| */ |
| setExecutionLocation(uiLocation) { |
| - var sourceView = this._getOrCreateSourceView(uiLocation.uiSourceCode); |
| + this.clearCurrentExecutionLine(); |
| + var persistenceLocation = this._toPersistenceLocation(uiLocation); |
| + var sourceView = this._getOrCreateSourceView(persistenceLocation.uiSourceCode); |
| if (sourceView instanceof Sources.UISourceCodeFrame) { |
| var sourceFrame = /** @type {!Sources.UISourceCodeFrame} */ (sourceView); |
| - sourceFrame.setExecutionLocation(uiLocation); |
| + sourceFrame.setExecutionLocation(persistenceLocation); |
| this._executionSourceFrame = sourceFrame; |
| + this._executionLocation = uiLocation; |
| } |
| } |
| /** |
| + * @param {!Workspace.UILocation} uiLocation |
| + * @return {!Workspace.UILocation} |
| + */ |
| + _toPersistenceLocation(uiLocation) { |
|
dgozman
2016/12/06 01:14:27
Let's inline.
lushnikov
2016/12/06 02:21:05
Done.
|
| + var binding = Persistence.persistence.binding(uiLocation.uiSourceCode); |
| + if (!binding) |
| + return uiLocation; |
| + return new Workspace.UILocation(binding.fileSystem, uiLocation.lineNumber, uiLocation.columnNumber); |
| + } |
| + |
| + /** |
| * @param {!Common.Event} event |
| */ |
| _editorClosed(event) { |