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

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js

Issue 2567283004: DevTools: drastically simplify UISourceCode.checkContentUpdated (Closed)
Patch Set: kill stale test Created 4 years 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 | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
index 5a4b67350debc272e9e6ff0a9935a348def3f45a..eb25c7ea4f5912b98f9e80b5836fe4fec67a6cec 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -222,44 +222,11 @@ Workspace.UISourceCode = class extends Common.Object {
return promise;
}
- /**
- * @param {function()} callback
- */
- _pushCheckContentUpdatedCallback(callback) {
- if (!this._checkContentUpdatedCallbacks)
- this._checkContentUpdatedCallbacks = [];
- this._checkContentUpdatedCallbacks.push(callback);
- }
-
- _terminateContentCheck() {
- delete this._checkingContent;
- if (this._checkContentUpdatedCallbacks) {
- this._checkContentUpdatedCallbacks.forEach(function(callback) {
- callback();
- });
- delete this._checkContentUpdatedCallbacks;
- }
- }
-
- /**
- * @param {boolean=} forceLoad
- * @param {function()=} callback
- */
- checkContentUpdated(forceLoad, callback) {
- callback = callback || function() {};
- forceLoad = forceLoad || this._forceLoadOnCheckContent;
- if (!this.contentLoaded() && !forceLoad) {
- callback();
+ checkContentUpdated() {
+ if (!this._contentLoaded && !this._forceLoadOnCheckContent)
return;
- }
- if (!this._project.canSetFileContent()) {
- callback();
- return;
- }
- this._pushCheckContentUpdatedCallback(callback);
-
- if (this._checkingContent)
+ if (!this._project.canSetFileContent() || this._checkingContent)
return;
this._checkingContent = true;
@@ -270,27 +237,23 @@ Workspace.UISourceCode = class extends Common.Object {
* @this {Workspace.UISourceCode}
*/
function contentLoaded(updatedContent) {
+ this._checkingContent = false;
if (updatedContent === null) {
var workingCopy = this.workingCopy();
this._contentCommitted('', false);
this.setWorkingCopy(workingCopy);
- this._terminateContentCheck();
return;
}
- if (typeof this._lastAcceptedContent === 'string' && this._lastAcceptedContent === updatedContent) {
- this._terminateContentCheck();
+ if (typeof this._lastAcceptedContent === 'string' && this._lastAcceptedContent === updatedContent)
return;
- }
if (this._content === updatedContent) {
delete this._lastAcceptedContent;
- this._terminateContentCheck();
return;
}
if (!this.isDirty() || this._workingCopy === updatedContent) {
this._contentCommitted(updatedContent, false);
- this._terminateContentCheck();
return;
}
@@ -300,7 +263,6 @@ Workspace.UISourceCode = class extends Common.Object {
this._contentCommitted(updatedContent, false);
else
this._lastAcceptedContent = updatedContent;
- this._terminateContentCheck();
}
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698