Chromium Code Reviews| Index: mojo/public/cpp/application/lib/remote_service_provider.h |
| diff --git a/mojo/public/cpp/application/lib/remote_service_provider.h b/mojo/public/cpp/application/lib/remote_service_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bed2afe2c1114922c34415e9ab59124f38581ba6 |
| --- /dev/null |
| +++ b/mojo/public/cpp/application/lib/remote_service_provider.h |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_PUBLIC_APPLICATION_LIB_REMOTE_SERVICE_PROVIDER_H_ |
| +#define MOJO_PUBLIC_APPLICATION_LIB_REMOTE_SERVICE_PROVIDER_H_ |
| + |
| +#include "mojo/public/interfaces/application/service_provider.mojom.h" |
| + |
| +namespace mojo { |
| +namespace internal { |
| +class ServiceConnectorBase; |
| + |
| +// Implements a weak pointer to a ServiceProvider. Necessary as the lifetime of |
| +// the ServiceProviderImpl is bound to that of its pipe, but code may continue |
| +// to reference a remote service provider beyond the lifetime of said pipe. |
| +// Calls to ConnectToService() are silently dropped when the pipe is closed. |
| +class RemoteServiceProvider : public ServiceProvider { |
|
darin (slow to review)
2014/08/07 16:53:03
nit: I might still call this WeakServiceProvider.
|
| + public: |
| + explicit RemoteServiceProvider(ServiceProvider* service_provider); |
| + virtual ~RemoteServiceProvider(); |
| + |
| + void Clear(); |
| + |
| + private: |
| + // Overridden from ServiceProvider: |
| + virtual void ConnectToService( |
| + const String& service_name, |
| + ScopedMessagePipeHandle client_handle) MOJO_OVERRIDE; |
| + |
| + ServiceProvider* service_provider_; |
| + |
| + MOJO_DISALLOW_COPY_AND_ASSIGN(RemoteServiceProvider); |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace mojo |
| + |
| +#endif // MOJO_PUBLIC_APPLICATION_LIB_REMOTE_SERVICE_PROVIDER_H_ |