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

Side by Side Diff: trunk/src/components/metrics/serialization/serialization_utils.cc

Issue 474483002: Revert 289312 "Move StringToUpperASCII and LowerCaseEqualsASCII ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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/serialization/serialization_utils.h" 5 #include "components/metrics/serialization/serialization_utils.h"
6 6
7 #include <sys/file.h> 7 #include <sys/file.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // We should have two null terminated strings so split should produce 90 // We should have two null terminated strings so split should produce
91 // three chunks. 91 // three chunks.
92 if (parts.size() != 3) { 92 if (parts.size() != 3) {
93 DLOG(ERROR) << "splitting message on \\0 produced " << parts.size() 93 DLOG(ERROR) << "splitting message on \\0 produced " << parts.size()
94 << " parts (expected 3)"; 94 << " parts (expected 3)";
95 return scoped_ptr<MetricSample>(); 95 return scoped_ptr<MetricSample>();
96 } 96 }
97 const std::string& name = parts[0]; 97 const std::string& name = parts[0];
98 const std::string& value = parts[1]; 98 const std::string& value = parts[1];
99 99
100 if (base::LowerCaseEqualsASCII(name, "crash")) { 100 if (LowerCaseEqualsASCII(name, "crash")) {
101 return MetricSample::CrashSample(value); 101 return MetricSample::CrashSample(value);
102 } else if (base::LowerCaseEqualsASCII(name, "histogram")) { 102 } else if (LowerCaseEqualsASCII(name, "histogram")) {
103 return MetricSample::ParseHistogram(value); 103 return MetricSample::ParseHistogram(value);
104 } else if (base::LowerCaseEqualsASCII(name, "linearhistogram")) { 104 } else if (LowerCaseEqualsASCII(name, "linearhistogram")) {
105 return MetricSample::ParseLinearHistogram(value); 105 return MetricSample::ParseLinearHistogram(value);
106 } else if (base::LowerCaseEqualsASCII(name, "sparsehistogram")) { 106 } else if (LowerCaseEqualsASCII(name, "sparsehistogram")) {
107 return MetricSample::ParseSparseHistogram(value); 107 return MetricSample::ParseSparseHistogram(value);
108 } else if (base::LowerCaseEqualsASCII(name, "useraction")) { 108 } else if (LowerCaseEqualsASCII(name, "useraction")) {
109 return MetricSample::UserActionSample(value); 109 return MetricSample::UserActionSample(value);
110 } else { 110 } else {
111 DLOG(ERROR) << "invalid event type: " << name << ", value: " << value; 111 DLOG(ERROR) << "invalid event type: " << name << ", value: " << value;
112 } 112 }
113 return scoped_ptr<MetricSample>(); 113 return scoped_ptr<MetricSample>();
114 } 114 }
115 115
116 void SerializationUtils::ReadAndTruncateMetricsFromFile( 116 void SerializationUtils::ReadAndTruncateMetricsFromFile(
117 const std::string& filename, 117 const std::string& filename,
118 ScopedVector<MetricSample>* metrics) { 118 ScopedVector<MetricSample>* metrics) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 file_descriptor.get(), msg.c_str(), msg.length()) != 207 file_descriptor.get(), msg.c_str(), msg.length()) !=
208 static_cast<int>(msg.length())) { 208 static_cast<int>(msg.length())) {
209 DLOG(ERROR) << "error writing message" << errno; 209 DLOG(ERROR) << "error writing message" << errno;
210 return false; 210 return false;
211 } 211 }
212 212
213 return true; 213 return true;
214 } 214 }
215 215
216 } // namespace metrics 216 } // namespace metrics
OLDNEW
« no previous file with comments | « trunk/src/components/google/core/browser/google_util.cc ('k') | trunk/src/components/omnibox/autocomplete_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698