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

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

Issue 2671933002: Migrate WTF::HashMap::add() to ::insert() (Closed)
Patch Set: rebase, add TODOs Created 3 years, 10 months 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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (MemoryCoordinator::isLowEndDevice()) { 76 if (MemoryCoordinator::isLowEndDevice()) {
77 resolver->reject(DOMException::create( 77 resolver->reject(DOMException::create(
78 NotSupportedError, 78 NotSupportedError,
79 "Availability monitoring is not supported on this device.")); 79 "Availability monitoring is not supported on this device."));
80 return promise; 80 return promise;
81 } 81 }
82 82
83 int id; 83 int id;
84 do { 84 do {
85 id = getExecutionContext()->circularSequentialID(); 85 id = getExecutionContext()->circularSequentialID();
86 } while (!m_availabilityCallbacks 86 } while (
87 .add(id, TraceWrapperMember<RemotePlaybackAvailabilityCallback>( 87 !m_availabilityCallbacks
88 this, callback)) 88 .insert(id, TraceWrapperMember<RemotePlaybackAvailabilityCallback>(
89 .isNewEntry); 89 this, callback))
90 .isNewEntry);
90 91
91 // Report the current availability via the callback. 92 // Report the current availability via the callback.
92 getExecutionContext()->postTask( 93 getExecutionContext()->postTask(
93 TaskType::MediaElementEvent, BLINK_FROM_HERE, 94 TaskType::MediaElementEvent, BLINK_FROM_HERE,
94 createSameThreadTask(&RemotePlayback::notifyInitialAvailability, 95 createSameThreadTask(&RemotePlayback::notifyInitialAvailability,
95 wrapPersistent(this), id), 96 wrapPersistent(this), id),
96 "watchAvailabilityCallback"); 97 "watchAvailabilityCallback");
97 98
98 // TODO(avayvod): Currently the availability is tracked for each media element 99 // TODO(avayvod): Currently the availability is tracked for each media element
99 // as soon as it's created, we probably want to limit that to when the 100 // as soon as it's created, we probably want to limit that to when the
(...skipping 207 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

Powered by Google App Engine
This is Rietveld 408576698