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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/i18n/time_formatting.h" | 6 #include "base/i18n/time_formatting.h" |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/profiler/scoped_tracker.h" | |
9 #include "base/sha1.h" | 8 #include "base/sha1.h" |
10 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
12 #if !defined(OS_ANDROID) | 11 #if !defined(OS_ANDROID) |
13 // channel_common.proto defines ANDROID constant that conflicts with Android | 12 // channel_common.proto defines ANDROID constant that conflicts with Android |
14 // build. At the same time TiclInvalidationService is not used on Android so it | 13 // build. At the same time TiclInvalidationService is not used on Android so it |
15 // is safe to exclude these protos from Android build. | 14 // is safe to exclude these protos from Android build. |
16 #include "google/cacheinvalidation/android_channel.pb.h" | 15 #include "google/cacheinvalidation/android_channel.pb.h" |
17 #include "google/cacheinvalidation/channel_common.pb.h" | 16 #include "google/cacheinvalidation/channel_common.pb.h" |
18 #include "google/cacheinvalidation/types.pb.h" | 17 #include "google/cacheinvalidation/types.pb.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 const std::string echo_header("echo-token: " + echo_token_); | 216 const std::string echo_header("echo-token: " + echo_token_); |
218 fetcher_->AddExtraRequestHeader(echo_header); | 217 fetcher_->AddExtraRequestHeader(echo_header); |
219 } | 218 } |
220 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); | 219 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); |
221 fetcher_->Start(); | 220 fetcher_->Start(); |
222 // Clear message to prevent accidentally resending it in the future. | 221 // Clear message to prevent accidentally resending it in the future. |
223 cached_message_.clear(); | 222 cached_message_.clear(); |
224 } | 223 } |
225 | 224 |
226 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { | 225 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { |
227 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. | |
228 tracked_objects::ScopedTracker tracking_profile( | |
229 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
230 "422577 GCMNetworkChannel::OnURLFetchComplete")); | |
231 | |
232 DCHECK(CalledOnValidThread()); | 226 DCHECK(CalledOnValidThread()); |
233 DCHECK_EQ(fetcher_, source); | 227 DCHECK_EQ(fetcher_, source); |
234 // Free fetcher at the end of function. | 228 // Free fetcher at the end of function. |
235 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); | 229 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); |
236 | 230 |
237 net::URLRequestStatus status = fetcher->GetStatus(); | 231 net::URLRequestStatus status = fetcher->GetStatus(); |
238 diagnostic_info_.last_post_response_code_ = | 232 diagnostic_info_.last_post_response_code_ = |
239 status.is_success() ? source->GetResponseCode() : status.error(); | 233 status.is_success() ? source->GetResponseCode() : status.error(); |
240 | 234 |
241 if (status.is_success() && | 235 if (status.is_success() && |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 ENUM_CASE(gcm::GCMClient::NOT_SIGNED_IN); | 449 ENUM_CASE(gcm::GCMClient::NOT_SIGNED_IN); |
456 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); | 450 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); |
457 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); | 451 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); |
458 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); | 452 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); |
459 } | 453 } |
460 NOTREACHED(); | 454 NOTREACHED(); |
461 return ""; | 455 return ""; |
462 } | 456 } |
463 | 457 |
464 } // namespace syncer | 458 } // namespace syncer |
OLD | NEW |