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

Unified Diff: third_party/WebKit/Source/devtools/front_end/network_group_lookup/NetworkProductGroupLookup.js

Issue 2788793002: [Devtools] Added frame grouping to network panel (Closed)
Patch Set: [Devtools] Added frame grouping to network panel 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/network_group_lookup/NetworkProductGroupLookup.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network_group_lookup/NetworkProductGroupLookup.js b/third_party/WebKit/Source/devtools/front_end/network_group_lookup/NetworkProductGroupLookup.js
index c264d77c74023341d17753232b8edb1a0b8a1563..cc6ba991a18d7d7851e3236269e6dd29a3d71e39 100644
--- a/third_party/WebKit/Source/devtools/front_end/network_group_lookup/NetworkProductGroupLookup.js
+++ b/third_party/WebKit/Source/devtools/front_end/network_group_lookup/NetworkProductGroupLookup.js
@@ -11,8 +11,20 @@ NetworkGroupLookup.NetworkProductGroupLookup = class {
* @param {!SDK.NetworkRequest} request
* @return {?string}
*/
- lookup(request) {
- return ProductRegistry.nameForUrl(request.parsedURL);
+ groupKeyForRequest(request) {
+ var productName = ProductRegistry.nameForUrl(request.parsedURL);
+ if (!productName)
+ return null;
+ return productName;
+ }
+
+ /**
+ * @override
+ * @param {string} key
+ * @return {string}
+ */
+ groupNameForKey(key) {
+ return key;
pfeldman 2017/03/31 00:55:06 And here you would need to cast it, which is fine.
allada 2017/04/03 17:40:52 Done.
}
/**
@@ -21,7 +33,7 @@ NetworkGroupLookup.NetworkProductGroupLookup = class {
* @return {string}
*/
lookupColumnValue(request) {
- return this.lookup(request) || '';
+ return ProductRegistry.nameForUrl(request.parsedURL) || '';
}
/**
@@ -38,3 +50,48 @@ NetworkGroupLookup.NetworkProductGroupLookup = class {
return aValue > bValue ? 1 : -1;
}
};
+
+/**
+ * @implements {Network.NetworkGroupLookupInterface}
+ */
+NetworkGroupLookup.NetworkProductFrameGroupLookup = class {
pfeldman 2017/03/31 00:55:06 It seems like closure gave up altogether compiling
allada 2017/04/03 17:40:52 Done.
+ /**
+ * @override
+ * @param {!SDK.NetworkRequest} request
+ * @return {?SDK.ResourceTreeFrame}
+ */
+ groupKeyForRequest(request) {
+ var resourceTreeModel = request.target().model(SDK.ResourceTreeModel);
+ if (!resourceTreeModel)
+ return null;
+ var frame = resourceTreeModel.frameForId(request.frameId);
+ if (!frame || frame.isMainFrame())
+ return null;
+ return frame;
+ }
+
+ /**
+ * @override
+ * @param {!SDK.ResourceTreeFrame} frame
+ * @return {string}
+ */
+ groupNameForKey(frame) {
+ var name;
+ var frameParsedURL = new Common.ParsedURL(frame.url);
+ if (frame.url)
+ name = ProductRegistry.nameForUrl(frameParsedURL);
+ if (name)
+ return name;
+ var stackTrace = frame.creationStackTrace();
+ while (stackTrace) {
+ for (var stack of stackTrace.callFrames) {
+ if (stack.url)
+ name = ProductRegistry.nameForUrl(new Common.ParsedURL(stack.url));
pfeldman 2017/03/31 00:55:06 This is going to be expensive at some point. 1000
allada 2017/04/03 17:40:52 Done.
+ if (name)
+ return name;
+ }
+ stackTrace = frame.parent;
+ }
+ return frameParsedURL.host || frame.name || '<iframe>';
+ }
+};

Powered by Google App Engine
This is Rietveld 408576698