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

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

Issue 2673543003: Migrate WTF::HashMap::remove() to ::erase() (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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 EventTypeNames::connect, getOrCreateDevice(std::move(deviceInfo)))); 213 EventTypeNames::connect, getOrCreateDevice(std::move(deviceInfo))));
214 } 214 }
215 215
216 void USB::OnDeviceRemoved(usb::DeviceInfoPtr deviceInfo) { 216 void USB::OnDeviceRemoved(usb::DeviceInfoPtr deviceInfo) {
217 String guid = deviceInfo->guid; 217 String guid = deviceInfo->guid;
218 USBDevice* device = m_deviceCache.get(guid); 218 USBDevice* device = m_deviceCache.get(guid);
219 if (!device) 219 if (!device)
220 device = USBDevice::create(std::move(deviceInfo), nullptr, 220 device = USBDevice::create(std::move(deviceInfo), nullptr,
221 getExecutionContext()); 221 getExecutionContext());
222 dispatchEvent(USBConnectionEvent::create(EventTypeNames::disconnect, device)); 222 dispatchEvent(USBConnectionEvent::create(EventTypeNames::disconnect, device));
223 m_deviceCache.remove(guid); 223 m_deviceCache.erase(guid);
224 } 224 }
225 225
226 void USB::onDeviceManagerConnectionError() { 226 void USB::onDeviceManagerConnectionError() {
227 m_deviceManager.reset(); 227 m_deviceManager.reset();
228 for (ScriptPromiseResolver* resolver : m_deviceManagerRequests) 228 for (ScriptPromiseResolver* resolver : m_deviceManagerRequests)
229 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 229 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
230 m_deviceManagerRequests.clear(); 230 m_deviceManagerRequests.clear();
231 } 231 }
232 232
233 void USB::onChooserServiceConnectionError() { 233 void USB::onChooserServiceConnectionError() {
234 m_chooserService.reset(); 234 m_chooserService.reset();
235 for (ScriptPromiseResolver* resolver : m_chooserServiceRequests) 235 for (ScriptPromiseResolver* resolver : m_chooserServiceRequests)
236 resolver->reject(DOMException::create(NotFoundError, kNoServiceError)); 236 resolver->reject(DOMException::create(NotFoundError, kNoServiceError));
237 m_chooserServiceRequests.clear(); 237 m_chooserServiceRequests.clear();
238 } 238 }
239 239
240 DEFINE_TRACE(USB) { 240 DEFINE_TRACE(USB) {
241 visitor->trace(m_deviceManagerRequests); 241 visitor->trace(m_deviceManagerRequests);
242 visitor->trace(m_chooserServiceRequests); 242 visitor->trace(m_chooserServiceRequests);
243 visitor->trace(m_deviceCache); 243 visitor->trace(m_deviceCache);
244 EventTargetWithInlineData::trace(visitor); 244 EventTargetWithInlineData::trace(visitor);
245 ContextLifecycleObserver::trace(visitor); 245 ContextLifecycleObserver::trace(visitor);
246 } 246 }
247 247
248 } // namespace blink 248 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp ('k') | third_party/WebKit/Source/platform/Length.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698