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

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

Issue 2476063002: Service Manager: Rework Service and ServiceContext lifetime (Closed)
Patch Set: . Created 4 years, 1 month 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/catalog/catalog.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 "media/base/media_log.h" 9 #include "media/base/media_log.h"
10 #include "media/mojo/services/interface_factory_impl.h" 10 #include "media/mojo/services/interface_factory_impl.h"
11 #include "media/mojo/services/mojo_media_client.h" 11 #include "media/mojo/services/mojo_media_client.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
13 #include "services/service_manager/public/cpp/connection.h" 13 #include "services/service_manager/public/cpp/connection.h"
14 #include "services/service_manager/public/cpp/connector.h" 14 #include "services/service_manager/public/cpp/connector.h"
15 #include "services/service_manager/public/cpp/interface_registry.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 // TODO(xhwang): Hook up MediaLog when possible. 19 // TODO(xhwang): Hook up MediaLog when possible.
19 MediaService::MediaService(std::unique_ptr<MojoMediaClient> mojo_media_client, 20 MediaService::MediaService(std::unique_ptr<MojoMediaClient> mojo_media_client,
20 const base::Closure& quit_closure) 21 const base::Closure& quit_closure)
21 : mojo_media_client_(std::move(mojo_media_client)), 22 : mojo_media_client_(std::move(mojo_media_client)),
22 media_log_(new MediaLog()), 23 media_log_(new MediaLog()),
23 ref_factory_(quit_closure) { 24 ref_factory_(quit_closure) {
24 DCHECK(mojo_media_client_); 25 DCHECK(mojo_media_client_);
25 } 26 }
26 27
27 MediaService::~MediaService() {} 28 MediaService::~MediaService() {}
28 29
29 void MediaService::OnStart(const service_manager::ServiceInfo& info) { 30 void MediaService::OnStart(service_manager::ServiceContext* context) {
30 mojo_media_client_->Initialize(); 31 mojo_media_client_->Initialize();
31 } 32 }
32 33
33 bool MediaService::OnConnect(const service_manager::ServiceInfo& remote_info, 34 bool MediaService::OnConnect(const service_manager::ServiceInfo& remote_info,
34 service_manager::InterfaceRegistry* registry) { 35 service_manager::InterfaceRegistry* registry) {
35 registry->AddInterface<mojom::MediaService>(this); 36 registry->AddInterface<mojom::MediaService>(this);
36 return true; 37 return true;
37 } 38 }
38 39
39 bool MediaService::OnStop() { 40 bool MediaService::OnStop() {
(...skipping 14 matching lines...) Expand all
54 return; 55 return;
55 56
56 mojo::MakeStrongBinding( 57 mojo::MakeStrongBinding(
57 base::MakeUnique<InterfaceFactoryImpl>( 58 base::MakeUnique<InterfaceFactoryImpl>(
58 std::move(remote_interfaces), media_log_, ref_factory_.CreateRef(), 59 std::move(remote_interfaces), media_log_, ref_factory_.CreateRef(),
59 mojo_media_client_.get()), 60 mojo_media_client_.get()),
60 std::move(request)); 61 std::move(request));
61 } 62 }
62 63
63 } // namespace media 64 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/media_service.h ('k') | services/catalog/catalog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698