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

Side by Side Diff: mojo/public/cpp/bindings/lib/native_struct_data.h

Issue 2064903002: Mojo: Report bindings validation errors via MojoNotifyBadMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_NATIVE_STRUCT_DATA_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "mojo/public/cpp/bindings/lib/array_internal.h" 10 #include "mojo/public/cpp/bindings/lib/array_internal.h"
11 #include "mojo/public/cpp/system/handle.h" 11 #include "mojo/public/cpp/system/handle.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 namespace internal { 14 namespace internal {
15 15
16 class BoundsChecker;
17 class Buffer; 16 class Buffer;
17 class ValidationContext;
18 18
19 class NativeStruct_Data { 19 class NativeStruct_Data {
20 public: 20 public:
21 static bool Validate(const void* data, BoundsChecker* bounds_checker); 21 static bool Validate(const void* data, ValidationContext* validation_context);
22 22
23 void EncodePointers() {} 23 void EncodePointers() {}
24 void DecodePointers() {} 24 void DecodePointers() {}
25 25
26 // Unlike normal structs, the memory layout is exactly the same as an array 26 // Unlike normal structs, the memory layout is exactly the same as an array
27 // of uint8_t. 27 // of uint8_t.
28 Array_Data<uint8_t> data; 28 Array_Data<uint8_t> data;
29 29
30 private: 30 private:
31 NativeStruct_Data() = delete; 31 NativeStruct_Data() = delete;
32 ~NativeStruct_Data() = delete; 32 ~NativeStruct_Data() = delete;
33 }; 33 };
34 34
35 static_assert(sizeof(Array_Data<uint8_t>) == sizeof(NativeStruct_Data), 35 static_assert(sizeof(Array_Data<uint8_t>) == sizeof(NativeStruct_Data),
36 "Mismatched NativeStruct_Data and Array_Data<uint8_t> size"); 36 "Mismatched NativeStruct_Data and Array_Data<uint8_t> size");
37 37
38 } // namespace internal 38 } // namespace internal
39 } // namespace mojo 39 } // namespace mojo
40 40
41 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_ 41 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/native_enum_data.h ('k') | mojo/public/cpp/bindings/lib/native_struct_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698