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

Unified Diff: base/files/file_path_watcher_browsertest.cc

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 2 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 | « base/files/file_path_watcher.cc ('k') | base/files/file_path_watcher_fsevents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path_watcher_browsertest.cc
diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc
index f6d6d333a0fb11f366010cdc4a2e2c7149d2c7fe..520d90b3ad524e2d927cb1ff851f516f009cf0e6 100644
--- a/base/files/file_path_watcher_browsertest.cc
+++ b/base/files/file_path_watcher_browsertest.cc
@@ -21,13 +21,14 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h"
+#include "base/sequenced_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/test_file_util.h"
#include "base/test/test_timeouts.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,14 +43,14 @@ class TestDelegate;
class NotificationCollector
: public base::RefCountedThreadSafe<NotificationCollector> {
public:
- NotificationCollector()
- : loop_(base::MessageLoopProxy::current()) {}
+ NotificationCollector() : task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
// Called from the file thread by the delegates.
void OnChange(TestDelegate* delegate) {
- loop_->PostTask(FROM_HERE,
- base::Bind(&NotificationCollector::RecordChange, this,
- base::Unretained(delegate)));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&NotificationCollector::RecordChange,
+ this,
+ base::Unretained(delegate)));
}
void Register(TestDelegate* delegate) {
@@ -70,13 +71,13 @@ class NotificationCollector
void RecordChange(TestDelegate* delegate) {
// Warning: |delegate| is Unretained. Do not dereference.
- ASSERT_TRUE(loop_->BelongsToCurrentThread());
+ ASSERT_TRUE(task_runner_->RunsTasksOnCurrentThread());
ASSERT_TRUE(delegates_.count(delegate));
signaled_.insert(delegate);
// Check whether all delegates have been signaled.
if (signaled_ == delegates_)
- loop_->PostTask(FROM_HERE, MessageLoop::QuitWhenIdleClosure());
+ task_runner_->PostTask(FROM_HERE, MessageLoop::QuitWhenIdleClosure());
}
// Set of registered delegates.
@@ -86,7 +87,7 @@ class NotificationCollector
std::set<TestDelegate*> signaled_;
// The loop we should break after all delegates signaled.
- scoped_refptr<base::MessageLoopProxy> loop_;
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
};
class TestDelegateBase : public SupportsWeakPtr<TestDelegateBase> {
« no previous file with comments | « base/files/file_path_watcher.cc ('k') | base/files/file_path_watcher_fsevents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698