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

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

Issue 1800753005: C++ bindings: A struct's Deserialize() now does validation before deserializing. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address comments. DeserializeWithoutValidation returns void, doesn't take in buf_size. Created 4 years, 9 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 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 <type_traits> 8 #include <type_traits>
9 9
10 #include "mojo/public/cpp/bindings/lib/template_util.h" 10 #include "mojo/public/cpp/bindings/lib/template_util.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 T temp = *ptr; 91 T temp = *ptr;
92 *ptr = T(); 92 *ptr = T();
93 return temp; 93 return temp;
94 } 94 }
95 95
96 template <typename H> 96 template <typename H>
97 struct IsHandle { 97 struct IsHandle {
98 enum { value = std::is_base_of<Handle, H>::value }; 98 enum { value = std::is_base_of<Handle, H>::value };
99 }; 99 };
100 100
101 // TODO(vardhan): Should RemoveStructPtr<> be internal-only? Should be /the/ way
viettrungluu 2016/03/30 17:49:01 Hmmm. Or is specializing std::pointer_traits the r
vardhan 2016/03/30 22:49:07 yeah, good point; std::pointer_traits will defini
102 // to get T from StructPtr<T>?
101 template <typename T> 103 template <typename T>
102 struct RemoveStructPtr { 104 struct RemoveStructPtr {
103 typedef T type; 105 typedef T type;
104 }; 106 };
105 107
106 template <typename T> 108 template <typename T>
107 struct RemoveStructPtr<StructPtr<T>> { 109 struct RemoveStructPtr<StructPtr<T>> {
108 typedef T type; 110 typedef T type;
109 }; 111 };
110 112
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 static bool Equals(const InterfaceRequest<I>& a, 272 static bool Equals(const InterfaceRequest<I>& a,
271 const InterfaceRequest<I>& b) { 273 const InterfaceRequest<I>& b) {
272 return (&a == &b) || (!a.is_pending() && !b.is_pending()); 274 return (&a == &b) || (!a.is_pending() && !b.is_pending());
273 } 275 }
274 }; 276 };
275 277
276 } // namespace internal 278 } // namespace internal
277 } // namespace mojo 279 } // namespace mojo
278 280
279 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ 281 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698