| 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 58b6cec87f9c1d96d1ed9101eac7835c70a22f4d..46729dd062e1c7ff983d93e6bd7d2b5bd8f0feaf 100644
|
| --- a/mojo/public/cpp/bindings/struct_ptr.h
|
| +++ b/mojo/public/cpp/bindings/struct_ptr.h
|
| @@ -67,6 +67,13 @@ class StructPtr {
|
| std::swap(ptr_, other->ptr_);
|
| }
|
|
|
| + // Please note that calling this method will fail compilation if the value
|
| + // type |Struct| doesn't have a Clone() method defined (which usually means
|
| + // that it contains Mojo handles).
|
| + StructPtr Clone() const {
|
| + return is_null() ? StructPtr() : ptr_->Clone();
|
| + }
|
| +
|
| private:
|
| typedef Struct* StructPtr::*Testable;
|
|
|
| @@ -132,6 +139,10 @@ class InlinedStructPtr {
|
| std::swap(is_null_, other->is_null_);
|
| }
|
|
|
| + InlinedStructPtr Clone() const {
|
| + return is_null() ? InlinedStructPtr() : value_.Clone();
|
| + }
|
| +
|
| private:
|
| typedef Struct InlinedStructPtr::*Testable;
|
|
|
|
|