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

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

Issue 921223002: Cpp bindings: Return false from Validator::Accept() on unrecognized message or invalid flags (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix test Created 5 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 26 matching lines...) Expand all
37 case VALIDATION_ERROR_UNEXPECTED_NULL_POINTER: 37 case VALIDATION_ERROR_UNEXPECTED_NULL_POINTER:
38 return "VALIDATION_ERROR_UNEXPECTED_NULL_POINTER"; 38 return "VALIDATION_ERROR_UNEXPECTED_NULL_POINTER";
39 case VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION: 39 case VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION:
40 return "VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION"; 40 return "VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION";
41 case VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID: 41 case VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID:
42 return "VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID"; 42 return "VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID";
43 case VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP: 43 case VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP:
44 return "VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP"; 44 return "VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP";
45 case VALIDATION_ERROR_UNKOWN_UNION_TAG: 45 case VALIDATION_ERROR_UNKOWN_UNION_TAG:
46 return "VALIDATION_ERROR_UNKOWN_UNION_TAG"; 46 return "VALIDATION_ERROR_UNKOWN_UNION_TAG";
47 case VALIDATION_ERROR_UNKOWN_METHOD:
48 return "VALIDATION_ERROR_UNKOWN_METHOD";
47 } 49 }
48 50
49 return "Unknown error"; 51 return "Unknown error";
50 } 52 }
51 53
52 void ReportValidationError(ValidationError error, const char* description) { 54 void ReportValidationError(ValidationError error, const char* description) {
53 if (g_validation_error_observer) { 55 if (g_validation_error_observer) {
54 g_validation_error_observer->set_last_error(error); 56 g_validation_error_observer->set_last_error(error);
55 } else if (description) { 57 } else if (description) {
56 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error) 58 MOJO_LOG(ERROR) << "Invalid message: " << ValidationErrorToString(error)
(...skipping 30 matching lines...) Expand all
87 } 89 }
88 90
89 SerializationWarningObserverForTesting:: 91 SerializationWarningObserverForTesting::
90 ~SerializationWarningObserverForTesting() { 92 ~SerializationWarningObserverForTesting() {
91 MOJO_DCHECK(g_serialization_warning_observer == this); 93 MOJO_DCHECK(g_serialization_warning_observer == this);
92 g_serialization_warning_observer = nullptr; 94 g_serialization_warning_observer = nullptr;
93 } 95 }
94 96
95 } // namespace internal 97 } // namespace internal
96 } // namespace mojo 98 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698