| 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) | 313 var upperBound = this._upperBound(request); |
| 314 lowerBound = 0; | 314 var changed = false; |
| 315 else | 315 if (lowerBound !== -1 || this.startAtZero) |
| 316 lowerBound = this._lowerBound(request); | 316 changed = this._extendBoundariesToIncludeTimestamp(this.startAtZero
? 0 : lowerBound); |
| 317 | 317 if (upperBound !== -1) |
| 318 if (lowerBound !== -1 && (typeof this._minimumBoundary === "undefined" |
| lowerBound < this._minimumBoundary)) { | 318 changed = this._extendBoundariesToIncludeTimestamp(upperBound) || ch
anged; |
| 319 this._minimumBoundary = lowerBound; | 319 if (changed) |
| 320 this._boundaryChanged(); | 320 this._boundaryChanged(); |
| 321 } | |
| 322 | |
| 323 var upperBound = this._upperBound(request); | |
| 324 if (upperBound !== -1 && (typeof this._maximumBoundary === "undefined" |
| upperBound > this._maximumBoundary)) { | |
| 325 this._maximumBoundary = upperBound; | |
| 326 this._boundaryChanged(); | |
| 327 } | |
| 328 }, | 321 }, |
| 329 | 322 |
| 330 /** | 323 /** |
| 324 * @param {number} timestamp |
| 325 * @return {boolean} |
| 326 */ |
| 327 _extendBoundariesToIncludeTimestamp: function(timestamp) |
| 328 { |
| 329 var previousMinimumBoundary = this._minimumBoundary; |
| 330 var previousMaximumBoundary = this._maximumBoundary; |
| 331 if (typeof this._minimumBoundary === "undefined" || typeof this._maximum
Boundary === "undefined") { |
| 332 this._minimumBoundary = timestamp; |
| 333 this._maximumBoundary = timestamp + 1; |
| 334 } else { |
| 335 this._minimumBoundary = Math.min(timestamp, this._minimumBoundary); |
| 336 this._maximumBoundary = Math.max(timestamp, this._minimumBoundary +
1, this._maximumBoundary); |
| 337 } |
| 338 return previousMinimumBoundary !== this._minimumBoundary || previousMaxi
mumBoundary !== this._maximumBoundary; |
| 339 }, |
| 340 |
| 341 /** |
| 331 * @param {!WebInspector.NetworkRequest} request | 342 * @param {!WebInspector.NetworkRequest} request |
| 332 * @return {number} | 343 * @return {number} |
| 333 */ | 344 */ |
| 334 _lowerBound: function(request) | 345 _lowerBound: function(request) |
| 335 { | 346 { |
| 336 return 0; | 347 return 0; |
| 337 }, | 348 }, |
| 338 | 349 |
| 339 /** | 350 /** |
| 340 * @param {!WebInspector.NetworkRequest} request | 351 * @param {!WebInspector.NetworkRequest} request |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 * @param {!WebInspector.NetworkRequest} request | 429 * @param {!WebInspector.NetworkRequest} request |
| 419 * @return {number} | 430 * @return {number} |
| 420 */ | 431 */ |
| 421 _upperBound: function(request) | 432 _upperBound: function(request) |
| 422 { | 433 { |
| 423 return request.duration; | 434 return request.duration; |
| 424 }, | 435 }, |
| 425 | 436 |
| 426 __proto__: WebInspector.NetworkTimeCalculator.prototype | 437 __proto__: WebInspector.NetworkTimeCalculator.prototype |
| 427 } | 438 } |
| OLD | NEW |