OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
7 | 7 |
8 #include <cassert> | 8 #include <cassert> |
9 #include <string> | 9 #include <string> |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 #define EAT_STREAM_PARAMETERS \ | 426 #define EAT_STREAM_PARAMETERS \ |
427 true ? (void) 0 : ::logging::LogMessageVoidify() & LOG_STREAM(FATAL) | 427 true ? (void) 0 : ::logging::LogMessageVoidify() & LOG_STREAM(FATAL) |
428 | 428 |
429 // CHECK dies with a fatal error if condition is not true. It is *not* | 429 // CHECK dies with a fatal error if condition is not true. It is *not* |
430 // controlled by NDEBUG, so the check will be executed regardless of | 430 // controlled by NDEBUG, so the check will be executed regardless of |
431 // compilation mode. | 431 // compilation mode. |
432 // | 432 // |
433 // We make sure CHECK et al. always evaluates their arguments, as | 433 // We make sure CHECK et al. always evaluates their arguments, as |
434 // doing CHECK(FunctionWithSideEffect()) is a common idiom. | 434 // doing CHECK(FunctionWithSideEffect()) is a common idiom. |
435 | 435 |
436 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) | 436 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) && !defined(OS_ANDROID) |
437 | 437 |
438 // Make all CHECK functions discard their log strings to reduce code | 438 // Make all CHECK functions discard their log strings to reduce code |
439 // bloat for official release builds. | 439 // bloat for official release builds. |
440 | 440 |
441 // TODO(akalin): This would be more valuable if there were some way to | 441 // TODO(akalin): This would be more valuable if there were some way to |
442 // remove BreakDebugger() from the backtrace, perhaps by turning it | 442 // remove BreakDebugger() from the backtrace, perhaps by turning it |
443 // into a macro (like __debugbreak() on Windows). | 443 // into a macro (like __debugbreak() on Windows). |
444 #define CHECK(condition) \ | 444 #define CHECK(condition) \ |
445 !(condition) ? ::base::debug::BreakDebugger() : EAT_STREAM_PARAMETERS | 445 !(condition) ? ::base::debug::BreakDebugger() : EAT_STREAM_PARAMETERS |
446 | 446 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 #elif NOTIMPLEMENTED_POLICY == 5 | 880 #elif NOTIMPLEMENTED_POLICY == 5 |
881 #define NOTIMPLEMENTED() do {\ | 881 #define NOTIMPLEMENTED() do {\ |
882 static bool logged_once = false;\ | 882 static bool logged_once = false;\ |
883 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 883 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
884 logged_once = true;\ | 884 logged_once = true;\ |
885 } while(0);\ | 885 } while(0);\ |
886 EAT_STREAM_PARAMETERS | 886 EAT_STREAM_PARAMETERS |
887 #endif | 887 #endif |
888 | 888 |
889 #endif // BASE_LOGGING_H_ | 889 #endif // BASE_LOGGING_H_ |
OLD | NEW |