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 double nowSeconds = monotonicallyIncreasingTime() - m_timeOrigin; | 427 double timeInSeconds = monotonicTime - m_timeOrigin; |
428 return 1000.0 * clampTimeResolution(nowSeconds); | 428 return convertSecondsToDOMHighResTimeStamp(clampTimeResolution(timeInSeconds )); |
429 } | |
430 | |
431 DOMHighResTimeStamp PerformanceBase::now() const | |
432 { | |
433 return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime()); // in milliseconds | |
Rick Byers
2015/09/29 15:57:59
nit: this comment seems redundant (it's clear you'
majidvp
2015/10/01 20:57:19
Done.
| |
429 } | 434 } |
430 | 435 |
431 DEFINE_TRACE(PerformanceBase) | 436 DEFINE_TRACE(PerformanceBase) |
432 { | 437 { |
433 visitor->trace(m_frameTimingBuffer); | 438 visitor->trace(m_frameTimingBuffer); |
434 visitor->trace(m_resourceTimingBuffer); | 439 visitor->trace(m_resourceTimingBuffer); |
435 visitor->trace(m_userTiming); | 440 visitor->trace(m_userTiming); |
436 visitor->trace(m_observers); | 441 visitor->trace(m_observers); |
437 visitor->trace(m_activeObservers); | 442 visitor->trace(m_activeObservers); |
438 visitor->trace(m_suspendedObservers); | 443 visitor->trace(m_suspendedObservers); |
439 RefCountedGarbageCollectedEventTargetWithInlineData<PerformanceBase>::trace( visitor); | 444 RefCountedGarbageCollectedEventTargetWithInlineData<PerformanceBase>::trace( visitor); |
440 } | 445 } |
441 | 446 |
442 } // namespace blink | 447 } // namespace blink |
OLD | NEW |