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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js

Issue 2298373002: DevTools: remove indirection between CSSWorkspaceBindings and CSS mappings (Closed)
Patch Set: Created 4 years, 4 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/bindings/StylesSourceMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
index 1afbf70322426f0fa691606c913eddfc8575f640..c154a81b6b16502b793994309bf9ccc016c0fbc5 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js
@@ -45,12 +45,16 @@ WebInspector.StylesSourceMapping = function(cssModel, workspace, networkMapping)
/** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.StyleFile>} */
this._styleFiles = new Map();
- this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, this._projectRemoved, this);
- this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this);
- this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
- this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
- WebInspector.ResourceTreeModel.fromTarget(cssModel.target()).addEventListener(
- WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._unbindAllUISourceCodes, this);
+ this._eventListeners = [
+ this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, this._projectRemoved, this),
+ this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this),
+ this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this),
+ this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetAdded, this._styleSheetAdded, this),
+ this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetRemoved, this._styleSheetRemoved, this),
+ this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetChanged, this._styleSheetChanged, this),
+ WebInspector.ResourceTreeModel.fromTarget(cssModel.target()).addEventListener(
+ WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._unbindAllUISourceCodes, this)
+ ];
}
WebInspector.StylesSourceMapping.ChangeUpdateTimeoutMs = 200;
@@ -76,10 +80,11 @@ WebInspector.StylesSourceMapping.prototype = {
},
/**
- * @param {!WebInspector.CSSStyleSheetHeader} header
+ * @param {!WebInspector.Event} event
*/
- addHeader: function(header)
+ _styleSheetAdded: function(event)
{
+ var header = /** @type {!WebInspector.CSSStyleSheetHeader} */(event.data);
var url = header.resourceURL();
if (!url)
return;
@@ -102,10 +107,11 @@ WebInspector.StylesSourceMapping.prototype = {
},
/**
- * @param {!WebInspector.CSSStyleSheetHeader} header
+ * @param {!WebInspector.Event} event
*/
- removeHeader: function(header)
+ _styleSheetRemoved: function(event)
{
+ var header = /** @type {!WebInspector.CSSStyleSheetHeader} */(event.data);
var url = header.resourceURL();
if (!url)
return;
@@ -283,6 +289,11 @@ WebInspector.StylesSourceMapping.prototype = {
if (styleFile)
styleFile.addRevision(content || "");
}
+ },
+
+ dispose: function()
+ {
+ WebInspector.EventTarget.removeEventListeners(this._eventListeners);
}
}

Powered by Google App Engine
This is Rietveld 408576698