OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 rowElement.createTextChild(WebInspector.UIString("%s %s", formatter(val
ue), category.title)); | 370 rowElement.createTextChild(WebInspector.UIString("%s %s", formatter(val
ue), category.title)); |
371 } | 371 } |
372 return element; | 372 return element; |
373 } | 373 } |
374 | 374 |
375 /** | 375 /** |
376 * @param {!WebInspector.TimelineFrameModel} frameModel | 376 * @param {!WebInspector.TimelineFrameModel} frameModel |
377 * @param {!WebInspector.TimelineFrame} frame | 377 * @param {!WebInspector.TimelineFrame} frame |
378 * @return {!Element} | 378 * @return {!Element} |
379 */ | 379 */ |
380 WebInspector.TimelineUIUtils.generatePopupContentForFrame = function(frameModel,
frame) | 380 WebInspector.TimelineUIUtils.generateDetailsContentForFrame = function(frameMode
l, frame) |
381 { | 381 { |
382 var contentHelper = new WebInspector.TimelinePopupContentHelper(WebInspector
.UIString("Frame")); | 382 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null
, true); |
383 var durationInMillis = frame.endTime - frame.startTime; | 383 var durationInMillis = frame.endTime - frame.startTime; |
384 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString
(frame.endTime - frame.startTime, true), | 384 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString
(frame.endTime - frame.startTime, true), |
385 Number.millisToString(frame.startTimeOffset, true)); | 385 Number.millisToString(frame.startTimeOffset, true)); |
386 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText)
; | 386 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText)
; |
387 contentHelper.appendTextRow(WebInspector.UIString("FPS"), Math.floor(1000 /
durationInMillis)); | 387 contentHelper.appendTextRow(WebInspector.UIString("FPS"), Math.floor(1000 /
durationInMillis)); |
388 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis
ToString(frame.cpuTime, true)); | 388 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis
ToString(frame.cpuTime, true)); |
389 contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"), | 389 contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"), |
390 WebInspector.TimelineUIUtils._generateAggregatedInfo(frame.timeByCategor
y)); | 390 WebInspector.TimelineUIUtils._generateAggregatedInfo(frame.timeByCategor
y)); |
391 if (WebInspector.experimentsSettings.layersPanel.isEnabled() && frame.layerT
ree) { | 391 if (WebInspector.experimentsSettings.layersPanel.isEnabled() && frame.layerT
ree) { |
392 contentHelper.appendElementRow(WebInspector.UIString("Layer tree"), | 392 contentHelper.appendElementRow(WebInspector.UIString("Layer tree"), |
393 WebInspector.Linkifier.linkifyUsingReveal
er(frame.layerTree, WebInspector.UIString("show"))); | 393 WebInspector.Linkifier.linkifyUsingReveal
er(frame.layerTree, WebInspector.UIString("show"))); |
394 } | 394 } |
395 return contentHelper.contentTable(); | |
396 } | |
397 | |
398 /** | |
399 * @param {!WebInspector.FrameStatistics} statistics | |
400 * @return {!Element} | |
401 */ | |
402 WebInspector.TimelineUIUtils.generatePopupContentForFrameStatistics = function(s
tatistics) | |
403 { | |
404 /** | |
405 * @param {number} time | |
406 */ | |
407 function formatTimeAndFPS(time) | |
408 { | |
409 return WebInspector.UIString("%s (%.0f FPS)", Number.millisToString(time
, true), 1 / time); | |
410 } | |
411 | |
412 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null
, false); | |
413 contentHelper.appendTextRow(WebInspector.UIString("Minimum Time"), formatTim
eAndFPS(statistics.minDuration)); | |
414 contentHelper.appendTextRow(WebInspector.UIString("Average Time"), formatTim
eAndFPS(statistics.average)); | |
415 contentHelper.appendTextRow(WebInspector.UIString("Maximum Time"), formatTim
eAndFPS(statistics.maxDuration)); | |
416 contentHelper.appendTextRow(WebInspector.UIString("Standard Deviation"), Num
ber.millisToString(statistics.stddev, true)); | |
417 | |
418 return contentHelper.element; | 395 return contentHelper.element; |
419 } | 396 } |
420 | 397 |
421 /** | 398 /** |
422 * @param {!CanvasRenderingContext2D} context | 399 * @param {!CanvasRenderingContext2D} context |
423 * @param {number} width | 400 * @param {number} width |
424 * @param {number} height | 401 * @param {number} height |
425 * @param {string} color0 | 402 * @param {string} color0 |
426 * @param {string} color1 | 403 * @param {string} color1 |
427 * @param {string} color2 | 404 * @param {string} color2 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 "}"; | 444 "}"; |
468 } | 445 } |
469 | 446 |
470 /** | 447 /** |
471 * @param {!WebInspector.TimelineModel.Record} record | 448 * @param {!WebInspector.TimelineModel.Record} record |
472 * @param {!WebInspector.TimelineModel} model | 449 * @param {!WebInspector.TimelineModel} model |
473 * @param {!WebInspector.Linkifier} linkifier | 450 * @param {!WebInspector.Linkifier} linkifier |
474 * @param {function(!DocumentFragment)} callback | 451 * @param {function(!DocumentFragment)} callback |
475 * @param {boolean} loadedFromFile | 452 * @param {boolean} loadedFromFile |
476 */ | 453 */ |
477 WebInspector.TimelineUIUtils.generatePopupContent = function(record, model, link
ifier, callback, loadedFromFile) | 454 WebInspector.TimelineUIUtils.generateDetailsContent = function(record, model, li
nkifier, callback, loadedFromFile) |
478 { | 455 { |
479 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelineUI
Utils::preview-element") || null); | 456 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelineUI
Utils::preview-element") || null); |
480 var relatedNode = null; | 457 var relatedNode = null; |
481 var recordData = record.data(); | 458 var recordData = record.data(); |
482 var barrier = new CallbackBarrier(); | 459 var barrier = new CallbackBarrier(); |
483 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record
.type())) | 460 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record
.type())) |
484 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.targe
t(), recordData["url"], false, barrier.createCallback(saveImage)); | 461 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.targe
t(), recordData["url"], false, barrier.createCallback(saveImage)); |
485 if (recordData["backendNodeId"]) | 462 if (recordData["backendNodeId"]) |
486 record.target().domModel.pushNodesByBackendIdsToFrontend([recordData["ba
ckendNodeId"]], barrier.createCallback(setRelatedNode)); | 463 record.target().domModel.pushNodesByBackendIdsToFrontend([recordData["ba
ckendNodeId"]], barrier.createCallback(setRelatedNode)); |
487 barrier.callWhenDone(callbackWrapper); | 464 barrier.callWhenDone(callbackWrapper); |
(...skipping 11 matching lines...) Expand all Loading... |
499 * @param {?Array.<!DOMAgent.NodeId>} nodeIds | 476 * @param {?Array.<!DOMAgent.NodeId>} nodeIds |
500 */ | 477 */ |
501 function setRelatedNode(nodeIds) | 478 function setRelatedNode(nodeIds) |
502 { | 479 { |
503 if (nodeIds) | 480 if (nodeIds) |
504 relatedNode = record.target().domModel.nodeForId(nodeIds[0]); | 481 relatedNode = record.target().domModel.nodeForId(nodeIds[0]); |
505 } | 482 } |
506 | 483 |
507 function callbackWrapper() | 484 function callbackWrapper() |
508 { | 485 { |
509 callback(WebInspector.TimelineUIUtils._generatePopupContentSynchronously
(record, model, linkifier, imageElement, relatedNode, loadedFromFile)); | 486 callback(WebInspector.TimelineUIUtils._generateDetailsContentSynchronous
ly(record, model, linkifier, imageElement, relatedNode, loadedFromFile)); |
510 } | 487 } |
511 } | 488 } |
512 | 489 |
513 /** | 490 /** |
514 * @param {!WebInspector.TimelineModel.Record} record | 491 * @param {!WebInspector.TimelineModel.Record} record |
515 * @param {!WebInspector.TimelineModel} model | 492 * @param {!WebInspector.TimelineModel} model |
516 * @param {!WebInspector.Linkifier} linkifier | 493 * @param {!WebInspector.Linkifier} linkifier |
517 * @param {?Element} imagePreviewElement | 494 * @param {?Element} imagePreviewElement |
518 * @param {?WebInspector.DOMNode} relatedNode | 495 * @param {?WebInspector.DOMNode} relatedNode |
519 * @param {boolean} loadedFromFile | 496 * @param {boolean} loadedFromFile |
520 * @return {!DocumentFragment} | 497 * @return {!DocumentFragment} |
521 */ | 498 */ |
522 WebInspector.TimelineUIUtils._generatePopupContentSynchronously = function(recor
d, model, linkifier, imagePreviewElement, relatedNode, loadedFromFile) | 499 WebInspector.TimelineUIUtils._generateDetailsContentSynchronously = function(rec
ord, model, linkifier, imagePreviewElement, relatedNode, loadedFromFile) |
523 { | 500 { |
524 var fragment = document.createDocumentFragment(); | 501 var fragment = document.createDocumentFragment(); |
525 if (record.children().length) | 502 if (record.children().length) |
526 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats(), record.category(), record.selfTime())); | 503 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats(), record.category(), record.selfTime())); |
527 else | 504 else |
528 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats())); | 505 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats())); |
529 | 506 |
530 const recordTypes = WebInspector.TimelineModel.RecordType; | 507 const recordTypes = WebInspector.TimelineModel.RecordType; |
531 | 508 |
532 // The messages may vary per record.type(); | 509 // The messages may vary per record.type(); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 for (var i = 0; i < stackTrace.length; ++i) { | 988 for (var i = 0; i < stackTrace.length; ++i) { |
1012 var stackFrame = stackTrace[i]; | 989 var stackFrame = stackTrace[i]; |
1013 var row = stackTraceElement.createChild("div"); | 990 var row = stackTraceElement.createChild("div"); |
1014 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); | 991 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); |
1015 row.createTextChild(" @ "); | 992 row.createTextChild(" @ "); |
1016 var urlElement = this._linkifier.linkifyLocation(this._target, stack
Frame.url, stackFrame.lineNumber - 1); | 993 var urlElement = this._linkifier.linkifyLocation(this._target, stack
Frame.url, stackFrame.lineNumber - 1); |
1017 row.appendChild(urlElement); | 994 row.appendChild(urlElement); |
1018 } | 995 } |
1019 } | 996 } |
1020 } | 997 } |
OLD | NEW |