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

Unified Diff: extensions/shell/browser/shell_device_client.cc

Issue 1314273002: Manage UsbService lifetime in DeviceClient implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/shell/browser/shell_device_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/shell/browser/shell_device_client.cc
diff --git a/extensions/shell/browser/shell_device_client.cc b/extensions/shell/browser/shell_device_client.cc
index 5dd1c6b689755b85d1c2874c38034b2554f87eb0..ae006661e78193d96cc7a122b1ef8f031b028407 100644
--- a/extensions/shell/browser/shell_device_client.cc
+++ b/extensions/shell/browser/shell_device_client.cc
@@ -19,8 +19,12 @@ ShellDeviceClient::~ShellDeviceClient() {}
device::UsbService* ShellDeviceClient::GetUsbService() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- return device::UsbService::GetInstance(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
+
+ if (!usb_service_) {
+ usb_service_ = device::UsbService::Create(
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
+ }
+ return usb_service_.get();
}
device::HidService* ShellDeviceClient::GetHidService() {
« no previous file with comments | « extensions/shell/browser/shell_device_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698