OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 _update: function() | 90 _update: function() |
91 { | 91 { |
92 delete this._refreshTimeout; | 92 delete this._refreshTimeout; |
93 | 93 |
94 this._overviewCalculator.setWindow(this._model.minimumRecordTime(), this ._model.maximumRecordTime()); | 94 this._overviewCalculator.setWindow(this._model.minimumRecordTime(), this ._model.maximumRecordTime()); |
95 this._overviewCalculator.setDisplayWindow(0, this._overviewGrid.clientWi dth()); | 95 this._overviewCalculator.setDisplayWindow(0, this._overviewGrid.clientWi dth()); |
96 if (this._overviewControl) | 96 if (this._overviewControl) |
97 this._overviewControl.update(); | 97 this._overviewControl.update(); |
98 this._overviewGrid.updateDividers(this._overviewCalculator); | 98 this._overviewGrid.updateDividers(this._overviewCalculator); |
99 this._updateEventDividers(); | 99 this._updateEventDividers(); |
100 this._updateWindow(); | |
pfeldman
2014/03/04 06:26:52
This is strange since window has not changed. We s
| |
100 }, | 101 }, |
101 | 102 |
102 _updateEventDividers: function() | 103 _updateEventDividers: function() |
103 { | 104 { |
104 var records = this._eventDividers; | 105 var records = this._eventDividers; |
105 this._overviewGrid.removeEventDividers(); | 106 this._overviewGrid.removeEventDividers(); |
106 var dividers = []; | 107 var dividers = []; |
107 for (var i = 0; i < records.length; ++i) { | 108 for (var i = 0; i < records.length; ++i) { |
108 var record = records[i]; | 109 var record = records[i]; |
109 var positions = this._overviewCalculator.computeBarGraphPercentages( record); | 110 var positions = this._overviewCalculator.computeBarGraphPercentages( record); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 }, | 146 }, |
146 | 147 |
147 /** | 148 /** |
148 * @param {!WebInspector.Event} event | 149 * @param {!WebInspector.Event} event |
149 */ | 150 */ |
150 _onWindowChanged: function(event) | 151 _onWindowChanged: function(event) |
151 { | 152 { |
152 if (this._muteOnWindowChanged) | 153 if (this._muteOnWindowChanged) |
153 return; | 154 return; |
154 var windowTimes = this._overviewControl.windowTimes(this._overviewGrid.w indowLeft(), this._overviewGrid.windowRight()); | 155 var windowTimes = this._overviewControl.windowTimes(this._overviewGrid.w indowLeft(), this._overviewGrid.windowRight()); |
156 this._windowStartTime = windowTimes.startTime; | |
pfeldman
2014/03/04 06:26:52
These three lines should be extracted (they are us
| |
157 this._windowEndTime = windowTimes.endTime; | |
155 this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.W indowChanged, windowTimes); | 158 this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.W indowChanged, windowTimes); |
156 }, | 159 }, |
157 | 160 |
158 /** | 161 /** |
159 * @param {number} startTime | 162 * @param {number} startTime |
160 * @param {number} endTime | 163 * @param {number} endTime |
161 */ | 164 */ |
162 requestWindowTimes: function(startTime, endTime) | 165 requestWindowTimes: function(startTime, endTime) |
163 { | 166 { |
164 if (startTime === this._windowStartTime && endTime === this._windowEndTi me) | 167 if (startTime === this._windowStartTime && endTime === this._windowEndTi me) |
165 return; | 168 return; |
166 this._windowStartTime = startTime; | 169 this._windowStartTime = startTime; |
167 this._windowEndTime = endTime; | 170 this._windowEndTime = endTime; |
168 var windowBoundaries = this._overviewControl.windowBoundaries(startTime, endTime); | 171 this._updateWindow(); |
172 this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.W indowChanged, { startTime: startTime, endTime: endTime }); | |
173 }, | |
174 | |
175 _updateWindow: function() | |
176 { | |
177 var windowBoundaries = this._overviewControl.windowBoundaries(this._wind owStartTime, this._windowEndTime); | |
169 this._muteOnWindowChanged = true; | 178 this._muteOnWindowChanged = true; |
170 this._overviewGrid.setWindow(windowBoundaries.left, windowBoundaries.rig ht); | 179 this._overviewGrid.setWindow(windowBoundaries.left, windowBoundaries.rig ht); |
171 this._overviewGrid.setResizeEnabled(!!this._model.records().length); | 180 this._overviewGrid.setResizeEnabled(!!this._model.records().length); |
172 this._muteOnWindowChanged = false; | 181 this._muteOnWindowChanged = false; |
173 | |
174 this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.W indowChanged, { startTime: startTime, endTime: endTime }); | |
175 }, | 182 }, |
176 | 183 |
177 _scheduleRefresh: function() | 184 _scheduleRefresh: function() |
178 { | 185 { |
179 if (this._refreshTimeout) | 186 if (this._refreshTimeout) |
180 return; | 187 return; |
181 if (!this.isShowing()) | 188 if (!this.isShowing()) |
182 return; | 189 return; |
183 this._refreshTimeout = setTimeout(this._update.bind(this), 300); | 190 this._refreshTimeout = setTimeout(this._update.bind(this), 300); |
184 }, | 191 }, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 }, | 347 }, |
341 | 348 |
342 resetCanvas: function() | 349 resetCanvas: function() |
343 { | 350 { |
344 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 351 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
345 this._canvas.height = this.element.clientHeight * window.devicePixelRati o; | 352 this._canvas.height = this.element.clientHeight * window.devicePixelRati o; |
346 }, | 353 }, |
347 | 354 |
348 __proto__: WebInspector.View.prototype | 355 __proto__: WebInspector.View.prototype |
349 } | 356 } |
OLD | NEW |