summaryrefslogtreecommitdiffstats
path: root/remoting/signaling
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2015-04-24 17:18:08 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-25 00:18:25 +0000
commitd9bdcb6c95619e6cb3a4281156573c58f7626a26 (patch)
tree84cf1bd7964177589cc1f1e024655dbb0ef50042 /remoting/signaling
parentf79a51f871181b0da7653cfa17d351745bd12994 (diff)
downloadchromium_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/signaling')
-rw-r--r--remoting/signaling/iq_sender.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/remoting/signaling/iq_sender.cc b/remoting/signaling/iq_sender.cc
index d3e7432..7fefc71 100644
--- a/remoting/signaling/iq_sender.cc
+++ b/remoting/signaling/iq_sender.cc
@@ -5,6 +5,7 @@
#include "remoting/signaling/iq_sender.h"
#include "base/bind.h"
+#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -138,11 +139,8 @@ void IqRequest::SetTimeout(base::TimeDelta timeout) {
}
void IqRequest::CallCallback(const buzz::XmlElement* stanza) {
- if (!callback_.is_null()) {
- IqSender::ReplyCallback callback(callback_);
- callback_.Reset();
- callback.Run(this, stanza);
- }
+ if (!callback_.is_null())
+ base::ResetAndReturn(&callback_).Run(this, stanza);
}
void IqRequest::OnTimeout() {