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/mediastream/MediaDevices.h" | 5 #include "modules/mediastream/MediaDevices.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
66 MediaDevices* MediaDevices::create(ExecutionContext* context) { | 66 MediaDevices* MediaDevices::create(ExecutionContext* context) { |
67 MediaDevices* mediaDevices = new MediaDevices(context); | 67 MediaDevices* mediaDevices = new MediaDevices(context); |
68 mediaDevices->suspendIfNeeded(); | 68 mediaDevices->suspendIfNeeded(); |
69 return mediaDevices; | 69 return mediaDevices; |
70 } | 70 } |
71 | 71 |
72 MediaDevices::MediaDevices(ExecutionContext* context) | 72 MediaDevices::MediaDevices(ExecutionContext* context) |
73 : ActiveScriptWrappable(this), | 73 : ActiveScriptWrappable<MediaDevices>(this), |
74 SuspendableObject(context), | 74 SuspendableObject(context), |
75 m_observing(false), | 75 m_observing(false), |
76 m_stopped(false), | 76 m_stopped(false), |
77 m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaDevices>::create( | 77 m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaDevices>::create( |
78 this, | 78 this, |
79 &MediaDevices::dispatchScheduledEvent)) { | 79 &MediaDevices::dispatchScheduledEvent)) {} |
80 } | |
81 | 80 |
82 MediaDevices::~MediaDevices() {} | 81 MediaDevices::~MediaDevices() {} |
83 | 82 |
84 ScriptPromise MediaDevices::enumerateDevices(ScriptState* scriptState) { | 83 ScriptPromise MediaDevices::enumerateDevices(ScriptState* scriptState) { |
85 Document* document = toDocument(scriptState->getExecutionContext()); | 84 Document* document = toDocument(scriptState->getExecutionContext()); |
86 UserMediaController* userMedia = UserMediaController::from(document->frame()); | 85 UserMediaController* userMedia = UserMediaController::from(document->frame()); |
87 if (!userMedia) | 86 if (!userMedia) |
88 return ScriptPromise::rejectWithDOMException( | 87 return ScriptPromise::rejectWithDOMException( |
89 scriptState, | 88 scriptState, |
90 DOMException::create(NotSupportedError, | 89 DOMException::create(NotSupportedError, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 247 } |
249 | 248 |
250 DEFINE_TRACE(MediaDevices) { | 249 DEFINE_TRACE(MediaDevices) { |
251 visitor->trace(m_dispatchScheduledEventRunner); | 250 visitor->trace(m_dispatchScheduledEventRunner); |
252 visitor->trace(m_scheduledEvents); | 251 visitor->trace(m_scheduledEvents); |
253 EventTargetWithInlineData::trace(visitor); | 252 EventTargetWithInlineData::trace(visitor); |
254 SuspendableObject::trace(visitor); | 253 SuspendableObject::trace(visitor); |
255 } | 254 } |
256 | 255 |
257 } // namespace blink | 256 } // namespace blink |
OLD | NEW |