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

Side by Side Diff: components/metrics/persisted_logs.cc

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 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 | Annotate | Revision Log
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/metrics/persisted_logs.h" 5 #include "components/metrics/persisted_logs.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
(...skipping 23 matching lines...) Expand all
34 std::string base64_result; 34 std::string base64_result;
35 if (!list_value.GetString(index, &base64_result)) 35 if (!list_value.GetString(index, &base64_result))
36 return false; 36 return false;
37 return base::Base64Decode(base64_result, result); 37 return base::Base64Decode(base64_result, result);
38 } 38 }
39 39
40 // Base64-encodes |str| and appends the result to |list_value|. 40 // Base64-encodes |str| and appends the result to |list_value|.
41 void AppendBase64String(const std::string& str, base::ListValue* list_value) { 41 void AppendBase64String(const std::string& str, base::ListValue* list_value) {
42 std::string base64_str; 42 std::string base64_str;
43 base::Base64Encode(str, &base64_str); 43 base::Base64Encode(str, &base64_str);
44 list_value->Append(base::Value::CreateStringValue(base64_str)); 44 list_value->AppendString(base64_str);
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
49 void PersistedLogs::LogHashPair::Init(const std::string& log_data) { 49 void PersistedLogs::LogHashPair::Init(const std::string& log_data) {
50 DCHECK(!log_data.empty()); 50 DCHECK(!log_data.empty());
51 51
52 if (!GzipCompress(log_data, &compressed_log_data)) { 52 if (!GzipCompress(log_data, &compressed_log_data)) {
53 NOTREACHED(); 53 NOTREACHED();
54 return; 54 return;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return MakeRecallStatusHistogram(CHECKSUM_STRING_CORRUPTION); 289 return MakeRecallStatusHistogram(CHECKSUM_STRING_CORRUPTION);
290 } 290 }
291 if (recovered_md5 != base::MD5DigestToBase16(digest)) { 291 if (recovered_md5 != base::MD5DigestToBase16(digest)) {
292 list_.clear(); 292 list_.clear();
293 return MakeRecallStatusHistogram(CHECKSUM_CORRUPTION); 293 return MakeRecallStatusHistogram(CHECKSUM_CORRUPTION);
294 } 294 }
295 return MakeRecallStatusHistogram(RECALL_SUCCESS); 295 return MakeRecallStatusHistogram(RECALL_SUCCESS);
296 } 296 }
297 297
298 } // namespace metrics 298 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698