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

Unified Diff: third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js

Issue 2780933003: DevTools: support UISourceCode rename in automapping (Closed)
Patch Set: fix test Created 3 years, 9 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/persistence/Automapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js b/third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js
index d71391a7581569f513840c327e5afdb8fd2f3852..87c40a11d4da99d8cb2341a04f64e4f83e15347d 100644
--- a/third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js
@@ -35,6 +35,8 @@ Persistence.Automapping = class {
Workspace.Workspace.Events.UISourceCodeRemoved,
event => this._onUISourceCodeRemoved(/** @type {!Workspace.UISourceCode} */ (event.data))),
this._workspace.addEventListener(
+ Workspace.Workspace.Events.UISourceCodeRenamed, this._onUISourceCodeRenamed, this),
+ this._workspace.addEventListener(
Workspace.Workspace.Events.ProjectAdded,
event => this._onProjectAdded(/** @type {!Workspace.Project} */ (event.data)), this),
this._workspace.addEventListener(
@@ -132,6 +134,26 @@ Persistence.Automapping = class {
}
/**
+ * @param {!Common.Event} event
+ */
+ _onUISourceCodeRenamed(event) {
+ var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data.uiSourceCode);
+ var oldURL = /** @type {string} */ (event.data.oldURL);
+ if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem)
+ return;
+
+ this._filesIndex.removePath(oldURL);
+ this._fileSystemUISourceCodes.delete(oldURL);
+ var binding = uiSourceCode[Persistence.Automapping._binding];
+ if (binding)
+ this._unbindNetwork(binding.network);
+
+ this._filesIndex.addPath(uiSourceCode.url());
+ this._fileSystemUISourceCodes.set(uiSourceCode.url(), uiSourceCode);
+ this._scheduleSweep();
+ }
+
+ /**
* @param {!Workspace.UISourceCode} networkSourceCode
*/
_bindNetwork(networkSourceCode) {

Powered by Google App Engine
This is Rietveld 408576698