| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return ActiveDOMObject::getExecutionContext(); | 162 return ActiveDOMObject::getExecutionContext(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void MediaDevices::removeAllEventListeners() | 165 void MediaDevices::removeAllEventListeners() |
| 166 { | 166 { |
| 167 EventTargetWithInlineData::removeAllEventListeners(); | 167 EventTargetWithInlineData::removeAllEventListeners(); |
| 168 DCHECK(!hasEventListeners()); | 168 DCHECK(!hasEventListeners()); |
| 169 stopObserving(); | 169 stopObserving(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool MediaDevices::addEventListenerInternal(const AtomicString& eventType, Event
Listener* listener, const EventListenerOptions& options) | 172 void MediaDevices::addedEventListener(const AtomicString& eventType, RegisteredE
ventListener& registeredListener) |
| 173 { | 173 { |
| 174 if (!EventTargetWithInlineData::addEventListenerInternal(eventType, listener
, options)) | 174 EventTargetWithInlineData::addedEventListener(eventType, registeredListener)
; |
| 175 return false; | |
| 176 startObserving(); | 175 startObserving(); |
| 177 return true; | |
| 178 } | 176 } |
| 179 | 177 |
| 180 bool MediaDevices::removeEventListenerInternal(const AtomicString& eventType, Ev
entListener* listener, const EventListenerOptions& options) | 178 void MediaDevices::removedEventListener(const AtomicString& eventType, const Reg
isteredEventListener& registeredListener) |
| 181 { | 179 { |
| 182 if (!EventTargetWithInlineData::removeEventListenerInternal(eventType, liste
ner, options)) | 180 EventTargetWithInlineData::removedEventListener(eventType, registeredListene
r); |
| 183 return false; | |
| 184 if (!hasEventListeners()) | 181 if (!hasEventListeners()) |
| 185 stopObserving(); | 182 stopObserving(); |
| 186 return true; | |
| 187 } | 183 } |
| 188 | 184 |
| 189 bool MediaDevices::hasPendingActivity() const | 185 bool MediaDevices::hasPendingActivity() const |
| 190 { | 186 { |
| 191 DCHECK(m_stopped || m_observing == hasEventListeners()); | 187 DCHECK(m_stopped || m_observing == hasEventListeners()); |
| 192 return m_observing; | 188 return m_observing; |
| 193 } | 189 } |
| 194 | 190 |
| 195 void MediaDevices::stop() | 191 void MediaDevices::stop() |
| 196 { | 192 { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 264 |
| 269 DEFINE_TRACE(MediaDevices) | 265 DEFINE_TRACE(MediaDevices) |
| 270 { | 266 { |
| 271 visitor->trace(m_dispatchScheduledEventRunner); | 267 visitor->trace(m_dispatchScheduledEventRunner); |
| 272 visitor->trace(m_scheduledEvents); | 268 visitor->trace(m_scheduledEvents); |
| 273 EventTargetWithInlineData::trace(visitor); | 269 EventTargetWithInlineData::trace(visitor); |
| 274 ActiveDOMObject::trace(visitor); | 270 ActiveDOMObject::trace(visitor); |
| 275 } | 271 } |
| 276 | 272 |
| 277 } // namespace blink | 273 } // namespace blink |
| OLD | NEW |