| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 573 } |
| 574 | 574 |
| 575 DOMHighResTimeStamp PerformanceBase::monotonicTimeToDOMHighResTimeStamp( | 575 DOMHighResTimeStamp PerformanceBase::monotonicTimeToDOMHighResTimeStamp( |
| 576 double timeOrigin, | 576 double timeOrigin, |
| 577 double monotonicTime) { | 577 double monotonicTime) { |
| 578 // Avoid exposing raw platform timestamps. | 578 // Avoid exposing raw platform timestamps. |
| 579 if (!monotonicTime || !timeOrigin) | 579 if (!monotonicTime || !timeOrigin) |
| 580 return 0.0; | 580 return 0.0; |
| 581 | 581 |
| 582 double timeInSeconds = monotonicTime - timeOrigin; | 582 double timeInSeconds = monotonicTime - timeOrigin; |
| 583 DCHECK_GE(timeInSeconds, 0); | 583 if (timeInSeconds < 0) |
| 584 return 0.0; |
| 584 return convertSecondsToDOMHighResTimeStamp( | 585 return convertSecondsToDOMHighResTimeStamp( |
| 585 clampTimeResolution(timeInSeconds)); | 586 clampTimeResolution(timeInSeconds)); |
| 586 } | 587 } |
| 587 | 588 |
| 588 DOMHighResTimeStamp PerformanceBase::monotonicTimeToDOMHighResTimeStamp( | 589 DOMHighResTimeStamp PerformanceBase::monotonicTimeToDOMHighResTimeStamp( |
| 589 double monotonicTime) const { | 590 double monotonicTime) const { |
| 590 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, monotonicTime); | 591 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, monotonicTime); |
| 591 } | 592 } |
| 592 | 593 |
| 593 DOMHighResTimeStamp PerformanceBase::now() const { | 594 DOMHighResTimeStamp PerformanceBase::now() const { |
| 594 return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime()); | 595 return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime()); |
| 595 } | 596 } |
| 596 | 597 |
| 597 DEFINE_TRACE(PerformanceBase) { | 598 DEFINE_TRACE(PerformanceBase) { |
| 598 visitor->trace(m_frameTimingBuffer); | 599 visitor->trace(m_frameTimingBuffer); |
| 599 visitor->trace(m_resourceTimingBuffer); | 600 visitor->trace(m_resourceTimingBuffer); |
| 600 visitor->trace(m_navigationTiming); | 601 visitor->trace(m_navigationTiming); |
| 601 visitor->trace(m_userTiming); | 602 visitor->trace(m_userTiming); |
| 602 visitor->trace(m_observers); | 603 visitor->trace(m_observers); |
| 603 visitor->trace(m_activeObservers); | 604 visitor->trace(m_activeObservers); |
| 604 visitor->trace(m_suspendedObservers); | 605 visitor->trace(m_suspendedObservers); |
| 605 EventTargetWithInlineData::trace(visitor); | 606 EventTargetWithInlineData::trace(visitor); |
| 606 } | 607 } |
| 607 | 608 |
| 608 } // namespace blink | 609 } // namespace blink |
| OLD | NEW |