| Index: mojo/public/cpp/bindings/interface_ptr.h
|
| diff --git a/mojo/public/cpp/bindings/interface_ptr.h b/mojo/public/cpp/bindings/interface_ptr.h
|
| index b868a0a5c36167c1885c16f597a600bfed4ecef2..01b15ed047d579df025a435d56433612ff5c49fa 100644
|
| --- a/mojo/public/cpp/bindings/interface_ptr.h
|
| +++ b/mojo/public/cpp/bindings/interface_ptr.h
|
| @@ -104,6 +104,16 @@ class InterfacePtr {
|
| return &internal_state_;
|
| }
|
|
|
| + // Allow InterfacePtr<> to be used in boolean expressions, but not
|
| + // implicitly convertible to a real bool (which is dangerous).
|
| + private:
|
| + typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable;
|
| +
|
| + public:
|
| + operator Testable() const {
|
| + return internal_state_.is_bound() ? &InterfacePtr::internal_state_ : NULL;
|
| + }
|
| +
|
| private:
|
| typedef internal::InterfacePtrState<Interface> State;
|
| mutable State internal_state_;
|
|
|