Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / mojo / public / cpp / application / lazy_interface_ptr.h
index 62d0ae9..908ea08 100644 (file)
 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>(