| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return remotePlaybackStateToString(m_state); | 195 return remotePlaybackStateToString(m_state); |
| 196 } | 196 } |
| 197 | 197 |
| 198 bool RemotePlayback::hasPendingActivity() const { | 198 bool RemotePlayback::hasPendingActivity() const { |
| 199 return hasEventListeners() || !m_availabilityCallbacks.isEmpty() || | 199 return hasEventListeners() || !m_availabilityCallbacks.isEmpty() || |
| 200 m_promptPromiseResolver; | 200 m_promptPromiseResolver; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void RemotePlayback::contextDestroyed() { | 203 void RemotePlayback::contextDestroyed() { |
| 204 m_availabilityCallbacks.clear(); | 204 m_availabilityCallbacks.clear(); |
| 205 m_promptPromiseResolver = nullptr; |
| 205 } | 206 } |
| 206 | 207 |
| 207 void RemotePlayback::notifyInitialAvailability(int callbackId) { | 208 void RemotePlayback::notifyInitialAvailability(int callbackId) { |
| 208 // 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. |
| 209 auto iter = m_availabilityCallbacks.find(callbackId); | 210 auto iter = m_availabilityCallbacks.find(callbackId); |
| 210 if (iter == m_availabilityCallbacks.end()) | 211 if (iter == m_availabilityCallbacks.end()) |
| 211 return; | 212 return; |
| 212 | 213 |
| 213 iter->value->call(this, remotePlaybackAvailable()); | 214 iter->value->call(this, remotePlaybackAvailable()); |
| 214 } | 215 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 308 } |
| 308 | 309 |
| 309 DEFINE_TRACE_WRAPPERS(RemotePlayback) { | 310 DEFINE_TRACE_WRAPPERS(RemotePlayback) { |
| 310 for (auto callback : m_availabilityCallbacks.values()) { | 311 for (auto callback : m_availabilityCallbacks.values()) { |
| 311 visitor->traceWrappers(callback); | 312 visitor->traceWrappers(callback); |
| 312 } | 313 } |
| 313 EventTargetWithInlineData::traceWrappers(visitor); | 314 EventTargetWithInlineData::traceWrappers(visitor); |
| 314 } | 315 } |
| 315 | 316 |
| 316 } // namespace blink | 317 } // namespace blink |
| OLD | NEW |