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

Side by Side Diff: components/variations/variations_seed_store.cc

Issue 2605293002: Add WARN_UNUSED_RESULT to base::Time methods that return bool. (Closed)
Patch Set: Add comment to PexeDownloader::didReceiveResponse() Created 3 years, 11 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 "components/variations/variations_seed_store.h" 5 #include "components/variations/variations_seed_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 return SEED_DATE_SAME_DAY; 133 return SEED_DATE_SAME_DAY;
134 } 134 }
135 135
136 #if defined(OS_ANDROID) 136 #if defined(OS_ANDROID)
137 enum FirstRunResult { 137 enum FirstRunResult {
138 FIRST_RUN_SEED_IMPORT_SUCCESS, 138 FIRST_RUN_SEED_IMPORT_SUCCESS,
139 FIRST_RUN_SEED_IMPORT_FAIL_NO_CALLBACK, 139 FIRST_RUN_SEED_IMPORT_FAIL_NO_CALLBACK,
140 FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED, 140 FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED,
141 FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED, 141 FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED,
142 FIRST_RUN_SEED_IMPORT_FAIL_INVALID_RESPONSE_DATE,
Alexei Svitkine (slow) 2017/01/17 21:38:07 Can you add this to histograms.xml? Seems like you
digit1 2017/01/19 12:57:41 Thanks for spotting this. Please see the new patch
142 FIRST_RUN_RESULT_ENUM_SIZE, 143 FIRST_RUN_RESULT_ENUM_SIZE,
143 }; 144 };
144 145
145 void RecordFirstRunResult(FirstRunResult result) { 146 void RecordFirstRunResult(FirstRunResult result) {
146 UMA_HISTOGRAM_ENUMERATION("Variations.FirstRunResult", result, 147 UMA_HISTOGRAM_ENUMERATION("Variations.FirstRunResult", result,
147 FIRST_RUN_RESULT_ENUM_SIZE); 148 FIRST_RUN_RESULT_ENUM_SIZE);
148 } 149 }
149 #endif // OS_ANDROID 150 #endif // OS_ANDROID
150 151
151 } // namespace 152 } // namespace
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 bool is_gzip_compressed; 361 bool is_gzip_compressed;
361 362
362 android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country, 363 android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
363 &response_date, &is_gzip_compressed); 364 &response_date, &is_gzip_compressed);
364 if (seed_data.empty()) { 365 if (seed_data.empty()) {
365 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED); 366 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED);
366 return; 367 return;
367 } 368 }
368 369
369 base::Time current_date; 370 base::Time current_date;
370 base::Time::FromUTCString(response_date.c_str(), &current_date); 371 if (!base::Time::FromUTCString(response_date.c_str(), &current_date)) {
372 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_INVALID_RESPONSE_DATE);
373 LOG(WARNING) << "Invalid response date: " << response_date;
374 return;
375 }
371 376
372 if (!StoreSeedData(seed_data, seed_signature, seed_country, current_date, 377 if (!StoreSeedData(seed_data, seed_signature, seed_country, current_date,
373 false, is_gzip_compressed, nullptr)) { 378 false, is_gzip_compressed, nullptr)) {
374 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED); 379 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED);
375 LOG(WARNING) << "First run variations seed is invalid."; 380 LOG(WARNING) << "First run variations seed is invalid.";
376 return; 381 return;
377 } 382 }
378 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_SUCCESS); 383 RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_SUCCESS);
379 } 384 }
380 #endif // OS_ANDROID 385 #endif // OS_ANDROID
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 536 }
532 return true; 537 return true;
533 } 538 }
534 539
535 void VariationsSeedStore::ReportUnsupportedSeedFormatError() { 540 void VariationsSeedStore::ReportUnsupportedSeedFormatError() {
536 RecordSeedStoreHistogram( 541 RecordSeedStoreHistogram(
537 VARIATIONS_SEED_STORE_FAILED_UNSUPPORTED_SEED_FORMAT); 542 VARIATIONS_SEED_STORE_FAILED_UNSUPPORTED_SEED_FORMAT);
538 } 543 }
539 544
540 } // namespace variations 545 } // namespace variations
OLDNEW
« no previous file with comments | « components/nacl/renderer/ppb_nacl_private_impl.cc ('k') | content/browser/blob_storage/blob_storage_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698