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

Unified Diff: Source/devtools/front_end/sdk/ResourceTreeModel.js

Issue 1314783010: DevTools: fix race conditions while recording film strips (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use counter, not a flag to track reload suspension Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/network/NetworkPanel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/ResourceTreeModel.js
diff --git a/Source/devtools/front_end/sdk/ResourceTreeModel.js b/Source/devtools/front_end/sdk/ResourceTreeModel.js
index 2d8ac60e027992b880c753bbcfa195c0b3908980..6fda65b1082d8ee11885cfb65fd17942fe5b5e53 100644
--- a/Source/devtools/front_end/sdk/ResourceTreeModel.js
+++ b/Source/devtools/front_end/sdk/ResourceTreeModel.js
@@ -53,6 +53,8 @@ WebInspector.ResourceTreeModel = function(target)
this._pendingConsoleMessages = {};
this._securityOriginFrameCount = {};
this._inspectedPageURL = "";
+ this._pendingReloadOptions = null;
+ this._reloadSuspensionCount = 0;
}
WebInspector.ResourceTreeModel.EventTypes = {
@@ -497,12 +499,30 @@ WebInspector.ResourceTreeModel.prototype = {
return new WebInspector.Resource(this.target(), null, url, frame.url, frame.id, frame.loaderId, type, mimeType);
},
+ suspendReload: function()
+ {
+ this._reloadSuspensionCount++;
+ },
+
+ resumeReload: function()
+ {
+ this._reloadSuspensionCount--;
+ console.assert(this._reloadSuspensionCount >= 0, "Unbalanced call to ResourceTreeModel.resumeReload()");
+ if (!this._reloadSuspensionCount && this._pendingReloadOptions)
+ this.reloadPage.apply(this, this._pendingReloadOptions);
+ },
+
/**
* @param {boolean=} ignoreCache
* @param {string=} scriptToEvaluateOnLoad
*/
reloadPage: function(ignoreCache, scriptToEvaluateOnLoad)
{
+ if (this._reloadSuspensionCount) {
+ this._pendingReloadOptions = [ignoreCache, scriptToEvaluateOnLoad];
+ return;
+ }
+ this._pendingReloadOptions = null;
this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage);
this._agent.reload(ignoreCache, scriptToEvaluateOnLoad);
},
« no previous file with comments | « Source/devtools/front_end/network/NetworkPanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698