| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(this), |
| 74 ActiveDOMObject(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 ThreadState::current()->registerPreFinalizer(this); | 80 ThreadState::current()->registerPreFinalizer(this); |
| 81 } | 81 } |
| 82 | 82 |
| 83 MediaDevices::~MediaDevices() {} | 83 MediaDevices::~MediaDevices() {} |
| 84 | 84 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 if (RuntimeEnabledFeatures::onDeviceChangeEnabled()) | 147 if (RuntimeEnabledFeatures::onDeviceChangeEnabled()) |
| 148 scheduleDispatchEvent(Event::create(EventTypeNames::devicechange)); | 148 scheduleDispatchEvent(Event::create(EventTypeNames::devicechange)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 const AtomicString& MediaDevices::interfaceName() const { | 151 const AtomicString& MediaDevices::interfaceName() const { |
| 152 return EventTargetNames::MediaDevices; | 152 return EventTargetNames::MediaDevices; |
| 153 } | 153 } |
| 154 | 154 |
| 155 ExecutionContext* MediaDevices::getExecutionContext() const { | 155 ExecutionContext* MediaDevices::getExecutionContext() const { |
| 156 return ActiveDOMObject::getExecutionContext(); | 156 return SuspendableObject::getExecutionContext(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void MediaDevices::removeAllEventListeners() { | 159 void MediaDevices::removeAllEventListeners() { |
| 160 EventTargetWithInlineData::removeAllEventListeners(); | 160 EventTargetWithInlineData::removeAllEventListeners(); |
| 161 DCHECK(!hasEventListeners()); | 161 DCHECK(!hasEventListeners()); |
| 162 stopObserving(); | 162 stopObserving(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void MediaDevices::addedEventListener( | 165 void MediaDevices::addedEventListener( |
| 166 const AtomicString& eventType, | 166 const AtomicString& eventType, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 | 246 |
| 247 void MediaDevices::dispose() { | 247 void MediaDevices::dispose() { |
| 248 stopObserving(); | 248 stopObserving(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 DEFINE_TRACE(MediaDevices) { | 251 DEFINE_TRACE(MediaDevices) { |
| 252 visitor->trace(m_dispatchScheduledEventRunner); | 252 visitor->trace(m_dispatchScheduledEventRunner); |
| 253 visitor->trace(m_scheduledEvents); | 253 visitor->trace(m_scheduledEvents); |
| 254 EventTargetWithInlineData::trace(visitor); | 254 EventTargetWithInlineData::trace(visitor); |
| 255 ActiveDOMObject::trace(visitor); | 255 SuspendableObject::trace(visitor); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace blink | 258 } // namespace blink |
| OLD | NEW |