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

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

Issue 1968623002: Mojo C++ bindings: expose public <struct>DataView and StringDataView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_totally_new
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/string_serialization.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_SERIALIZATION_UTIL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 template <typename T> 96 template <typename T>
97 inline void InterfaceDataToPointer(Interface_Data* input, 97 inline void InterfaceDataToPointer(Interface_Data* input,
98 InterfacePtr<T>* output, 98 InterfacePtr<T>* output,
99 SerializationContext* context) { 99 SerializationContext* context) {
100 output->Bind(InterfacePtrInfo<T>( 100 output->Bind(InterfacePtrInfo<T>(
101 context->handles.TakeHandleAs<mojo::MessagePipeHandle>(input->handle), 101 context->handles.TakeHandleAs<mojo::MessagePipeHandle>(input->handle),
102 input->version)); 102 input->version));
103 } 103 }
104 104
105 // TODO(yzshen): Unify StructTraits::Read*() methods and remove
106 // HasReadFromDataViewMethod.
105 template <typename T> 107 template <typename T>
106 struct HasReadFromRawDataMethod { 108 struct HasReadFromDataViewMethod {
107 template <typename U> 109 template <typename U>
108 static char Test(decltype(U::ReadFromRawData)*); 110 static char Test(decltype(U::ReadFromDataView)*);
109 template <typename U> 111 template <typename U>
110 static int Test(...); 112 static int Test(...);
111 static const bool value = sizeof(Test<T>(0)) == sizeof(char); 113 static const bool value = sizeof(Test<T>(0)) == sizeof(char);
112 114
113 private: 115 private:
114 EnsureTypeIsComplete<T> check_t_; 116 EnsureTypeIsComplete<T> check_t_;
115 }; 117 };
116 118
117 template <typename T> 119 template <typename T>
118 struct HasIsNullMethod { 120 struct HasIsNullMethod {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 ReturnType CallWithContext(ReturnType (*f)(ParamType), 209 ReturnType CallWithContext(ReturnType (*f)(ParamType),
208 MaybeConstUserType& input, 210 MaybeConstUserType& input,
209 void* context) { 211 void* context) {
210 return f(input); 212 return f(input);
211 } 213 }
212 214
213 } // namespace internal 215 } // namespace internal
214 } // namespace mojo 216 } // namespace mojo
215 217
216 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ 218 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/string_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698