Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
| 4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 else if (request.cached()) | 302 else if (request.cached()) |
| 303 tooltip = WebInspector.NetworkTimeCalculator._fromCacheFormat.format (tooltip); | 303 tooltip = WebInspector.NetworkTimeCalculator._fromCacheFormat.format (tooltip); |
| 304 return {left: leftLabel, right: rightLabel, tooltip: tooltip}; | 304 return {left: leftLabel, right: rightLabel, tooltip: tooltip}; |
| 305 }, | 305 }, |
| 306 | 306 |
| 307 /** | 307 /** |
| 308 * @param {!WebInspector.NetworkRequest} request | 308 * @param {!WebInspector.NetworkRequest} request |
| 309 */ | 309 */ |
| 310 updateBoundaries: function(request) | 310 updateBoundaries: function(request) |
| 311 { | 311 { |
| 312 var lowerBound; | 312 var lowerBound = this._lowerBound(request); |
| 313 if (this.startAtZero) | |
| 314 lowerBound = 0; | |
| 315 else | |
| 316 lowerBound = this._lowerBound(request); | |
| 317 | |
| 318 if (lowerBound !== -1 && (typeof this._minimumBoundary === "undefined" | | lowerBound < this._minimumBoundary)) { | |
| 319 this._minimumBoundary = lowerBound; | |
| 320 this._boundaryChanged(); | |
| 321 } | |
| 322 | |
| 323 var upperBound = this._upperBound(request); | 313 var upperBound = this._upperBound(request); |
| 324 if (upperBound !== -1 && (typeof this._maximumBoundary === "undefined" | | upperBound > this._maximumBoundary)) { | 314 if (lowerBound !== -1 || this.startAtZero) |
| 325 this._maximumBoundary = upperBound; | 315 this._updateBoundariesWithTimestamp(this.startAtZero ? 0 : lowerBoun d); |
| 326 this._boundaryChanged(); | 316 if (upperBound !== -1) |
| 327 } | 317 this._updateBoundariesWithTimestamp(upperBound); |
| 328 }, | 318 }, |
| 329 | 319 |
| 330 /** | 320 /** |
| 321 * @param {number} timestamp | |
| 322 */ | |
| 323 _updateBoundariesWithTimestamp: function(timestamp) | |
|
yurys
2015/06/11 15:33:36
_extendBoundariesToIncludeTimestamp
alph
2015/06/11 16:35:00
Done.
| |
| 324 { | |
| 325 if (typeof this._minimumBoundary === "undefined" || typeof this._maximum Boundary === "undefined") { | |
| 326 this._minimumBoundary = timestamp; | |
| 327 this._maximumBoundary = timestamp + 1; | |
| 328 } else { | |
| 329 this._minimumBoundary = Math.min(timestamp, this._minimumBoundary); | |
| 330 this._maximumBoundary = Math.max(timestamp, this._minimumBoundary + 1, this._maximumBoundary); | |
| 331 } | |
| 332 this._boundaryChanged(); | |
|
yurys
2015/06/11 15:33:36
This call can be done once in updateBoundaries.
alph
2015/06/11 16:35:00
Done.
| |
| 333 }, | |
| 334 | |
| 335 /** | |
| 331 * @param {!WebInspector.NetworkRequest} request | 336 * @param {!WebInspector.NetworkRequest} request |
| 332 * @return {number} | 337 * @return {number} |
| 333 */ | 338 */ |
| 334 _lowerBound: function(request) | 339 _lowerBound: function(request) |
| 335 { | 340 { |
| 336 return 0; | 341 return 0; |
| 337 }, | 342 }, |
| 338 | 343 |
| 339 /** | 344 /** |
| 340 * @param {!WebInspector.NetworkRequest} request | 345 * @param {!WebInspector.NetworkRequest} request |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 * @param {!WebInspector.NetworkRequest} request | 423 * @param {!WebInspector.NetworkRequest} request |
| 419 * @return {number} | 424 * @return {number} |
| 420 */ | 425 */ |
| 421 _upperBound: function(request) | 426 _upperBound: function(request) |
| 422 { | 427 { |
| 423 return request.duration; | 428 return request.duration; |
| 424 }, | 429 }, |
| 425 | 430 |
| 426 __proto__: WebInspector.NetworkTimeCalculator.prototype | 431 __proto__: WebInspector.NetworkTimeCalculator.prototype |
| 427 } | 432 } |
| OLD | NEW |