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

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..a5e8d100de3f8cb2f615a9eac4d4d1a00bdca5db 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
@@ -9,10 +9,13 @@ NetworkGroupLookup.NetworkProductGroupLookup = class {
/**
* @override
* @param {!SDK.NetworkRequest} request
- * @return {?string}
+ * @return {?Network.NetworkGroupLookupInterface.LookupKeyNameTuple}
*/
- lookup(request) {
- return ProductRegistry.nameForUrl(request.parsedURL);
+ lookupNameForRequest(request) {
pfeldman 2017/03/30 23:45:51 Split this interface into two methods: lookupGrou
allada 2017/03/31 00:17:42 Done.
+ var productName = ProductRegistry.nameForUrl(request.parsedURL);
+ if (!productName)
+ return null;
+ return [productName, productName];
}
/**
@@ -21,7 +24,7 @@ NetworkGroupLookup.NetworkProductGroupLookup = class {
* @return {string}
*/
lookupColumnValue(request) {
- return this.lookup(request) || '';
+ return ProductRegistry.nameForUrl(request.parsedURL) || '';
}
/**
@@ -38,3 +41,46 @@ NetworkGroupLookup.NetworkProductGroupLookup = class {
return aValue > bValue ? 1 : -1;
}
};
+
+/**
+ * @implements {Network.NetworkGroupLookupInterface}
+ */
+NetworkGroupLookup.NetworkProductFrameGroupLookup = class {
+ /**
+ * @override
+ * @param {!SDK.NetworkRequest} request
+ * @return {?Network.NetworkGroupLookupInterface.LookupKeyNameTuple}
+ */
+ lookupNameForRequest(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 [request.frameId, this._lookupNameForFrame(frame)];
+ }
+
+ /**
+ * @param {!SDK.ResourceTreeFrame} frame
+ * @return {string}
+ */
+ _lookupNameForFrame(frame) {
+ var name;
+ var frameParsedURL = new Common.ParsedURL(frame.url);
pfeldman 2017/03/30 23:45:50 Otherwise you parse too much.
allada 2017/03/31 00:17:42 Done.
+ if (frame.url)
+ name = ProductRegistry.nameForUrl(frameParsedURL);
+ if (name)
+ return name;
+ var creationStackTrace = frame.creationStackTrace();
+ if (creationStackTrace) {
+ for (var stack of creationStackTrace) {
pfeldman 2017/03/30 23:45:50 Traverse async.
allada 2017/03/31 00:17:42 Done.
+ if (stack.url)
+ name = ProductRegistry.nameForUrl(new Common.ParsedURL(stack.url));
+ if (name)
+ return name;
+ }
+ }
+ return frameParsedURL.host || frame.name || '<iframe>';
+ }
+};

Powered by Google App Engine
This is Rietveld 408576698