Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RemotePlayback_h | 5 #ifndef RemotePlayback_h |
| 6 #define RemotePlayback_h | 6 #define RemotePlayback_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
| 10 #include "core/frame/DOMWindowProperty.h" | 10 #include "core/frame/DOMWindowProperty.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 12 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
| 13 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" | 13 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" |
| 14 #include "wtf/text/AtomicString.h" | 14 #include "wtf/text/AtomicString.h" |
| 15 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class ExecutionContext; | 19 class ExecutionContext; |
| 20 class HTMLMediaElement; | 20 class HTMLMediaElement; |
| 21 class LocalFrame; | 21 class LocalFrame; |
| 22 class RemotePlaybackAvailability; | 22 class RemotePlaybackAvailability; |
| 23 class ScriptPromiseResolver; | |
| 23 | 24 |
| 24 class RemotePlayback final | 25 class RemotePlayback final |
| 25 : public RefCountedGarbageCollectedEventTargetWithInlineData<RemotePlayback> | 26 : public RefCountedGarbageCollectedEventTargetWithInlineData<RemotePlayback> |
| 26 , public DOMWindowProperty | 27 , public DOMWindowProperty |
| 27 , private WebRemotePlaybackClient { | 28 , private WebRemotePlaybackClient { |
| 28 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RemotePlayback); | 29 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RemotePlayback); |
| 29 DEFINE_WRAPPERTYPEINFO(); | 30 DEFINE_WRAPPERTYPEINFO(); |
| 30 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback); | 31 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback); |
| 31 public: | 32 public: |
| 32 static RemotePlayback* create(HTMLMediaElement&); | 33 static RemotePlayback* create(HTMLMediaElement&); |
| 33 | 34 |
| 34 ~RemotePlayback() override = default; | 35 ~RemotePlayback() override = default; |
| 35 | 36 |
| 36 // EventTarget implementation. | 37 // EventTarget implementation. |
| 37 const WTF::AtomicString& interfaceName() const override; | 38 const WTF::AtomicString& interfaceName() const override; |
| 38 ExecutionContext* getExecutionContext() const override; | 39 ExecutionContext* getExecutionContext() const override; |
| 39 | 40 |
| 40 ScriptPromise getAvailability(ScriptState*); | 41 ScriptPromise getAvailability(ScriptState*); |
| 42 ScriptPromise connect(ScriptState*); | |
| 41 | 43 |
| 42 String state() const; | 44 String state() const; |
| 43 | 45 |
| 44 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 46 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
| 45 | 47 |
| 46 DECLARE_VIRTUAL_TRACE(); | 48 DECLARE_VIRTUAL_TRACE(); |
| 47 | 49 |
| 48 private: | 50 private: |
| 49 RemotePlayback(LocalFrame*, WebRemotePlaybackState, bool availability); | 51 explicit RemotePlayback(HTMLMediaElement&); |
| 50 | 52 |
| 51 void stateChanged(WebRemotePlaybackState) override; | 53 void stateChanged(WebRemotePlaybackState) override; |
| 52 void availabilityChanged(bool available) override; | 54 void availabilityChanged(bool available) override; |
| 53 | 55 |
| 54 WebRemotePlaybackState m_state; | 56 WebRemotePlaybackState m_state; |
| 55 bool m_availability; | 57 bool m_availability; |
| 56 HeapVector<Member<RemotePlaybackAvailability>> m_availabilityObjects; | 58 HeapVector<Member<RemotePlaybackAvailability>> m_availabilityObjects; |
| 59 RawPtrWillBeWeakMember<HTMLMediaElement> m_mediaElement; | |
|
philipj_slow
2016/03/24 07:31:57
Hmm, why weak? I guess that RawPtr is needed pre-O
mlamouri (slow - plz ping)
2016/03/24 10:47:06
+1. I believe oilpan will deal with the cycle:
htt
philipj_slow
2016/03/24 11:06:23
~HTMLMediaElement would be one way, or perhaps Wea
whywhat
2016/03/24 16:08:40
Sounds like if it's a Member in Oilpan world, it s
philipj_slow
2016/03/29 05:51:45
The trouble is that one can't really get the same
| |
| 60 HeapVector<Member<ScriptPromiseResolver>> m_connectPromiseResolvers; | |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 } // namespace blink | 63 } // namespace blink |
| 60 | 64 |
| 61 #endif // RemotePlayback_h | 65 #endif // RemotePlayback_h |
| OLD | NEW |