Index: components/storage_monitor/volume_mount_watcher_win.cc |
diff --git a/components/storage_monitor/volume_mount_watcher_win.cc b/components/storage_monitor/volume_mount_watcher_win.cc |
index fd3e6a5a4ad969eba086319ab445af72bc3485ad..6a89e1a1e01e4800f41208533eecfe85d2430e2a 100644 |
--- a/components/storage_monitor/volume_mount_watcher_win.cc |
+++ b/components/storage_monitor/volume_mount_watcher_win.cc |
@@ -34,6 +34,8 @@ namespace { |
const DWORD kMaxPathBufLen = MAX_PATH + 1; |
+const char kDeviceInfoTaskRunnerName[] = "device-info-task-runner"; |
+ |
enum DeviceType { |
FLOPPY, |
REMOVABLE, |
@@ -324,18 +326,12 @@ void EjectDeviceInThreadPool( |
} // namespace |
-const int kWorkerPoolNumThreads = 3; |
-const char* kWorkerPoolNamePrefix = "DeviceInfoPool"; |
- |
VolumeMountWatcherWin::VolumeMountWatcherWin() |
- : device_info_worker_pool_(new base::SequencedWorkerPool( |
- kWorkerPoolNumThreads, kWorkerPoolNamePrefix)), |
- notifications_(NULL), |
- weak_factory_(this) { |
- task_runner_ = |
- device_info_worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
- device_info_worker_pool_->GetSequenceToken(), |
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
+ : notifications_(NULL), weak_factory_(this) { |
+ base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); |
+ device_info_task_runner_ = pool->GetSequencedTaskRunnerWithShutdownBehavior( |
+ pool->GetNamedSequenceToken(kDeviceInfoTaskRunnerName), |
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
} |
// static |
@@ -361,7 +357,7 @@ void VolumeMountWatcherWin::Init() { |
// so a posted task from the constructor would never run. Therefore, do all |
// the initializations here. |
base::PostTaskAndReplyWithResult( |
- task_runner_.get(), FROM_HERE, GetAttachedDevicesCallback(), |
+ device_info_task_runner_.get(), FROM_HERE, GetAttachedDevicesCallback(), |
base::Bind(&VolumeMountWatcherWin::AddDevicesOnUIThread, |
weak_factory_.GetWeakPtr())); |
} |
@@ -374,7 +370,7 @@ void VolumeMountWatcherWin::AddDevicesOnUIThread( |
if (ContainsKey(pending_device_checks_, removable_devices[i])) |
continue; |
pending_device_checks_.insert(removable_devices[i]); |
- task_runner_->PostTask( |
+ device_info_task_runner_->PostTask( |
FROM_HERE, |
base::Bind(&VolumeMountWatcherWin::RetrieveInfoForDeviceAndAdd, |
removable_devices[i], GetDeviceDetailsCallback(), |
@@ -503,7 +499,6 @@ void VolumeMountWatcherWin::SetNotifications( |
VolumeMountWatcherWin::~VolumeMountWatcherWin() { |
weak_factory_.InvalidateWeakPtrs(); |
- device_info_worker_pool_->Shutdown(); |
} |
void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread( |
@@ -548,9 +543,9 @@ void VolumeMountWatcherWin::EjectDevice( |
return; |
} |
- task_runner_->PostTask( |
- FROM_HERE, |
- base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); |
+ device_info_task_runner_->PostTask( |
+ FROM_HERE, base::Bind(&EjectDeviceInThreadPool, device, callback, |
+ device_info_task_runner_, 0)); |
} |
} // namespace storage_monitor |