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

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

Issue 344443007: Encapsulate implementation-specific timeline record handling in TimelineUIUtils (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
7 * @extends {WebInspector.TimelineUIUtils}
6 */ 8 */
7 WebInspector.TracingTimelineUIUtils = function() { } 9 WebInspector.TracingTimelineUIUtils = function()
10 {
11 WebInspector.TimelineUIUtils.call(this);
12 }
13
14 WebInspector.TracingTimelineUIUtils.prototype = {
15 /**
16 * @param {!WebInspector.TimelineModel.Record} record
17 * @return {boolean}
18 */
19 isBeginFrame: function(record)
20 {
21 return record.type() === WebInspector.TracingTimelineModel.RecordType.Be ginFrame;
22 },
23
24 /**
25 * @param {!WebInspector.TimelineModel.Record} record
26 * @return {boolean}
27 */
28 isProgram: function(record)
29 {
30 return record.type() === WebInspector.TracingTimelineModel.RecordType.Pr ogram;
31 },
32
33 /**
34 * @param {string} recordType
35 * @return {boolean}
36 */
37 isCoalescable: function(recordType)
38 {
39 return !!WebInspector.TracingTimelineUIUtils._coalescableRecordTypes[rec ordType];
40 },
41
42 /**
43 * @param {!WebInspector.TimelineModel.Record} record
44 * @return {?Object}
45 */
46 countersForRecord: function(record)
47 {
48 return record.type() === WebInspector.TracingTimelineModel.RecordType.Up dateCounters ? record.data() : null;
49 },
50
51 /**
52 * @param {!WebInspector.TimelineModel.Record} record
53 * @return {?Object}
54 */
55 highlightQuadForRecord: function(record)
56 {
57 return record.traceEvent().highlightQuad || null;
58 },
59
60 __proto__: WebInspector.TimelineUIUtils.prototype
61 }
8 62
9 /** 63 /**
10 * @constructor 64 * @constructor
11 * @param {string} title 65 * @param {string} title
12 * @param {!WebInspector.TimelineCategory} category 66 * @param {!WebInspector.TimelineCategory} category
13 */ 67 */
14 WebInspector.TimelineRecordStyle = function(title, category) 68 WebInspector.TimelineRecordStyle = function(title, category)
15 { 69 {
16 this.title = title; 70 this.title = title;
17 this.category = category; 71 this.category = category;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 eventStyles[recordTypes.WebSocketReceiveHandshakeResponse] = new WebInspecto r.TimelineRecordStyle(WebInspector.UIString("Receive WebSocket Handshake"), cate gories["scripting"]); 127 eventStyles[recordTypes.WebSocketReceiveHandshakeResponse] = new WebInspecto r.TimelineRecordStyle(WebInspector.UIString("Receive WebSocket Handshake"), cate gories["scripting"]);
74 eventStyles[recordTypes.WebSocketDestroy] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("Destroy WebSocket"), categories["scripting"]); 128 eventStyles[recordTypes.WebSocketDestroy] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("Destroy WebSocket"), categories["scripting"]);
75 eventStyles[recordTypes.EmbedderCallback] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("Embedder Callback"), categories["scripting"]); 129 eventStyles[recordTypes.EmbedderCallback] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("Embedder Callback"), categories["scripting"]);
76 eventStyles[recordTypes.DecodeImage] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Image Decode"), categories["painting"]); 130 eventStyles[recordTypes.DecodeImage] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Image Decode"), categories["painting"]);
77 eventStyles[recordTypes.ResizeImage] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Image Resize"), categories["painting"]); 131 eventStyles[recordTypes.ResizeImage] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Image Resize"), categories["painting"]);
78 132
79 WebInspector.TracingTimelineUIUtils._eventStylesMap = eventStyles; 133 WebInspector.TracingTimelineUIUtils._eventStylesMap = eventStyles;
80 return eventStyles; 134 return eventStyles;
81 } 135 }
82 136
83 WebInspector.TracingTimelineUIUtils.coalescableRecordTypes = {}; 137 WebInspector.TracingTimelineUIUtils._coalescableRecordTypes = {};
84 WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingT imelineModel.RecordType.Layout] = 1; 138 WebInspector.TracingTimelineUIUtils._coalescableRecordTypes[WebInspector.Tracing TimelineModel.RecordType.Layout] = 1;
85 WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingT imelineModel.RecordType.Paint] = 1; 139 WebInspector.TracingTimelineUIUtils._coalescableRecordTypes[WebInspector.Tracing TimelineModel.RecordType.Paint] = 1;
86 WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingT imelineModel.RecordType.Rasterize] = 1; 140 WebInspector.TracingTimelineUIUtils._coalescableRecordTypes[WebInspector.Tracing TimelineModel.RecordType.Rasterize] = 1;
87 WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingT imelineModel.RecordType.DecodeImage] = 1; 141 WebInspector.TracingTimelineUIUtils._coalescableRecordTypes[WebInspector.Tracing TimelineModel.RecordType.DecodeImage] = 1;
88 WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingT imelineModel.RecordType.ResizeImage] = 1; 142 WebInspector.TracingTimelineUIUtils._coalescableRecordTypes[WebInspector.Tracing TimelineModel.RecordType.ResizeImage] = 1;
89 143
90 /** 144 /**
91 * @param {!WebInspector.TracingModel.Event} event 145 * @param {!WebInspector.TracingModel.Event} event
92 * @return {!{title: string, category: !WebInspector.TimelineCategory}} 146 * @return {!{title: string, category: !WebInspector.TimelineCategory}}
93 */ 147 */
94 WebInspector.TracingTimelineUIUtils.eventStyle = function(event) 148 WebInspector.TracingTimelineUIUtils.eventStyle = function(event)
95 { 149 {
96 return WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name); 150 return WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name);
97 } 151 }
98 152
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 callback(); 596 callback();
543 return; 597 return;
544 } 598 }
545 var container = document.createElement("div"); 599 var container = document.createElement("div");
546 container.className = "image-preview-container"; 600 container.className = "image-preview-container";
547 var img = container.createChild("img"); 601 var img = container.createChild("img");
548 img.src = encodedBitmap; 602 img.src = encodedBitmap;
549 callback(container); 603 callback(container);
550 } 604 }
551 } 605 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TracingTimelineModel.js ('k') | Source/devtools/scripts/frontend_modules.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698