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

Side by Side Diff: include/utils/SkRTConf.h

Issue 23174002: Fix crash when querying a runtime config that is defined in environment (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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
« no previous file with comments | « gyp/tests.gyp ('k') | src/utils/SkRTConf.cpp » ('j') | 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 8
9 #ifndef SkRTConf_DEFINED 9 #ifndef SkRTConf_DEFINED
10 #define SkRTConf_DEFINED 10 #define SkRTConf_DEFINED
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 class SkRTConfRegistry { 67 class SkRTConfRegistry {
68 public: 68 public:
69 SkRTConfRegistry(); 69 SkRTConfRegistry();
70 void printAll(const char *fname = NULL) const; 70 void printAll(const char *fname = NULL) const;
71 void printNonDefault(const char *fname = NULL) const; 71 void printNonDefault(const char *fname = NULL) const;
72 const char *configFileLocation() const; 72 const char *configFileLocation() const;
73 void possiblyDumpFile() const; 73 void possiblyDumpFile() const;
74 void validate() const; 74 void validate() const;
75 template <typename T> void set(const char *confname, T value); 75 template <typename T> void set(const char *confname, T value);
76 #ifdef SK_SUPPORT_UNITTEST
77 static void UnitTest();
78 #endif
76 private: 79 private:
77 template<typename T> friend class SkRTConf; 80 template<typename T> friend class SkRTConf;
78 81
79 void registerConf(SkRTConfBase *conf); 82 void registerConf(SkRTConfBase *conf);
80 template <typename T> bool parse(const char *name, T* value); 83 template <typename T> bool parse(const char *name, T* value);
81 84
82 SkTDArray<SkString *> fConfigFileKeys, fConfigFileValues; 85 SkTDArray<SkString *> fConfigFileKeys, fConfigFileValues;
83 typedef SkTDict< SkTDArray<SkRTConfBase *> * > ConfMap; 86 typedef SkTDict< SkTDArray<SkRTConfBase *> * > ConfMap;
84 ConfMap fConfs; 87 ConfMap fConfs;
88 #ifdef SK_SUPPORT_UNITTEST
89 SkRTConfRegistry(bool);
90 #endif
85 }; 91 };
86 92
87 // our singleton registry 93 // our singleton registry
88 94
89 SkRTConfRegistry &skRTConfRegistry(); 95 SkRTConfRegistry &skRTConfRegistry();
90 96
91 template<typename T> 97 template<typename T>
92 SkRTConf<T>::SkRTConf(const char *name, const T &defaultValue, const char *descr iption) 98 SkRTConf<T>::SkRTConf(const char *name, const T &defaultValue, const char *descr iption)
93 : SkRTConfBase(name) 99 : SkRTConfBase(name)
94 , fValue(defaultValue) 100 , fValue(defaultValue)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // static_cast here is okay because there's only one kind of child class. 169 // static_cast here is okay because there's only one kind of child class.
164 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf); 170 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf);
165 return child_pointer && 171 return child_pointer &&
166 fName == child_pointer->fName && 172 fName == child_pointer->fName &&
167 fDescription == child_pointer->fDescription && 173 fDescription == child_pointer->fDescription &&
168 fValue == child_pointer->fValue && 174 fValue == child_pointer->fValue &&
169 fDefault == child_pointer->fDefault; 175 fDefault == child_pointer->fDefault;
170 } 176 }
171 177
172 #endif 178 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gyp ('k') | src/utils/SkRTConf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698