OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "mojo/public/cpp/bindings/lib/validation_errors.h" | 5 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
6 | 6 |
7 #include "mojo/public/cpp/environment/logging.h" | 7 #include "mojo/public/cpp/environment/logging.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace internal { | 10 namespace internal { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (g_validation_error_observer) { | 59 if (g_validation_error_observer) { |
60 g_validation_error_observer->set_last_error(error); | 60 g_validation_error_observer->set_last_error(error); |
61 } else if (description) { | 61 } else if (description) { |
62 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error) | 62 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error) |
63 << " (" << description << ")"; | 63 << " (" << description << ")"; |
64 } else { | 64 } else { |
65 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error); | 65 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 ValidationErrorObserverForTesting::ValidationErrorObserverForTesting() | 69 ValidationErrorObserverForTesting::ValidationErrorObserverForTesting( |
70 : last_error_(VALIDATION_ERROR_NONE) { | 70 const Callback<void()>& callback) |
| 71 : last_error_(VALIDATION_ERROR_NONE), callback_(callback) { |
71 MOJO_DCHECK(!g_validation_error_observer); | 72 MOJO_DCHECK(!g_validation_error_observer); |
72 g_validation_error_observer = this; | 73 g_validation_error_observer = this; |
73 } | 74 } |
74 | 75 |
75 ValidationErrorObserverForTesting::~ValidationErrorObserverForTesting() { | 76 ValidationErrorObserverForTesting::~ValidationErrorObserverForTesting() { |
76 MOJO_DCHECK(g_validation_error_observer == this); | 77 MOJO_DCHECK(g_validation_error_observer == this); |
77 g_validation_error_observer = nullptr; | 78 g_validation_error_observer = nullptr; |
78 } | 79 } |
79 | 80 |
80 bool ReportSerializationWarning(ValidationError error) { | 81 bool ReportSerializationWarning(ValidationError error) { |
(...skipping 12 matching lines...) Expand all Loading... |
93 } | 94 } |
94 | 95 |
95 SerializationWarningObserverForTesting:: | 96 SerializationWarningObserverForTesting:: |
96 ~SerializationWarningObserverForTesting() { | 97 ~SerializationWarningObserverForTesting() { |
97 MOJO_DCHECK(g_serialization_warning_observer == this); | 98 MOJO_DCHECK(g_serialization_warning_observer == this); |
98 g_serialization_warning_observer = nullptr; | 99 g_serialization_warning_observer = nullptr; |
99 } | 100 } |
100 | 101 |
101 } // namespace internal | 102 } // namespace internal |
102 } // namespace mojo | 103 } // namespace mojo |
OLD | NEW |