| 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/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting); | 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting); |
| 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
| 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
| 70 | 70 |
| 71 DECLARE_VIRTUAL_TRACE(); | 71 DECLARE_VIRTUAL_TRACE(); |
| 72 DECLARE_VIRTUAL_TRACE_WRAPPERS(); | 72 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 friend class V8RemotePlayback; | 75 friend class V8RemotePlayback; |
| 76 friend class InternalsRemotePlayback; |
| 76 friend class RemotePlaybackTest; | 77 friend class RemotePlaybackTest; |
| 77 | 78 |
| 78 explicit RemotePlayback(ScriptState*, HTMLMediaElement&); | 79 explicit RemotePlayback(ScriptState*, HTMLMediaElement&); |
| 79 | 80 |
| 80 // Calls the specified availability callback with the current availability. | 81 // Calls the specified availability callback with the current availability. |
| 81 // Need a void() method to post it as a task. | 82 // Need a void() method to post it as a task. |
| 82 void notifyInitialAvailability(int callbackId); | 83 void notifyInitialAvailability(int callbackId); |
| 83 | 84 |
| 84 // WebRemotePlaybackClient implementation. | 85 // WebRemotePlaybackClient implementation. |
| 85 void stateChanged(WebRemotePlaybackState) override; | 86 void stateChanged(WebRemotePlaybackState) override; |
| 86 void availabilityChanged(bool available) override; | 87 void availabilityChanged(bool available) override; |
| 87 void promptCancelled() override; | 88 void promptCancelled() override; |
| 88 | 89 |
| 89 // Prevent v8 from garbage collecting the availability callbacks. | 90 // Prevent v8 from garbage collecting the availability callbacks. |
| 90 // TODO(avayvod): remove when crbug.com/468240 is fixed and the references | 91 // TODO(avayvod): remove when crbug.com/468240 is fixed and the references |
| 91 // are maintained automatically. | 92 // are maintained automatically. |
| 92 void setV8ReferencesForCallbacks(v8::Isolate*, | 93 void setV8ReferencesForCallbacks(v8::Isolate*, |
| 93 const v8::Persistent<v8::Object>& wrapper); | 94 const v8::Persistent<v8::Object>& wrapper); |
| 94 | 95 |
| 96 void setIsLowEndDeviceForTesting(bool isLowEndDevice) { |
| 97 m_isLowEndDevice = isLowEndDevice; |
| 98 } |
| 99 |
| 95 RefPtr<ScriptState> m_scriptState; | 100 RefPtr<ScriptState> m_scriptState; |
| 96 WebRemotePlaybackState m_state; | 101 WebRemotePlaybackState m_state; |
| 97 bool m_availability; | 102 bool m_availability; |
| 98 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> | 103 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> |
| 99 m_availabilityCallbacks; | 104 m_availabilityCallbacks; |
| 100 Member<HTMLMediaElement> m_mediaElement; | 105 Member<HTMLMediaElement> m_mediaElement; |
| 101 Member<ScriptPromiseResolver> m_promptPromiseResolver; | 106 Member<ScriptPromiseResolver> m_promptPromiseResolver; |
| 107 bool m_isLowEndDevice; |
| 102 }; | 108 }; |
| 103 | 109 |
| 104 } // namespace blink | 110 } // namespace blink |
| 105 | 111 |
| 106 #endif // RemotePlayback_h | 112 #endif // RemotePlayback_h |
| OLD | NEW |