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

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

Issue 1486573003: Mojo C++ bindings: associated interface pointers/requests validation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BINDINGS_INTERNAL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
7 7
8 #include "mojo/public/cpp/bindings/lib/interface_id.h" 8 #include "mojo/public/cpp/bindings/lib/interface_id.h"
9 #include "mojo/public/cpp/bindings/lib/template_util.h" 9 #include "mojo/public/cpp/bindings/lib/template_util.h"
10 #include "mojo/public/cpp/bindings/struct_ptr.h" 10 #include "mojo/public/cpp/bindings/struct_ptr.h"
(...skipping 26 matching lines...) Expand all
37 }; 37 };
38 static_assert(sizeof(StructPointer<char>) == 8, "Bad_sizeof(StructPointer)"); 38 static_assert(sizeof(StructPointer<char>) == 8, "Bad_sizeof(StructPointer)");
39 39
40 template <typename T> 40 template <typename T>
41 union ArrayPointer { 41 union ArrayPointer {
42 uint64_t offset; 42 uint64_t offset;
43 Array_Data<T>* ptr; 43 Array_Data<T>* ptr;
44 }; 44 };
45 static_assert(sizeof(ArrayPointer<char>) == 8, "Bad_sizeof(ArrayPointer)"); 45 static_assert(sizeof(ArrayPointer<char>) == 8, "Bad_sizeof(ArrayPointer)");
46 46
47 union StringPointer { 47 using StringPointer = ArrayPointer<char>;
48 uint64_t offset;
49 Array_Data<char>* ptr;
50 };
51 static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)"); 48 static_assert(sizeof(StringPointer) == 8, "Bad_sizeof(StringPointer)");
52 49
53 50
54 template <typename T> 51 template <typename T>
55 union UnionPointer { 52 union UnionPointer {
56 uint64_t offset; 53 uint64_t offset;
57 T* ptr; 54 T* ptr;
58 }; 55 };
59 static_assert(sizeof(UnionPointer<char>) == 8, "Bad_sizeof(UnionPointer)"); 56 static_assert(sizeof(UnionPointer<char>) == 8, "Bad_sizeof(UnionPointer)");
60 57
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 }; 123 };
127 template <typename S> 124 template <typename S>
128 struct WrapperTraits<S, true> { 125 struct WrapperTraits<S, true> {
129 typedef typename S::Data_* DataType; 126 typedef typename S::Data_* DataType;
130 }; 127 };
131 128
132 } // namespace internal 129 } // namespace internal
133 } // namespace mojo 130 } // namespace mojo
134 131
135 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ 132 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698