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

Unified Diff: chromeos/dbus/fake_cros_disks_client.cc

Issue 2601413002: Use TaskScheduler instead of WorkerPool in fake_cros_disks_client.cc. (Closed)
Patch Set: add ScopedTaskScheduler in test Created 3 years, 12 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 | « no previous file | chromeos/disks/disk_mount_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_cros_disks_client.cc
diff --git a/chromeos/dbus/fake_cros_disks_client.cc b/chromeos/dbus/fake_cros_disks_client.cc
index 99ddc7bc6c9414cbb73b8e1e0c244af8630ec82c..15db3a4ac6ef1f47c95f9195bcc1759d3e067d89 100644
--- a/chromeos/dbus/fake_cros_disks_client.cc
+++ b/chromeos/dbus/fake_cros_disks_client.cc
@@ -9,9 +9,8 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
-#include "base/task_runner_util.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "base/threading/worker_pool.h"
namespace chromeos {
@@ -104,16 +103,14 @@ void FakeCrosDisksClient::Mount(const std::string& source_path,
}
mounted_paths_.insert(mounted_path);
- base::PostTaskAndReplyWithResult(
- base::WorkerPool::GetTaskRunner(true /* task_is_slow */).get(),
- FROM_HERE,
+ base::PostTaskWithTraitsAndReplyWithResult(
+ FROM_HERE, base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .MayBlock(),
base::Bind(&PerformFakeMount, source_path, mounted_path),
- base::Bind(&DidMount,
- mount_completed_handler_,
- source_path,
- type,
- callback,
- mounted_path));
+ base::Bind(&DidMount, mount_completed_handler_, source_path, type,
+ callback, mounted_path));
}
void FakeCrosDisksClient::Unmount(const std::string& device_path,
@@ -126,13 +123,16 @@ void FakeCrosDisksClient::Unmount(const std::string& device_path,
// Remove the dummy mounted directory if it exists.
if (mounted_paths_.count(base::FilePath::FromUTF8Unsafe(device_path)) > 0) {
mounted_paths_.erase(base::FilePath::FromUTF8Unsafe(device_path));
- base::WorkerPool::PostTaskAndReply(
- FROM_HERE,
+ base::PostTaskWithTraitsAndReply(
+ FROM_HERE, base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .MayBlock(),
base::Bind(base::IgnoreResult(&base::DeleteFile),
base::FilePath::FromUTF8Unsafe(device_path),
true /* recursive */),
- callback,
- true /* task_is_slow */);
+ callback);
}
unmount_call_count_++;
« no previous file with comments | « no previous file | chromeos/disks/disk_mount_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698