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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineUIUtils.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 /* 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 12 matching lines...) Expand all
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 /** 32 /**
33 * @constructor
33 */ 34 */
34 WebInspector.TimelineUIUtils = function() { } 35 WebInspector.TimelineUIUtils = function() { }
35 36
37 WebInspector.TimelineUIUtils.prototype = {
38 /**
39 * @param {!WebInspector.TimelineModel.Record} record
40 * @return {boolean}
41 */
42 isBeginFrame: function(record)
43 {
44 throw new Error("Not implemented.");
45 },
46 /**
47 * @param {!WebInspector.TimelineModel.Record} record
48 * @return {boolean}
49 */
50 isProgram: function(record)
51 {
52 throw new Error("Not implemented.");
53 },
54 /**
55 * @param {string} recordType
56 * @return {boolean}
57 */
58 isCoalescable: function(recordType)
59 {
60 throw new Error("Not implemented.");
61 },
62 /**
63 * @param {!WebInspector.TimelineModel.Record} record
64 * @return {?Object}
65 */
66 countersForRecord: function(record)
67 {
68 throw new Error("Not implemented.");
69 },
70 /**
71 * @param {!WebInspector.TimelineModel.Record} record
72 * @return {?Object}
73 */
74 highlightQuadForRecord: function(record)
75 {
76 throw new Error("Not implemented.");
77 }
78 }
79
36 /** 80 /**
37 * @return {!Object.<string, !WebInspector.TimelineCategory>} 81 * @return {!Object.<string, !WebInspector.TimelineCategory>}
38 */ 82 */
39 WebInspector.TimelineUIUtils.categories = function() 83 WebInspector.TimelineUIUtils.categories = function()
40 { 84 {
41 if (WebInspector.TimelineUIUtils._categories) 85 if (WebInspector.TimelineUIUtils._categories)
42 return WebInspector.TimelineUIUtils._categories; 86 return WebInspector.TimelineUIUtils._categories;
43 WebInspector.TimelineUIUtils._categories = { 87 WebInspector.TimelineUIUtils._categories = {
44 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIStr ing("Loading"), 0, "hsl(214, 53%, 58%)", "hsl(214, 67%, 90%)", "hsl(214, 67%, 74 %)", "hsl(214, 67%, 66%)"), 88 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIStr ing("Loading"), 0, "hsl(214, 53%, 58%)", "hsl(214, 67%, 90%)", "hsl(214, 67%, 74 %)", "hsl(214, 67%, 66%)"),
45 scripting: new WebInspector.TimelineCategory("scripting", WebInspector.U IString("Scripting"), 1, "hsl(43, 90%, 45%)", "hsl(43, 83%, 90%)", "hsl(43, 83%, 72%)", "hsl(43, 83%, 64%) "), 89 scripting: new WebInspector.TimelineCategory("scripting", WebInspector.U IString("Scripting"), 1, "hsl(43, 90%, 45%)", "hsl(43, 83%, 90%)", "hsl(43, 83%, 72%)", "hsl(43, 83%, 64%) "),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 recordStyles[recordTypes.WebSocketCreate] = { title: WebInspector.UIString(" Create WebSocket"), category: categories["scripting"] }; 148 recordStyles[recordTypes.WebSocketCreate] = { title: WebInspector.UIString(" Create WebSocket"), category: categories["scripting"] };
105 recordStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspec tor.UIString("Send WebSocket Handshake"), category: categories["scripting"] }; 149 recordStyles[recordTypes.WebSocketSendHandshakeRequest] = { title: WebInspec tor.UIString("Send WebSocket Handshake"), category: categories["scripting"] };
106 recordStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebIn spector.UIString("Receive WebSocket Handshake"), category: categories["scripting "] }; 150 recordStyles[recordTypes.WebSocketReceiveHandshakeResponse] = { title: WebIn spector.UIString("Receive WebSocket Handshake"), category: categories["scripting "] };
107 recordStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString( "Destroy WebSocket"), category: categories["scripting"] }; 151 recordStyles[recordTypes.WebSocketDestroy] = { title: WebInspector.UIString( "Destroy WebSocket"), category: categories["scripting"] };
108 recordStyles[recordTypes.EmbedderCallback] = { title: WebInspector.UIString( "Embedder Callback"), category: categories["scripting"] }; 152 recordStyles[recordTypes.EmbedderCallback] = { title: WebInspector.UIString( "Embedder Callback"), category: categories["scripting"] };
109 153
110 WebInspector.TimelineUIUtils._recordStylesMap = recordStyles; 154 WebInspector.TimelineUIUtils._recordStylesMap = recordStyles;
111 return recordStyles; 155 return recordStyles;
112 } 156 }
113 157
114 WebInspector.TimelineUIUtils.coalescableRecordTypes = {};
115 WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.R ecordType.Layout] = 1;
116 WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.R ecordType.Paint] = 1;
117 WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.R ecordType.Rasterize] = 1;
118 WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.R ecordType.DecodeImage] = 1;
119 WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.R ecordType.ResizeImage] = 1;
120
121 /** 158 /**
122 * @param {!WebInspector.TimelineModel.Record} record 159 * @param {!WebInspector.TimelineModel.Record} record
123 * @return {!{title: string, category: !WebInspector.TimelineCategory}} 160 * @return {!{title: string, category: !WebInspector.TimelineCategory}}
124 */ 161 */
125 WebInspector.TimelineUIUtils.recordStyle = function(record) 162 WebInspector.TimelineUIUtils.recordStyle = function(record)
126 { 163 {
127 return WebInspector.TimelineUIUtils.styleForTimelineEvent(record.type()); 164 return WebInspector.TimelineUIUtils.styleForTimelineEvent(record.type());
128 } 165 }
129 166
130 /** 167 /**
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 for (var i = 0; i < stackTrace.length; ++i) { 1015 for (var i = 0; i < stackTrace.length; ++i) {
979 var stackFrame = stackTrace[i]; 1016 var stackFrame = stackTrace[i];
980 var row = stackTraceElement.createChild("div"); 1017 var row = stackTraceElement.createChild("div");
981 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 1018 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
982 row.createTextChild(" @ "); 1019 row.createTextChild(" @ ");
983 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1); 1020 var urlElement = this._linkifier.linkifyLocation(this._target, stack Frame.url, stackFrame.lineNumber - 1);
984 row.appendChild(urlElement); 1021 row.appendChild(urlElement);
985 } 1022 }
986 } 1023 }
987 } 1024 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698