Index: mojo/public/cpp/application/lazy_interface_ptr.h |
diff --git a/mojo/public/cpp/application/lazy_interface_ptr.h b/mojo/public/cpp/application/lazy_interface_ptr.h |
index 62d0ae9f6ee32d414ec63ce69f9b4362b5dd682b..908ea0854b83ea12541fbfc9b37983f9bb1b6bb9 100644 |
--- a/mojo/public/cpp/application/lazy_interface_ptr.h |
+++ b/mojo/public/cpp/application/lazy_interface_ptr.h |
@@ -13,12 +13,21 @@ |
namespace mojo { |
template<typename Interface> |
-class LazyInterfacePtr : InterfacePtr<Interface> { |
+class LazyInterfacePtr : public InterfacePtr<Interface> { |
public: |
+ LazyInterfacePtr() : service_provider_(NULL) {} |
+ |
LazyInterfacePtr(ServiceProvider* service_provider) |
: service_provider_(service_provider) { |
} |
+ void set_service_provider(ServiceProvider* service_provider) { |
+ if (service_provider != service_provider_) { |
+ InterfacePtr<Interface>::reset(); |
+ } |
+ service_provider_ = service_provider; |
+ } |
+ |
Interface* get() const { |
if (!InterfacePtr<Interface>::get()) { |
mojo::ConnectToService<Interface>( |