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

Side by Side Diff: chrome/common/metrics/experiments_helper.cc

Issue 10800078: Remove wchar_t versions of StringPrintf from Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: First cut, compiles on Android Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/metrics/experiments_helper.h" 5 #include "chrome/common/metrics/experiments_helper.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 if (!current_chunk.empty()) 150 if (!current_chunk.empty())
151 chunks->push_back(current_chunk); 151 chunks->push_back(current_chunk);
152 } 152 }
153 153
154 void SetChildProcessLoggingExperimentList() { 154 void SetChildProcessLoggingExperimentList() {
155 std::vector<SelectedGroupId> name_group_ids; 155 std::vector<SelectedGroupId> name_group_ids;
156 GetFieldTrialSelectedGroupIds(&name_group_ids); 156 GetFieldTrialSelectedGroupIds(&name_group_ids);
157 std::vector<string16> experiment_strings(name_group_ids.size()); 157 std::vector<string16> experiment_strings(name_group_ids.size());
158 for (size_t i = 0; i < name_group_ids.size(); ++i) { 158 for (size_t i = 0; i < name_group_ids.size(); ++i) {
159 #if defined(OS_ANDROID)
160 // Android doesn't have wchar_t StringPrintf.
161 experiment_strings[i] = UTF8ToUTF16(base::StringPrintf(
162 "%x-%x", name_group_ids[i].name, name_group_ids[i].group));
163 #else
159 // Wish there was a StringPrintf for string16... :-( 164 // Wish there was a StringPrintf for string16... :-(
160 experiment_strings[i] = WideToUTF16(base::StringPrintf( 165 experiment_strings[i] = WideToUTF16(base::StringPrintf(
161 L"%x-%x", name_group_ids[i].name, name_group_ids[i].group)); 166 L"%x-%x", name_group_ids[i].name, name_group_ids[i].group));
167 #endif
162 } 168 }
163 child_process_logging::SetExperimentList(experiment_strings); 169 child_process_logging::SetExperimentList(experiment_strings);
164 } 170 }
165 171
166 } // namespace experiments_helper 172 } // namespace experiments_helper
167 173
168 // Functions below are exposed for testing explicitly behind this namespace. 174 // Functions below are exposed for testing explicitly behind this namespace.
169 // They simply wrap existing functions in this file. 175 // They simply wrap existing functions in this file.
170 namespace testing { 176 namespace testing {
171 177
172 void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( 178 void TestGetFieldTrialSelectedGroupIdsForSelectedGroups(
173 const base::FieldTrial::SelectedGroups& selected_groups, 179 const base::FieldTrial::SelectedGroups& selected_groups,
174 std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { 180 std::vector<experiments_helper::SelectedGroupId>* name_group_ids) {
175 ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups, 181 ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups,
176 name_group_ids); 182 name_group_ids);
177 } 183 }
178 184
179 uint32 TestHashName(const std::string& name) { 185 uint32 TestHashName(const std::string& name) {
180 return ::HashName(name); 186 return ::HashName(name);
181 } 187 }
182 188
183 } // namespace testing 189 } // namespace testing
OLDNEW
« base/stringprintf.h ('K') | « chrome/browser/diagnostics/diagnostics_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698