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

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

Issue 2869293002: DevTools: make CompilerScriptMapping / SASSSourceMapping manage UISourceCodes (Closed)
Patch Set: Created 3 years, 7 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/NetworkProject.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
index 4c288b061890f851cb9fb31f0ed52449e5611ea2..113ee056921e83f5ad2defe777e2ed284e85c2fc 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
@@ -31,12 +31,13 @@
* @implements {SDK.TargetManager.Observer}
* @unrestricted
*/
-Bindings.NetworkProjectManager = class {
+Bindings.NetworkProjectManager = class extends Common.Object {
/**
* @param {!SDK.TargetManager} targetManager
* @param {!Workspace.Workspace} workspace
*/
constructor(targetManager, workspace) {
+ super();
this._workspace = workspace;
targetManager.observeTargets(this);
}
@@ -58,6 +59,10 @@ Bindings.NetworkProjectManager = class {
}
};
+Bindings.NetworkProjectManager.Events = {
+ FrameAttributionChanged: Symbol('FrameAttributionChanged')
+};
+
/**
* @unrestricted
*/
@@ -131,8 +136,32 @@ Bindings.NetworkProject = class {
* @return {?Set<string>}
*/
static frameAttribution(uiSourceCode) {
- var frameId = uiSourceCode[Bindings.NetworkProject._frameAttributionSymbol];
- return frameId ? new Set([frameId]) : null;
+ var frameIds = uiSourceCode[Bindings.NetworkProject._frameAttributionSymbol];
+ return frameIds ? new Set(frameIds) : null;
+ }
+
+ /**
+ * @param {!Workspace.UISourceCode} uiSourceCode
+ * @param {?Set<string>} frameIds
+ */
+ static setInitialFrameAttribution(uiSourceCode, frameIds) {
+ uiSourceCode[Bindings.NetworkProject._frameAttributionSymbol] = frameIds;
+ }
+
+ /**
+ * @param {!Workspace.UISourceCode} uiSourceCode
+ * @param {?Set<string>} frameIds
+ */
+ static changeFrameAttribution(uiSourceCode, frameIds) {
+ var frameAttribution = uiSourceCode[Bindings.NetworkProject._frameAttributionSymbol];
+ if (!frameAttribution && !frameIds)
+ return;
+ if (frameAttribution && frameIds && frameIds.size === frameAttribution.size &&
+ frameAttribution.containsAll(frameIds))
+ return;
+ uiSourceCode[Bindings.NetworkProject._frameAttributionSymbol] = frameIds;
+ Bindings.networkProjectManager.dispatchEventToListeners(
+ Bindings.NetworkProjectManager.Events.FrameAttributionChanged, uiSourceCode);
}
/**
@@ -143,6 +172,14 @@ Bindings.NetworkProject = class {
return uiSourceCode.project()[Bindings.NetworkProject._targetSymbol] || null;
}
+ /**
+ * @param {!Workspace.Project} project
+ * @param {!SDK.Target} target
+ */
+ static setTargetForProject(project, target) {
+ project[Bindings.NetworkProject._targetSymbol] = target;
+ }
+
/**
* @param {!Workspace.UISourceCode} uiSourceCode
* @return {!Array<!SDK.ResourceTreeFrame>}
@@ -192,29 +229,6 @@ Bindings.NetworkProject = class {
return project;
}
- /**
- * @param {!Common.ContentProvider} contentProvider
- * @param {string} frameId
- * @param {boolean} isContentScript
- * @param {?number} contentSize
- * @return {!Workspace.UISourceCode}
- */
- addSourceMapFile(contentProvider, frameId, isContentScript, contentSize) {
- var uiSourceCode = this._createFile(contentProvider, frameId, isContentScript || false);
- var metadata = typeof contentSize === 'number' ? new Workspace.UISourceCodeMetadata(null, contentSize) : null;
- this._addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadata);
- return uiSourceCode;
- }
-
- /**
- * @param {string} url
- * @param {string} frameId
- * @param {boolean} isContentScript
- */
- removeSourceMapFile(url, frameId, isContentScript) {
- this._removeFileForURL(url, frameId, isContentScript);
- }
-
/**
* @param {string} frameId
* @param {string} url
@@ -417,7 +431,8 @@ Bindings.NetworkProject = class {
var url = contentProvider.contentURL();
var project = this._workspaceProject(frameId, isContentScript);
var uiSourceCode = project.createUISourceCode(url, contentProvider.contentType());
- uiSourceCode[Bindings.NetworkProject._frameAttributionSymbol] = frameId;
+ if (frameId)
+ Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, new Set([frameId]));
return uiSourceCode;
}

Powered by Google App Engine
This is Rietveld 408576698