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

Unified Diff: mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h

Issue 2403533003: Mojo C++ Bindings: Support custom impl ref types (Closed)
Patch Set: nit, move Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/binding_state.h ('k') | mojo/public/cpp/bindings/tests/binding_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h
diff --git a/mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h b/mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..4d40cdfc12dc27af950bf4bcb0cbd494bf03f2c9
--- /dev/null
+++ b/mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h
@@ -0,0 +1,22 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_CPP_BINDINGS_RAW_PTR_IMPL_REF_TRAITS_H_
+#define MOJO_PUBLIC_CPP_BINDINGS_RAW_PTR_IMPL_REF_TRAITS_H_
+
+namespace mojo {
+
+// Default traits for a binding's implementation reference type. This
+// corresponds to a raw pointer.
+template <typename Interface>
+struct RawPtrImplRefTraits {
+ using PointerType = Interface*;
+
+ static bool IsNull(PointerType ptr) { return !ptr; }
+ static Interface* GetRawPointer(PointerType* ptr) { return *ptr; }
+};
+
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_RAW_PTR_IMPL_REF_TRAITS_H_
« no previous file with comments | « mojo/public/cpp/bindings/lib/binding_state.h ('k') | mojo/public/cpp/bindings/tests/binding_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698