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

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

Issue 363343004: DevTools: Unify main thread name across vanilla and tracing timeline modes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 this._pushRecord(this._cpuThreadRecord, 0, this.minimumBoundary(), Math. max(this._model.maximumRecordTime(), this.totalTime() + this.minimumBoundary())) ; 139 this._pushRecord(this._cpuThreadRecord, 0, this.minimumBoundary(), Math. max(this._model.maximumRecordTime(), this.totalTime() + this.minimumBoundary())) ;
140 140
141 this._gpuThreadRecord = null; 141 this._gpuThreadRecord = null;
142 142
143 var records = this._model.records(); 143 var records = this._model.records();
144 for (var i = 0; i < records.length; ++i) { 144 for (var i = 0; i < records.length; ++i) {
145 var record = records[i]; 145 var record = records[i];
146 var thread = record.thread(); 146 var thread = record.thread();
147 if (thread === "gpu") 147 if (thread === "gpu")
148 continue; 148 continue;
149 if (!thread) { 149 if (thread === WebInspector.TimelineModel.MainThreadName) {
150 for (var j = 0; j < record.children().length; ++j) 150 for (var j = 0; j < record.children().length; ++j)
151 this._appendRecord(record.children()[j], 1); 151 this._appendRecord(record.children()[j], 1);
152 } else { 152 } else {
153 var visible = this._appendRecord(records[i], 1); 153 var visible = this._appendRecord(records[i], 1);
154 if (visible && !this._gpuThreadRecord) { 154 if (visible && !this._gpuThreadRecord) {
155 var gpuThreadRecordPayload = { type: WebInspector.TimelineMo del.RecordType.Program }; 155 var gpuThreadRecordPayload = { type: WebInspector.TimelineMo del.RecordType.Program };
156 this._gpuThreadRecord = new WebInspector.TimelineModel.Recor dImpl(this._model, /** @type {!TimelineAgent.TimelineEvent} */ (gpuThreadRecordP ayload), null); 156 this._gpuThreadRecord = new WebInspector.TimelineModel.Recor dImpl(this._model, /** @type {!TimelineAgent.TimelineEvent} */ (gpuThreadRecordP ayload), null);
157 this._pushRecord(this._gpuThreadRecord, 0, this.minimumBound ary(), Math.max(this._model.maximumRecordTime(), this.totalTime() + this.minimum Boundary())); 157 this._pushRecord(this._gpuThreadRecord, 0, this.minimumBound ary(), Math.max(this._model.maximumRecordTime(), this.totalTime() + this.minimum Boundary()));
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 var cpuStackDepth = Math.max(4, this._entryThreadDepths[undefined]); 162 var cpuStackDepth = Math.max(4, this._entryThreadDepths[WebInspector.Tim elineModel.MainThreadName]);
163 delete this._entryThreadDepths[undefined]; 163 delete this._entryThreadDepths[WebInspector.TimelineModel.MainThreadName ];
164 this._maxStackDepth = cpuStackDepth; 164 this._maxStackDepth = cpuStackDepth;
165 165
166 if (this._gpuThreadRecord) { 166 if (this._gpuThreadRecord) {
167 // We have multiple threads, update levels. 167 // We have multiple threads, update levels.
168 var threadBaselines = {}; 168 var threadBaselines = {};
169 var threadBaseline = cpuStackDepth + 2; 169 var threadBaseline = cpuStackDepth + 2;
170 170
171 for (var thread in this._entryThreadDepths) { 171 for (var thread in this._entryThreadDepths) {
172 threadBaselines[thread] = threadBaseline; 172 threadBaselines[thread] = threadBaseline;
173 threadBaseline += this._entryThreadDepths[thread]; 173 threadBaseline += this._entryThreadDepths[thread];
174 } 174 }
175 this._maxStackDepth = threadBaseline; 175 this._maxStackDepth = threadBaseline;
176 176
177 for (var i = 0; i < this._records.length; ++i) { 177 for (var i = 0; i < this._records.length; ++i) {
178 var record = this._records[i]; 178 var record = this._records[i];
179 var level = this._timelineData.entryLevels[i]; 179 var level = this._timelineData.entryLevels[i];
180 if (record === this._cpuThreadRecord) 180 if (record === this._cpuThreadRecord)
181 level = 0; 181 level = 0;
182 else if (record === this._gpuThreadRecord) 182 else if (record === this._gpuThreadRecord)
183 level = cpuStackDepth + 2; 183 level = cpuStackDepth + 2;
184 else if (record.thread()) 184 else if (record.thread() !== WebInspector.TimelineModel.MainThre adName)
185 level += threadBaselines[record.thread()]; 185 level += threadBaselines[record.thread()];
186 this._timelineData.entryLevels[i] = level; 186 this._timelineData.entryLevels[i] = level;
187 } 187 }
188 } 188 }
189 189
190 return this._timelineData; 190 return this._timelineData;
191 }, 191 },
192 192
193 /** 193 /**
194 * @return {number} 194 * @return {number}
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 * @param {number} entryIndex 971 * @param {number} entryIndex
972 * @return {?WebInspector.TimelineSelection} 972 * @return {?WebInspector.TimelineSelection}
973 */ 973 */
974 createSelection: function(entryIndex) { }, 974 createSelection: function(entryIndex) { },
975 /** 975 /**
976 * @param {?WebInspector.TimelineSelection} selection 976 * @param {?WebInspector.TimelineSelection} selection
977 * @return {number} 977 * @return {number}
978 */ 978 */
979 entryIndexForSelection: function(selection) { } 979 entryIndexForSelection: function(selection) { }
980 } 980 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698