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

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

Issue 1293273002: DevTools: Use better event titles on timeline tree view. (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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 parent.children = /** @type {!Map<string,!WebInspector.TimelineModel .ProfileTreeNode>} */ (new Map()); 1504 parent.children = /** @type {!Map<string,!WebInspector.TimelineModel .ProfileTreeNode>} */ (new Map());
1505 var node = parent.children.get(id); 1505 var node = parent.children.get(id);
1506 if (node) { 1506 if (node) {
1507 node.selfTime += time; 1507 node.selfTime += time;
1508 node.totalTime += time; 1508 node.totalTime += time;
1509 } else { 1509 } else {
1510 node = new WebInspector.TimelineModel.ProfileTreeNode(); 1510 node = new WebInspector.TimelineModel.ProfileTreeNode();
1511 node.totalTime = time; 1511 node.totalTime = time;
1512 node.selfTime = time; 1512 node.selfTime = time;
1513 node.parent = parent; 1513 node.parent = parent;
1514 node.name = eventName(e);
1515 node.id = id; 1514 node.id = id;
1516 node.event = e; 1515 node.event = e;
1517 parent.children.set(id, node); 1516 parent.children.set(id, node);
1518 } 1517 }
1519 parent.selfTime -= time; 1518 parent.selfTime -= time;
1520 if (parent.selfTime < 0) { 1519 if (parent.selfTime < 0) {
1521 console.log("Error: Negative self of " + parent.selfTime, e); 1520 console.log("Error: Negative self of " + parent.selfTime, e);
1522 parent.selfTime = 0; 1521 parent.selfTime = 0;
1523 } 1522 }
1524 parent = node; 1523 parent = node;
1525 } 1524 }
1526 1525
1527 /** 1526 /**
1528 * @param {!WebInspector.TracingModel.Event} e 1527 * @param {!WebInspector.TracingModel.Event} e
1529 */ 1528 */
1530 function onEndEvent(e) 1529 function onEndEvent(e)
1531 { 1530 {
1532 if (!filter(e)) 1531 if (!filter(e))
1533 return; 1532 return;
1534 parent = parent.parent; 1533 parent = parent.parent;
1535 } 1534 }
1536 1535
1537 /**
1538 * @param {!WebInspector.TracingModel.Event} e
1539 * @return {string}
1540 */
1541 function eventName(e)
1542 {
1543 if (e.name === "JSFrame")
1544 return WebInspector.beautifyFunctionName(e.args.data.functionName);
1545 if (e.name === "EventDispatch")
1546 return WebInspector.UIString("Event%s", e.args.data ? " (" + e.args. data.type + ")" : "");
1547 return e.name;
1548 }
1549
1550 WebInspector.TimelineModel.forEachEvent(events, onStartEvent, onEndEvent); 1536 WebInspector.TimelineModel.forEachEvent(events, onStartEvent, onEndEvent);
1551 root.totalTime -= root.selfTime; 1537 root.totalTime -= root.selfTime;
1552 root.selfTime = 0; 1538 root.selfTime = 0;
1553 return root; 1539 return root;
1554 } 1540 }
1555 1541
1556 /** 1542 /**
1557 * @param {!WebInspector.TimelineModel.ProfileTreeNode} topDownTree 1543 * @param {!WebInspector.TimelineModel.ProfileTreeNode} topDownTree
1558 * @param {?function(!WebInspector.TimelineModel.ProfileTreeNode):!WebInspector. TimelineModel.ProfileTreeNode=} groupingCallback 1544 * @param {?function(!WebInspector.TimelineModel.ProfileTreeNode):!WebInspector. TimelineModel.ProfileTreeNode=} groupingCallback
1559 * @return {!WebInspector.TimelineModel.ProfileTreeNode} 1545 * @return {!WebInspector.TimelineModel.ProfileTreeNode}
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 2349 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
2364 this._invalidations = {}; 2350 this._invalidations = {};
2365 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 2351 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
2366 this._invalidationsByNodeId = {}; 2352 this._invalidationsByNodeId = {};
2367 2353
2368 this._lastRecalcStyle = undefined; 2354 this._lastRecalcStyle = undefined;
2369 this._lastPaintWithLayer = undefined; 2355 this._lastPaintWithLayer = undefined;
2370 this._didPaint = false; 2356 this._didPaint = false;
2371 } 2357 }
2372 } 2358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698