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

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

Issue 2179023004: Make Service own ServiceContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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/mojo_media_application.h ('k') | services/shell/public/cpp/lib/service.cc » ('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/mojo_media_application.h" 5 #include "media/mojo/services/mojo_media_application.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/mojo_media_client.h" 10 #include "media/mojo/services/mojo_media_client.h"
11 #include "media/mojo/services/service_factory_impl.h" 11 #include "media/mojo/services/service_factory_impl.h"
12 #include "services/shell/public/cpp/connection.h" 12 #include "services/shell/public/cpp/connection.h"
13 #include "services/shell/public/cpp/connector.h" 13 #include "services/shell/public/cpp/connector.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 // TODO(xhwang): Hook up MediaLog when possible. 17 // TODO(xhwang): Hook up MediaLog when possible.
18 MojoMediaApplication::MojoMediaApplication( 18 MojoMediaApplication::MojoMediaApplication(
19 std::unique_ptr<MojoMediaClient> mojo_media_client, 19 std::unique_ptr<MojoMediaClient> mojo_media_client,
20 const base::Closure& quit_closure) 20 const base::Closure& quit_closure)
21 : mojo_media_client_(std::move(mojo_media_client)), 21 : mojo_media_client_(std::move(mojo_media_client)),
22 connector_(nullptr),
23 media_log_(new MediaLog()), 22 media_log_(new MediaLog()),
24 ref_factory_(quit_closure) { 23 ref_factory_(quit_closure) {
25 DCHECK(mojo_media_client_); 24 DCHECK(mojo_media_client_);
26 } 25 }
27 26
28 MojoMediaApplication::~MojoMediaApplication() {} 27 MojoMediaApplication::~MojoMediaApplication() {}
29 28
30 void MojoMediaApplication::OnStart(shell::Connector* connector, 29 void MojoMediaApplication::OnStart(const shell::Identity& identity) {
31 const shell::Identity& identity,
32 uint32_t /* id */) {
33 connector_ = connector;
34 mojo_media_client_->Initialize(); 30 mojo_media_client_->Initialize();
35 } 31 }
36 32
37 bool MojoMediaApplication::OnConnect(shell::Connection* connection) { 33 bool MojoMediaApplication::OnConnect(shell::Connection* connection) {
38 connection->AddInterface<mojom::ServiceFactory>(this); 34 connection->AddInterface<mojom::ServiceFactory>(this);
39 remote_interface_provider_ = connection->GetRemoteInterfaceProvider(); 35 remote_interface_provider_ = connection->GetRemoteInterfaceProvider();
40 return true; 36 return true;
41 } 37 }
42 38
43 bool MojoMediaApplication::OnStop() { 39 bool MojoMediaApplication::OnStop() {
44 mojo_media_client_->WillQuit(); 40 mojo_media_client_->WillQuit();
45 return true; 41 return true;
46 } 42 }
47 43
48 void MojoMediaApplication::Create( 44 void MojoMediaApplication::Create(
49 const shell::Identity& remote_identity, 45 const shell::Identity& remote_identity,
50 mojo::InterfaceRequest<mojom::ServiceFactory> request) { 46 mojo::InterfaceRequest<mojom::ServiceFactory> request) {
51 // The created object is owned by the pipe. 47 // The created object is owned by the pipe.
52 new ServiceFactoryImpl(std::move(request), remote_interface_provider_, 48 new ServiceFactoryImpl(std::move(request), remote_interface_provider_,
53 media_log_, ref_factory_.CreateRef(), 49 media_log_, ref_factory_.CreateRef(),
54 mojo_media_client_.get()); 50 mojo_media_client_.get());
55 } 51 }
56 52
57 } // namespace media 53 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_media_application.h ('k') | services/shell/public/cpp/lib/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698