OLD | NEW |
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 "device/usb/usb_service.h" | 5 #include "device/usb/usb_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return base::WrapUnique(new UsbServiceImpl()); | 59 return base::WrapUnique(new UsbServiceImpl()); |
60 #else | 60 #else |
61 return nullptr; | 61 return nullptr; |
62 #endif | 62 #endif |
63 } | 63 } |
64 | 64 |
65 // static | 65 // static |
66 scoped_refptr<base::SequencedTaskRunner> | 66 scoped_refptr<base::SequencedTaskRunner> |
67 UsbService::CreateBlockingTaskRunner() { | 67 UsbService::CreateBlockingTaskRunner() { |
68 return base::CreateSequencedTaskRunnerWithTraits( | 68 return base::CreateSequencedTaskRunnerWithTraits( |
69 base::TaskTraits() | 69 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, |
70 .MayBlock() | 70 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}); |
71 .WithPriority(base::TaskPriority::USER_VISIBLE) | |
72 .WithShutdownBehavior( | |
73 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); | |
74 } | 71 } |
75 | 72 |
76 UsbService::~UsbService() { | 73 UsbService::~UsbService() { |
77 #if DCHECK_IS_ON() | 74 #if DCHECK_IS_ON() |
78 DCHECK(did_shutdown_); | 75 DCHECK(did_shutdown_); |
79 #endif | 76 #endif |
80 for (const auto& map_entry : devices_) | 77 for (const auto& map_entry : devices_) |
81 map_entry.second->OnDisconnect(); | 78 map_entry.second->OnDisconnect(); |
82 for (auto& observer : observer_list_) | 79 for (auto& observer : observer_list_) |
83 observer.WillDestroyUsbService(); | 80 observer.WillDestroyUsbService(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 DCHECK(CalledOnValidThread()); | 175 DCHECK(CalledOnValidThread()); |
179 | 176 |
180 for (auto& observer : observer_list_) | 177 for (auto& observer : observer_list_) |
181 observer.OnDeviceRemoved(device); | 178 observer.OnDeviceRemoved(device); |
182 device->NotifyDeviceRemoved(); | 179 device->NotifyDeviceRemoved(); |
183 for (auto& observer : observer_list_) | 180 for (auto& observer : observer_list_) |
184 observer.OnDeviceRemovedCleanup(device); | 181 observer.OnDeviceRemovedCleanup(device); |
185 } | 182 } |
186 | 183 |
187 } // namespace device | 184 } // namespace device |
OLD | NEW |