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

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

Issue 2826173003: DevTools: prepare Navigator and Network Project for merging uiSourceCodes (Closed)
Patch Set: address comments Created 3 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: third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js b/third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js
index dec3afbe0bf96e1ce5ee45bb8fe9e425cd37c900..006a493f5c201934674148ef7ed4418e99d1a510 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/ResourceUtils.js
@@ -84,3 +84,28 @@ Bindings.displayNameForURL = function(url) {
var displayName = url.trimURL(parsedURL.host);
return displayName === '/' ? parsedURL.host + '/' : displayName;
};
+
+/**
+ * @param {?SDK.Resource} resource
+ * @return {?Workspace.UISourceCodeMetadata}
+ */
+Bindings.resourceMetadata = function(resource) {
+ if (!resource || (typeof resource.contentSize() !== 'number' && !resource.lastModified()))
+ return null;
+ return new Workspace.UISourceCodeMetadata(resource.lastModified(), resource.contentSize());
+};
+
+/**
+ * @param {!SDK.Script} script
+ * @return {string}
+ */
+Bindings.frameIdForScript = function(script) {
+ var executionContext = script.executionContext();
+ if (executionContext)
+ return executionContext.frameId || '';
+ // This is to overcome compilation cache which doesn't get reset.
+ var resourceTreeModel = script.debuggerModel.target().model(SDK.ResourceTreeModel);
+ if (!resourceTreeModel || !resourceTreeModel.mainFrame)
+ return '';
+ return resourceTreeModel.mainFrame.id;
+};

Powered by Google App Engine
This is Rietveld 408576698