This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -46,17 +46,22 @@ std::ostream& ValidationLog::GetStream() {
4646}
4747
4848void ImpellerValidationBreak (const char * message) {
49- // Nothing to do. Exists for the debugger.
50- #ifdef IMPELLER_ENABLE_VALIDATION
5149 std::stringstream stream;
50+ #if FLUTTER_RELEASE
51+ stream << " Impeller validation: " << message;
52+ #else
5253 stream << " Break on '" << __FUNCTION__
5354 << " ' to inspect point of failure: " << message;
55+ #endif
5456 if (sValidationLogsAreFatal > 0 ) {
5557 FML_LOG (FATAL) << stream.str ();
5658 } else {
5759 FML_LOG (ERROR) << stream.str ();
5860 }
59- #endif // IMPELLER_ENABLE_VALIDATION
61+ }
62+
63+ bool ImpellerValidationErrorsAreFatal () {
64+ return sValidationLogsAreFatal ;
6065}
6166
6267} // namespace impeller
Original file line number Diff line number Diff line change 55#ifndef FLUTTER_IMPELLER_BASE_VALIDATION_H_
66#define FLUTTER_IMPELLER_BASE_VALIDATION_H_
77
8- #ifndef IMPELLER_ENABLE_VALIDATION
9- #ifdef IMPELLER_DEBUG
10- #define IMPELLER_ENABLE_VALIDATION 1
11- #endif
12- #endif
13-
148#include < sstream>
159
1610namespace impeller {
@@ -39,6 +33,8 @@ void ImpellerValidationBreak(const char* message);
3933
4034void ImpellerValidationErrorsSetFatal (bool fatal);
4135
36+ bool ImpellerValidationErrorsAreFatal ();
37+
4238struct ScopedValidationDisable {
4339 ScopedValidationDisable ();
4440
Original file line number Diff line number Diff line change 88#include " flutter/fml/build_config.h"
99#include " flutter/fml/command_line.h"
1010#include " flutter/fml/logging.h"
11+ #include " flutter/impeller/base/validation.h"
1112#include " flutter/impeller/golden_tests/golden_digest.h"
1213#include " flutter/impeller/golden_tests/working_directory.h"
1314#include " gtest/gtest.h"
@@ -24,7 +25,14 @@ void print_usage() {
2425}
2526} // namespace
2627
28+ namespace impeller {
29+ TEST (ValidationTest, IsFatal) {
30+ EXPECT_TRUE (ImpellerValidationErrorsAreFatal ());
31+ }
32+ } // namespace impeller
33+
2734int main (int argc, char ** argv) {
35+ impeller::ImpellerValidationErrorsSetFatal (true );
2836 fml::InstallCrashHandler ();
2937 testing::InitGoogleTest (&argc, argv);
3038 fml::CommandLine cmd = fml::CommandLineFromPlatformOrArgcArgv (argc, argv);
You can’t perform that action at this time.
0 commit comments