| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 /** | 54 /** |
| 55 * @param {string} recordType | 55 * @param {string} recordType |
| 56 * @return {boolean} | 56 * @return {boolean} |
| 57 */ | 57 */ |
| 58 isCoalescable: function(recordType) | 58 isCoalescable: function(recordType) |
| 59 { | 59 { |
| 60 throw new Error("Not implemented."); | 60 throw new Error("Not implemented."); |
| 61 }, | 61 }, |
| 62 /** | 62 /** |
| 63 * @param {!WebInspector.TimelineModel.Record} record | 63 * @param {!WebInspector.TimelineModel.Record} record |
| 64 * @return {boolean} |
| 65 */ |
| 66 isEventDivider: function(record) |
| 67 { |
| 68 throw new Error("Not implemented."); |
| 69 }, |
| 70 /** |
| 71 * @param {!WebInspector.TimelineModel.Record} record |
| 64 * @return {?Object} | 72 * @return {?Object} |
| 65 */ | 73 */ |
| 66 countersForRecord: function(record) | 74 countersForRecord: function(record) |
| 67 { | 75 { |
| 68 throw new Error("Not implemented."); | 76 throw new Error("Not implemented."); |
| 69 }, | 77 }, |
| 70 /** | 78 /** |
| 71 * @param {!WebInspector.TimelineModel.Record} record | 79 * @param {!WebInspector.TimelineModel.Record} record |
| 72 * @return {?Object} | 80 * @return {?Object} |
| 73 */ | 81 */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 /** | 96 /** |
| 89 * @param {!WebInspector.TimelineModel.Record} record | 97 * @param {!WebInspector.TimelineModel.Record} record |
| 90 * @param {!WebInspector.TimelineModel} model | 98 * @param {!WebInspector.TimelineModel} model |
| 91 * @param {!WebInspector.Linkifier} linkifier | 99 * @param {!WebInspector.Linkifier} linkifier |
| 92 * @param {function(!DocumentFragment)} callback | 100 * @param {function(!DocumentFragment)} callback |
| 93 * @param {boolean} loadedFromFile | 101 * @param {boolean} loadedFromFile |
| 94 */ | 102 */ |
| 95 generateDetailsContent: function(record, model, linkifier, callback, loadedF
romFile) | 103 generateDetailsContent: function(record, model, linkifier, callback, loadedF
romFile) |
| 96 { | 104 { |
| 97 throw new Error("Not implemented."); | 105 throw new Error("Not implemented."); |
| 106 }, |
| 107 /** |
| 108 * @param {string} recordType |
| 109 * @param {string=} title |
| 110 * @return {!Element} |
| 111 */ |
| 112 createEventDivider: function(recordType, title) |
| 113 { |
| 114 throw new Error("Not implemented."); |
| 98 } | 115 } |
| 99 } | 116 } |
| 100 | 117 |
| 101 /** | 118 /** |
| 102 * @return {!Object.<string, !WebInspector.TimelineCategory>} | 119 * @return {!Object.<string, !WebInspector.TimelineCategory>} |
| 103 */ | 120 */ |
| 104 WebInspector.TimelineUIUtils.categories = function() | 121 WebInspector.TimelineUIUtils.categories = function() |
| 105 { | 122 { |
| 106 if (WebInspector.TimelineUIUtils._categories) | 123 if (WebInspector.TimelineUIUtils._categories) |
| 107 return WebInspector.TimelineUIUtils._categories; | 124 return WebInspector.TimelineUIUtils._categories; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 result = { | 206 result = { |
| 190 title: WebInspector.UIString("Unknown: %s", type), | 207 title: WebInspector.UIString("Unknown: %s", type), |
| 191 category: WebInspector.TimelineUIUtils.categories()["other"] | 208 category: WebInspector.TimelineUIUtils.categories()["other"] |
| 192 }; | 209 }; |
| 193 recordStyles[type] = result; | 210 recordStyles[type] = result; |
| 194 } | 211 } |
| 195 return result; | 212 return result; |
| 196 } | 213 } |
| 197 | 214 |
| 198 /** | 215 /** |
| 199 * @param {!WebInspector.TimelineModel.Record} record | |
| 200 * @return {boolean} | |
| 201 */ | |
| 202 WebInspector.TimelineUIUtils.isEventDivider = function(record) | |
| 203 { | |
| 204 var recordTypes = WebInspector.TimelineModel.RecordType; | |
| 205 if (record.type() === recordTypes.TimeStamp) | |
| 206 return true; | |
| 207 if (record.type() === recordTypes.MarkFirstPaint) | |
| 208 return true; | |
| 209 if (record.type() === recordTypes.MarkDOMContent || record.type() === record
Types.MarkLoad) | |
| 210 return record.data()["isMainFrame"]; | |
| 211 return false; | |
| 212 } | |
| 213 | |
| 214 /** | |
| 215 * @param {string=} recordType | 216 * @param {string=} recordType |
| 216 * @return {boolean} | 217 * @return {boolean} |
| 217 */ | 218 */ |
| 218 WebInspector.TimelineUIUtils.needsPreviewElement = function(recordType) | 219 WebInspector.TimelineUIUtils.needsPreviewElement = function(recordType) |
| 219 { | 220 { |
| 220 if (!recordType) | 221 if (!recordType) |
| 221 return false; | 222 return false; |
| 222 const recordTypes = WebInspector.TimelineModel.RecordType; | 223 const recordTypes = WebInspector.TimelineModel.RecordType; |
| 223 switch (recordType) { | 224 switch (recordType) { |
| 224 case recordTypes.ResourceSendRequest: | 225 case recordTypes.ResourceSendRequest: |
| 225 case recordTypes.ResourceReceiveResponse: | 226 case recordTypes.ResourceReceiveResponse: |
| 226 case recordTypes.ResourceReceivedData: | 227 case recordTypes.ResourceReceivedData: |
| 227 case recordTypes.ResourceFinish: | 228 case recordTypes.ResourceFinish: |
| 228 return true; | 229 return true; |
| 229 default: | 230 default: |
| 230 return false; | 231 return false; |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 /** | 235 /** |
| 235 * @param {string} recordType | |
| 236 * @param {string=} title | |
| 237 * @return {!Element} | |
| 238 */ | |
| 239 WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title) | |
| 240 { | |
| 241 var eventDivider = document.createElement("div"); | |
| 242 eventDivider.className = "resources-event-divider"; | |
| 243 var recordTypes = WebInspector.TimelineModel.RecordType; | |
| 244 | |
| 245 if (recordType === recordTypes.MarkDOMContent) | |
| 246 eventDivider.className += " resources-blue-divider"; | |
| 247 else if (recordType === recordTypes.MarkLoad) | |
| 248 eventDivider.className += " resources-red-divider"; | |
| 249 else if (recordType === recordTypes.MarkFirstPaint) | |
| 250 eventDivider.className += " resources-green-divider"; | |
| 251 else if (recordType === recordTypes.TimeStamp) | |
| 252 eventDivider.className += " resources-orange-divider"; | |
| 253 else if (recordType === recordTypes.BeginFrame) | |
| 254 eventDivider.className += " timeline-frame-divider"; | |
| 255 | |
| 256 if (title) | |
| 257 eventDivider.title = title; | |
| 258 | |
| 259 return eventDivider; | |
| 260 } | |
| 261 | |
| 262 | |
| 263 /** | |
| 264 * @param {!WebInspector.TimelineModel} model | 236 * @param {!WebInspector.TimelineModel} model |
| 265 * @param {!{name: string, tasks: !Array.<!{startTime: number, endTime: number}>
, firstTaskIndex: number, lastTaskIndex: number}} info | 237 * @param {!{name: string, tasks: !Array.<!{startTime: number, endTime: number}>
, firstTaskIndex: number, lastTaskIndex: number}} info |
| 266 * @return {!Element} | 238 * @return {!Element} |
| 267 */ | 239 */ |
| 268 WebInspector.TimelineUIUtils.generateMainThreadBarPopupContent = function(model,
info) | 240 WebInspector.TimelineUIUtils.generateMainThreadBarPopupContent = function(model,
info) |
| 269 { | 241 { |
| 270 var firstTaskIndex = info.firstTaskIndex; | 242 var firstTaskIndex = info.firstTaskIndex; |
| 271 var lastTaskIndex = info.lastTaskIndex; | 243 var lastTaskIndex = info.lastTaskIndex; |
| 272 var tasks = info.tasks; | 244 var tasks = info.tasks; |
| 273 var messageCount = lastTaskIndex - firstTaskIndex + 1; | 245 var messageCount = lastTaskIndex - firstTaskIndex + 1; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 295 * @param {!WebInspector.TimelineModel} model | 267 * @param {!WebInspector.TimelineModel} model |
| 296 * @return {string} | 268 * @return {string} |
| 297 */ | 269 */ |
| 298 WebInspector.TimelineUIUtils.recordTitle = function(record, model) | 270 WebInspector.TimelineUIUtils.recordTitle = function(record, model) |
| 299 { | 271 { |
| 300 var recordData = record.data(); | 272 var recordData = record.data(); |
| 301 if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp) | 273 if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp) |
| 302 return recordData["message"]; | 274 return recordData["message"]; |
| 303 if (record.type() === WebInspector.TimelineModel.RecordType.JSFrame) | 275 if (record.type() === WebInspector.TimelineModel.RecordType.JSFrame) |
| 304 return recordData["functionName"]; | 276 return recordData["functionName"]; |
| 305 if (WebInspector.TimelineUIUtils.isEventDivider(record)) { | 277 if (WebInspector.TimelineUIUtilsImpl.isEventDivider(record)) { |
| 306 var startTime = Number.millisToString(record.startTime() - model.minimum
RecordTime()); | 278 var startTime = Number.millisToString(record.startTime() - model.minimum
RecordTime()); |
| 307 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re
cordStyle(record).title, startTime, true); | 279 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re
cordStyle(record).title, startTime, true); |
| 308 } | 280 } |
| 309 return WebInspector.TimelineUIUtils.recordStyle(record).title; | 281 return WebInspector.TimelineUIUtils.recordStyle(record).title; |
| 310 } | 282 } |
| 311 | 283 |
| 312 /** | 284 /** |
| 313 * @param {!Object} total | 285 * @param {!Object} total |
| 314 * @param {!Object} addend | 286 * @param {!Object} addend |
| 315 */ | 287 */ |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 for (var i = 0; i < stackTrace.length; ++i) { | 660 for (var i = 0; i < stackTrace.length; ++i) { |
| 689 var stackFrame = stackTrace[i]; | 661 var stackFrame = stackTrace[i]; |
| 690 var row = stackTraceElement.createChild("div"); | 662 var row = stackTraceElement.createChild("div"); |
| 691 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); | 663 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); |
| 692 row.createTextChild(" @ "); | 664 row.createTextChild(" @ "); |
| 693 var urlElement = this._linkifier.linkifyLocation(this._target, stack
Frame.url, stackFrame.lineNumber - 1); | 665 var urlElement = this._linkifier.linkifyLocation(this._target, stack
Frame.url, stackFrame.lineNumber - 1); |
| 694 row.appendChild(urlElement); | 666 row.appendChild(urlElement); |
| 695 } | 667 } |
| 696 } | 668 } |
| 697 } | 669 } |
| OLD | NEW |