| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 char *keyptr = strtok(line, sep); | 39 char *keyptr = strtok(line, sep); |
| 40 if (!keyptr) { | 40 if (!keyptr) { |
| 41 continue; | 41 continue; |
| 42 } | 42 } |
| 43 | 43 |
| 44 char *valptr = strtok(NULL, sep); | 44 char *valptr = strtok(NULL, sep); |
| 45 if (!valptr) { | 45 if (!valptr) { |
| 46 continue; | 46 continue; |
| 47 } | 47 } |
| 48 | 48 |
| 49 SkString* key = SkNEW_ARGS(SkString,(keyptr)); | 49 SkString *key = new SkString(keyptr); |
| 50 SkString* val = SkNEW_ARGS(SkString,(valptr)); | 50 SkString *val = new SkString(valptr); |
| 51 | 51 |
| 52 fConfigFileKeys.append(1, &key); | 52 fConfigFileKeys.append(1, &key); |
| 53 fConfigFileValues.append(1, &val); | 53 fConfigFileValues.append(1, &val); |
| 54 } | 54 } |
| 55 sk_fclose(fp); | 55 sk_fclose(fp); |
| 56 } | 56 } |
| 57 | 57 |
| 58 SkRTConfRegistry::~SkRTConfRegistry() { | 58 SkRTConfRegistry::~SkRTConfRegistry() { |
| 59 ConfMap::Iter iter(fConfs); | 59 ConfMap::Iter iter(fConfs); |
| 60 SkTDArray<SkRTConfBase *> *confArray; | 60 SkTDArray<SkRTConfBase *> *confArray; |
| 61 | 61 |
| 62 while (iter.next(&confArray)) { | 62 while (iter.next(&confArray)) { |
| 63 delete confArray; | 63 delete confArray; |
| 64 } | 64 } |
| 65 | 65 |
| 66 for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { | 66 for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { |
| 67 SkDELETE(fConfigFileKeys[i]); | 67 delete fConfigFileKeys[i]; |
| 68 SkDELETE(fConfigFileValues[i]); | 68 delete fConfigFileValues[i]; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 const char *SkRTConfRegistry::configFileLocation() const { | 72 const char *SkRTConfRegistry::configFileLocation() const { |
| 73 return "skia.conf"; // for now -- should probably do something fancier like
home directories or whatever. | 73 return "skia.conf"; // for now -- should probably do something fancier like
home directories or whatever. |
| 74 } | 74 } |
| 75 | 75 |
| 76 // dump all known runtime config options to the file with their default values. | 76 // dump all known runtime config options to the file with their default values. |
| 77 // to trigger this, make a config file of zero size. | 77 // to trigger this, make a config file of zero size. |
| 78 void SkRTConfRegistry::possiblyDumpFile() const { | 78 void SkRTConfRegistry::possiblyDumpFile() const { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 template void SkRTConfRegistry::set(const char *name, int value, bool); | 316 template void SkRTConfRegistry::set(const char *name, int value, bool); |
| 317 template void SkRTConfRegistry::set(const char *name, unsigned int value, bool); | 317 template void SkRTConfRegistry::set(const char *name, unsigned int value, bool); |
| 318 template void SkRTConfRegistry::set(const char *name, float value, bool); | 318 template void SkRTConfRegistry::set(const char *name, float value, bool); |
| 319 template void SkRTConfRegistry::set(const char *name, double value, bool); | 319 template void SkRTConfRegistry::set(const char *name, double value, bool); |
| 320 template void SkRTConfRegistry::set(const char *name, char * value, bool); | 320 template void SkRTConfRegistry::set(const char *name, char * value, bool); |
| 321 | 321 |
| 322 SkRTConfRegistry &skRTConfRegistry() { | 322 SkRTConfRegistry &skRTConfRegistry() { |
| 323 static SkRTConfRegistry r; | 323 static SkRTConfRegistry r; |
| 324 return r; | 324 return r; |
| 325 } | 325 } |
| OLD | NEW |