| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 recordStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspec
tor.UIString("Send WebSocket Handshake"), category: categories["scripting"] }; | 102 recordStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspec
tor.UIString("Send WebSocket Handshake"), category: categories["scripting"] }; |
| 103 recordStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebIn
spector.UIString("Receive WebSocket Handshake"), category: categories["scripting
"] }; | 103 recordStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebIn
spector.UIString("Receive WebSocket Handshake"), category: categories["scripting
"] }; |
| 104 recordStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString(
"Destroy WebSocket"), category: categories["scripting"] }; | 104 recordStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString(
"Destroy WebSocket"), category: categories["scripting"] }; |
| 105 recordStyles[recordTypes.EmbedderCallback] = { title: WebInspector.UIString(
"Embedder Callback"), category: categories["scripting"] }; | 105 recordStyles[recordTypes.EmbedderCallback] = { title: WebInspector.UIString(
"Embedder Callback"), category: categories["scripting"] }; |
| 106 | 106 |
| 107 WebInspector.TimelineUIUtils._recordStylesMap = recordStyles; | 107 WebInspector.TimelineUIUtils._recordStylesMap = recordStyles; |
| 108 return recordStyles; | 108 return recordStyles; |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * @param {!TimelineAgent.TimelineEvent} record | 112 * @param {!WebInspector.TimelineModel.Record} record |
| 113 * @return {!{title: string, category: !WebInspector.TimelineCategory}} | 113 * @return {!{title: string, category: !WebInspector.TimelineCategory}} |
| 114 */ | 114 */ |
| 115 WebInspector.TimelineUIUtils.recordStyle = function(record) | 115 WebInspector.TimelineUIUtils.recordStyle = function(record) |
| 116 { | 116 { |
| 117 var recordStyles = WebInspector.TimelineUIUtils._initRecordStyles(); | 117 var recordStyles = WebInspector.TimelineUIUtils._initRecordStyles(); |
| 118 var result = recordStyles[record.type]; | 118 var result = recordStyles[record.type]; |
| 119 if (!result) { | 119 if (!result) { |
| 120 result = { | 120 result = { |
| 121 title: WebInspector.UIString("Unknown: %s", record.type), | 121 title: WebInspector.UIString("Unknown: %s", record.type), |
| 122 category: WebInspector.TimelineUIUtils.categories()["other"] | 122 category: WebInspector.TimelineUIUtils.categories()["other"] |
| 123 }; | 123 }; |
| 124 recordStyles[record.type] = result; | 124 recordStyles[record.type] = result; |
| 125 } | 125 } |
| 126 return result; | 126 return result; |
| 127 } | 127 } |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * @param {!TimelineAgent.TimelineEvent} record | 130 * @param {!WebInspector.TimelineModel.Record} record |
| 131 * @return {!WebInspector.TimelineCategory} | 131 * @return {!WebInspector.TimelineCategory} |
| 132 */ | 132 */ |
| 133 WebInspector.TimelineUIUtils.categoryForRecord = function(record) | 133 WebInspector.TimelineUIUtils.categoryForRecord = function(record) |
| 134 { | 134 { |
| 135 return WebInspector.TimelineUIUtils.recordStyle(record).category; | 135 return WebInspector.TimelineUIUtils.recordStyle(record).category; |
| 136 } | 136 } |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * @param {!TimelineAgent.TimelineEvent} record | 139 * @param {!WebInspector.TimelineModel.Record} record |
| 140 */ | 140 */ |
| 141 WebInspector.TimelineUIUtils.isEventDivider = function(record) | 141 WebInspector.TimelineUIUtils.isEventDivider = function(record) |
| 142 { | 142 { |
| 143 var recordTypes = WebInspector.TimelineModel.RecordType; | 143 var recordTypes = WebInspector.TimelineModel.RecordType; |
| 144 if (record.type === recordTypes.TimeStamp) | 144 if (record.type === recordTypes.TimeStamp) |
| 145 return true; | 145 return true; |
| 146 if (record.type === recordTypes.MarkFirstPaint) | 146 if (record.type === recordTypes.MarkFirstPaint) |
| 147 return true; | 147 return true; |
| 148 if (record.type === recordTypes.MarkDOMContent || record.type === recordType
s.MarkLoad) { | 148 if (record.type === recordTypes.MarkDOMContent || record.type === recordType
s.MarkLoad) { |
| 149 if (record.data && ((typeof record.data.isMainFrame) === "boolean")) | 149 if (record.data && ((typeof record.data.isMainFrame) === "boolean")) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 var contentHelper = new WebInspector.TimelinePopupContentHelper(info.name); | 225 var contentHelper = new WebInspector.TimelinePopupContentHelper(info.name); |
| 226 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString
(duration, true), | 226 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString
(duration, true), |
| 227 Number.millisToString(startTime - model.minimumRecordTime(), true)); | 227 Number.millisToString(startTime - model.minimumRecordTime(), true)); |
| 228 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText)
; | 228 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText)
; |
| 229 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis
ToString(cpuTime, true)); | 229 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis
ToString(cpuTime, true)); |
| 230 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC
ount); | 230 contentHelper.appendTextRow(WebInspector.UIString("Message Count"), messageC
ount); |
| 231 return contentHelper.contentTable(); | 231 return contentHelper.contentTable(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * @param {!TimelineAgent.TimelineEvent} record | 235 * @param {!WebInspector.TimelineModel.Record} record |
| 236 * @return {string} | 236 * @return {string} |
| 237 */ | 237 */ |
| 238 WebInspector.TimelineUIUtils.recordTitle = function(record) | 238 WebInspector.TimelineUIUtils.recordTitle = function(record) |
| 239 { | 239 { |
| 240 if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp) | 240 if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp) |
| 241 return record.data["message"]; | 241 return record.data["message"]; |
| 242 if (WebInspector.TimelineUIUtils.isEventDivider(record)) { | 242 if (WebInspector.TimelineUIUtils.isEventDivider(record)) { |
| 243 var startTime = Number.millisToString(record.startTimeOffset); | 243 var startTime = Number.millisToString(record.startTimeOffset); |
| 244 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re
cordStyle(record).title, startTime, true); | 244 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re
cordStyle(record).title, startTime, true); |
| 245 } | 245 } |
| 246 return WebInspector.TimelineUIUtils.recordStyle(record).title; | 246 return WebInspector.TimelineUIUtils.recordStyle(record).title; |
| 247 } | 247 } |
| 248 | 248 |
| 249 /** | 249 /** |
| 250 * @param {!Object} total | 250 * @param {!Object} total |
| 251 * @param {!Object} addend | 251 * @param {!Object} addend |
| 252 */ | 252 */ |
| 253 WebInspector.TimelineUIUtils.aggregateTimeByCategory = function(total, addend) | 253 WebInspector.TimelineUIUtils.aggregateTimeByCategory = function(total, addend) |
| 254 { | 254 { |
| 255 for (var category in addend) | 255 for (var category in addend) |
| 256 total[category] = (total[category] || 0) + addend[category]; | 256 total[category] = (total[category] || 0) + addend[category]; |
| 257 } | 257 } |
| 258 | 258 |
| 259 /** | 259 /** |
| 260 * @param {!Object} total | 260 * @param {!Object} total |
| 261 * @param {!TimelineAgent.TimelineEvent} rawRecord | 261 * @param {!WebInspector.TimelineModel.Record} record |
| 262 */ | 262 */ |
| 263 WebInspector.TimelineUIUtils.aggregateTimeForRecord = function(total, rawRecord) | 263 WebInspector.TimelineUIUtils.aggregateTimeForRecord = function(total, record) |
| 264 { | 264 { |
| 265 var childrenTime = 0; | 265 var childrenTime = 0; |
| 266 var children = rawRecord["children"] || []; | 266 var children = record.children; |
| 267 for (var i = 0; i < children.length; ++i) { | 267 for (var i = 0; i < children.length; ++i) { |
| 268 WebInspector.TimelineUIUtils.aggregateTimeForRecord(total, children[i]); | 268 WebInspector.TimelineUIUtils.aggregateTimeForRecord(total, children[i]); |
| 269 childrenTime += children[i].endTime - children[i].startTime; | 269 childrenTime += children[i].endTime - children[i].startTime; |
| 270 } | 270 } |
| 271 var categoryName = WebInspector.TimelineUIUtils.recordStyle(rawRecord).categ
ory.name; | 271 var categoryName = WebInspector.TimelineUIUtils.recordStyle(record).category
.name; |
| 272 var ownTime = rawRecord.endTime - rawRecord.startTime - childrenTime; | 272 var ownTime = record.endTime - record.startTime - childrenTime; |
| 273 total[categoryName] = (total[categoryName] || 0) + ownTime; | 273 total[categoryName] = (total[categoryName] || 0) + ownTime; |
| 274 } | 274 } |
| 275 | 275 |
| 276 /** | 276 /** |
| 277 * @param {!Object} aggregatedStats | 277 * @param {!Object} aggregatedStats |
| 278 */ | 278 */ |
| 279 WebInspector.TimelineUIUtils._generateAggregatedInfo = function(aggregatedStats) | 279 WebInspector.TimelineUIUtils._generateAggregatedInfo = function(aggregatedStats) |
| 280 { | 280 { |
| 281 var cell = document.createElement("span"); | 281 var cell = document.createElement("span"); |
| 282 cell.className = "timeline-aggregated-info"; | 282 cell.className = "timeline-aggregated-info"; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 ".timeline-details-view .timeline-" + category.name + ", " + | 425 ".timeline-details-view .timeline-" + category.name + ", " + |
| 426 ".timeline-category-" + category.name + " .timeline-tree-icon" | 426 ".timeline-category-" + category.name + " .timeline-tree-icon" |
| 427 | 427 |
| 428 return selector + " { background-image: linear-gradient(" + | 428 return selector + " { background-image: linear-gradient(" + |
| 429 category.fillColorStop0 + ", " + category.fillColorStop1 + " 25%, " + cat
egory.fillColorStop1 + " 25%, " + category.fillColorStop1 + ");" + | 429 category.fillColorStop0 + ", " + category.fillColorStop1 + " 25%, " + cat
egory.fillColorStop1 + " 25%, " + category.fillColorStop1 + ");" + |
| 430 " border-color: " + category.borderColor + | 430 " border-color: " + category.borderColor + |
| 431 "}"; | 431 "}"; |
| 432 } | 432 } |
| 433 | 433 |
| 434 /** | 434 /** |
| 435 * @param {!WebInspector.TimelinePresentationModel.Record} record | 435 * @param {!WebInspector.TimelineModel.Record} record |
| 436 * @param {!WebInspector.Linkifier} linkifier | 436 * @param {!WebInspector.Linkifier} linkifier |
| 437 * @param {function(!DocumentFragment)} callback | 437 * @param {function(!DocumentFragment)} callback |
| 438 */ | 438 */ |
| 439 WebInspector.TimelineUIUtils.generatePopupContent = function(record, linkifier,
callback) | 439 WebInspector.TimelineUIUtils.generatePopupContent = function(record, linkifier,
callback) |
| 440 { | 440 { |
| 441 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelinePr
esentationModel::preview-element") || null); | 441 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelineUI
Utils::preview-element") || null); |
| 442 var relatedNode = /** @type {?WebInspector.DOMNode} */ (record.getUserObject
("TimelinePresentationModel::related-node") || null); | 442 var relatedNode = /** @type {?WebInspector.DOMNode} */ (record.getUserObject
("TimelineUIUtils::related-node") || null); |
| 443 | 443 |
| 444 var barrier = new CallbackBarrier(); | 444 var barrier = new CallbackBarrier(); |
| 445 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record
.type)) | 445 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record
.type)) |
| 446 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.url,
false, barrier.createCallback(saveImage)); | 446 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.url,
false, barrier.createCallback(saveImage)); |
| 447 if (!relatedNode && record.relatedBackendNodeId()) | 447 if (!relatedNode && record.relatedBackendNodeId()) |
| 448 WebInspector.domAgent.pushNodeByBackendIdToFrontend(record.relatedBacken
dNodeId(), barrier.createCallback(saveNode)); | 448 WebInspector.domAgent.pushNodeByBackendIdToFrontend(record.relatedBacken
dNodeId(), barrier.createCallback(saveNode)); |
| 449 barrier.callWhenDone(callbackWrapper); | 449 barrier.callWhenDone(callbackWrapper); |
| 450 | 450 |
| 451 /** | 451 /** |
| 452 * @param {!Element=} element | 452 * @param {!Element=} element |
| 453 */ | 453 */ |
| 454 function saveImage(element) | 454 function saveImage(element) |
| 455 { | 455 { |
| 456 imageElement = element || null; | 456 imageElement = element || null; |
| 457 record.setUserObject("TimelinePresentationModel::preview-element", eleme
nt); | 457 record.setUserObject("TimelineUIUtils::preview-element", element); |
| 458 } | 458 } |
| 459 | 459 |
| 460 /** | 460 /** |
| 461 * @param {?DOMAgent.NodeId} nodeId | 461 * @param {?DOMAgent.NodeId} nodeId |
| 462 */ | 462 */ |
| 463 function saveNode(nodeId) | 463 function saveNode(nodeId) |
| 464 { | 464 { |
| 465 if (nodeId !== null) { | 465 if (nodeId !== null) { |
| 466 relatedNode = WebInspector.domAgent.nodeForId(nodeId); | 466 relatedNode = WebInspector.domAgent.nodeForId(nodeId); |
| 467 record.setUserObject("TimelinePresentationModel::related-node", rela
tedNode); | 467 record.setUserObject("TimelineUIUtils::related-node", relatedNode); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 /** | |
| 472 * @this {WebInspector.TimelinePresentationModel.Record} | |
| 473 */ | |
| 474 function callbackWrapper() | 471 function callbackWrapper() |
| 475 { | 472 { |
| 476 callback(WebInspector.TimelineUIUtils._generatePopupContentSynchronously
(record, linkifier, imageElement, relatedNode)); | 473 callback(WebInspector.TimelineUIUtils._generatePopupContentSynchronously
(record, linkifier, imageElement, relatedNode)); |
| 477 } | 474 } |
| 478 } | 475 } |
| 479 | 476 |
| 480 /** | 477 /** |
| 481 * @param {!WebInspector.TimelinePresentationModel.Record} record | 478 * @param {!WebInspector.TimelineModel.Record} record |
| 482 * @param {!WebInspector.Linkifier} linkifier | 479 * @param {!WebInspector.Linkifier} linkifier |
| 483 * @param {?Element} imagePreviewElement | 480 * @param {?Element} imagePreviewElement |
| 484 * @param {?WebInspector.DOMNode} relatedNode | 481 * @param {?WebInspector.DOMNode} relatedNode |
| 485 * @return {!DocumentFragment} | 482 * @return {!DocumentFragment} |
| 486 */ | 483 */ |
| 487 WebInspector.TimelineUIUtils._generatePopupContentSynchronously = function(recor
d, linkifier, imagePreviewElement, relatedNode) | 484 WebInspector.TimelineUIUtils._generatePopupContentSynchronously = function(recor
d, linkifier, imagePreviewElement, relatedNode) |
| 488 { | 485 { |
| 489 var fragment = document.createDocumentFragment(); | 486 var fragment = document.createDocumentFragment(); |
| 490 if (!record.coalesced && record.children.length) | 487 if (record.children.length) |
| 491 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats, record.category, record.selfTime)); | 488 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats, record.category, record.selfTime)); |
| 492 else | |
| 493 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats)); | |
| 494 | |
| 495 if (record.coalesced) | |
| 496 return fragment; | |
| 497 | 489 |
| 498 const recordTypes = WebInspector.TimelineModel.RecordType; | 490 const recordTypes = WebInspector.TimelineModel.RecordType; |
| 499 | 491 |
| 500 // The messages may vary per record type; | 492 // The messages may vary per record type; |
| 501 var callSiteStackTraceLabel; | 493 var callSiteStackTraceLabel; |
| 502 var callStackLabel; | 494 var callStackLabel; |
| 503 var relatedNodeLabel; | 495 var relatedNodeLabel; |
| 504 | 496 |
| 505 var contentHelper = new WebInspector.TimelineDetailsContentHelper(linkifier,
true); | 497 var contentHelper = new WebInspector.TimelineDetailsContentHelper(linkifier,
true); |
| 506 contentHelper.appendTextRow(WebInspector.UIString("Self Time"), Number.milli
sToString(record.selfTime, true)); | 498 contentHelper.appendTextRow(WebInspector.UIString("Self Time"), Number.milli
sToString(record.selfTime, true)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 contentHelper.appendTextRow(WebInspector.UIString("Encoded Data
Length"), WebInspector.UIString("%d Bytes", record.data["encodedDataLength"])); | 540 contentHelper.appendTextRow(WebInspector.UIString("Encoded Data
Length"), WebInspector.UIString("%d Bytes", record.data["encodedDataLength"])); |
| 549 break; | 541 break; |
| 550 case recordTypes.EvaluateScript: | 542 case recordTypes.EvaluateScript: |
| 551 if (record.data && record.url) | 543 if (record.data && record.url) |
| 552 contentHelper.appendLocationRow(WebInspector.UIString("Script"),
record.url, record.data["lineNumber"]); | 544 contentHelper.appendLocationRow(WebInspector.UIString("Script"),
record.url, record.data["lineNumber"]); |
| 553 break; | 545 break; |
| 554 case recordTypes.Paint: | 546 case recordTypes.Paint: |
| 555 var clip = record.data["clip"]; | 547 var clip = record.data["clip"]; |
| 556 if (clip) { | 548 if (clip) { |
| 557 contentHelper.appendTextRow(WebInspector.UIString("Location"), W
ebInspector.UIString("(%d, %d)", clip[0], clip[1])); | 549 contentHelper.appendTextRow(WebInspector.UIString("Location"), W
ebInspector.UIString("(%d, %d)", clip[0], clip[1])); |
| 558 var clipWidth = WebInspector.TimelinePresentationModel.quadWidth
(clip); | 550 var clipWidth = WebInspector.TimelineUIUtils._quadWidth(clip); |
| 559 var clipHeight = WebInspector.TimelinePresentationModel.quadHeig
ht(clip); | 551 var clipHeight = WebInspector.TimelineUIUtils._quadHeight(clip); |
| 560 contentHelper.appendTextRow(WebInspector.UIString("Dimensions"),
WebInspector.UIString("%d × %d", clipWidth, clipHeight)); | 552 contentHelper.appendTextRow(WebInspector.UIString("Dimensions"),
WebInspector.UIString("%d × %d", clipWidth, clipHeight)); |
| 561 } else { | 553 } else { |
| 562 // Backward compatibility: older version used x, y, width, heigh
t fields directly in data. | 554 // Backward compatibility: older version used x, y, width, heigh
t fields directly in data. |
| 563 if (typeof record.data["x"] !== "undefined" && typeof record.dat
a["y"] !== "undefined") | 555 if (typeof record.data["x"] !== "undefined" && typeof record.dat
a["y"] !== "undefined") |
| 564 contentHelper.appendTextRow(WebInspector.UIString("Location"
), WebInspector.UIString("(%d, %d)", record.data["x"], record.data["y"])); | 556 contentHelper.appendTextRow(WebInspector.UIString("Location"
), WebInspector.UIString("(%d, %d)", record.data["x"], record.data["y"])); |
| 565 if (typeof record.data["width"] !== "undefined" && typeof record
.data["height"] !== "undefined") | 557 if (typeof record.data["width"] !== "undefined" && typeof record
.data["height"] !== "undefined") |
| 566 contentHelper.appendTextRow(WebInspector.UIString("Dimension
s"), WebInspector.UIString("%d\u2009\u00d7\u2009%d", record.data["width"], recor
d.data["height"])); | 558 contentHelper.appendTextRow(WebInspector.UIString("Dimension
s"), WebInspector.UIString("%d\u2009\u00d7\u2009%d", record.data["width"], recor
d.data["height"])); |
| 567 } | 559 } |
| 568 // Fall-through intended. | 560 // Fall-through intended. |
| 569 | 561 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 var ul = document.createElement("ul"); | 652 var ul = document.createElement("ul"); |
| 661 for (var i = 0; i < record.warnings.length; ++i) | 653 for (var i = 0; i < record.warnings.length; ++i) |
| 662 ul.createChild("li").textContent = record.warnings[i]; | 654 ul.createChild("li").textContent = record.warnings[i]; |
| 663 contentHelper.appendElementRow(WebInspector.UIString("Warning"), ul); | 655 contentHelper.appendElementRow(WebInspector.UIString("Warning"), ul); |
| 664 } | 656 } |
| 665 fragment.appendChild(contentHelper.element); | 657 fragment.appendChild(contentHelper.element); |
| 666 return fragment; | 658 return fragment; |
| 667 } | 659 } |
| 668 | 660 |
| 669 /** | 661 /** |
| 670 * @param {!WebInspector.TimelinePresentationModel.Record} record | 662 * @param {!Array.<number>} quad |
| 663 * @return {number} |
| 664 */ |
| 665 WebInspector.TimelineUIUtils._quadWidth = function(quad) |
| 666 { |
| 667 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1
] - quad[3], 2))); |
| 668 } |
| 669 |
| 670 /** |
| 671 * @param {!Array.<number>} quad |
| 672 * @return {number} |
| 673 */ |
| 674 WebInspector.TimelineUIUtils._quadHeight = function(quad) |
| 675 { |
| 676 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1
] - quad[7], 2))); |
| 677 } |
| 678 |
| 679 /** |
| 680 * @param {!WebInspector.TimelineModel.Record} record |
| 671 * @param {!WebInspector.Linkifier} linkifier | 681 * @param {!WebInspector.Linkifier} linkifier |
| 672 * @return {?Node} | 682 * @return {?Node} |
| 673 */ | 683 */ |
| 674 WebInspector.TimelineUIUtils.buildDetailsNode = function(record, linkifier) | 684 WebInspector.TimelineUIUtils.buildDetailsNode = function(record, linkifier) |
| 675 { | 685 { |
| 676 var details; | 686 var details; |
| 677 var detailsText; | 687 var detailsText; |
| 678 if (record.coalesced) { | |
| 679 var node = document.createElement("span"); | |
| 680 node.textContent = WebInspector.UIString("× %d", record.children.length)
; | |
| 681 return node; | |
| 682 } | |
| 683 | 688 |
| 684 switch (record.type) { | 689 switch (record.type) { |
| 685 case WebInspector.TimelineModel.RecordType.GCEvent: | 690 case WebInspector.TimelineModel.RecordType.GCEvent: |
| 686 detailsText = WebInspector.UIString("%s collected", Number.bytesToString
(record.data["usedHeapSizeDelta"])); | 691 detailsText = WebInspector.UIString("%s collected", Number.bytesToString
(record.data["usedHeapSizeDelta"])); |
| 687 break; | 692 break; |
| 688 case WebInspector.TimelineModel.RecordType.TimerFire: | 693 case WebInspector.TimelineModel.RecordType.TimerFire: |
| 689 details = linkifyScriptLocation(); | 694 details = linkifyScriptLocation(); |
| 690 detailsText = record.data["timerId"]; | 695 detailsText = record.data["timerId"]; |
| 691 break; | 696 break; |
| 692 case WebInspector.TimelineModel.RecordType.FunctionCall: | 697 case WebInspector.TimelineModel.RecordType.FunctionCall: |
| 693 if (record.scriptName) | 698 if (record.scriptName) |
| 694 details = linkifyLocation(record.scriptName, record.scriptLine, 0); | 699 details = linkifyLocation(record.scriptName, record.scriptLine, 0); |
| 695 break; | 700 break; |
| 696 case WebInspector.TimelineModel.RecordType.FireAnimationFrame: | 701 case WebInspector.TimelineModel.RecordType.FireAnimationFrame: |
| 697 details = linkifyScriptLocation(); | 702 details = linkifyScriptLocation(); |
| 698 detailsText = record.data["id"]; | 703 detailsText = record.data["id"]; |
| 699 break; | 704 break; |
| 700 case WebInspector.TimelineModel.RecordType.EventDispatch: | 705 case WebInspector.TimelineModel.RecordType.EventDispatch: |
| 701 detailsText = record.data ? record.data["type"] : null; | 706 detailsText = record.data ? record.data["type"] : null; |
| 702 break; | 707 break; |
| 703 case WebInspector.TimelineModel.RecordType.Paint: | 708 case WebInspector.TimelineModel.RecordType.Paint: |
| 704 var width = record.data.clip ? WebInspector.TimelinePresentationModel.qu
adWidth(record.data.clip) : record.data.width; | 709 var width = record.data.clip ? WebInspector.TimelineUIUtils._quadWidth(r
ecord.data.clip) : record.data.width; |
| 705 var height = record.data.clip ? WebInspector.TimelinePresentationModel.q
uadHeight(record.data.clip) : record.data.height; | 710 var height = record.data.clip ? WebInspector.TimelineUIUtils._quadHeight
(record.data.clip) : record.data.height; |
| 706 if (width && height) | 711 if (width && height) |
| 707 detailsText = WebInspector.UIString("%d\u2009\u00d7\u2009%d", width,
height); | 712 detailsText = WebInspector.UIString("%d\u2009\u00d7\u2009%d", width,
height); |
| 708 break; | 713 break; |
| 709 case WebInspector.TimelineModel.RecordType.TimerInstall: | 714 case WebInspector.TimelineModel.RecordType.TimerInstall: |
| 710 case WebInspector.TimelineModel.RecordType.TimerRemove: | 715 case WebInspector.TimelineModel.RecordType.TimerRemove: |
| 711 details = linkifyTopCallFrame(); | 716 details = linkifyTopCallFrame(); |
| 712 detailsText = record.data["timerId"]; | 717 detailsText = record.data["timerId"]; |
| 713 break; | 718 break; |
| 714 case WebInspector.TimelineModel.RecordType.RequestAnimationFrame: | 719 case WebInspector.TimelineModel.RecordType.RequestAnimationFrame: |
| 715 case WebInspector.TimelineModel.RecordType.CancelAnimationFrame: | 720 case WebInspector.TimelineModel.RecordType.CancelAnimationFrame: |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 for (var i = 0; i < stackTrace.length; ++i) { | 972 for (var i = 0; i < stackTrace.length; ++i) { |
| 968 var stackFrame = stackTrace[i]; | 973 var stackFrame = stackTrace[i]; |
| 969 var row = stackTraceElement.createChild("div"); | 974 var row = stackTraceElement.createChild("div"); |
| 970 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); | 975 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); |
| 971 row.createTextChild(" @ "); | 976 row.createTextChild(" @ "); |
| 972 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta
ckFrame.lineNumber - 1); | 977 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta
ckFrame.lineNumber - 1); |
| 973 row.appendChild(urlElement); | 978 row.appendChild(urlElement); |
| 974 } | 979 } |
| 975 } | 980 } |
| 976 } | 981 } |
| OLD | NEW |