| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/storage_monitor/volume_mount_watcher_win.h" | 5 #include "components/storage_monitor/volume_mount_watcher_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <dbt.h> | 9 #include <dbt.h> |
| 10 #include <fileapi.h> | 10 #include <fileapi.h> |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace | 325 } // namespace |
| 326 | 326 |
| 327 const int kWorkerPoolNumThreads = 3; | 327 const int kWorkerPoolNumThreads = 3; |
| 328 const char* kWorkerPoolNamePrefix = "DeviceInfoPool"; | 328 const char* kWorkerPoolNamePrefix = "DeviceInfoPool"; |
| 329 | 329 |
| 330 VolumeMountWatcherWin::VolumeMountWatcherWin() | 330 VolumeMountWatcherWin::VolumeMountWatcherWin() |
| 331 : device_info_worker_pool_(new base::SequencedWorkerPool( | 331 : device_info_worker_pool_(new base::SequencedWorkerPool( |
| 332 kWorkerPoolNumThreads, kWorkerPoolNamePrefix)), | 332 kWorkerPoolNumThreads, kWorkerPoolNamePrefix)), |
| 333 weak_factory_(this), | 333 notifications_(NULL), |
| 334 notifications_(NULL) { | 334 weak_factory_(this) { |
| 335 task_runner_ = | 335 task_runner_ = |
| 336 device_info_worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( | 336 device_info_worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
| 337 device_info_worker_pool_->GetSequenceToken(), | 337 device_info_worker_pool_->GetSequenceToken(), |
| 338 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 338 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
| 339 } | 339 } |
| 340 | 340 |
| 341 // static | 341 // static |
| 342 base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) { | 342 base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) { |
| 343 if (drive_number < 0 || drive_number > 25) | 343 if (drive_number < 0 || drive_number > 25) |
| 344 return base::FilePath(); | 344 return base::FilePath(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 callback.Run(StorageMonitor::EJECT_FAILURE); | 547 callback.Run(StorageMonitor::EJECT_FAILURE); |
| 548 return; | 548 return; |
| 549 } | 549 } |
| 550 | 550 |
| 551 task_runner_->PostTask( | 551 task_runner_->PostTask( |
| 552 FROM_HERE, | 552 FROM_HERE, |
| 553 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); | 553 base::Bind(&EjectDeviceInThreadPool, device, callback, task_runner_, 0)); |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace storage_monitor | 556 } // namespace storage_monitor |
| OLD | NEW |