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 <memory> | 7 #include <memory> |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 timer_(TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state), | 59 timer_(TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, script_state), |
60 this, | 60 this, |
61 &SetSinkIdResolver::TimerFired) {} | 61 &SetSinkIdResolver::TimerFired) {} |
62 | 62 |
63 void SetSinkIdResolver::StartAsync() { | 63 void SetSinkIdResolver::StartAsync() { |
64 timer_.StartOneShot(0, BLINK_FROM_HERE); | 64 timer_.StartOneShot(0, BLINK_FROM_HERE); |
65 } | 65 } |
66 | 66 |
67 void SetSinkIdResolver::TimerFired(TimerBase* timer) { | 67 void SetSinkIdResolver::TimerFired(TimerBase* timer) { |
68 ExecutionContext* context = GetExecutionContext(); | 68 ExecutionContext* context = GetExecutionContext(); |
69 ASSERT(context && context->IsDocument()); | 69 DCHECK(context); |
| 70 DCHECK(context->IsDocument()); |
70 std::unique_ptr<SetSinkIdCallbacks> callbacks = | 71 std::unique_ptr<SetSinkIdCallbacks> callbacks = |
71 WTF::WrapUnique(new SetSinkIdCallbacks(this, *element_, sink_id_)); | 72 WTF::WrapUnique(new SetSinkIdCallbacks(this, *element_, sink_id_)); |
72 WebMediaPlayer* web_media_player = element_->GetWebMediaPlayer(); | 73 WebMediaPlayer* web_media_player = element_->GetWebMediaPlayer(); |
73 if (web_media_player) { | 74 if (web_media_player) { |
74 // Using release() to transfer ownership because |webMediaPlayer| is a | 75 // Using release() to transfer ownership because |webMediaPlayer| is a |
75 // platform object that takes raw pointers. | 76 // platform object that takes raw pointers. |
76 web_media_player->SetSinkId(sink_id_, | 77 web_media_player->SetSinkId(sink_id_, |
77 WebSecurityOrigin(context->GetSecurityOrigin()), | 78 WebSecurityOrigin(context->GetSecurityOrigin()), |
78 callbacks.release()); | 79 callbacks.release()); |
79 } else { | 80 } else { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ProvideTo(element, SupplementName(), supplement); | 142 ProvideTo(element, SupplementName(), supplement); |
142 } | 143 } |
143 return *supplement; | 144 return *supplement; |
144 } | 145 } |
145 | 146 |
146 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) { | 147 DEFINE_TRACE(HTMLMediaElementAudioOutputDevice) { |
147 Supplement<HTMLMediaElement>::Trace(visitor); | 148 Supplement<HTMLMediaElement>::Trace(visitor); |
148 } | 149 } |
149 | 150 |
150 } // namespace blink | 151 } // namespace blink |
OLD | NEW |