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

Unified Diff: include/utils/SkRTConf.h

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
« no previous file with comments | « gyp/tests.gyp ('k') | src/utils/SkRTConf.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkRTConf.h
diff --git a/include/utils/SkRTConf.h b/include/utils/SkRTConf.h
index d09410ebb17dc256a972e2e2feabcdf6d7780088..4d7cda23d599508d1aad66505346812eddcebb01 100644
--- a/include/utils/SkRTConf.h
+++ b/include/utils/SkRTConf.h
@@ -52,10 +52,17 @@ protected:
#ifdef SK_DEVELOPER
#define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description) static SkRTConf<confType> varName(confName, defaultValue, description)
-#define SK_CONF_SET(confname, value) skRTConfRegistry().set(confname, value)
+#define SK_CONF_SET(confname, value) \
reed1 2013/11/06 15:02:21 at some point we should clean-up the readability o
+ skRTConfRegistry().set(confname, value, true)
+/* SK_CONF_TRY_SET() is like SK_CONF_SET(), but doesn't complain if
+ confname can't be found. This is useful if the SK_CONF_DECLARE is
+ inside a source file whose linkage is dependent on the system. */
+#define SK_CONF_TRY_SET(confname, value) \
+ skRTConfRegistry().set(confname, value, false)
#else
#define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description) static confType varName = defaultValue
#define SK_CONF_SET(confname, value) (void) confname, (void) value
+#define SK_CONF_TRY_SET(confname, value) (void) confname, (void) value
#endif
/** \class SkRTConfRegistry
@@ -72,7 +79,9 @@ public:
const char *configFileLocation() const;
void possiblyDumpFile() const;
void validate() const;
- template <typename T> void set(const char *confname, T value);
+ template <typename T> void set(const char *confname,
+ T value,
+ bool warnIfNotFound = true);
#ifdef SK_SUPPORT_UNITTEST
static void UnitTest();
#endif
« 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