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

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

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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/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
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
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
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_auth_fetcher.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698