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

Side by Side Diff: google_apis/gcm/engine/checkin_request.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "google_apis/gcm/engine/checkin_request.h" 5 #include "google_apis/gcm/engine/checkin_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" 10 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 request_info_.account_tokens.begin(); 136 request_info_.account_tokens.begin();
137 iter != request_info_.account_tokens.end(); 137 iter != request_info_.account_tokens.end();
138 ++iter) { 138 ++iter) {
139 request.add_account_cookie(iter->first); 139 request.add_account_cookie(iter->first);
140 request.add_account_cookie(iter->second); 140 request.add_account_cookie(iter->second);
141 } 141 }
142 142
143 std::string upload_data; 143 std::string upload_data;
144 CHECK(request.SerializeToString(&upload_data)); 144 CHECK(request.SerializeToString(&upload_data));
145 145
146 url_fetcher_.reset( 146 url_fetcher_ =
147 net::URLFetcher::Create(checkin_url_, net::URLFetcher::POST, this)); 147 net::URLFetcher::Create(checkin_url_, net::URLFetcher::POST, this);
148 url_fetcher_->SetRequestContext(request_context_getter_); 148 url_fetcher_->SetRequestContext(request_context_getter_);
149 url_fetcher_->SetUploadData(kRequestContentType, upload_data); 149 url_fetcher_->SetUploadData(kRequestContentType, upload_data);
150 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 150 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
151 net::LOAD_DO_NOT_SAVE_COOKIES); 151 net::LOAD_DO_NOT_SAVE_COOKIES);
152 recorder_->RecordCheckinInitiated(request_info_.android_id); 152 recorder_->RecordCheckinInitiated(request_info_.android_id);
153 request_start_time_ = base::TimeTicks::Now(); 153 request_start_time_ = base::TimeTicks::Now();
154 url_fetcher_->Start(); 154 url_fetcher_->Start();
155 } 155 }
156 156
157 void CheckinRequest::RetryWithBackoff(bool update_backoff) { 157 void CheckinRequest::RetryWithBackoff(bool update_backoff) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 RecordCheckinStatusAndReportUMA(SUCCESS, recorder_, false); 228 RecordCheckinStatusAndReportUMA(SUCCESS, recorder_, false);
229 UMA_HISTOGRAM_COUNTS("GCM.CheckinRetryCount", 229 UMA_HISTOGRAM_COUNTS("GCM.CheckinRetryCount",
230 backoff_entry_.failure_count()); 230 backoff_entry_.failure_count());
231 UMA_HISTOGRAM_TIMES("GCM.CheckinCompleteTime", 231 UMA_HISTOGRAM_TIMES("GCM.CheckinCompleteTime",
232 base::TimeTicks::Now() - request_start_time_); 232 base::TimeTicks::Now() - request_start_time_);
233 callback_.Run(response_proto); 233 callback_.Run(response_proto);
234 } 234 }
235 235
236 } // namespace gcm 236 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_api_call_flow_unittest.cc ('k') | google_apis/gcm/engine/registration_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698