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

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

Issue 2751173004: Make navigator.usb open the DeviceManager connection lazily. (Closed)
Patch Set: Created 3 years, 9 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 #ifndef USB_h 5 #ifndef USB_h
6 #define USB_h 6 #define USB_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "core/dom/ContextLifecycleObserver.h" 10 #include "core/dom/ContextLifecycleObserver.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // DeviceManagerClient implementation. 63 // DeviceManagerClient implementation.
64 void OnDeviceAdded(device::usb::blink::DeviceInfoPtr); 64 void OnDeviceAdded(device::usb::blink::DeviceInfoPtr);
65 void OnDeviceRemoved(device::usb::blink::DeviceInfoPtr); 65 void OnDeviceRemoved(device::usb::blink::DeviceInfoPtr);
66 66
67 void onDeviceManagerConnectionError(); 67 void onDeviceManagerConnectionError();
68 void onChooserServiceConnectionError(); 68 void onChooserServiceConnectionError();
69 69
70 DECLARE_VIRTUAL_TRACE(); 70 DECLARE_VIRTUAL_TRACE();
71 71
72 protected:
73 // EventTarget protected overrides.
74 void addedEventListener(const AtomicString& eventType,
75 RegisteredEventListener&) override;
76
72 private: 77 private:
73 explicit USB(LocalFrame& frame); 78 explicit USB(LocalFrame& frame);
74 79
80 void ensureDeviceManagerConnection();
81
75 device::usb::blink::DeviceManagerPtr m_deviceManager; 82 device::usb::blink::DeviceManagerPtr m_deviceManager;
76 HeapHashSet<Member<ScriptPromiseResolver>> m_deviceManagerRequests; 83 HeapHashSet<Member<ScriptPromiseResolver>> m_deviceManagerRequests;
77 device::usb::blink::ChooserServicePtr m_chooserService; 84 device::usb::blink::ChooserServicePtr m_chooserService;
78 HeapHashSet<Member<ScriptPromiseResolver>> m_chooserServiceRequests; 85 HeapHashSet<Member<ScriptPromiseResolver>> m_chooserServiceRequests;
79 mojo::Binding<device::usb::blink::DeviceManagerClient> m_clientBinding; 86 mojo::Binding<device::usb::blink::DeviceManagerClient> m_clientBinding;
80 HeapHashMap<String, WeakMember<USBDevice>> m_deviceCache; 87 HeapHashMap<String, WeakMember<USBDevice>> m_deviceCache;
81 }; 88 };
82 89
83 } // namespace blink 90 } // namespace blink
84 91
85 #endif // USB_h 92 #endif // USB_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webusb/USB.cpp » ('j') | third_party/WebKit/Source/modules/webusb/USB.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698