diff options
author | sergeyu <sergeyu@chromium.org> | 2015-04-24 17:18:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-25 00:18:25 +0000 |
commit | d9bdcb6c95619e6cb3a4281156573c58f7626a26 (patch) | |
tree | 84cf1bd7964177589cc1f1e024655dbb0ef50042 /remoting/host/daemon_process.cc | |
parent | f79a51f871181b0da7653cfa17d351745bd12994 (diff) | |
download | chromium_src-d9bdcb6c95619e6cb3a4281156573c58f7626a26.zip chromium_src-d9bdcb6c95619e6cb3a4281156573c58f7626a26.tar.gz chromium_src-d9bdcb6c95619e6cb3a4281156573c58f7626a26.tar.bz2 |
Use base::ResetAndReturn() in remoting.
base::ResetAndReturn() makes code shorter and simpler. Also in several
places callbacks were Reset() after Run(), which is dangerous for
callback that are allowed to delete the caller. base::ResetAndReturn()
helps to avoid this issue.
Review URL: https://codereview.chromium.org/1064863004
Cr-Commit-Position: refs/heads/master@{#326940}
Diffstat (limited to 'remoting/host/daemon_process.cc')
-rw-r--r-- | remoting/host/daemon_process.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/remoting/host/daemon_process.cc b/remoting/host/daemon_process.cc index 8c9ebbb..e08677a 100644 --- a/remoting/host/daemon_process.cc +++ b/remoting/host/daemon_process.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/callback_helpers.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -285,9 +286,7 @@ void DaemonProcess::Stop() { DCHECK(caller_task_runner()->BelongsToCurrentThread()); if (!stopped_callback_.is_null()) { - base::Closure stopped_callback = stopped_callback_; - stopped_callback_.Reset(); - stopped_callback.Run(); + base::ResetAndReturn(&stopped_callback_).Run(); } } |