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

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

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 case VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS: 43 case VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS:
44 return "VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS"; 44 return "VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS";
45 case VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID: 45 case VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID:
46 return "VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID"; 46 return "VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID";
47 case VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD: 47 case VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD:
48 return "VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD"; 48 return "VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD";
49 case VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP: 49 case VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP:
50 return "VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP"; 50 return "VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP";
51 case VALIDATION_ERROR_UNKNOWN_UNION_TAG: 51 case VALIDATION_ERROR_UNKNOWN_UNION_TAG:
52 return "VALIDATION_ERROR_UNKNOWN_UNION_TAG"; 52 return "VALIDATION_ERROR_UNKNOWN_UNION_TAG";
53 case VALIDATION_ERROR_UNKNOWN_ENUM_VALUE:
54 return "VALIDATION_ERROR_UNKNOWN_ENUM_VALUE";
53 } 55 }
54 56
55 return "Unknown error"; 57 return "Unknown error";
56 } 58 }
57 59
58 void ReportValidationError(ValidationError error, const char* description) { 60 void ReportValidationError(ValidationError error, const char* description) {
59 if (g_validation_error_observer) { 61 if (g_validation_error_observer) {
60 g_validation_error_observer->set_last_error(error); 62 g_validation_error_observer->set_last_error(error);
61 } else if (description) { 63 } else if (description) {
62 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error) 64 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 96 }
95 97
96 SerializationWarningObserverForTesting:: 98 SerializationWarningObserverForTesting::
97 ~SerializationWarningObserverForTesting() { 99 ~SerializationWarningObserverForTesting() {
98 MOJO_DCHECK(g_serialization_warning_observer == this); 100 MOJO_DCHECK(g_serialization_warning_observer == this);
99 g_serialization_warning_observer = nullptr; 101 g_serialization_warning_observer = nullptr;
100 } 102 }
101 103
102 } // namespace internal 104 } // namespace internal
103 } // namespace mojo 105 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/validation_errors.h ('k') | mojo/public/cpp/bindings/lib/validation_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698