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

Side by Side Diff: third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: 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/imagecapture/ImageCapture.h" 5 #include "modules/imagecapture/ImageCapture.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ScriptState* scriptState, 100 ScriptState* scriptState,
101 ExceptionState& exceptionState) { 101 ExceptionState& exceptionState) {
102 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 102 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
103 ScriptPromise promise = resolver->promise(); 103 ScriptPromise promise = resolver->promise();
104 104
105 if (!m_service) { 105 if (!m_service) {
106 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 106 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
107 return promise; 107 return promise;
108 } 108 }
109 109
110 m_serviceRequests.add(resolver); 110 m_serviceRequests.insert(resolver);
111 111
112 // m_streamTrack->component()->source()->id() is the renderer "name" of the 112 // m_streamTrack->component()->source()->id() is the renderer "name" of the
113 // camera; 113 // camera;
114 // TODO(mcasas) consider sending the security origin as well: 114 // TODO(mcasas) consider sending the security origin as well:
115 // scriptState->getExecutionContext()->getSecurityOrigin()->toString() 115 // scriptState->getExecutionContext()->getSecurityOrigin()->toString()
116 m_service->GetCapabilities( 116 m_service->GetCapabilities(
117 m_streamTrack->component()->source()->id(), 117 m_streamTrack->component()->source()->id(),
118 convertToBaseCallback(WTF::bind(&ImageCapture::onCapabilities, 118 convertToBaseCallback(WTF::bind(&ImageCapture::onCapabilities,
119 wrapPersistent(this), 119 wrapPersistent(this),
120 wrapPersistent(resolver)))); 120 wrapPersistent(resolver))));
(...skipping 10 matching lines...) Expand all
131 resolver->reject(DOMException::create( 131 resolver->reject(DOMException::create(
132 InvalidStateError, "The associated Track is in an invalid state.")); 132 InvalidStateError, "The associated Track is in an invalid state."));
133 return promise; 133 return promise;
134 } 134 }
135 135
136 if (!m_service) { 136 if (!m_service) {
137 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 137 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
138 return promise; 138 return promise;
139 } 139 }
140 140
141 m_serviceRequests.add(resolver); 141 m_serviceRequests.insert(resolver);
142 142
143 // TODO(mcasas): should be using a mojo::StructTraits instead. 143 // TODO(mcasas): should be using a mojo::StructTraits instead.
144 media::mojom::blink::PhotoSettingsPtr settings = 144 media::mojom::blink::PhotoSettingsPtr settings =
145 media::mojom::blink::PhotoSettings::New(); 145 media::mojom::blink::PhotoSettings::New();
146 settings->has_zoom = photoSettings.hasZoom(); 146 settings->has_zoom = photoSettings.hasZoom();
147 if (settings->has_zoom) 147 if (settings->has_zoom)
148 settings->zoom = photoSettings.zoom(); 148 settings->zoom = photoSettings.zoom();
149 settings->has_height = photoSettings.hasImageHeight(); 149 settings->has_height = photoSettings.hasImageHeight();
150 if (settings->has_height) 150 if (settings->has_height)
151 settings->height = photoSettings.imageHeight(); 151 settings->height = photoSettings.imageHeight();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 resolver->reject(DOMException::create( 216 resolver->reject(DOMException::create(
217 InvalidStateError, "The associated Track is in an invalid state.")); 217 InvalidStateError, "The associated Track is in an invalid state."));
218 return promise; 218 return promise;
219 } 219 }
220 220
221 if (!m_service) { 221 if (!m_service) {
222 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 222 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
223 return promise; 223 return promise;
224 } 224 }
225 225
226 m_serviceRequests.add(resolver); 226 m_serviceRequests.insert(resolver);
227 227
228 // m_streamTrack->component()->source()->id() is the renderer "name" of the 228 // m_streamTrack->component()->source()->id() is the renderer "name" of the
229 // camera; 229 // camera;
230 // TODO(mcasas) consider sending the security origin as well: 230 // TODO(mcasas) consider sending the security origin as well:
231 // scriptState->getExecutionContext()->getSecurityOrigin()->toString() 231 // scriptState->getExecutionContext()->getSecurityOrigin()->toString()
232 m_service->TakePhoto(m_streamTrack->component()->source()->id(), 232 m_service->TakePhoto(m_streamTrack->component()->source()->id(),
233 convertToBaseCallback(WTF::bind( 233 convertToBaseCallback(WTF::bind(
234 &ImageCapture::onTakePhoto, wrapPersistent(this), 234 &ImageCapture::onTakePhoto, wrapPersistent(this),
235 wrapPersistent(resolver)))); 235 wrapPersistent(resolver))));
236 return promise; 236 return promise;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 DEFINE_TRACE(ImageCapture) { 383 DEFINE_TRACE(ImageCapture) {
384 visitor->trace(m_streamTrack); 384 visitor->trace(m_streamTrack);
385 visitor->trace(m_serviceRequests); 385 visitor->trace(m_serviceRequests);
386 EventTargetWithInlineData::trace(visitor); 386 EventTargetWithInlineData::trace(visitor);
387 ContextLifecycleObserver::trace(visitor); 387 ContextLifecycleObserver::trace(visitor);
388 } 388 }
389 389
390 } // namespace blink 390 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698