OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.SplitView} | 33 * @extends {WebInspector.SplitView} |
34 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 34 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
35 * @param {!WebInspector.TimelinePresentationModel} presentationModel | 35 * @param {!WebInspector.TimelineModel} model |
36 */ | 36 */ |
37 WebInspector.MemoryStatistics = function(delegate, presentationModel) | 37 WebInspector.MemoryStatistics = function(delegate, model) |
38 { | 38 { |
39 WebInspector.SplitView.call(this, true, false); | 39 WebInspector.SplitView.call(this, true, false); |
40 | 40 |
41 this.element.id = "memory-graphs-container"; | 41 this.element.id = "memory-graphs-container"; |
42 | 42 |
43 this._delegate = delegate; | 43 this._delegate = delegate; |
44 this._presentationModel = presentationModel; | 44 this._model = model; |
45 this._calculator = new WebInspector.TimelineCalculator(this._presentationMod
el); | 45 this._calculator = new WebInspector.TimelineCalculator(this._model); |
46 | 46 |
47 this._graphsContainer = this.mainElement(); | 47 this._graphsContainer = this.mainElement(); |
48 this._createCurrentValuesBar(); | 48 this._createCurrentValuesBar(); |
49 this._canvasView = new WebInspector.ViewWithResizeCallback(this._resize.bind
(this)); | 49 this._canvasView = new WebInspector.ViewWithResizeCallback(this._resize.bind
(this)); |
50 this._canvasView.show(this._graphsContainer); | 50 this._canvasView.show(this._graphsContainer); |
51 this._canvasContainer = this._canvasView.element; | 51 this._canvasContainer = this._canvasView.element; |
52 this._canvasContainer.id = "memory-graphs-canvas-container"; | 52 this._canvasContainer.id = "memory-graphs-canvas-container"; |
53 this._canvas = this._canvasContainer.createChild("canvas"); | 53 this._canvas = this._canvasContainer.createChild("canvas"); |
54 this._canvas.id = "memory-counters-graph"; | 54 this._canvas.id = "memory-counters-graph"; |
55 | 55 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 { | 250 { |
251 throw new Error("Not implemented"); | 251 throw new Error("Not implemented"); |
252 }, | 252 }, |
253 | 253 |
254 _createAllCounters: function() | 254 _createAllCounters: function() |
255 { | 255 { |
256 throw new Error("Not implemented"); | 256 throw new Error("Not implemented"); |
257 }, | 257 }, |
258 | 258 |
259 /** | 259 /** |
260 * @param {!TimelineAgent.TimelineEvent} record | 260 * @param {!WebInspector.TimelineModel.Record} record |
261 * @param {!Array.<!WebInspector.TimelinePresentationModel.Record>} presenta
tionRecords | |
262 */ | 261 */ |
263 addRecord: function(record, presentationRecords) | 262 addRecord: function(record) |
264 { | 263 { |
265 throw new Error("Not implemented"); | 264 throw new Error("Not implemented"); |
266 }, | 265 }, |
267 | 266 |
268 reset: function() | 267 reset: function() |
269 { | 268 { |
270 for (var i = 0; i < this._counters.length; ++i) | 269 for (var i = 0; i < this._counters.length; ++i) |
271 this._counters[i].reset(); | 270 this._counters[i].reset(); |
272 | 271 |
273 for (var i = 0; i < this._counterUI.length; ++i) | 272 for (var i = 0; i < this._counterUI.length; ++i) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 }, | 336 }, |
338 | 337 |
339 /** | 338 /** |
340 * @param {number} time | 339 * @param {number} time |
341 */ | 340 */ |
342 _revealRecordAt: function(time) | 341 _revealRecordAt: function(time) |
343 { | 342 { |
344 var recordToReveal; | 343 var recordToReveal; |
345 function findRecordToReveal(record) | 344 function findRecordToReveal(record) |
346 { | 345 { |
347 if (record.containsTime(time)) { | 346 if (record.startTime <= time && time <= record.endTime) { |
348 recordToReveal = record; | 347 recordToReveal = record; |
349 return true; | 348 return true; |
350 } | 349 } |
351 // If there is no record containing the time than use the latest one
before that time. | 350 // If there is no record containing the time than use the latest one
before that time. |
352 if (!recordToReveal || record.endTime < time && recordToReveal.endTi
me < record.endTime) | 351 if (!recordToReveal || record.endTime < time && recordToReveal.endTi
me < record.endTime) |
353 recordToReveal = record; | 352 recordToReveal = record; |
354 return false; | 353 return false; |
355 } | 354 } |
356 WebInspector.TimelinePresentationModel.forAllRecords(this._presentationM
odel.rootRecord().children, null, findRecordToReveal); | 355 this._model.forAllRecords(null, findRecordToReveal); |
357 | |
358 this._delegate.selectRecord(recordToReveal); | 356 this._delegate.selectRecord(recordToReveal); |
359 }, | 357 }, |
360 | 358 |
361 /** | 359 /** |
362 * @param {?Event} event | 360 * @param {?Event} event |
363 */ | 361 */ |
364 _onMouseOut: function(event) | 362 _onMouseOut: function(event) |
365 { | 363 { |
366 delete this._markerXPosition; | 364 delete this._markerXPosition; |
367 this._clearCurrentValueAndMarker(); | 365 this._clearCurrentValueAndMarker(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 this._clippedHeight = height; | 411 this._clippedHeight = height; |
414 }, | 412 }, |
415 | 413 |
416 _clear: function() | 414 _clear: function() |
417 { | 415 { |
418 var ctx = this._canvas.getContext("2d"); | 416 var ctx = this._canvas.getContext("2d"); |
419 ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); | 417 ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
420 }, | 418 }, |
421 | 419 |
422 /** | 420 /** |
423 * @param {?WebInspector.TimelinePresentationModel.Record} record | 421 * @param {?WebInspector.TimelineModel.Record} record |
424 * @param {string=} regex | 422 * @param {string=} regex |
425 * @param {boolean=} selectRecord | 423 * @param {boolean=} selectRecord |
426 */ | 424 */ |
427 highlightSearchResult: function(record, regex, selectRecord) | 425 highlightSearchResult: function(record, regex, selectRecord) |
428 { | 426 { |
429 }, | 427 }, |
430 | 428 |
431 /** | 429 /** |
432 * @param {?WebInspector.TimelinePresentationModel.Record} record | 430 * @param {?WebInspector.TimelineModel.Record} record |
433 */ | 431 */ |
434 setSelectedRecord: function(record) | 432 setSelectedRecord: function(record) |
435 { | 433 { |
436 }, | 434 }, |
437 | 435 |
438 __proto__: WebInspector.SplitView.prototype | 436 __proto__: WebInspector.SplitView.prototype |
439 } | 437 } |
OLD | NEW |