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

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

Issue 228863002: DevTools: remove setScriptFile from UISourceCode. (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
Index: Source/devtools/front_end/LiveEditSupport.js
diff --git a/Source/devtools/front_end/LiveEditSupport.js b/Source/devtools/front_end/LiveEditSupport.js
index 2a7ffab2235b62c91af150225bc3c0ae3b528e48..2e271b35b6b46b81f0960637169b6a4cab0325d6 100644
--- a/Source/devtools/front_end/LiveEditSupport.js
+++ b/Source/devtools/front_end/LiveEditSupport.js
@@ -59,8 +59,8 @@ WebInspector.LiveEditSupport.prototype = {
console.assert(!script.isInlineScript());
var liveEditUISourceCode = this._workspaceProvider.addUniqueFileForURL(script.sourceURL, script, true, script.isContentScript);
+ liveEditUISourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
- liveEditUISourceCode.setScriptFile(new WebInspector.LiveEditScriptFile(uiSourceCode, liveEditUISourceCode, script.scriptId));
this._uiSourceCodeForScriptId[script.scriptId] = liveEditUISourceCode;
this._scriptIdForUISourceCode.put(liveEditUISourceCode, script.scriptId);
return liveEditUISourceCode;
@@ -74,6 +74,30 @@ WebInspector.LiveEditSupport.prototype = {
this._scriptIdForUISourceCode = new Map();
this._workspaceProvider.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();
+ }
+ }
}
/**
@@ -104,75 +128,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 | « no previous file | Source/devtools/front_end/ResourceScriptMapping.js » ('j') | Source/devtools/front_end/ResourceScriptMapping.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698