Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 WebInspector.TimelineProfileTree = { }; | 5 WebInspector.TimelineProfileTree = { }; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @constructor | 8 * @constructor |
| 9 */ | 9 */ |
| 10 WebInspector.TimelineProfileTree.Node = function() | 10 WebInspector.TimelineProfileTree.Node = function() |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 this._categoryMapper = categoryMapper; | 225 this._categoryMapper = categoryMapper; |
| 226 /** @type {!Map<string, !WebInspector.TimelineProfileTree.Node>} */ | 226 /** @type {!Map<string, !WebInspector.TimelineProfileTree.Node>} */ |
| 227 this._groupNodes = new Map(); | 227 this._groupNodes = new Map(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 /** | 230 /** |
| 231 * @enum {string} | 231 * @enum {string} |
| 232 */ | 232 */ |
| 233 WebInspector.TimelineAggregator.GroupBy = { | 233 WebInspector.TimelineAggregator.GroupBy = { |
| 234 None: "None", | 234 None: "None", |
| 235 EventName: "EventName", | |
| 235 Category: "Category", | 236 Category: "Category", |
| 236 Domain: "Domain", | 237 Domain: "Domain", |
| 237 Subdomain: "Subdomain", | 238 Subdomain: "Subdomain", |
| 238 URL: "URL" | 239 URL: "URL" |
| 239 } | 240 } |
| 240 | 241 |
| 241 /** | 242 /** |
| 242 * @param {!WebInspector.TracingModel.Event} event | 243 * @param {!WebInspector.TracingModel.Event} event |
| 243 * @return {string} | 244 * @return {string} |
| 244 */ | 245 */ |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 if (!groupSubdomains) | 330 if (!groupSubdomains) |
| 330 return parsedURL.host; | 331 return parsedURL.host; |
| 331 if (/^[.0-9]+$/.test(parsedURL.host)) | 332 if (/^[.0-9]+$/.test(parsedURL.host)) |
| 332 return parsedURL.host; | 333 return parsedURL.host; |
| 333 var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host); | 334 var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host); |
| 334 return domainMatch && domainMatch[0] || ""; | 335 return domainMatch && domainMatch[0] || ""; |
| 335 } | 336 } |
| 336 | 337 |
| 337 switch (groupBy) { | 338 switch (groupBy) { |
| 338 case WebInspector.TimelineAggregator.GroupBy.None: return null; | 339 case WebInspector.TimelineAggregator.GroupBy.None: return null; |
| 340 case WebInspector.TimelineAggregator.GroupBy.EventName: return node => n ode.event.name; | |
|
alph
2016/05/26 07:23:20
Can event be null? There's a check on the next lin
| |
| 339 case WebInspector.TimelineAggregator.GroupBy.Category: return node => no de.event ? this._categoryMapper(node.event) : ""; | 341 case WebInspector.TimelineAggregator.GroupBy.Category: return node => no de.event ? this._categoryMapper(node.event) : ""; |
| 340 case WebInspector.TimelineAggregator.GroupBy.Subdomain: return groupByDo main.bind(null, false); | 342 case WebInspector.TimelineAggregator.GroupBy.Subdomain: return groupByDo main.bind(null, false); |
| 341 case WebInspector.TimelineAggregator.GroupBy.Domain: return groupByDomai n.bind(null, true); | 343 case WebInspector.TimelineAggregator.GroupBy.Domain: return groupByDomai n.bind(null, true); |
| 342 case WebInspector.TimelineAggregator.GroupBy.URL: return groupByURL; | 344 case WebInspector.TimelineAggregator.GroupBy.URL: return groupByURL; |
| 343 default: return null; | 345 default: return null; |
| 344 } | 346 } |
| 345 }, | 347 }, |
| 346 | 348 |
| 347 /** | 349 /** |
| 348 * @param {string} id | 350 * @param {string} id |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 366 * @param {function(!WebInspector.TimelineProfileTree.Node):string} nodeToGr oupId | 368 * @param {function(!WebInspector.TimelineProfileTree.Node):string} nodeToGr oupId |
| 367 * @param {!WebInspector.TimelineProfileTree.Node} node | 369 * @param {!WebInspector.TimelineProfileTree.Node} node |
| 368 * @return {!WebInspector.TimelineProfileTree.Node} | 370 * @return {!WebInspector.TimelineProfileTree.Node} |
| 369 */ | 371 */ |
| 370 _nodeToGroupNode: function(nodeToGroupId, node) | 372 _nodeToGroupNode: function(nodeToGroupId, node) |
| 371 { | 373 { |
| 372 var id = nodeToGroupId(node); | 374 var id = nodeToGroupId(node); |
| 373 return this._groupNodes.get(id) || this._buildGroupNode(id, node.event); | 375 return this._groupNodes.get(id) || this._buildGroupNode(id, node.event); |
| 374 }, | 376 }, |
| 375 } | 377 } |
| OLD | NEW |