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

Unified Diff: chrome/browser/storage_monitor/volume_mount_watcher_win.cc

Issue 12476026: Disable drive scan on startup to avoid spinning floppy drives (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DoNothing closure to spawn a thread early Created 7 years, 9 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 | « chrome/browser/storage_monitor/volume_mount_watcher_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/storage_monitor/volume_mount_watcher_win.cc
diff --git a/chrome/browser/storage_monitor/volume_mount_watcher_win.cc b/chrome/browser/storage_monitor/volume_mount_watcher_win.cc
index 0a76d1122e4233f0787a8c67719a7f4db24d9e36..e285e1ff437808dfeda94899a8f9c67615ae83d1 100644
--- a/chrome/browser/storage_monitor/volume_mount_watcher_win.cc
+++ b/chrome/browser/storage_monitor/volume_mount_watcher_win.cc
@@ -8,6 +8,7 @@
#include <dbt.h>
#include <fileapi.h>
+#include "base/bind_helpers.h"
#include "base/stl_util.h"
#include "base/string_util.h"
#include "base/strings/string_number_conversions.h"
@@ -174,12 +175,17 @@ const int kWorkerPoolNumThreads = 3;
const char* kWorkerPoolNamePrefix = "DeviceInfoPool";
VolumeMountWatcherWin::VolumeMountWatcherWin()
- : device_info_worker_pool_(new base::SequencedWorkerPool(
- kWorkerPoolNumThreads, kWorkerPoolNamePrefix)),
- weak_factory_(this),
+ : weak_factory_(this),
notifications_(NULL) {
get_attached_devices_callback_ = base::Bind(&GetAttachedDevices);
get_device_details_callback_ = base::Bind(&GetDeviceDetails);
+
+ device_info_worker_pool_ = new base::SequencedWorkerPool(
+ kWorkerPoolNumThreads, kWorkerPoolNamePrefix);
+ task_runner_ =
+ device_info_worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior(
+ device_info_worker_pool_->GetSequenceToken(),
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
}
// static
@@ -204,9 +210,14 @@ void VolumeMountWatcherWin::Init() {
// When VolumeMountWatcherWin is created, the message pumps are not running
// so a posted task from the constructor would never run. Therefore, do all
// the initializations here.
- device_info_worker_pool_->PostTask(FROM_HERE, base::Bind(
- &FindExistingDevicesAndAdd, get_attached_devices_callback_,
- weak_factory_.GetWeakPtr()));
+ // Disabled pending resolution of http://crbug.com/173953
+ // task_runner_->PostTask(FROM_HERE, base::Bind(
+ // &FindExistingDevicesAndAdd, get_attached_devices_callback_,
+ // weak_factory_.GetWeakPtr()));
+
+ // This task is a mystery. Without it, the ToastCrasher test fails, but
+ // it isn't clear why. Need to move pool creation later?
+ task_runner_->PostTask(FROM_HERE, base::Bind(&base::DoNothing));
}
// static
@@ -226,18 +237,15 @@ void VolumeMountWatcherWin::AddDevicesOnUIThread(
std::vector<base::FilePath> removable_devices) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- scoped_refptr<base::TaskRunner> runner =
- device_info_worker_pool_->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
for (size_t i = 0; i < removable_devices.size(); i++) {
if (ContainsKey(pending_device_checks_, removable_devices[i]))
continue;
pending_device_checks_.insert(removable_devices[i]);
- runner->PostTask(FROM_HERE,
- base::Bind(&RetrieveInfoForDeviceAndAdd,
- removable_devices[i],
- get_device_details_callback_,
- weak_factory_.GetWeakPtr()));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&RetrieveInfoForDeviceAndAdd,
+ removable_devices[i],
+ get_device_details_callback_,
+ weak_factory_.GetWeakPtr()));
}
}
« no previous file with comments | « chrome/browser/storage_monitor/volume_mount_watcher_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698