| 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class ValidationContext { | 24 class ValidationContext { |
| 25 public: | 25 public: |
| 26 // [data, data + data_num_bytes) specifies the initial valid memory range. | 26 // [data, data + data_num_bytes) specifies the initial valid memory range. |
| 27 // [0, num_handles) specifies the initial valid range of handle indices. | 27 // [0, num_handles) specifies the initial valid range of handle indices. |
| 28 // | 28 // |
| 29 // If provided, |message| and |description| provide additional information | 29 // If provided, |message| and |description| provide additional information |
| 30 // to use when reporting validation errors. In addition if |message| is | 30 // to use when reporting validation errors. In addition if |message| is |
| 31 // provided, the MojoNotifyBadMessage API will be used to notify the system of | 31 // provided, the MojoNotifyBadMessage API will be used to notify the system of |
| 32 // such errors. | 32 // such errors. |
| 33 ValidationContext(const void* data, | 33 ValidationContext(const void* data, |
| 34 uint32_t data_num_bytes, | 34 size_t data_num_bytes, |
| 35 size_t num_handles, | 35 size_t num_handles, |
| 36 Message* message = nullptr, | 36 Message* message = nullptr, |
| 37 const base::StringPiece& description = ""); | 37 const base::StringPiece& description = ""); |
| 38 | 38 |
| 39 ~ValidationContext(); | 39 ~ValidationContext(); |
| 40 | 40 |
| 41 // Claims the specified memory range. | 41 // Claims the specified memory range. |
| 42 // The method succeeds if the range is valid to claim. (Please see | 42 // The method succeeds if the range is valid to claim. (Please see |
| 43 // the comments for IsValidRange().) | 43 // the comments for IsValidRange().) |
| 44 // On success, the valid memory range is shrinked to begin right after the end | 44 // On success, the valid memory range is shrinked to begin right after the end |
| (...skipping 28 matching lines...) Expand all Loading... |
| 73 uint32_t handle_begin_; | 73 uint32_t handle_begin_; |
| 74 uint32_t handle_end_; | 74 uint32_t handle_end_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(ValidationContext); | 76 DISALLOW_COPY_AND_ASSIGN(ValidationContext); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace internal | 79 } // namespace internal |
| 80 } // namespace mojo | 80 } // namespace mojo |
| 81 | 81 |
| 82 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ | 82 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_CONTEXT_H_ |
| OLD | NEW |