| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
| 33 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class Clock; | 37 class Clock; |
| 38 class ExceptionState; | 38 class ExceptionState; |
| 39 class ExecutionContext; | 39 class ExecutionContext; |
| 40 class GenericEventQueue; | 40 class GenericEventQueue; |
| 41 | 41 |
| 42 class MediaController FINAL : public RefCountedWillBeGarbageCollectedFinalized<M
ediaController>, public EventTargetWithInlineData { | 42 class MediaController final : public RefCountedWillBeGarbageCollectedFinalized<M
ediaController>, public EventTargetWithInlineData { |
| 43 DEFINE_WRAPPERTYPEINFO(); | 43 DEFINE_WRAPPERTYPEINFO(); |
| 44 REFCOUNTED_EVENT_TARGET(MediaController); | 44 REFCOUNTED_EVENT_TARGET(MediaController); |
| 45 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaController); | 45 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaController); |
| 46 public: | 46 public: |
| 47 static PassRefPtrWillBeRawPtr<MediaController> create(ExecutionContext*); | 47 static PassRefPtrWillBeRawPtr<MediaController> create(ExecutionContext*); |
| 48 virtual ~MediaController(); | 48 virtual ~MediaController(); |
| 49 | 49 |
| 50 void addMediaElement(HTMLMediaElement*); | 50 void addMediaElement(HTMLMediaElement*); |
| 51 void removeMediaElement(HTMLMediaElement*); | 51 void removeMediaElement(HTMLMediaElement*); |
| 52 | 52 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 enum PlaybackState { WAITING, PLAYING, ENDED }; | 81 enum PlaybackState { WAITING, PLAYING, ENDED }; |
| 82 const AtomicString& playbackState() const; | 82 const AtomicString& playbackState() const; |
| 83 | 83 |
| 84 bool isRestrained() const; | 84 bool isRestrained() const; |
| 85 bool isBlocked() const; | 85 bool isBlocked() const; |
| 86 | 86 |
| 87 #if !ENABLE(OILPAN) | 87 #if !ENABLE(OILPAN) |
| 88 void clearExecutionContext() { m_executionContext = nullptr; } | 88 void clearExecutionContext() { m_executionContext = nullptr; } |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 virtual void trace(Visitor*) OVERRIDE; | 91 virtual void trace(Visitor*) override; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 MediaController(ExecutionContext*); | 94 MediaController(ExecutionContext*); |
| 95 void reportControllerState(); | 95 void reportControllerState(); |
| 96 void updateReadyState(); | 96 void updateReadyState(); |
| 97 void updatePlaybackState(); | 97 void updatePlaybackState(); |
| 98 void updateMediaElements(); | 98 void updateMediaElements(); |
| 99 void bringElementUpToSpeed(HTMLMediaElement*); | 99 void bringElementUpToSpeed(HTMLMediaElement*); |
| 100 void scheduleEvent(const AtomicString& eventName); | 100 void scheduleEvent(const AtomicString& eventName); |
| 101 void clearPositionTimerFired(Timer<MediaController>*); | 101 void clearPositionTimerFired(Timer<MediaController>*); |
| 102 bool hasEnded() const; | 102 bool hasEnded() const; |
| 103 void scheduleTimeupdateEvent(); | 103 void scheduleTimeupdateEvent(); |
| 104 void timeupdateTimerFired(Timer<MediaController>*); | 104 void timeupdateTimerFired(Timer<MediaController>*); |
| 105 void startTimeupdateTimer(); | 105 void startTimeupdateTimer(); |
| 106 | 106 |
| 107 // EventTarget | 107 // EventTarget |
| 108 virtual const AtomicString& interfaceName() const OVERRIDE; | 108 virtual const AtomicString& interfaceName() const override; |
| 109 virtual ExecutionContext* executionContext() const OVERRIDE { return m_execu
tionContext; } | 109 virtual ExecutionContext* executionContext() const override { return m_execu
tionContext; } |
| 110 | 110 |
| 111 friend class HTMLMediaElement; | 111 friend class HTMLMediaElement; |
| 112 friend class MediaControllerEventListener; | 112 friend class MediaControllerEventListener; |
| 113 // FIXME: A MediaController should ideally keep an otherwise | 113 // FIXME: A MediaController should ideally keep an otherwise |
| 114 // unreferenced slaved media element alive. When Oilpan is | 114 // unreferenced slaved media element alive. When Oilpan is |
| 115 // enabled by default, consider making the hash set references | 115 // enabled by default, consider making the hash set references |
| 116 // strong to accomplish that. crbug.com/383072 | 116 // strong to accomplish that. crbug.com/383072 |
| 117 typedef WillBeHeapLinkedHashSet<RawPtrWillBeWeakMember<HTMLMediaElement> > M
ediaElementSequence; | 117 typedef WillBeHeapLinkedHashSet<RawPtrWillBeWeakMember<HTMLMediaElement> > M
ediaElementSequence; |
| 118 MediaElementSequence m_mediaElements; | 118 MediaElementSequence m_mediaElements; |
| 119 bool m_paused; | 119 bool m_paused; |
| 120 double m_defaultPlaybackRate; | 120 double m_defaultPlaybackRate; |
| 121 double m_volume; | 121 double m_volume; |
| 122 mutable double m_position; | 122 mutable double m_position; |
| 123 bool m_muted; | 123 bool m_muted; |
| 124 ReadyState m_readyState; | 124 ReadyState m_readyState; |
| 125 PlaybackState m_playbackState; | 125 PlaybackState m_playbackState; |
| 126 OwnPtrWillBeMember<GenericEventQueue> m_pendingEventsQueue; | 126 OwnPtrWillBeMember<GenericEventQueue> m_pendingEventsQueue; |
| 127 mutable Timer<MediaController> m_clearPositionTimer; | 127 mutable Timer<MediaController> m_clearPositionTimer; |
| 128 OwnPtr<Clock> m_clock; | 128 OwnPtr<Clock> m_clock; |
| 129 RawPtrWillBeWeakMember<ExecutionContext> m_executionContext; | 129 RawPtrWillBeWeakMember<ExecutionContext> m_executionContext; |
| 130 Timer<MediaController> m_timeupdateTimer; | 130 Timer<MediaController> m_timeupdateTimer; |
| 131 double m_previousTimeupdateTime; | 131 double m_previousTimeupdateTime; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace blink | 134 } // namespace blink |
| 135 | 135 |
| 136 #endif // MediaController_h | 136 #endif // MediaController_h |
| OLD | NEW |