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

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

Issue 339493006: Move divider detection and creation onto TimelineUIUtils instance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.TimelineUIUtils} 7 * @extends {WebInspector.TimelineUIUtils}
8 */ 8 */
9 WebInspector.TimelineUIUtilsImpl = function() 9 WebInspector.TimelineUIUtilsImpl = function()
10 { 10 {
(...skipping 21 matching lines...) Expand all
32 * @param {string} recordType 32 * @param {string} recordType
33 * @return {boolean} 33 * @return {boolean}
34 */ 34 */
35 isCoalescable: function(recordType) 35 isCoalescable: function(recordType)
36 { 36 {
37 return !!WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[record Type]; 37 return !!WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[record Type];
38 }, 38 },
39 39
40 /** 40 /**
41 * @param {!WebInspector.TimelineModel.Record} record 41 * @param {!WebInspector.TimelineModel.Record} record
42 * @return {boolean}
43 */
44 isEventDivider: function(record)
45 {
46 return WebInspector.TimelineUIUtilsImpl.isEventDivider(record);
47 },
48
49 /**
50 * @param {!WebInspector.TimelineModel.Record} record
42 * @return {?Object} 51 * @return {?Object}
43 */ 52 */
44 countersForRecord: function(record) 53 countersForRecord: function(record)
45 { 54 {
46 return record.type() === WebInspector.TimelineModel.RecordType.UpdateCou nters ? record.data() : null; 55 return record.type() === WebInspector.TimelineModel.RecordType.UpdateCou nters ? record.data() : null;
47 }, 56 },
48 57
49 /** 58 /**
50 * @param {!WebInspector.TimelineModel.Record} record 59 * @param {!WebInspector.TimelineModel.Record} record
51 * @return {?Object} 60 * @return {?Object}
(...skipping 27 matching lines...) Expand all
79 * @param {!WebInspector.TimelineModel} model 88 * @param {!WebInspector.TimelineModel} model
80 * @param {!WebInspector.Linkifier} linkifier 89 * @param {!WebInspector.Linkifier} linkifier
81 * @param {function(!DocumentFragment)} callback 90 * @param {function(!DocumentFragment)} callback
82 * @param {boolean} loadedFromFile 91 * @param {boolean} loadedFromFile
83 */ 92 */
84 generateDetailsContent: function(record, model, linkifier, callback, loadedF romFile) 93 generateDetailsContent: function(record, model, linkifier, callback, loadedF romFile)
85 { 94 {
86 WebInspector.TimelineUIUtilsImpl.generateDetailsContent(record, model, l inkifier, callback, loadedFromFile); 95 WebInspector.TimelineUIUtilsImpl.generateDetailsContent(record, model, l inkifier, callback, loadedFromFile);
87 }, 96 },
88 97
98 /**
99 * @param {string} recordType
100 * @param {string=} title
101 * @return {!Element}
102 */
103 createEventDivider: function(recordType, title)
104 {
105 return WebInspector.TimelineUIUtilsImpl._createEventDivider(recordType, title);
106 },
107
89 __proto__: WebInspector.TimelineUIUtils.prototype 108 __proto__: WebInspector.TimelineUIUtils.prototype
90 } 109 }
91 110
92 111
93 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes = {}; 112 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes = {};
94 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.Layout] = 1; 113 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.Layout] = 1;
95 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.Paint] = 1; 114 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.Paint] = 1;
96 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.Rasterize] = 1; 115 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.Rasterize] = 1;
97 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.DecodeImage] = 1; 116 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.DecodeImage] = 1;
98 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.ResizeImage] = 1; 117 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo del.RecordType.ResizeImage] = 1;
99 118
100 119
101 /** 120 /**
102 * @param {!WebInspector.TimelineModel.Record} record 121 * @param {!WebInspector.TimelineModel.Record} record
122 * @return {boolean}
123 */
124 WebInspector.TimelineUIUtilsImpl.isEventDivider = function(record)
125 {
126 var recordTypes = WebInspector.TimelineModel.RecordType;
127 if (record.type() === recordTypes.TimeStamp)
128 return true;
129 if (record.type() === recordTypes.MarkFirstPaint)
130 return true;
131 if (record.type() === recordTypes.MarkDOMContent || record.type() === record Types.MarkLoad)
132 return record.data()["isMainFrame"];
133 return false;
134 }
135
136 /**
137 * @param {!WebInspector.TimelineModel.Record} record
103 * @param {!WebInspector.Linkifier} linkifier 138 * @param {!WebInspector.Linkifier} linkifier
104 * @param {boolean} loadedFromFile 139 * @param {boolean} loadedFromFile
105 * @return {?Node} 140 * @return {?Node}
106 */ 141 */
107 WebInspector.TimelineUIUtilsImpl.buildDetailsNode = function(record, linkifier, loadedFromFile) 142 WebInspector.TimelineUIUtilsImpl.buildDetailsNode = function(record, linkifier, loadedFromFile)
108 { 143 {
109 var details; 144 var details;
110 var detailsText; 145 var detailsText;
111 var recordData = record.data(); 146 var recordData = record.data();
112 switch (record.type()) { 147 switch (record.type()) {
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 465
431 if (record.warnings()) { 466 if (record.warnings()) {
432 var ul = document.createElement("ul"); 467 var ul = document.createElement("ul");
433 for (var i = 0; i < record.warnings().length; ++i) 468 for (var i = 0; i < record.warnings().length; ++i)
434 ul.createChild("li").textContent = record.warnings()[i]; 469 ul.createChild("li").textContent = record.warnings()[i];
435 contentHelper.appendElementRow(WebInspector.UIString("Warning"), ul); 470 contentHelper.appendElementRow(WebInspector.UIString("Warning"), ul);
436 } 471 }
437 fragment.appendChild(contentHelper.element); 472 fragment.appendChild(contentHelper.element);
438 return fragment; 473 return fragment;
439 } 474 }
475
476 /**
477 * @param {string} recordType
478 * @param {string=} title
479 * @return {!Element}
480 */
481 WebInspector.TimelineUIUtilsImpl._createEventDivider = function(recordType, titl e)
482 {
483 var eventDivider = document.createElement("div");
484 eventDivider.className = "resources-event-divider";
485 var recordTypes = WebInspector.TimelineModel.RecordType;
486
487 if (recordType === recordTypes.MarkDOMContent)
488 eventDivider.className += " resources-blue-divider";
489 else if (recordType === recordTypes.MarkLoad)
490 eventDivider.className += " resources-red-divider";
491 else if (recordType === recordTypes.MarkFirstPaint)
492 eventDivider.className += " resources-green-divider";
493 else if (recordType === recordTypes.TimeStamp)
494 eventDivider.className += " resources-orange-divider";
495 else if (recordType === recordTypes.BeginFrame)
496 eventDivider.className += " timeline-frame-divider";
497
498 if (title)
499 eventDivider.title = title;
500
501 return eventDivider;
502 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineUIUtils.js ('k') | Source/devtools/front_end/timeline/TimelineView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698