OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |