| 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/gcm_store_impl.h" | 5 #include "google_apis/gcm/engine/gcm_store_impl.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 base::Bind(callback, | 335 base::Bind(callback, |
| 336 base::Passed(&result))); | 336 base::Passed(&result))); |
| 337 return; | 337 return; |
| 338 } | 338 } |
| 339 | 339 |
| 340 // |result->registrations| contains both GCM registrations and InstanceID | 340 // |result->registrations| contains both GCM registrations and InstanceID |
| 341 // tokens. Count them separately. | 341 // tokens. Count them separately. |
| 342 int gcm_registration_count = 0; | 342 int gcm_registration_count = 0; |
| 343 int instance_id_token_count = 0; | 343 int instance_id_token_count = 0; |
| 344 for (const auto& registration : result->registrations) { | 344 for (const auto& registration : result->registrations) { |
| 345 if (StartsWithASCII(registration.first, "iid-", true)) | 345 if (base::StartsWithASCII(registration.first, "iid-", true)) |
| 346 instance_id_token_count++; | 346 instance_id_token_count++; |
| 347 else | 347 else |
| 348 gcm_registration_count++; | 348 gcm_registration_count++; |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Only record histograms if GCM had already been set up for this device. | 351 // Only record histograms if GCM had already been set up for this device. |
| 352 if (result->device_android_id != 0 && result->device_security_token != 0) { | 352 if (result->device_android_id != 0 && result->device_security_token != 0) { |
| 353 int64 file_size = 0; | 353 int64 file_size = 0; |
| 354 if (base::GetFileSize(path_, &file_size)) { | 354 if (base::GetFileSize(path_, &file_size)) { |
| 355 UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB", | 355 UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB", |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 removed_message_counts.begin(); | 1457 removed_message_counts.begin(); |
| 1458 iter != removed_message_counts.end(); ++iter) { | 1458 iter != removed_message_counts.end(); ++iter) { |
| 1459 DCHECK_NE(app_message_counts_.count(iter->first), 0U); | 1459 DCHECK_NE(app_message_counts_.count(iter->first), 0U); |
| 1460 app_message_counts_[iter->first] -= iter->second; | 1460 app_message_counts_[iter->first] -= iter->second; |
| 1461 DCHECK_GE(app_message_counts_[iter->first], 0); | 1461 DCHECK_GE(app_message_counts_[iter->first], 0); |
| 1462 } | 1462 } |
| 1463 callback.Run(true); | 1463 callback.Run(true); |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 } // namespace gcm | 1466 } // namespace gcm |
| OLD | NEW |