| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/animation/TimedItem.h" | 34 #include "core/animation/TimedItem.h" |
| 35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 class DocumentTimeline; | 39 class DocumentTimeline; |
| 40 | 40 |
| 41 class Player FINAL : public RefCounted<Player> { | 41 class Player FINAL : public RefCounted<Player> { |
| 42 | 42 |
| 43 public: | 43 public: |
| 44 ~Player(); |
| 44 static PassRefPtr<Player> create(DocumentTimeline*, TimedItem*); | 45 static PassRefPtr<Player> create(DocumentTimeline*, TimedItem*); |
| 45 | 46 |
| 46 // Returns whether this player is still current or in effect. | 47 // Returns whether this player is still current or in effect. |
| 47 bool update(); | 48 bool update(); |
| 48 double currentTime() const; | 49 double currentTime() const; |
| 49 void setCurrentTime(double); | 50 void setCurrentTime(double); |
| 50 bool paused() const { return !isNull(m_pauseStartTime); } | 51 bool paused() const { return !isNull(m_pauseStartTime); } |
| 51 void setPaused(bool); | 52 void setPaused(bool); |
| 52 double playbackRate() const { return m_playbackRate; } | 53 double playbackRate() const { return m_playbackRate; } |
| 53 void setPlaybackRate(double); | 54 void setPlaybackRate(double); |
| 54 double startTime() const { return m_startTime; } | 55 double startTime() const { return m_startTime; } |
| 55 double timeDrift() const; | 56 double timeDrift() const; |
| 57 DocumentTimeline* timeline() { return m_timeline; } |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 Player(DocumentTimeline*, TimedItem*); | 60 Player(DocumentTimeline*, TimedItem*); |
| 59 static double effectiveTime(double time) { return isNull(time) ? 0 : time; } | 61 static double effectiveTime(double time) { return isNull(time) ? 0 : time; } |
| 60 inline double pausedTimeDrift() const; | 62 inline double pausedTimeDrift() const; |
| 61 inline double currentTimeBeforeDrift() const; | 63 inline double currentTimeBeforeDrift() const; |
| 62 | 64 |
| 63 double m_pauseStartTime; | 65 double m_pauseStartTime; |
| 64 double m_playbackRate; | 66 double m_playbackRate; |
| 65 double m_timeDrift; | 67 double m_timeDrift; |
| 66 const double m_startTime; | 68 const double m_startTime; |
| 67 | 69 |
| 68 RefPtr<TimedItem> m_content; | 70 RefPtr<TimedItem> m_content; |
| 69 DocumentTimeline* const m_timeline; | 71 DocumentTimeline* const m_timeline; |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace | 74 } // namespace |
| 73 | 75 |
| 74 #endif | 76 #endif |
| OLD | NEW |