Commit 921d5298 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[DevTools] chaotic green dots displacement fix

With the experiment, we see the markers for a brief second before they are
immediately removed without any user intervention.  This CL fixes the race.

BUG=chromium:695236
R=luoe@chromium.org,lushnikov@chromium.org

Review-Url: https://codereview.chromium.org/2742653003
Cr-Commit-Position: refs/heads/master@{#456174}
parent adcdf2d7
...@@ -595,9 +595,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { ...@@ -595,9 +595,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame);
if (!callFrame) if (!callFrame)
return; return;
if (this._clearContinueToLocationsTimer) {
clearTimeout(this._clearContinueToLocationsTimer);
delete this._clearContinueToLocationsTimer;
}
var localScope = callFrame.localScope(); var localScope = callFrame.localScope();
if (!localScope) if (!localScope) {
this.textEditor.operation(clearExistingLocations.bind(this));
return; return;
}
var start = localScope.startLocation(); var start = localScope.startLocation();
var end = localScope.endLocation(); var end = localScope.endLocation();
var debuggerModel = callFrame.debuggerModel; var debuggerModel = callFrame.debuggerModel;
...@@ -605,20 +611,12 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { ...@@ -605,20 +611,12 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
debuggerModel.getPossibleBreakpoints(start, end, true) debuggerModel.getPossibleBreakpoints(start, end, true)
.then(locations => this.textEditor.operation(renderLocations.bind(this, locations))); .then(locations => this.textEditor.operation(renderLocations.bind(this, locations)));
if (this._clearContinueToLocationsTimer) {
clearTimeout(this._clearContinueToLocationsTimer);
delete this._clearContinueToLocationsTimer;
}
/** /**
* @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations
* @this {Sources.JavaScriptSourceFrame} * @this {Sources.JavaScriptSourceFrame}
*/ */
function renderLocations(locations) { function renderLocations(locations) {
var bookmarks = this.textEditor.bookmarks( clearExistingLocations.call(this);
this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol);
bookmarks.map(bookmark => bookmark.clear());
for (var location of locations) { for (var location of locations) {
var icon; var icon;
var isCurrent = location.lineNumber === executionLocation.lineNumber && var isCurrent = location.lineNumber === executionLocation.lineNumber &&
...@@ -647,6 +645,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame { ...@@ -647,6 +645,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
} }
} }
/**
* @this {Sources.JavaScriptSourceFrame}
*/
function clearExistingLocations() {
var bookmarks = this.textEditor.bookmarks(
this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol);
bookmarks.map(bookmark => bookmark.clear());
}
/** /**
* @param {!Event} event * @param {!Event} event
* @this {Sources.JavaScriptSourceFrame} * @this {Sources.JavaScriptSourceFrame}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment