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

Unified Diff: src/utils/SkRTConf.cpp

Issue 54503007: New SkRTConf macro SK_CONF_TRY_SET: no complaint on missing configuration (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: whitespace change for ifdefs Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: src/utils/SkRTConf.cpp
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index 6fcc318d25312ad6942f675f45fd7899b0cc2997..90e016ee945b47c7b9d03ecaf637e0b0332a250f 100644
--- a/src/utils/SkRTConf.cpp
+++ b/src/utils/SkRTConf.cpp
@@ -272,14 +272,18 @@ template bool SkRTConfRegistry::parse(const char *name, float *value);
template bool SkRTConfRegistry::parse(const char *name, double *value);
template bool SkRTConfRegistry::parse(const char *name, const char **value);
-template <typename T> void SkRTConfRegistry::set(const char *name, T value) {
-
+template <typename T> void SkRTConfRegistry::set(const char *name,
+ T value,
+ bool warnIfNotFound) {
SkTDArray<SkRTConfBase *> *confArray;
if (!fConfs.find(name, &confArray)) {
- SkDebugf("WARNING: Attempting to set configuration value \"%s\", but I've never heard of that.\n", name);
+ if (warnIfNotFound) {
+ SkDebugf("WARNING: Attempting to set configuration value \"%s\","
+ " but I've never heard of that.\n", name);
+ }
return;
}
-
+ SkASSERT(confArray != NULL);
for (SkRTConfBase **confBase = confArray->begin(); confBase != confArray->end(); confBase++) {
// static_cast here is okay because there's only one kind of child class.
SkRTConf<T> *concrete = static_cast<SkRTConf<T> *>(*confBase);
@@ -290,12 +294,12 @@ template <typename T> void SkRTConfRegistry::set(const char *name, T value) {
}
}
-template void SkRTConfRegistry::set(const char *name, bool value);
-template void SkRTConfRegistry::set(const char *name, int value);
-template void SkRTConfRegistry::set(const char *name, unsigned int value);
-template void SkRTConfRegistry::set(const char *name, float value);
-template void SkRTConfRegistry::set(const char *name, double value);
-template void SkRTConfRegistry::set(const char *name, char * value);
+template void SkRTConfRegistry::set(const char *name, bool value, bool);
+template void SkRTConfRegistry::set(const char *name, int value, bool);
+template void SkRTConfRegistry::set(const char *name, unsigned int value, bool);
+template void SkRTConfRegistry::set(const char *name, float value, bool);
+template void SkRTConfRegistry::set(const char *name, double value, bool);
+template void SkRTConfRegistry::set(const char *name, char * value, bool);
SkRTConfRegistry &skRTConfRegistry() {
static SkRTConfRegistry r;

Powered by Google App Engine
This is Rietveld 408576698