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

Unified Diff: Source/devtools/front_end/LiveEditSupport.js

Issue 235893006: DevTools: Remove LiveEditSupport.ScriptFile as it is not really needed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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/DebuggerModel.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/LiveEditSupport.js
diff --git a/Source/devtools/front_end/LiveEditSupport.js b/Source/devtools/front_end/LiveEditSupport.js
index e742600017697a3fdd97fb377716111e91632e1e..465d64e1d30a6192540a7382ae6379d851003b63 100644
--- a/Source/devtools/front_end/LiveEditSupport.js
+++ b/Source/devtools/front_end/LiveEditSupport.js
@@ -63,7 +63,7 @@ WebInspector.LiveEditSupport.prototype = {
var path = this._projectDelegate.addScript(script, true);
var liveEditUISourceCode = this._workspace.uiSourceCode(this._projectId, path);
- liveEditUISourceCode.setScriptFile(new WebInspector.LiveEditScriptFile(uiSourceCode, liveEditUISourceCode, script.scriptId));
+ liveEditUISourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
this._uiSourceCodeForScriptId[script.scriptId] = liveEditUISourceCode;
this._scriptIdForUISourceCode.put(liveEditUISourceCode, script.scriptId);
return liveEditUISourceCode;
@@ -77,6 +77,30 @@ WebInspector.LiveEditSupport.prototype = {
this._scriptIdForUISourceCode = new Map();
this._projectDelegate.reset();
},
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _workingCopyCommitted: function(event)
+ {
+ var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.target);
+ var scriptId = /** @type {string} */ (this._scriptIdForUISourceCode.get(uiSourceCode));
+ WebInspector.debuggerModel.setScriptSource(scriptId, uiSourceCode.workingCopy(), innerCallback);
+
+ /**
+ * @param {?string} error
+ * @param {!DebuggerAgent.SetScriptSourceError=} errorData
+ */
+ function innerCallback(error, errorData)
+ {
+ if (error) {
+ var script = WebInspector.debuggerModel.scriptForId(scriptId);
+ WebInspector.LiveEditSupport.logDetailedError(error, errorData, script);
+ return;
+ }
+ WebInspector.LiveEditSupport.logSuccess();
+ }
+ }
}
/**
@@ -107,75 +131,5 @@ WebInspector.LiveEditSupport.logSuccess = function()
WebInspector.console.log(WebInspector.UIString("Recompilation and update succeeded."), WebInspector.ConsoleMessage.MessageLevel.Debug, false);
}
-/**
- * @constructor
- * @implements {WebInspector.ScriptFile}
- * @extends {WebInspector.Object}
- * @param {!WebInspector.UISourceCode} uiSourceCode
- * @param {!WebInspector.UISourceCode} liveEditUISourceCode
- * @param {string} scriptId
- */
-WebInspector.LiveEditScriptFile = function(uiSourceCode, liveEditUISourceCode, scriptId)
-{
- WebInspector.ScriptFile.call(this);
- this._uiSourceCode = uiSourceCode;
- this._liveEditUISourceCode = liveEditUISourceCode;
- this._scriptId = scriptId;
- this._liveEditUISourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
-}
-
-WebInspector.LiveEditScriptFile.prototype = {
- _workingCopyCommitted: function(event)
- {
- /**
- * @param {?string} error
- * @param {!DebuggerAgent.SetScriptSourceError=} errorData
- * @this {WebInspector.LiveEditScriptFile}
- */
- function innerCallback(error, errorData)
- {
- if (error) {
- var script = WebInspector.debuggerModel.scriptForId(this._scriptId);
- WebInspector.LiveEditSupport.logDetailedError(error, errorData, script);
- return;
- }
- WebInspector.LiveEditSupport.logSuccess();
- }
-
- var script = WebInspector.debuggerModel.scriptForId(this._scriptId);
- WebInspector.debuggerModel.setScriptSource(script.scriptId, this._liveEditUISourceCode.workingCopy(), innerCallback.bind(this));
- },
-
- /**
- * @return {boolean}
- */
- hasDivergedFromVM: function()
- {
- return true;
- },
-
- /**
- * @return {boolean}
- */
- isDivergingFromVM: function()
- {
- return false;
- },
-
- /**
- * @return {boolean}
- */
- isMergingToVM: function()
- {
- return false;
- },
-
- checkMapping: function()
- {
- },
-
- __proto__: WebInspector.Object.prototype
-}
-
/** @type {!WebInspector.LiveEditSupport} */
WebInspector.liveEditSupport;
« no previous file with comments | « Source/devtools/front_end/DebuggerModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698