Chromium Code Reviews| Index: components/storage_monitor/portable_device_watcher_win.cc |
| diff --git a/components/storage_monitor/portable_device_watcher_win.cc b/components/storage_monitor/portable_device_watcher_win.cc |
| index 826a2af8ce3a3a70ba3ca1e83c49178c87d8aea4..9d894a41f2bba47a301aacb073ce5e3c13a472bb 100644 |
| --- a/components/storage_monitor/portable_device_watcher_win.cc |
| +++ b/components/storage_monitor/portable_device_watcher_win.cc |
| @@ -313,8 +313,8 @@ bool IsMassStoragePortableDevice(const base::string16& pnp_device_id, |
| base::string16 GetDeviceNameOnBlockingThread( |
| IPortableDeviceManager* portable_device_manager, |
| const base::string16& pnp_device_id) { |
| - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| DCHECK(portable_device_manager); |
| + base::ThreadRestrictions::AssertIOAllowed(); |
|
blundell
2017/05/17 15:24:52
Is this the canonical change to make here?
Yeol Park
2017/05/19 04:34:51
I used TaskScheduler instead of blocking pool and
blundell
2017/05/22 09:29:39
I would do this in a different CL, yes.
Yeol Park
2017/06/23 04:59:20
Done in https://codereview.chromium.org/2943923002
|
| base::string16 name; |
| GetFriendlyName(pnp_device_id, portable_device_manager, &name) || |
| GetDeviceDescription(pnp_device_id, portable_device_manager, &name) || |
| @@ -327,8 +327,8 @@ base::string16 GetDeviceNameOnBlockingThread( |
| bool GetDeviceStorageObjectsOnBlockingThread( |
| const base::string16& pnp_device_id, |
| PortableDeviceWatcherWin::StorageObjects* storage_objects) { |
| - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| DCHECK(storage_objects); |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| base::win::ScopedComPtr<IPortableDevice> device; |
| if (!SetUp(pnp_device_id, &device)) |
| return false; |
| @@ -365,10 +365,10 @@ bool GetDeviceInfoOnBlockingThread( |
| IPortableDeviceManager* portable_device_manager, |
| const base::string16& pnp_device_id, |
| PortableDeviceWatcherWin::DeviceDetails* device_details) { |
| - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| DCHECK(portable_device_manager); |
| DCHECK(device_details); |
| DCHECK(!pnp_device_id.empty()); |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| device_details->name = GetDeviceNameOnBlockingThread(portable_device_manager, |
| pnp_device_id); |
| if (IsMassStoragePortableDevice(pnp_device_id, device_details->name)) |
| @@ -384,7 +384,7 @@ bool GetDeviceInfoOnBlockingThread( |
| // returns true and fills in |portable_device_mgr|. On failure, returns false. |
| bool GetPortableDeviceManager( |
| base::win::ScopedComPtr<IPortableDeviceManager>* portable_device_mgr) { |
| - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| HRESULT hr = portable_device_mgr->CreateInstance( |
| __uuidof(PortableDeviceManager), NULL, CLSCTX_INPROC_SERVER); |
| if (SUCCEEDED(hr)) |
| @@ -401,8 +401,8 @@ bool GetPortableDeviceManager( |
| // false. |
| bool EnumerateAttachedDevicesOnBlockingThread( |
| PortableDeviceWatcherWin::Devices* devices) { |
| - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| DCHECK(devices); |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| base::win::ScopedComPtr<IPortableDeviceManager> portable_device_mgr; |
| if (!GetPortableDeviceManager(&portable_device_mgr)) |
| return false; |
| @@ -436,8 +436,8 @@ bool EnumerateAttachedDevicesOnBlockingThread( |
| bool HandleDeviceAttachedEventOnBlockingThread( |
| const base::string16& pnp_device_id, |
| PortableDeviceWatcherWin::DeviceDetails* device_details) { |
| - DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| DCHECK(device_details); |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| base::win::ScopedComPtr<IPortableDeviceManager> portable_device_mgr; |
| if (!GetPortableDeviceManager(&portable_device_mgr)) |
| return false; |