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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 base::Bind(callback, | 350 base::Bind(callback, |
351 base::Passed(&result))); | 351 base::Passed(&result))); |
352 return; | 352 return; |
353 } | 353 } |
354 | 354 |
355 // |result->registrations| contains both GCM registrations and InstanceID | 355 // |result->registrations| contains both GCM registrations and InstanceID |
356 // tokens. Count them separately. | 356 // tokens. Count them separately. |
357 int gcm_registration_count = 0; | 357 int gcm_registration_count = 0; |
358 int instance_id_token_count = 0; | 358 int instance_id_token_count = 0; |
359 for (const auto& registration : result->registrations) { | 359 for (const auto& registration : result->registrations) { |
360 if (base::StartsWithASCII(registration.first, "iid-", true)) | 360 if (base::StartsWith(registration.first, "iid-", |
| 361 base::CompareCase::SENSITIVE)) |
361 instance_id_token_count++; | 362 instance_id_token_count++; |
362 else | 363 else |
363 gcm_registration_count++; | 364 gcm_registration_count++; |
364 } | 365 } |
365 | 366 |
366 // Only record histograms if GCM had already been set up for this device. | 367 // Only record histograms if GCM had already been set up for this device. |
367 if (result->device_android_id != 0 && result->device_security_token != 0) { | 368 if (result->device_android_id != 0 && result->device_security_token != 0) { |
368 int64 file_size = 0; | 369 int64 file_size = 0; |
369 if (base::GetFileSize(path_, &file_size)) { | 370 if (base::GetFileSize(path_, &file_size)) { |
370 UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB", | 371 UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB", |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 removed_message_counts.begin(); | 1474 removed_message_counts.begin(); |
1474 iter != removed_message_counts.end(); ++iter) { | 1475 iter != removed_message_counts.end(); ++iter) { |
1475 DCHECK_NE(app_message_counts_.count(iter->first), 0U); | 1476 DCHECK_NE(app_message_counts_.count(iter->first), 0U); |
1476 app_message_counts_[iter->first] -= iter->second; | 1477 app_message_counts_[iter->first] -= iter->second; |
1477 DCHECK_GE(app_message_counts_[iter->first], 0); | 1478 DCHECK_GE(app_message_counts_[iter->first], 0); |
1478 } | 1479 } |
1479 callback.Run(true); | 1480 callback.Run(true); |
1480 } | 1481 } |
1481 | 1482 |
1482 } // namespace gcm | 1483 } // namespace gcm |
OLD | NEW |