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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return promise; | 130 return promise; |
131 } | 131 } |
132 | 132 |
133 auto iter = m_availabilityCallbacks.find(id); | 133 auto iter = m_availabilityCallbacks.find(id); |
134 if (iter == m_availabilityCallbacks.end()) { | 134 if (iter == m_availabilityCallbacks.end()) { |
135 resolver->reject(DOMException::create( | 135 resolver->reject(DOMException::create( |
136 NotFoundError, "A callback with the given id is not found.")); | 136 NotFoundError, "A callback with the given id is not found.")); |
137 return promise; | 137 return promise; |
138 } | 138 } |
139 | 139 |
140 m_availabilityCallbacks.remove(iter); | 140 m_availabilityCallbacks.erase(iter); |
141 | 141 |
142 resolver->resolve(); | 142 resolver->resolve(); |
143 return promise; | 143 return promise; |
144 } | 144 } |
145 | 145 |
146 ScriptPromise RemotePlayback::cancelWatchAvailability( | 146 ScriptPromise RemotePlayback::cancelWatchAvailability( |
147 ScriptState* scriptState) { | 147 ScriptState* scriptState) { |
148 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 148 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
149 ScriptPromise promise = resolver->promise(); | 149 ScriptPromise promise = resolver->promise(); |
150 | 150 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 314 } |
315 | 315 |
316 DEFINE_TRACE_WRAPPERS(RemotePlayback) { | 316 DEFINE_TRACE_WRAPPERS(RemotePlayback) { |
317 for (auto callback : m_availabilityCallbacks.values()) { | 317 for (auto callback : m_availabilityCallbacks.values()) { |
318 visitor->traceWrappers(callback); | 318 visitor->traceWrappers(callback); |
319 } | 319 } |
320 EventTargetWithInlineData::traceWrappers(visitor); | 320 EventTargetWithInlineData::traceWrappers(visitor); |
321 } | 321 } |
322 | 322 |
323 } // namespace blink | 323 } // namespace blink |
OLD | NEW |