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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USB.cpp

Issue 2703833002: Migrate WTF::HashSet::remove() to ::erase() [part 2] (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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/webusb/USB.h" 5 #include "modules/webusb/USB.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.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/Document.h" 10 #include "core/dom/Document.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 m_deviceCache.insert(guid, device); 165 m_deviceCache.insert(guid, device);
166 } 166 }
167 return device; 167 return device;
168 } 168 }
169 169
170 void USB::onGetDevices(ScriptPromiseResolver* resolver, 170 void USB::onGetDevices(ScriptPromiseResolver* resolver,
171 Vector<usb::DeviceInfoPtr> deviceInfos) { 171 Vector<usb::DeviceInfoPtr> deviceInfos) {
172 auto requestEntry = m_deviceManagerRequests.find(resolver); 172 auto requestEntry = m_deviceManagerRequests.find(resolver);
173 if (requestEntry == m_deviceManagerRequests.end()) 173 if (requestEntry == m_deviceManagerRequests.end())
174 return; 174 return;
175 m_deviceManagerRequests.remove(requestEntry); 175 m_deviceManagerRequests.erase(requestEntry);
176 176
177 HeapVector<Member<USBDevice>> devices; 177 HeapVector<Member<USBDevice>> devices;
178 for (auto& deviceInfo : deviceInfos) 178 for (auto& deviceInfo : deviceInfos)
179 devices.push_back(getOrCreateDevice(std::move(deviceInfo))); 179 devices.push_back(getOrCreateDevice(std::move(deviceInfo)));
180 resolver->resolve(devices); 180 resolver->resolve(devices);
181 m_deviceManagerRequests.erase(resolver); 181 m_deviceManagerRequests.erase(resolver);
182 } 182 }
183 183
184 void USB::onGetPermission(ScriptPromiseResolver* resolver, 184 void USB::onGetPermission(ScriptPromiseResolver* resolver,
185 usb::DeviceInfoPtr deviceInfo) { 185 usb::DeviceInfoPtr deviceInfo) {
186 auto requestEntry = m_chooserServiceRequests.find(resolver); 186 auto requestEntry = m_chooserServiceRequests.find(resolver);
187 if (requestEntry == m_chooserServiceRequests.end()) 187 if (requestEntry == m_chooserServiceRequests.end())
188 return; 188 return;
189 m_chooserServiceRequests.remove(requestEntry); 189 m_chooserServiceRequests.erase(requestEntry);
190 190
191 if (!m_deviceManager) { 191 if (!m_deviceManager) {
192 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 192 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
193 return; 193 return;
194 } 194 }
195 195
196 if (deviceInfo) 196 if (deviceInfo)
197 resolver->resolve(getOrCreateDevice(std::move(deviceInfo))); 197 resolver->resolve(getOrCreateDevice(std::move(deviceInfo)));
198 else 198 else
199 resolver->reject( 199 resolver->reject(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 DEFINE_TRACE(USB) { 235 DEFINE_TRACE(USB) {
236 visitor->trace(m_deviceManagerRequests); 236 visitor->trace(m_deviceManagerRequests);
237 visitor->trace(m_chooserServiceRequests); 237 visitor->trace(m_chooserServiceRequests);
238 visitor->trace(m_deviceCache); 238 visitor->trace(m_deviceCache);
239 EventTargetWithInlineData::trace(visitor); 239 EventTargetWithInlineData::trace(visitor);
240 ContextLifecycleObserver::trace(visitor); 240 ContextLifecycleObserver::trace(visitor);
241 } 241 }
242 242
243 } // namespace blink 243 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698