OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return; | 379 return; |
380 | 380 |
381 var profileNode = searchResult.profileNode; | 381 var profileNode = searchResult.profileNode; |
382 profileNode.revealAndSelect(); | 382 profileNode.revealAndSelect(); |
383 }, | 383 }, |
384 | 384 |
385 _ensureFlameChartCreated: function() | 385 _ensureFlameChartCreated: function() |
386 { | 386 { |
387 if (this._flameChart) | 387 if (this._flameChart) |
388 return; | 388 return; |
389 var dataProvider = new WebInspector.CPUFlameChartDataProvider(this); | 389 this._dataProvider = new WebInspector.CPUFlameChartDataProvider(this); |
390 this._flameChart = new WebInspector.FlameChart(dataProvider); | 390 this._flameChart = new WebInspector.FlameChart(this._dataProvider); |
391 this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySe
lected, this._onEntrySelected.bind(this)); | 391 this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySe
lected, this._onEntrySelected.bind(this)); |
392 }, | 392 }, |
393 | 393 |
394 /** | 394 /** |
395 * @param {!WebInspector.Event} event | 395 * @param {!WebInspector.Event} event |
396 */ | 396 */ |
397 _onEntrySelected: function(event) | 397 _onEntrySelected: function(event) |
398 { | 398 { |
399 var node = event.data; | 399 var entryIndex = event.data; |
| 400 var node = this._dataProvider._entryNodes[entryIndex]; |
400 if (!node || !node.scriptId) | 401 if (!node || !node.scriptId) |
401 return; | 402 return; |
402 var script = WebInspector.debuggerModel.scriptForId(node.scriptId) | 403 var script = WebInspector.debuggerModel.scriptForId(node.scriptId) |
403 if (!script) | 404 if (!script) |
404 return; | 405 return; |
405 WebInspector.Revealer.reveal(script.rawLocationToUILocation(node.lineNum
ber)); | 406 WebInspector.Revealer.reveal(script.rawLocationToUILocation(node.lineNum
ber)); |
406 }, | 407 }, |
407 | 408 |
408 _changeView: function() | 409 _changeView: function() |
409 { | 410 { |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 this._font = (this.barHeight() - 4) + "px " + WebInspector.fontFamil
y(); | 1323 this._font = (this.barHeight() - 4) + "px " + WebInspector.fontFamil
y(); |
1323 this._boldFont = "bold " + this._font; | 1324 this._boldFont = "bold " + this._font; |
1324 } | 1325 } |
1325 var node = this._entryNodes[entryIndex]; | 1326 var node = this._entryNodes[entryIndex]; |
1326 var reason = node.deoptReason; | 1327 var reason = node.deoptReason; |
1327 return (reason && reason !== "no reason") ? this._boldFont : this._font; | 1328 return (reason && reason !== "no reason") ? this._boldFont : this._font; |
1328 }, | 1329 }, |
1329 | 1330 |
1330 /** | 1331 /** |
1331 * @param {number} entryIndex | 1332 * @param {number} entryIndex |
1332 * @return {!Object} | |
1333 */ | |
1334 entryData: function(entryIndex) | |
1335 { | |
1336 return this._entryNodes[entryIndex]; | |
1337 }, | |
1338 | |
1339 /** | |
1340 * @param {number} entryIndex | |
1341 * @return {!string} | 1333 * @return {!string} |
1342 */ | 1334 */ |
1343 entryColor: function(entryIndex) | 1335 entryColor: function(entryIndex) |
1344 { | 1336 { |
1345 var node = this._entryNodes[entryIndex]; | 1337 var node = this._entryNodes[entryIndex]; |
1346 return this._colorGenerator.colorForID(node.functionName + ":" + node.ur
l + ":" + node.lineNumber);; | 1338 return this._colorGenerator.colorForID(node.functionName + ":" + node.ur
l + ":" + node.lineNumber);; |
1347 }, | 1339 }, |
1348 | 1340 |
1349 /** | 1341 /** |
| 1342 * @param {number} entryIndex |
| 1343 * @return {!{startTimeOffset: number, endTimeOffset: number}} |
| 1344 */ |
| 1345 highlightTimeRange: function(entryIndex) |
| 1346 { |
| 1347 var startTimeOffset = this._timelineData.entryOffsets[entryIndex]; |
| 1348 return { |
| 1349 startTimeOffset: startTimeOffset, |
| 1350 endTimeOffset: startTimeOffset + this._timelineData.entryTotalTimes[
entryIndex] |
| 1351 }; |
| 1352 }, |
| 1353 |
| 1354 /** |
1350 * @param {number} entryIndex | 1355 * @param {number} entryIndex |
1351 * @return {!string} | 1356 * @return {!string} |
1352 */ | 1357 */ |
1353 textColor: function(entryIndex) | 1358 textColor: function(entryIndex) |
1354 { | 1359 { |
1355 return "#333"; | 1360 return "#333"; |
1356 } | 1361 } |
1357 } | 1362 } |
OLD | NEW |