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

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

Issue 2349343002: DevTools: introduce persistence/ module (Closed)
Patch Set: DevTools: add persistence/ module Created 4 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
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 b8facd4b5b7118af9344a8c1028195e3b89c1bc6..c6ddae8cd4a6b72ff2bfc1e65d87e64c14382963 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js
@@ -56,7 +56,6 @@ WebInspector.UISourceCode = function(project, url, contentType)
/** @type {!Array.<!WebInspector.Revision>} */
this.history = [];
- this._hasUnsavedCommittedChanges = false;
/** @type {!Array<!WebInspector.UISourceCode.Message>} */
this._messages = [];
@@ -292,7 +291,7 @@ WebInspector.UISourceCode.prototype = {
{
if (updatedContent === null) {
var workingCopy = this.workingCopy();
- this._contentCommitted("", true, false);
+ this._contentCommitted("", false);
this.setWorkingCopy(workingCopy);
this._terminateContentCheck();
return;
@@ -309,14 +308,14 @@ WebInspector.UISourceCode.prototype = {
}
if (!this.isDirty() || this._workingCopy === updatedContent) {
- this._contentCommitted(updatedContent, true, false);
+ this._contentCommitted(updatedContent, false);
this._terminateContentCheck();
return;
}
var shouldUpdate = window.confirm(WebInspector.UIString("This file was changed externally. Would you like to reload it?"));
if (shouldUpdate)
- this._contentCommitted(updatedContent, true, false);
+ this._contentCommitted(updatedContent, false);
else
this._lastAcceptedContent = updatedContent;
this._terminateContentCheck();
@@ -344,26 +343,20 @@ WebInspector.UISourceCode.prototype = {
*/
_commitContent: function(content)
{
- var wasPersisted = false;
if (this._project.canSetFileContent()) {
this._project.setFileContent(this, content, function() { });
- wasPersisted = true;
- } else if (this._project.workspace().hasResourceContentTrackingExtensions()) {
- wasPersisted = true;
} else if (this._url && WebInspector.fileManager.isURLSaved(this._url)) {
WebInspector.fileManager.save(this._url, content, false, function() { });
WebInspector.fileManager.close(this._url);
- wasPersisted = true;
}
- this._contentCommitted(content, wasPersisted, true);
+ this._contentCommitted(content, true);
},
/**
* @param {string} content
- * @param {boolean} wasPersisted
* @param {boolean} committedByUser
*/
- _contentCommitted: function(content, wasPersisted, committedByUser)
+ _contentCommitted: function(content, committedByUser)
{
delete this._lastAcceptedContent;
this._content = content;
@@ -376,8 +369,7 @@ WebInspector.UISourceCode.prototype = {
}
this._innerResetWorkingCopy();
- this._hasUnsavedCommittedChanges = !wasPersisted;
- this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted);
+ this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, { content: content });
this._project.workspace().dispatchEventToListeners(WebInspector.Workspace.Events.WorkingCopyCommitted, { uiSourceCode: this, content: content });
if (committedByUser)
this._project.workspace().dispatchEventToListeners(WebInspector.Workspace.Events.WorkingCopyCommittedByUser, { uiSourceCode: this, content: content });
@@ -395,19 +387,11 @@ WebInspector.UISourceCode.prototype = {
function callback(accepted)
{
if (accepted)
- this._contentCommitted(this.workingCopy(), true, true);
+ this._contentCommitted(this.workingCopy(), true);
}
},
/**
- * @return {boolean}
- */
- hasUnsavedCommittedChanges: function()
- {
- return this._hasUnsavedCommittedChanges;
- },
-
- /**
* @param {string} content
*/
addRevision: function(content)

Powered by Google App Engine
This is Rietveld 408576698