Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 | 560 |
| 561 /** | 561 /** |
| 562 * @param {!SDK.TracingModel.Event} event | 562 * @param {!SDK.TracingModel.Event} event |
| 563 * @return {boolean} | 563 * @return {boolean} |
| 564 */ | 564 */ |
| 565 _processEvent(event) { | 565 _processEvent(event) { |
| 566 var recordTypes = TimelineModel.TimelineModel.RecordType; | 566 var recordTypes = TimelineModel.TimelineModel.RecordType; |
| 567 var eventStack = this._eventStack; | 567 var eventStack = this._eventStack; |
| 568 | 568 if (eventStack.length) { |
| 569 if (!eventStack.length) { | 569 event[TimelineModel.TimelineModel._parentSymbol] = eventStack.peekLast(); |
|
caseq
2017/03/29 22:08:20
should we stop pretending and do this in TracingMo
alph
2017/03/29 22:16:57
Can't do it on the TracingModel level, as we have
| |
| 570 } else { | |
| 570 if (this._currentTaskLayoutAndRecalcEvents && this._currentTaskLayoutAndRe calcEvents.length) { | 571 if (this._currentTaskLayoutAndRecalcEvents && this._currentTaskLayoutAndRe calcEvents.length) { |
| 571 var totalTime = this._currentTaskLayoutAndRecalcEvents.reduce((time, eve nt) => time + event.duration, 0); | 572 var totalTime = this._currentTaskLayoutAndRecalcEvents.reduce((time, eve nt) => time + event.duration, 0); |
| 572 if (totalTime > TimelineModel.TimelineModel.Thresholds.ForcedLayout) { | 573 if (totalTime > TimelineModel.TimelineModel.Thresholds.ForcedLayout) { |
| 573 for (var e of this._currentTaskLayoutAndRecalcEvents) { | 574 for (var e of this._currentTaskLayoutAndRecalcEvents) { |
| 574 let timelineData = TimelineModel.TimelineData.forEvent(e); | 575 let timelineData = TimelineModel.TimelineData.forEvent(e); |
| 575 timelineData.warning = e.name === recordTypes.Layout ? | 576 timelineData.warning = e.name === recordTypes.Layout ? |
| 576 TimelineModel.TimelineModel.WarningType.ForcedLayout : | 577 TimelineModel.TimelineModel.WarningType.ForcedLayout : |
| 577 TimelineModel.TimelineModel.WarningType.ForcedStyle; | 578 TimelineModel.TimelineModel.WarningType.ForcedStyle; |
| 578 } | 579 } |
| 579 } | 580 } |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 request = new TimelineModel.TimelineModel.NetworkRequest(e); | 1025 request = new TimelineModel.TimelineModel.NetworkRequest(e); |
| 1025 requests.set(id, request); | 1026 requests.set(id, request); |
| 1026 if (request.startTime) | 1027 if (request.startTime) |
| 1027 requestsList.push(request); | 1028 requestsList.push(request); |
| 1028 else | 1029 else |
| 1029 zeroStartRequestsList.push(request); | 1030 zeroStartRequestsList.push(request); |
| 1030 } | 1031 } |
| 1031 } | 1032 } |
| 1032 return zeroStartRequestsList.concat(requestsList); | 1033 return zeroStartRequestsList.concat(requestsList); |
| 1033 } | 1034 } |
| 1035 | |
| 1036 /** | |
| 1037 * @param {!SDK.TracingModel.Event} event | |
| 1038 * @return {?SDK.TracingModel.Event} | |
| 1039 */ | |
| 1040 static parentEvent(event) { | |
| 1041 return event[TimelineModel.TimelineModel._parentSymbol] || null; | |
| 1042 } | |
| 1034 }; | 1043 }; |
| 1035 | 1044 |
| 1045 TimelineModel.TimelineModel._parentSymbol = Symbol('parent'); | |
| 1046 | |
| 1036 /** | 1047 /** |
| 1037 * @enum {string} | 1048 * @enum {string} |
| 1038 */ | 1049 */ |
| 1039 TimelineModel.TimelineModel.RecordType = { | 1050 TimelineModel.TimelineModel.RecordType = { |
| 1040 Task: 'Task', | 1051 Task: 'Task', |
| 1041 Program: 'Program', | 1052 Program: 'Program', |
| 1042 EventDispatch: 'EventDispatch', | 1053 EventDispatch: 'EventDispatch', |
| 1043 | 1054 |
| 1044 GPUTask: 'GPUTask', | 1055 GPUTask: 'GPUTask', |
| 1045 | 1056 |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1804 var data = event[TimelineModel.TimelineData._symbol]; | 1815 var data = event[TimelineModel.TimelineData._symbol]; |
| 1805 if (!data) { | 1816 if (!data) { |
| 1806 data = new TimelineModel.TimelineData(); | 1817 data = new TimelineModel.TimelineData(); |
| 1807 event[TimelineModel.TimelineData._symbol] = data; | 1818 event[TimelineModel.TimelineData._symbol] = data; |
| 1808 } | 1819 } |
| 1809 return data; | 1820 return data; |
| 1810 } | 1821 } |
| 1811 }; | 1822 }; |
| 1812 | 1823 |
| 1813 TimelineModel.TimelineData._symbol = Symbol('timelineData'); | 1824 TimelineModel.TimelineData._symbol = Symbol('timelineData'); |
| OLD | NEW |