Skip to content

Commit 3668489

Browse files
committed
Fixed some review comments.
1 parent d7ead8f commit 3668489

File tree

2 files changed

+30
-41
lines changed

2 files changed

+30
-41
lines changed

src/profiler/profiler_style.css

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@
6969
text-align: center;
7070
}
7171

72-
.profiler-status.profiler-no-status
73-
{
74-
display: none;
75-
}
76-
7772
.profiler-empty
7873
{
7974
text-align: center;
@@ -193,15 +188,15 @@
193188
inset 0 -1px rgba(0, 0, 0, 0.05);
194189
}
195190

196-
.profiler-event.expandable:hover
191+
.profiler-event-expandable:hover
197192
{
198193
box-shadow: inset 0 2px rgba(255, 255, 255, 0.09),
199194
inset 0 0 0 1px rgba(0, 0, 0, 0.07),
200195
inset 0 -1px rgba(0, 0, 0, 0.05),
201196
0 0 0 2px rgba(137, 173, 232, 0.5);
202197
}
203198

204-
.profiler-event.non-expandable:hover
199+
.profiler-event-non-expandable:hover
205200
{
206201
box-shadow: inset 0 2px rgba(255, 255, 255, 0.09),
207202
inset 0 0 0 1px rgba(0, 0, 0, 0.07),
@@ -214,11 +209,6 @@
214209
position: absolute;
215210
}
216211

217-
.profiler-event.selected
218-
{
219-
box-shadow: 0 0 0 3px #769fe1;
220-
}
221-
222212
.event-type-3
223213
{
224214
background-color: rgba(203, 190, 235, 0.6);

src/profiler/profiler_templates.js

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -124,30 +124,27 @@ var ProfilerTemplates = function()
124124
return prev + curr.time;
125125
}, 0);
126126
event_list.forEach(function(event, index) {
127-
if (index !== -1)
128-
{
129-
var self_time_amount = total_time
130-
? event.time / total_time * 100
131-
: 0;
132-
template.push(
127+
var self_time_amount = total_time
128+
? event.time / total_time * 100
129+
: 0;
130+
template.push(
131+
["div",
133132
["div",
134-
["div",
135-
["span",
136-
event_type_string_map[event.type],
137-
"class", "profiler-legend-label"
138-
],
139-
["span",
140-
this.format_time(event.time, 0),
141-
"class", "profiler-legend-time"
142-
],
143-
"class", "profiler-legend-row"
133+
["span",
134+
event_type_string_map[event.type],
135+
"class", "profiler-legend-label"
144136
],
145-
"class", "profiler-timeline-row" + (index % 2 ? "" : " even"),
146-
"data-event-type", String(event.type),
147-
"handler", "profiler-event"
148-
]
149-
);
150-
}
137+
["span",
138+
this.format_time(event.time, 0),
139+
"class", "profiler-legend-time"
140+
],
141+
"class", "profiler-legend-row"
142+
],
143+
"class", "profiler-timeline-row" + (index % 2 ? "" : " even"),
144+
"data-event-type", String(event.type),
145+
"handler", "profiler-event"
146+
]
147+
);
151148
}, this);
152149
return template;
153150
}
@@ -200,7 +197,7 @@ var ProfilerTemplates = function()
200197
var duration = Math.max(interval_end, MIN_DURATION);
201198
var ms_unit = (container_width - EVENT_SMALL_MIN_WIDTH) / duration;
202199

203-
template.extend(event_list.map(this._full_timeline_event.bind(this, 0, ms_unit)));
200+
template.extend(event_list.map(this._full_timeline_event.bind(this, ms_unit)));
204201
}
205202
return template;
206203
};
@@ -218,10 +215,11 @@ var ProfilerTemplates = function()
218215
return template;
219216
};
220217

221-
this._full_timeline_event = function(interval_start, ms_unit, event)
218+
this._full_timeline_event = function(ms_unit, event)
222219
{
223-
var width = Math.round((event.interval.end - event.interval.start) * ms_unit);
224-
var left = Math.round((event.interval.start - interval_start) * ms_unit);
220+
var duration = event.interval.end - event.interval.start;
221+
var width = Math.round(duration * ms_unit); // min-width is specified
222+
var left = Math.round((event.interval.start) * ms_unit);
225223
var column = this._order.indexOf(event.type);
226224
return (
227225
["div",
@@ -240,10 +238,10 @@ var ProfilerTemplates = function()
240238
var self_time_amount = duration
241239
? (event.time / duration * 100).toFixed(2)
242240
: 0;
243-
var width = Math.round(duration * ms_unit);
241+
var width = Math.round(duration * ms_unit); // min-width is specified
244242
var left = Math.round((event.interval.start - interval_start) * ms_unit);
245243
var column = this._order.indexOf(event.type);
246-
var is_expandable = this._expandables.indexOf(event.type) != -1 && event.childCount > 1;
244+
var is_expandable = this._expandables.contains(event.type) && event.childCount > 1;
247245
var color = this._get_color_for_type(event.type);
248246
return (
249247
["div",
@@ -263,7 +261,8 @@ var ProfilerTemplates = function()
263261
"transparent " + self_time_amount + "%);"
264262
),
265263
"id", "profiler-event-" + event.eventID,
266-
"class", "profiler-event event-type-" + event.type + (is_expandable ? " expandable" : " non-expandable"),
264+
"class", "profiler-event event-type-" + event.type +
265+
" profiler-event-" + (is_expandable ? "expandable" : "non-expandable"),
267266
"data-event-id", String(event.eventID),
268267
"data-event-type", String(event.type),
269268
"data-tooltip", "profiler-event"

0 commit comments

Comments
 (0)