OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/imagecapture/ImageCapture.h" | 5 #include "modules/imagecapture/ImageCapture.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
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/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 const AtomicString& ImageCapture::interfaceName() const { | 81 const AtomicString& ImageCapture::interfaceName() const { |
82 return EventTargetNames::ImageCapture; | 82 return EventTargetNames::ImageCapture; |
83 } | 83 } |
84 | 84 |
85 ExecutionContext* ImageCapture::getExecutionContext() const { | 85 ExecutionContext* ImageCapture::getExecutionContext() const { |
86 return ContextLifecycleObserver::getExecutionContext(); | 86 return ContextLifecycleObserver::getExecutionContext(); |
87 } | 87 } |
88 | 88 |
89 bool ImageCapture::hasPendingActivity() const { | 89 bool ImageCapture::hasPendingActivity() const { |
90 return hasEventListeners(); | 90 return getExecutionContext() && hasEventListeners(); |
91 } | 91 } |
92 | 92 |
93 void ImageCapture::contextDestroyed() { | 93 void ImageCapture::contextDestroyed() { |
94 removeAllEventListeners(); | 94 removeAllEventListeners(); |
95 m_serviceRequests.clear(); | 95 m_serviceRequests.clear(); |
96 DCHECK(!hasEventListeners()); | 96 DCHECK(!hasEventListeners()); |
97 } | 97 } |
98 | 98 |
99 ScriptPromise ImageCapture::getPhotoCapabilities( | 99 ScriptPromise ImageCapture::getPhotoCapabilities( |
100 ScriptState* scriptState, | 100 ScriptState* scriptState, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 383 } |
384 | 384 |
385 DEFINE_TRACE(ImageCapture) { | 385 DEFINE_TRACE(ImageCapture) { |
386 visitor->trace(m_streamTrack); | 386 visitor->trace(m_streamTrack); |
387 visitor->trace(m_serviceRequests); | 387 visitor->trace(m_serviceRequests); |
388 EventTargetWithInlineData::trace(visitor); | 388 EventTargetWithInlineData::trace(visitor); |
389 ContextLifecycleObserver::trace(visitor); | 389 ContextLifecycleObserver::trace(visitor); |
390 } | 390 } |
391 | 391 |
392 } // namespace blink | 392 } // namespace blink |
OLD | NEW |