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

Unified Diff: ipc/ipc_sync_channel.cc

Issue 2801593002: Convert WaitableEvent::EventCallback to OnceCallback (Closed)
Patch Set: +#include <utility> Created 3 years, 8 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/browsing_data/chrome_browsing_data_remover_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_channel.cc
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
index 0d61e08ce945b01e27fd3005b138c1bfbc5c7eee..842e04e74c6f33038a7415c205af3df1c8c53137 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -88,9 +88,9 @@ class SyncChannel::ReceivedSyncMsgQueue :
outer_state_(sync_msg_queue_->top_send_done_event_watcher_),
event_(context->GetSendDoneEvent()),
callback_(
- base::Bind(&SyncChannel::SyncContext::OnSendDoneEventSignaled,
- context,
- run_loop)) {
+ base::BindOnce(&SyncChannel::SyncContext::OnSendDoneEventSignaled,
+ context,
+ run_loop)) {
sync_msg_queue_->top_send_done_event_watcher_ = this;
if (outer_state_)
outer_state_->StopWatching();
@@ -104,14 +104,23 @@ class SyncChannel::ReceivedSyncMsgQueue :
}
private:
- void StartWatching() { watcher_.StartWatching(event_, callback_); }
+ void Run(WaitableEvent* event) {
+ DCHECK(callback_);
+ std::move(callback_).Run(event);
+ }
+
+ void StartWatching() {
+ watcher_.StartWatching(event_, base::BindOnce(&NestedSendDoneWatcher::Run,
+ base::Unretained(this)));
+ }
+
void StopWatching() { watcher_.StopWatching(); }
ReceivedSyncMsgQueue* const sync_msg_queue_;
NestedSendDoneWatcher* const outer_state_;
base::WaitableEvent* const event_;
- const base::WaitableEventWatcher::EventCallback callback_;
+ base::WaitableEventWatcher::EventCallback callback_;
base::WaitableEventWatcher watcher_;
DISALLOW_COPY_AND_ASSIGN(NestedSendDoneWatcher);
« no previous file with comments | « chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698