Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 #undef GR_QNX_BUILD | 78 #undef GR_QNX_BUILD |
| 79 #define GR_QNX_BUILD 1 | 79 #define GR_QNX_BUILD 1 |
| 80 // #error "QNX" | 80 // #error "QNX" |
| 81 #else | 81 #else |
| 82 #undef GR_LINUX_BUILD | 82 #undef GR_LINUX_BUILD |
| 83 #define GR_LINUX_BUILD 1 | 83 #define GR_LINUX_BUILD 1 |
| 84 // #error "LINUX" | 84 // #error "LINUX" |
| 85 #endif | 85 #endif |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 // we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1 | |
| 89 // | |
| 90 #ifndef GR_DEBUG | |
| 91 #ifdef GR_RELEASE | |
| 92 #define GR_DEBUG !GR_RELEASE | |
| 93 #else | |
| 94 #ifdef NDEBUG | |
| 95 #define GR_DEBUG 0 | |
| 96 #else | |
| 97 #define GR_DEBUG 1 | |
| 98 #endif | |
| 99 #endif | |
| 100 #endif | |
| 101 | |
| 102 #ifndef GR_RELEASE | 88 #ifndef GR_RELEASE |
| 103 #define GR_RELEASE !GR_DEBUG | 89 #define GR_RELEASE !SK_DEBUG |
| 104 #endif | 90 #endif |
| 105 | 91 |
| 106 #if GR_DEBUG == GR_RELEASE | 92 #if SK_DEBUG == GR_RELEASE |
| 107 #error "GR_DEBUG and GR_RELEASE must not be the same" | 93 #error "SK_DEBUG and GR_RELEASE must not be the same" |
| 108 #endif | 94 #endif |
| 109 | 95 |
| 110 /////////////////////////////////////////////////////////////////////////////// | 96 /////////////////////////////////////////////////////////////////////////////// |
| 111 /////////////////////////////////////////////////////////////////////////////// | 97 /////////////////////////////////////////////////////////////////////////////// |
| 112 | 98 |
| 113 #if GR_WIN32_BUILD | 99 #if GR_WIN32_BUILD |
| 114 // VC8 doesn't support stdint.h, so we define those types here. | 100 // VC8 doesn't support stdint.h, so we define those types here. |
| 115 typedef signed char int8_t; | 101 typedef signed char int8_t; |
| 116 typedef unsigned char uint8_t; | 102 typedef unsigned char uint8_t; |
| 117 typedef short int16_t; | 103 typedef short int16_t; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 135 #include <stdint.h> | 121 #include <stdint.h> |
| 136 #endif | 122 #endif |
| 137 | 123 |
| 138 /* | 124 /* |
| 139 * The "user config" file can be empty, and everything should work. It is | 125 * The "user config" file can be empty, and everything should work. It is |
| 140 * meant to store a given platform/client's overrides of our guess-work. | 126 * meant to store a given platform/client's overrides of our guess-work. |
| 141 * | 127 * |
| 142 * A alternate user config file can be specified by defining | 128 * A alternate user config file can be specified by defining |
| 143 * GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h | 129 * GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h |
| 144 * | 130 * |
| 145 * e.g. it can specify GR_DEBUG/GR_RELEASE as it please, change the BUILD | 131 * e.g. it can specify SK_DEBUG/GR_RELEASE as it please, change the BUILD |
|
bsalomon
2013/08/23 12:54:23
We should remove this first example since GR_USER_
| |
| 146 * target, or supply its own defines for anything else (e.g. GR_DEFAULT_TEXTURE _CACHE_MB_LIMIT) | 132 * target, or supply its own defines for anything else (e.g. GR_DEFAULT_TEXTURE _CACHE_MB_LIMIT) |
| 147 */ | 133 */ |
| 148 #if !defined(GR_USER_CONFIG_FILE) | 134 #if !defined(GR_USER_CONFIG_FILE) |
| 149 #include "GrUserConfig.h" | 135 #include "GrUserConfig.h" |
| 150 #else | 136 #else |
| 151 #include GR_USER_CONFIG_FILE | 137 #include GR_USER_CONFIG_FILE |
| 152 #endif | 138 #endif |
| 153 | 139 |
| 154 | 140 |
| 155 /////////////////////////////////////////////////////////////////////////////// | 141 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 // sign extend for 64bit architectures to be sure this is | 221 // sign extend for 64bit architectures to be sure this is |
| 236 // in the high address range | 222 // in the high address range |
| 237 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xb eefcafe) = 0; | 223 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xb eefcafe) = 0; |
| 238 #endif | 224 #endif |
| 239 #endif | 225 #endif |
| 240 | 226 |
| 241 /** | 227 /** |
| 242 * GR_DEBUGBREAK is an unconditional break in debug builds. | 228 * GR_DEBUGBREAK is an unconditional break in debug builds. |
| 243 */ | 229 */ |
| 244 #if !defined(GR_DEBUGBREAK) | 230 #if !defined(GR_DEBUGBREAK) |
| 245 #if GR_DEBUG | 231 #if SK_DEBUG |
| 246 #define GR_DEBUGBREAK GR_ALWAYSBREAK | 232 #define GR_DEBUGBREAK GR_ALWAYSBREAK |
| 247 #else | 233 #else |
| 248 #define GR_DEBUGBREAK | 234 #define GR_DEBUGBREAK |
| 249 #endif | 235 #endif |
| 250 #endif | 236 #endif |
| 251 | 237 |
| 252 /** | 238 /** |
| 253 * GR_ALWAYSASSERT is an assertion in all builds. | 239 * GR_ALWAYSASSERT is an assertion in all builds. |
| 254 */ | 240 */ |
| 255 #if !defined(GR_ALWAYSASSERT) | 241 #if !defined(GR_ALWAYSASSERT) |
| 256 #define GR_ALWAYSASSERT(COND) \ | 242 #define GR_ALWAYSASSERT(COND) \ |
| 257 do { \ | 243 do { \ |
| 258 if (!(COND)) { \ | 244 if (!(COND)) { \ |
| 259 GrPrintf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \ | 245 GrPrintf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \ |
| 260 GR_ALWAYSBREAK; \ | 246 GR_ALWAYSBREAK; \ |
| 261 } \ | 247 } \ |
| 262 } while (false) | 248 } while (false) |
| 263 #endif | 249 #endif |
| 264 | 250 |
| 265 /** | 251 /** |
| 266 * GR_DEBUGASSERT is an assertion in debug builds only. | 252 * GR_DEBUGASSERT is an assertion in debug builds only. |
| 267 */ | 253 */ |
| 268 #if !defined(GR_DEBUGASSERT) | 254 #if !defined(GR_DEBUGASSERT) |
| 269 #if GR_DEBUG | 255 #if SK_DEBUG |
| 270 #define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND) | 256 #define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND) |
| 271 #else | 257 #else |
| 272 #define GR_DEBUGASSERT(COND) | 258 #define GR_DEBUGASSERT(COND) |
| 273 #endif | 259 #endif |
| 274 #endif | 260 #endif |
| 275 | 261 |
| 276 /** | 262 /** |
| 277 * Prettier forms of the above macros. | 263 * Prettier forms of the above macros. |
| 278 */ | 264 */ |
| 279 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) | 265 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) |
| 280 | 266 |
| 281 /** | 267 /** |
| 282 * Crash from unrecoverable condition, optionally with a message. The debug vari ants only | 268 * Crash from unrecoverable condition, optionally with a message. The debug vari ants only |
| 283 * crash in a debug build. The message versions print the message regardless of release vs debug. | 269 * crash in a debug build. The message versions print the message regardless of release vs debug. |
| 284 */ | 270 */ |
| 285 inline void GrCrash() { GrAlwaysAssert(false); } | 271 inline void GrCrash() { GrAlwaysAssert(false); } |
| 286 inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } | 272 inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } |
| 287 inline void GrDebugCrash() { SkASSERT(false); } | 273 inline void GrDebugCrash() { SkASSERT(false); } |
| 288 inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); } | 274 inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); } |
| 289 | 275 |
| 290 /** | 276 /** |
| 291 * GR_DEBUGCODE compiles the code X in debug builds only | 277 * GR_DEBUGCODE compiles the code X in debug builds only |
| 292 */ | 278 */ |
| 293 #if !defined(GR_DEBUGCODE) | 279 #if !defined(GR_DEBUGCODE) |
| 294 #if GR_DEBUG | 280 #if SK_DEBUG |
| 295 #define GR_DEBUGCODE(X) X | 281 #define GR_DEBUGCODE(X) X |
| 296 #else | 282 #else |
| 297 #define GR_DEBUGCODE(X) | 283 #define GR_DEBUGCODE(X) |
| 298 #endif | 284 #endif |
| 299 #endif | 285 #endif |
| 300 | 286 |
| 301 /** | 287 /** |
| 302 * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform | 288 * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform |
| 303 * it may print the message in the compiler log. Obviously, the condition must | 289 * it may print the message in the compiler log. Obviously, the condition must |
| 304 * be evaluatable at compile time. | 290 * be evaluatable at compile time. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 #endif | 363 #endif |
| 378 #if GR_LINUX_BUILD | 364 #if GR_LINUX_BUILD |
| 379 // #pragma message GR_WARN("GR_LINUX_BUILD") | 365 // #pragma message GR_WARN("GR_LINUX_BUILD") |
| 380 #endif | 366 #endif |
| 381 #if GR_QNX_BUILD | 367 #if GR_QNX_BUILD |
| 382 // #pragma message GR_WARN("GR_QNX_BUILD") | 368 // #pragma message GR_WARN("GR_QNX_BUILD") |
| 383 #endif | 369 #endif |
| 384 #endif | 370 #endif |
| 385 | 371 |
| 386 #endif | 372 #endif |
| OLD | NEW |