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

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

Issue 1509703002: Mojo C++ bindings: Fix bug: array<>, map<> should only initialize elements if they're not null when… (Closed) Base URL: https://github.com/domokit/mojo.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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/struct_ptr.h
diff --git a/mojo/public/cpp/bindings/struct_ptr.h b/mojo/public/cpp/bindings/struct_ptr.h
index 95aa58112e6cbc09dccfeedb120d8d19dede18c5..4fbd430874ca54f0e4d0fc3afdcd385a59a11e97 100644
--- a/mojo/public/cpp/bindings/struct_ptr.h
+++ b/mojo/public/cpp/bindings/struct_ptr.h
@@ -25,11 +25,10 @@ class StructHelper {
} // namespace internal
-// Smart pointer wrapping a mojom structure with move-only semantics.
+// Smart pointer wrapping a mojom structure or union, with move-only semantics.
template <typename Struct>
class StructPtr {
public:
-
StructPtr() : ptr_(nullptr) {}
StructPtr(decltype(nullptr)) : ptr_(nullptr) {}
@@ -103,11 +102,11 @@ class StructPtr {
MOJO_MOVE_ONLY_TYPE(StructPtr);
};
-// Designed to be used when Struct is small and copyable.
+// Designed to be used when Struct is small and copyable. Unions are always
+// InlinedStructPtr in practice.
template <typename Struct>
class InlinedStructPtr {
public:
-
InlinedStructPtr() : is_null_(true) {}
InlinedStructPtr(decltype(nullptr)) : is_null_(true) {}

Powered by Google App Engine
This is Rietveld 408576698