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

Unified Diff: remoting/test/remote_host_info_fetcher.cc

Issue 1064863004: Use base::ResetAndReturn() in remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « remoting/test/access_token_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/test/remote_host_info_fetcher.cc
diff --git a/remoting/test/remote_host_info_fetcher.cc b/remoting/test/remote_host_info_fetcher.cc
index f2b0e8fd390b48c5f4930a39cb9d8c63b895d636..e386bf868aabe2e92e17d55bcdf9076e25ce567a 100644
--- a/remoting/test/remote_host_info_fetcher.cc
+++ b/remoting/test/remote_host_info_fetcher.cc
@@ -5,6 +5,7 @@
#include "remoting/test/remote_host_info_fetcher.h"
#include "base/bind.h"
+#include "base/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
@@ -88,16 +89,14 @@ void RemoteHostInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
if (response_code != net::HTTP_OK) {
LOG(ERROR) << "RemoteHostInfo request failed with error code: "
<< response_code;
- remote_host_info_callback_.Run(remote_host_info);
- remote_host_info_callback_.Reset();
+ base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
return;
}
std::string response_string;
if (!request_->GetResponseAsString(&response_string)) {
LOG(ERROR) << "Failed to retrieve RemoteHostInfo response data";
- remote_host_info_callback_.Run(remote_host_info);
- remote_host_info_callback_.Reset();
+ base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
return;
}
@@ -106,8 +105,7 @@ void RemoteHostInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
if (!response_value ||
!response_value->IsType(base::Value::TYPE_DICTIONARY)) {
LOG(ERROR) << "Failed to parse response string to JSON";
- remote_host_info_callback_.Run(remote_host_info);
- remote_host_info_callback_.Reset();
+ base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
return;
}
@@ -117,8 +115,7 @@ void RemoteHostInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
response->GetString("status", &remote_host_status);
} else {
LOG(ERROR) << "Failed to convert parsed JSON to a dictionary object";
- remote_host_info_callback_.Run(remote_host_info);
- remote_host_info_callback_.Reset();
+ base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
return;
}
@@ -133,8 +130,7 @@ void RemoteHostInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
response->GetString("sharedSecret", &remote_host_info.shared_secret);
}
- remote_host_info_callback_.Run(remote_host_info);
- remote_host_info_callback_.Reset();
+ base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
}
} // namespace test
« no previous file with comments | « remoting/test/access_token_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698