Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: mojo/public/cpp/bindings/lib/validation_errors.cc

Issue 488123003: Mojo cpp bindings: remove IsNonNullableValidationEnabled() check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (g_validation_error_observer) 48 if (g_validation_error_observer)
49 g_validation_error_observer->set_last_error(error); 49 g_validation_error_observer->set_last_error(error);
50 else 50 else
51 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error); 51 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error);
52 } 52 }
53 53
54 ValidationErrorObserverForTesting::ValidationErrorObserverForTesting() 54 ValidationErrorObserverForTesting::ValidationErrorObserverForTesting()
55 : last_error_(VALIDATION_ERROR_NONE) { 55 : last_error_(VALIDATION_ERROR_NONE) {
56 MOJO_DCHECK(!g_validation_error_observer); 56 MOJO_DCHECK(!g_validation_error_observer);
57 g_validation_error_observer = this; 57 g_validation_error_observer = this;
58 MOJO_LOG(WARNING) << "Non-nullable validation is turned on for testing but "
59 << "not for production code yet!";
60 } 58 }
61 59
62 ValidationErrorObserverForTesting::~ValidationErrorObserverForTesting() { 60 ValidationErrorObserverForTesting::~ValidationErrorObserverForTesting() {
63 MOJO_DCHECK(g_validation_error_observer == this); 61 MOJO_DCHECK(g_validation_error_observer == this);
64 g_validation_error_observer = NULL; 62 g_validation_error_observer = NULL;
65 } 63 }
66 64
67 bool ReportSerializationWarning(ValidationError error) { 65 bool ReportSerializationWarning(ValidationError error) {
68 if (g_serialization_warning_observer) { 66 if (g_serialization_warning_observer) {
69 g_serialization_warning_observer->set_last_warning(error); 67 g_serialization_warning_observer->set_last_warning(error);
70 return true; 68 return true;
71 } 69 }
72 70
73 return false; 71 return false;
74 } 72 }
75 73
76 SerializationWarningObserverForTesting::SerializationWarningObserverForTesting() 74 SerializationWarningObserverForTesting::SerializationWarningObserverForTesting()
77 : last_warning_(VALIDATION_ERROR_NONE) { 75 : last_warning_(VALIDATION_ERROR_NONE) {
78 MOJO_DCHECK(!g_serialization_warning_observer); 76 MOJO_DCHECK(!g_serialization_warning_observer);
79 g_serialization_warning_observer = this; 77 g_serialization_warning_observer = this;
80 } 78 }
81 79
82 SerializationWarningObserverForTesting:: 80 SerializationWarningObserverForTesting::
83 ~SerializationWarningObserverForTesting() { 81 ~SerializationWarningObserverForTesting() {
84 MOJO_DCHECK(g_serialization_warning_observer == this); 82 MOJO_DCHECK(g_serialization_warning_observer == this);
85 g_serialization_warning_observer = NULL; 83 g_serialization_warning_observer = NULL;
86 } 84 }
87 85
88 bool IsNonNullableValidationEnabled() {
89 // TODO(yzshen): Remove this function and all call sites.
90 return true;
91 }
92
93 } // namespace internal 86 } // namespace internal
94 } // namespace mojo 87 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698