Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp

Issue 2531563002: [wrapper-tracing] Fix leak in RemotePlayback round 2 (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698