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

Unified Diff: mojo/public/cpp/bindings/lib/validation_util.cc

Issue 2203953003: [not for commit (yet)] inline more things but doesn't seem to improve perf Base URL: https://chromium.googlesource.com/chromium/src.git@85_3_inline_validation_context
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/validation_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/validation_util.cc
diff --git a/mojo/public/cpp/bindings/lib/validation_util.cc b/mojo/public/cpp/bindings/lib/validation_util.cc
index 4a7e30563ed16af98cc69174bee9b2220e044b21..a1aa2f9e0956eca209720c8794b2e05fdc48a0ff 100644
--- a/mojo/public/cpp/bindings/lib/validation_util.cc
+++ b/mojo/public/cpp/bindings/lib/validation_util.cc
@@ -68,41 +68,6 @@ bool ValidateUnionHeaderAndClaimMemory(const void* data,
return true;
}
-bool ValidateMessageIsRequestWithoutResponse(
- const Message* message,
- ValidationContext* validation_context) {
- if (message->has_flag(Message::kFlagIsResponse) ||
- message->has_flag(Message::kFlagExpectsResponse)) {
- ReportValidationError(validation_context,
- VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS);
- return false;
- }
- return true;
-}
-
-bool ValidateMessageIsRequestExpectingResponse(
- const Message* message,
- ValidationContext* validation_context) {
- if (message->has_flag(Message::kFlagIsResponse) ||
- !message->has_flag(Message::kFlagExpectsResponse)) {
- ReportValidationError(validation_context,
- VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS);
- return false;
- }
- return true;
-}
-
-bool ValidateMessageIsResponse(const Message* message,
- ValidationContext* validation_context) {
- if (message->has_flag(Message::kFlagExpectsResponse) ||
- !message->has_flag(Message::kFlagIsResponse)) {
- ReportValidationError(validation_context,
- VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAGS);
- return false;
- }
- return true;
-}
-
bool ValidateControlRequest(const Message* message,
ValidationContext* validation_context) {
switch (message->header()->name) {
@@ -132,111 +97,5 @@ bool ValidateControlResponse(const Message* message,
return false;
}
-bool IsHandleOrInterfaceValid(const AssociatedInterface_Data& input) {
- return IsValidInterfaceId(input.interface_id);
-}
-
-bool IsHandleOrInterfaceValid(const AssociatedInterfaceRequest_Data& input) {
- return IsValidInterfaceId(input.interface_id);
-}
-
-bool IsHandleOrInterfaceValid(const Interface_Data& input) {
- return input.handle.is_valid();
-}
-
-bool IsHandleOrInterfaceValid(const Handle_Data& input) {
- return input.is_valid();
-}
-
-bool ValidateHandleOrInterfaceNonNullable(
- const AssociatedInterface_Data& input,
- const char* error_message,
- ValidationContext* validation_context) {
- if (IsHandleOrInterfaceValid(input))
- return true;
-
- ReportValidationError(validation_context,
- VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID,
- error_message);
- return false;
-}
-
-bool ValidateHandleOrInterfaceNonNullable(
- const AssociatedInterfaceRequest_Data& input,
- const char* error_message,
- ValidationContext* validation_context) {
- if (IsHandleOrInterfaceValid(input))
- return true;
-
- ReportValidationError(validation_context,
- VALIDATION_ERROR_UNEXPECTED_INVALID_INTERFACE_ID,
- error_message);
- return false;
-}
-
-bool ValidateHandleOrInterfaceNonNullable(
- const Interface_Data& input,
- const char* error_message,
- ValidationContext* validation_context) {
- if (IsHandleOrInterfaceValid(input))
- return true;
-
- ReportValidationError(validation_context,
- VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
- error_message);
- return false;
-}
-
-bool ValidateHandleOrInterfaceNonNullable(
- const Handle_Data& input,
- const char* error_message,
- ValidationContext* validation_context) {
- if (IsHandleOrInterfaceValid(input))
- return true;
-
- ReportValidationError(validation_context,
- VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE,
- error_message);
- return false;
-}
-
-bool ValidateHandleOrInterface(const AssociatedInterface_Data& input,
- ValidationContext* validation_context) {
- if (!IsMasterInterfaceId(input.interface_id))
- return true;
-
- ReportValidationError(validation_context,
- VALIDATION_ERROR_ILLEGAL_INTERFACE_ID);
- return false;
-}
-
-bool ValidateHandleOrInterface(const AssociatedInterfaceRequest_Data& input,
- ValidationContext* validation_context) {
- if (!IsMasterInterfaceId(input.interface_id))
- return true;
-
- ReportValidationError(validation_context,
- VALIDATION_ERROR_ILLEGAL_INTERFACE_ID);
- return false;
-}
-
-bool ValidateHandleOrInterface(const Interface_Data& input,
- ValidationContext* validation_context) {
- if (validation_context->ClaimHandle(input.handle))
- return true;
-
- ReportValidationError(validation_context, VALIDATION_ERROR_ILLEGAL_HANDLE);
- return false;
-}
-
-bool ValidateHandleOrInterface(const Handle_Data& input,
- ValidationContext* validation_context) {
- if (validation_context->ClaimHandle(input))
- return true;
-
- ReportValidationError(validation_context, VALIDATION_ERROR_ILLEGAL_HANDLE);
- return false;
-}
-
} // namespace internal
} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/lib/validation_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698