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

Unified Diff: mojo/common/handle_watcher.cc

Issue 69283002: Revert "Mojo: Add BindingsSupportImpl on top of HandleWatcher" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « mojo/common/handle_watcher.h ('k') | mojo/common/handle_watcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/handle_watcher.cc
diff --git a/mojo/common/handle_watcher.cc b/mojo/common/handle_watcher.cc
index a159185ba35bc0029d658ab312168c746627a19a..1fef74a865e4294146fa5e6a09ea7ba32e6f6850 100644
--- a/mojo/common/handle_watcher.cc
+++ b/mojo/common/handle_watcher.cc
@@ -47,7 +47,7 @@ class WatcherThreadManager {
WatcherID StartWatching(MojoHandle handle,
MojoWaitFlags wait_flags,
base::TimeTicks deadline,
- const base::Callback<void(MojoResult)>& callback);
+ const base::Closure& callback);
// Stops watching a handle.
void StopWatching(WatcherID watcher_id);
@@ -65,7 +65,7 @@ class WatcherThreadManager {
MojoHandle handle;
MojoWaitFlags wait_flags;
base::TimeTicks deadline;
- base::Callback<void(MojoResult)> callback;
+ base::Closure callback;
scoped_refptr<base::MessageLoopProxy> message_loop;
};
@@ -138,11 +138,10 @@ WatcherThreadManager* WatcherThreadManager::GetInstance() {
return &instance.Get();
}
-WatcherID WatcherThreadManager::StartWatching(
- MojoHandle handle,
- MojoWaitFlags wait_flags,
- base::TimeTicks deadline,
- const base::Callback<void(MojoResult)>& callback) {
+WatcherID WatcherThreadManager::StartWatching(MojoHandle handle,
+ MojoWaitFlags wait_flags,
+ base::TimeTicks deadline,
+ const base::Closure& callback) {
WatcherID id = 0;
{
static int next_id = 0;
@@ -265,8 +264,7 @@ void WatcherThreadManager::RemoveAndNotify(WatcherID id, MojoResult result) {
to_notify = i->second;
id_to_callback_.erase(i);
}
- to_notify.message_loop->PostTask(FROM_HERE,
- base::Bind(to_notify.callback, result));
+ to_notify.message_loop->PostTask(FROM_HERE, to_notify.callback);
}
void WatcherThreadManager::RemoveHandle(MojoHandle handle) {
@@ -330,7 +328,7 @@ struct HandleWatcher::StartState {
WatcherID watcher_id;
// Callback to notify when done.
- base::Callback<void(MojoResult)> callback;
+ base::Closure callback;
// When Start() is invoked a callback is passed to WatcherThreadManager
// using a WeakRef from |weak_refactory_|. The callback invokes
@@ -356,7 +354,7 @@ HandleWatcher::~HandleWatcher() {
void HandleWatcher::Start(MojoHandle handle,
MojoWaitFlags wait_flags,
MojoDeadline deadline,
- const base::Callback<void(MojoResult)>& callback) {
+ const base::Closure& callback) {
DCHECK_NE(MOJO_HANDLE_INVALID, handle);
DCHECK_NE(MOJO_WAIT_FLAG_NONE, wait_flags);
@@ -381,12 +379,10 @@ void HandleWatcher::Stop() {
WatcherThreadManager::GetInstance()->StopWatching(old_state->watcher_id);
}
-void HandleWatcher::OnHandleReady(MojoResult result) {
+void HandleWatcher::OnHandleReady() {
DCHECK(start_state_.get());
scoped_ptr<StartState> old_state(start_state_.Pass());
- old_state->callback.Run(result);
-
- // NOTE: We may have been deleted during callback execution.
+ old_state->callback.Run();
}
// static
« no previous file with comments | « mojo/common/handle_watcher.h ('k') | mojo/common/handle_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698