| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" | 5 #include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" | 10 #include "modules/audio_output_devices/AudioOutputDeviceClient.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static SetSinkIdResolver* create(ScriptState*, HTMLMediaElement&, const Stri
ng& sinkId); | 21 static SetSinkIdResolver* create(ScriptState*, HTMLMediaElement&, const Stri
ng& sinkId); |
| 22 ~SetSinkIdResolver() override = default; | 22 ~SetSinkIdResolver() override = default; |
| 23 void startAsync(); | 23 void startAsync(); |
| 24 | 24 |
| 25 DECLARE_VIRTUAL_TRACE(); | 25 DECLARE_VIRTUAL_TRACE(); |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 SetSinkIdResolver(ScriptState*, HTMLMediaElement&, const String& sinkId); | 28 SetSinkIdResolver(ScriptState*, HTMLMediaElement&, const String& sinkId); |
| 29 void timerFired(Timer<SetSinkIdResolver>*); | 29 void timerFired(Timer<SetSinkIdResolver>*); |
| 30 | 30 |
| 31 RefPtrWillBeMember<HTMLMediaElement> m_element; | 31 Member<HTMLMediaElement> m_element; |
| 32 String m_sinkId; | 32 String m_sinkId; |
| 33 Timer<SetSinkIdResolver> m_timer; | 33 Timer<SetSinkIdResolver> m_timer; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 SetSinkIdResolver* SetSinkIdResolver::create(ScriptState* scriptState, HTMLMedia
Element& element, const String& sinkId) | 36 SetSinkIdResolver* SetSinkIdResolver::create(ScriptState* scriptState, HTMLMedia
Element& element, const String& sinkId) |
| 37 { | 37 { |
| 38 SetSinkIdResolver* resolver = new SetSinkIdResolver(scriptState, element, si
nkId); | 38 SetSinkIdResolver* resolver = new SetSinkIdResolver(scriptState, element, si
nkId); |
| 39 resolver->suspendIfNeeded(); | 39 resolver->suspendIfNeeded(); |
| 40 resolver->keepAliveWhilePending(); | 40 resolver->keepAliveWhilePending(); |
| 41 return resolver; | 41 return resolver; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return promise; | 110 return promise; |
| 111 } | 111 } |
| 112 | 112 |
| 113 const char* HTMLMediaElementAudioOutputDevice::supplementName() | 113 const char* HTMLMediaElementAudioOutputDevice::supplementName() |
| 114 { | 114 { |
| 115 return "HTMLMediaElementAudioOutputDevice"; | 115 return "HTMLMediaElementAudioOutputDevice"; |
| 116 } | 116 } |
| 117 | 117 |
| 118 HTMLMediaElementAudioOutputDevice& HTMLMediaElementAudioOutputDevice::from(HTMLM
ediaElement& element) | 118 HTMLMediaElementAudioOutputDevice& HTMLMediaElementAudioOutputDevice::from(HTMLM
ediaElement& element) |
| 119 { | 119 { |
| 120 HTMLMediaElementAudioOutputDevice* supplement = static_cast<HTMLMediaElement
AudioOutputDevice*>(WillBeHeapSupplement<HTMLMediaElement>::from(element, supple
mentName())); | 120 HTMLMediaElementAudioOutputDevice* supplement = static_cast<HTMLMediaElement
AudioOutputDevice*>(HeapSupplement<HTMLMediaElement>::from(element, supplementNa
me())); |
| 121 if (!supplement) { | 121 if (!supplement) { |
| 122 supplement = new HTMLMediaElementAudioOutputDevice(); | 122 supplement = new HTMLMediaElementAudioOutputDevice(); |
| 123 provideTo(element, supplementName(), adoptPtrWillBeNoop(supplement)); | 123 provideTo(element, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 124 } | 124 } |
| 125 return *supplement; | 125 return *supplement; |
| 126 } | 126 } |
| 127 | 127 |
| 128 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) | 128 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) |
| 129 { | 129 { |
| 130 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); | 130 HeapSupplement<HTMLMediaElement>::trace(visitor); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace blink | 133 } // namespace blink |
| OLD | NEW |