Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: media/mojo/services/media_service.cc

Issue 2701883002: service_manager: More consistent Service lifecycle API (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/mojo/services/media_service.h ('k') | services/image_decoder/image_decoder_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/mojo/services/media_service.h" 5 #include "media/mojo/services/media_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "media/base/media_log.h" 10 #include "media/base/media_log.h"
(...skipping 21 matching lines...) Expand all
32 base::Unretained(context())))); 32 base::Unretained(context()))));
33 mojo_media_client_->Initialize(context()->connector()); 33 mojo_media_client_->Initialize(context()->connector());
34 } 34 }
35 35
36 bool MediaService::OnConnect(const service_manager::ServiceInfo& remote_info, 36 bool MediaService::OnConnect(const service_manager::ServiceInfo& remote_info,
37 service_manager::InterfaceRegistry* registry) { 37 service_manager::InterfaceRegistry* registry) {
38 registry->AddInterface<mojom::MediaService>(this); 38 registry->AddInterface<mojom::MediaService>(this);
39 return true; 39 return true;
40 } 40 }
41 41
42 bool MediaService::OnStop() { 42 bool MediaService::OnServiceManagerConnectionLost() {
43 mojo_media_client_.reset(); 43 mojo_media_client_.reset();
44 return true; 44 return true;
45 } 45 }
46 46
47 void MediaService::Create(const service_manager::Identity& remote_identity, 47 void MediaService::Create(const service_manager::Identity& remote_identity,
48 mojom::MediaServiceRequest request) { 48 mojom::MediaServiceRequest request) {
49 bindings_.AddBinding(this, std::move(request)); 49 bindings_.AddBinding(this, std::move(request));
50 } 50 }
51 51
52 void MediaService::CreateInterfaceFactory( 52 void MediaService::CreateInterfaceFactory(
53 mojom::InterfaceFactoryRequest request, 53 mojom::InterfaceFactoryRequest request,
54 service_manager::mojom::InterfaceProviderPtr host_interfaces) { 54 service_manager::mojom::InterfaceProviderPtr host_interfaces) {
55 // Ignore request if service has already stopped. 55 // Ignore request if service has already stopped.
56 if (!mojo_media_client_) 56 if (!mojo_media_client_)
57 return; 57 return;
58 58
59 mojo::MakeStrongBinding( 59 mojo::MakeStrongBinding(
60 base::MakeUnique<InterfaceFactoryImpl>( 60 base::MakeUnique<InterfaceFactoryImpl>(
61 std::move(host_interfaces), media_log_, ref_factory_->CreateRef(), 61 std::move(host_interfaces), media_log_, ref_factory_->CreateRef(),
62 mojo_media_client_.get()), 62 mojo_media_client_.get()),
63 std::move(request)); 63 std::move(request));
64 } 64 }
65 65
66 } // namespace media 66 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/media_service.h ('k') | services/image_decoder/image_decoder_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698