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

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

Issue 2358133002: Turn //mojo/public/cpp/bindings and //mojo/public/cpp/system into components (Closed)
Patch Set: Fix wording Created 4 years, 3 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/bindings_export.h"
10 #include "mojo/public/cpp/bindings/lib/array_internal.h" 11 #include "mojo/public/cpp/bindings/lib/array_internal.h"
11 #include "mojo/public/cpp/system/handle.h" 12 #include "mojo/public/cpp/system/handle.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 namespace internal { 15 namespace internal {
15 16
16 class Buffer; 17 class Buffer;
17 class ValidationContext; 18 class ValidationContext;
18 19
19 class NativeStruct_Data { 20 class MOJO_CPP_BINDINGS_EXPORT NativeStruct_Data {
20 public: 21 public:
21 static bool Validate(const void* data, ValidationContext* validation_context); 22 static bool Validate(const void* data, ValidationContext* validation_context);
22 23
23 // Unlike normal structs, the memory layout is exactly the same as an array 24 // Unlike normal structs, the memory layout is exactly the same as an array
24 // of uint8_t. 25 // of uint8_t.
25 Array_Data<uint8_t> data; 26 Array_Data<uint8_t> data;
26 27
27 private: 28 private:
28 NativeStruct_Data() = delete; 29 NativeStruct_Data() = delete;
29 ~NativeStruct_Data() = delete; 30 ~NativeStruct_Data() = delete;
30 }; 31 };
31 32
32 static_assert(sizeof(Array_Data<uint8_t>) == sizeof(NativeStruct_Data), 33 static_assert(sizeof(Array_Data<uint8_t>) == sizeof(NativeStruct_Data),
33 "Mismatched NativeStruct_Data and Array_Data<uint8_t> size"); 34 "Mismatched NativeStruct_Data and Array_Data<uint8_t> size");
34 35
35 } // namespace internal 36 } // namespace internal
36 } // namespace mojo 37 } // namespace mojo
37 38
38 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_ 39 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_NATIVE_STRUCT_DATA_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/multiplex_router.h ('k') | mojo/public/cpp/bindings/lib/native_struct_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698