| Flutter Impeller |

validation.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #pragma once
6
7 #ifndef IMPELLER_ENABLE_VALIDATION
8 #ifdef IMPELLER_DEBUG
9 #define IMPELLER_ENABLE_VALIDATION 1
10 #endif
11 #endif
12
13 #include <sstream>
14
15 #include "flutter/fml/macros.h"
16
17 namespace impeller {
18
19 class ValidationLog {
20 public:
21 ValidationLog();
22
23 ~ValidationLog();
24
25 std::ostream& GetStream();
26
27 private:
28 std::ostringstream stream_;
29
30 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(ValidationLog);
31 };
32
33 void ImpellerValidationBreak(const char* message);
34
35 void ImpellerValidationErrorsSetFatal(bool fatal);
36
37 struct ScopedValidationDisable {
38 ScopedValidationDisable();
39
40 ~ScopedValidationDisable();
41
42 FML_DISALLOW_COPY_AND_ASSIGN(ScopedValidationDisable);
43 };
44
45 } // namespace impeller
46
47 //------------------------------------------------------------------------------
48 /// Get a stream to the log Impeller uses for all validation errors. The
49 /// behavior of these logs is as follows:
50 ///
51 /// * Validation error are completely ignored in the Flutter release
52 /// runtime-mode.
53 /// * In non-release runtime-modes, validation logs are redirected to the
54 /// Flutter `INFO` log. These logs typically show up when verbose logging is
55 /// enabled.
56 /// * If `ImpellerValidationErrorsSetFatal` is set to `true`, validation logs
57 /// are fatal. The runtime-mode restriction still applies. This usually
58 /// happens in test environments.
59 ///
60 #define VALIDATION_LOG ::impeller::ValidationLog{}.GetStream()
impeller::ImpellerValidationBreak
void ImpellerValidationBreak(const char *message)
Definition: validation.cc:40
impeller::ScopedValidationDisable::~ScopedValidationDisable
~ScopedValidationDisable()
Definition: validation.cc:24
impeller::ValidationLog::~ValidationLog
~ValidationLog()
Definition: validation.cc:30
impeller::ScopedValidationDisable::FML_DISALLOW_COPY_AND_ASSIGN
FML_DISALLOW_COPY_AND_ASSIGN(ScopedValidationDisable)
impeller::ValidationLog::ValidationLog
ValidationLog()
impeller::ScopedValidationDisable::ScopedValidationDisable
ScopedValidationDisable()
Definition: validation.cc:20
impeller::ValidationLog
Definition: validation.h:19
impeller::ImpellerValidationErrorsSetFatal
void ImpellerValidationErrorsSetFatal(bool fatal)
Definition: validation.cc:16
impeller::ValidationLog::GetStream
std::ostream & GetStream()
Definition: validation.cc:36
impeller::ScopedValidationDisable
Definition: validation.h:37
impeller
Definition: aiks_context.cc:10