| 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/remoteplayback/RemotePlayback.h" | 5 #include "modules/remoteplayback/RemotePlayback.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" | 8 #include "bindings/modules/v8/RemotePlaybackAvailabilityCallback.h" |
| 9 #include "core/HTMLNames.h" | 9 #include "core/HTMLNames.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 194 } |
| 195 | 195 |
| 196 return promise; | 196 return promise; |
| 197 } | 197 } |
| 198 | 198 |
| 199 String RemotePlayback::state() const { | 199 String RemotePlayback::state() const { |
| 200 return remotePlaybackStateToString(m_state); | 200 return remotePlaybackStateToString(m_state); |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool RemotePlayback::hasPendingActivity() const { | 203 bool RemotePlayback::hasPendingActivity() const { |
| 204 // TODO(haraken): This check should be moved to ActiveScriptWrappable. | |
| 205 if (getExecutionContext()->isContextDestroyed()) | |
| 206 return false; | |
| 207 return hasEventListeners() || !m_availabilityCallbacks.isEmpty() || | 204 return hasEventListeners() || !m_availabilityCallbacks.isEmpty() || |
| 208 m_promptPromiseResolver; | 205 m_promptPromiseResolver; |
| 209 } | 206 } |
| 210 | 207 |
| 211 void RemotePlayback::notifyInitialAvailability(int callbackId) { | 208 void RemotePlayback::notifyInitialAvailability(int callbackId) { |
| 212 // May not find the callback if the website cancels it fast enough. | 209 // May not find the callback if the website cancels it fast enough. |
| 213 auto iter = m_availabilityCallbacks.find(callbackId); | 210 auto iter = m_availabilityCallbacks.find(callbackId); |
| 214 if (iter == m_availabilityCallbacks.end()) | 211 if (iter == m_availabilityCallbacks.end()) |
| 215 return; | 212 return; |
| 216 | 213 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 307 } |
| 311 | 308 |
| 312 DEFINE_TRACE_WRAPPERS(RemotePlayback) { | 309 DEFINE_TRACE_WRAPPERS(RemotePlayback) { |
| 313 for (auto callback : m_availabilityCallbacks.values()) { | 310 for (auto callback : m_availabilityCallbacks.values()) { |
| 314 visitor->traceWrappers(callback); | 311 visitor->traceWrappers(callback); |
| 315 } | 312 } |
| 316 EventTargetWithInlineData::traceWrappers(visitor); | 313 EventTargetWithInlineData::traceWrappers(visitor); |
| 317 } | 314 } |
| 318 | 315 |
| 319 } // namespace blink | 316 } // namespace blink |
| OLD | NEW |