OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 // static | 418 // static |
419 double PerformanceBase::clampTimeResolution(double timeSeconds) | 419 double PerformanceBase::clampTimeResolution(double timeSeconds) |
420 { | 420 { |
421 const double resolutionSeconds = 0.000005; | 421 const double resolutionSeconds = 0.000005; |
422 return floor(timeSeconds / resolutionSeconds) * resolutionSeconds; | 422 return floor(timeSeconds / resolutionSeconds) * resolutionSeconds; |
423 } | 423 } |
424 | 424 |
425 double PerformanceBase::now() const | 425 DOMHighResTimeStamp PerformanceBase::monotonicTimeToDOMHighResTimeStamp(double m
onotonicTime) const |
426 { | 426 { |
427 // Avoid exposing raw platform timestamps. | 427 // Avoid exposing raw platform timestamps. |
428 if (m_timeOrigin == 0.0) | 428 if (m_timeOrigin == 0.0) |
429 return 0.0; | 429 return 0.0; |
430 | 430 |
431 double nowSeconds = monotonicallyIncreasingTime() - m_timeOrigin; | 431 double timeInSeconds = monotonicTime - m_timeOrigin; |
432 return 1000.0 * clampTimeResolution(nowSeconds); | 432 return convertSecondsToDOMHighResTimeStamp(clampTimeResolution(timeInSeconds
)); |
| 433 } |
| 434 |
| 435 DOMHighResTimeStamp PerformanceBase::now() const |
| 436 { |
| 437 return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime()); |
433 } | 438 } |
434 | 439 |
435 DEFINE_TRACE(PerformanceBase) | 440 DEFINE_TRACE(PerformanceBase) |
436 { | 441 { |
437 visitor->trace(m_frameTimingBuffer); | 442 visitor->trace(m_frameTimingBuffer); |
438 visitor->trace(m_resourceTimingBuffer); | 443 visitor->trace(m_resourceTimingBuffer); |
439 visitor->trace(m_userTiming); | 444 visitor->trace(m_userTiming); |
440 visitor->trace(m_observers); | 445 visitor->trace(m_observers); |
441 visitor->trace(m_activeObservers); | 446 visitor->trace(m_activeObservers); |
442 visitor->trace(m_suspendedObservers); | 447 visitor->trace(m_suspendedObservers); |
443 RefCountedGarbageCollectedEventTargetWithInlineData<PerformanceBase>::trace(
visitor); | 448 RefCountedGarbageCollectedEventTargetWithInlineData<PerformanceBase>::trace(
visitor); |
444 } | 449 } |
445 | 450 |
446 } // namespace blink | 451 } // namespace blink |
OLD | NEW |