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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineTreeView.js

Issue 1296453003: DevTools: [timeline tree view] expose human-readable names for chrome extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 * @param {!WebInspector.TimelineModel} model 8 * @param {!WebInspector.TimelineModel} model
9 */ 9 */
10 WebInspector.TimelineTreeView = function(model) 10 WebInspector.TimelineTreeView = function(model)
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 /** 176 /**
177 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node 177 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
178 * @return {string} 178 * @return {string}
179 */ 179 */
180 function groupByURL(node) 180 function groupByURL(node)
181 { 181 {
182 return WebInspector.TimelineTreeView.eventURL(node.event) || ""; 182 return WebInspector.TimelineTreeView.eventURL(node.event) || "";
183 } 183 }
184 184
185 /** 185 /**
186 * @param {boolean} groupSubdomains
186 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node 187 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
187 * @return {string} 188 * @return {string}
188 */ 189 */
189 function groupByDomain(node) 190 function groupByDomain(groupSubdomains, node)
190 {
191 var parsedURL = (WebInspector.TimelineTreeView.eventURL(node.event) || "").asParsedURL();
192 return parsedURL && parsedURL.host || "";
193 }
194
195 /**
196 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
197 * @return {string}
198 */
199 function groupByDomainSecondLevel(node)
200 { 191 {
201 var parsedURL = (WebInspector.TimelineTreeView.eventURL(node.event) || "").asParsedURL(); 192 var parsedURL = (WebInspector.TimelineTreeView.eventURL(node.event) || "").asParsedURL();
202 if (!parsedURL) 193 if (!parsedURL)
203 return ""; 194 return "";
195 if (parsedURL.scheme === "chrome-extension") {
196 var url = parsedURL.scheme + "://" + parsedURL.host;
197 var displayName = executionContextNamesByOrigin.get(url);
198 return displayName ? WebInspector.UIString("Chrome Extension: %s ", displayName) : url;
199 }
200 if (!groupSubdomains)
201 return parsedURL.host;
204 if (/^[.0-9]+$/.test(parsedURL.host)) 202 if (/^[.0-9]+$/.test(parsedURL.host))
205 return parsedURL.host; 203 return parsedURL.host;
206 var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host); 204 var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host);
207 return domainMatch && domainMatch[0] || ""; 205 return domainMatch && domainMatch[0] || "";
208 } 206 }
209 207
208 var executionContextNamesByOrigin = new Map();
209 var mainTarget = WebInspector.targetManager.mainTarget();
210 if (mainTarget) {
211 for (var context of mainTarget.runtimeModel.executionContexts())
212 executionContextNamesByOrigin.set(context.origin, context.name);
213 }
210 var groupByMap = /** @type {!Map<!WebInspector.TimelineTreeView.GroupBy, ?function(!WebInspector.TimelineModel.ProfileTreeNode):string>} */ (new Map([ 214 var groupByMap = /** @type {!Map<!WebInspector.TimelineTreeView.GroupBy, ?function(!WebInspector.TimelineModel.ProfileTreeNode):string>} */ (new Map([
211 [WebInspector.TimelineTreeView.GroupBy.None, null], 215 [WebInspector.TimelineTreeView.GroupBy.None, null],
212 [WebInspector.TimelineTreeView.GroupBy.Domain, groupByDomain], 216 [WebInspector.TimelineTreeView.GroupBy.Domain, groupByDomain.bind(nu ll, false)],
213 [WebInspector.TimelineTreeView.GroupBy.DomainSecondLevel, groupByDom ainSecondLevel], 217 [WebInspector.TimelineTreeView.GroupBy.DomainSecondLevel, groupByDom ain.bind(null, true)],
214 [WebInspector.TimelineTreeView.GroupBy.URL, groupByURL] 218 [WebInspector.TimelineTreeView.GroupBy.URL, groupByURL]
215 ])); 219 ]));
216 return groupByMap.get(this._groupBySetting.get()) || null; 220 return groupByMap.get(this._groupBySetting.get()) || null;
217 }, 221 },
218 222
219 /** 223 /**
220 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):string} nod eToGroupId 224 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):string} nod eToGroupId
221 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node 225 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
222 * @return {!WebInspector.TimelineModel.ProfileTreeNode} 226 * @return {!WebInspector.TimelineModel.ProfileTreeNode}
223 */ 227 */
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if (!this._profileNode.children) 414 if (!this._profileNode.children)
411 return; 415 return;
412 for (var node of this._profileNode.children.values()) { 416 for (var node of this._profileNode.children.values()) {
413 var gridNode = new WebInspector.TimelineTreeView.GridNode(node, this ._totalTime, this._maxTimes.self, this._maxTimes.total); 417 var gridNode = new WebInspector.TimelineTreeView.GridNode(node, this ._totalTime, this._maxTimes.self, this._maxTimes.total);
414 this.insertChildOrdered(gridNode); 418 this.insertChildOrdered(gridNode);
415 } 419 }
416 }, 420 },
417 421
418 __proto__: WebInspector.SortableDataGridNode.prototype 422 __proto__: WebInspector.SortableDataGridNode.prototype
419 } 423 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698