OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mojo/public/cpp/application/lib/weak_service_provider.h" | |
6 | |
7 #include "mojo/public/cpp/application/service_provider_impl.h" | |
8 #include "mojo/public/interfaces/application/service_provider.mojom.h" | |
9 | |
10 namespace mojo { | |
11 namespace internal { | |
12 | |
13 WeakServiceProvider::WeakServiceProvider(ServiceProviderImpl* creator, | |
14 ServiceProvider* service_provider) | |
15 : creator_(creator), service_provider_(service_provider) { | |
16 } | |
17 | |
18 WeakServiceProvider::~WeakServiceProvider() { | |
19 if (creator_) | |
20 creator_->ClearRemote(); | |
21 } | |
22 | |
23 void WeakServiceProvider::Clear() { | |
24 creator_ = nullptr; | |
25 service_provider_ = nullptr; | |
26 } | |
27 | |
28 void WeakServiceProvider::ConnectToService( | |
29 const String& service_name, | |
30 ScopedMessagePipeHandle client_handle) { | |
31 if (service_provider_) | |
32 service_provider_->ConnectToService(service_name, client_handle.Pass()); | |
33 } | |
34 | |
35 } // namespace internal | |
36 } // namespace mojo | |
OLD | NEW |