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

Side by Side Diff: src/utils/SkRTConf.cpp

Issue 20136003: search registered rtconf variables backwards and break when we find the (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkRTConf.h" 8 #include "SkRTConf.h"
9 #include "SkOSFile.h" 9 #include "SkOSFile.h"
10 10
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 for (char *ptr = s ; *ptr ; ptr++) { 208 for (char *ptr = s ; *ptr ; ptr++) {
209 if (*ptr == search) { 209 if (*ptr == search) {
210 *ptr = replace; 210 *ptr = replace;
211 } 211 }
212 } 212 }
213 } 213 }
214 214
215 template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) { 215 template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) {
216 SkString *str = NULL; 216 SkString *str = NULL;
217 217
218 for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { 218 for (int i = fConfigFileKeys.count() - 1 ; i >= 0; i--) {
219 if (fConfigFileKeys[i]->equals(name)) { 219 if (fConfigFileKeys[i]->equals(name)) {
220 str = fConfigFileValues[i]; 220 str = fConfigFileValues[i];
221 break;
221 } 222 }
222 } 223 }
223 224
224 SkString environment_variable("skia."); 225 SkString environment_variable("skia.");
225 environment_variable.append(name); 226 environment_variable.append(name);
226 227
227 const char *environment_value = getenv(environment_variable.c_str()); 228 const char *environment_value = getenv(environment_variable.c_str());
228 if (environment_value) { 229 if (environment_value) {
229 str->set(environment_value); 230 str->set(environment_value);
230 } else { 231 } else {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 template void SkRTConfRegistry::set(const char *name, int value); 287 template void SkRTConfRegistry::set(const char *name, int value);
287 template void SkRTConfRegistry::set(const char *name, unsigned int value); 288 template void SkRTConfRegistry::set(const char *name, unsigned int value);
288 template void SkRTConfRegistry::set(const char *name, float value); 289 template void SkRTConfRegistry::set(const char *name, float value);
289 template void SkRTConfRegistry::set(const char *name, double value); 290 template void SkRTConfRegistry::set(const char *name, double value);
290 template void SkRTConfRegistry::set(const char *name, char * value); 291 template void SkRTConfRegistry::set(const char *name, char * value);
291 292
292 SkRTConfRegistry &skRTConfRegistry() { 293 SkRTConfRegistry &skRTConfRegistry() {
293 static SkRTConfRegistry r; 294 static SkRTConfRegistry r;
294 return r; 295 return r;
295 } 296 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698