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

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

Issue 1529063004: Pass MojoMediaClient instance to MojoMediaApplication constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added bug number Created 5 years 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') | media/mojo/services/mojo_media_client.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/mojo_media_application.h" 5 #include "media/mojo/services/mojo_media_application.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/media_log.h" 8 #include "media/base/media_log.h"
9 #include "media/mojo/services/mojo_media_client.h"
9 #include "media/mojo/services/service_factory_impl.h" 10 #include "media/mojo/services/service_factory_impl.h"
10 #include "mojo/application/public/cpp/application_connection.h" 11 #include "mojo/application/public/cpp/application_connection.h"
11 #include "mojo/application/public/cpp/application_impl.h" 12 #include "mojo/application/public/cpp/application_impl.h"
12 13
13 namespace media { 14 namespace media {
14 15
15 // static 16 // static
16 scoped_ptr<mojo::ApplicationDelegate> MojoMediaApplication::CreateApp() { 17 scoped_ptr<mojo::ApplicationDelegate> MojoMediaApplication::CreateApp() {
17 // In all existing use cases we don't need to initialize logging when using 18 // In all existing use cases we don't need to initialize logging when using
18 // CreateApp() to create the application. We can pass |enable_logging| in 19 // CreateApp() to create the application. We can pass |enable_logging| in
19 // CreateApp() if this isn't the case any more in the future. 20 // CreateApp() if this isn't the case any more in the future.
20 return scoped_ptr<mojo::ApplicationDelegate>(new MojoMediaApplication(false)); 21 return scoped_ptr<mojo::ApplicationDelegate>(
22 new MojoMediaApplication(false, MojoMediaClient::Create()));
21 } 23 }
22 24
23 // TODO(xhwang): Hook up MediaLog when possible. 25 // TODO(xhwang): Hook up MediaLog when possible.
24 MojoMediaApplication::MojoMediaApplication(bool enable_logging) 26 MojoMediaApplication::MojoMediaApplication(
27 bool enable_logging,
28 scoped_ptr<MojoMediaClient> mojo_media_client)
25 : enable_logging_(enable_logging), 29 : enable_logging_(enable_logging),
30 mojo_media_client_(std::move(mojo_media_client)),
26 app_impl_(nullptr), 31 app_impl_(nullptr),
27 media_log_(new MediaLog()) {} 32 media_log_(new MediaLog()) {}
28 33
29 MojoMediaApplication::~MojoMediaApplication() { 34 MojoMediaApplication::~MojoMediaApplication() {
30 } 35 }
31 36
32 void MojoMediaApplication::Initialize(mojo::ApplicationImpl* app) { 37 void MojoMediaApplication::Initialize(mojo::ApplicationImpl* app) {
33 app_impl_ = app; 38 app_impl_ = app;
34 39
35 if (enable_logging_) { 40 if (enable_logging_) {
36 logging::LoggingSettings settings; 41 logging::LoggingSettings settings;
37 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 42 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
38 logging::InitLogging(settings); 43 logging::InitLogging(settings);
39 // Display process ID, thread ID and timestamp in logs. 44 // Display process ID, thread ID and timestamp in logs.
40 logging::SetLogItems(true, true, true, false); 45 logging::SetLogItems(true, true, true, false);
41 } 46 }
47 mojo_media_client_->Initialize();
42 } 48 }
43 49
44 bool MojoMediaApplication::ConfigureIncomingConnection( 50 bool MojoMediaApplication::ConfigureIncomingConnection(
45 mojo::ApplicationConnection* connection) { 51 mojo::ApplicationConnection* connection) {
46 connection->AddService<interfaces::ServiceFactory>(this); 52 connection->AddService<interfaces::ServiceFactory>(this);
47 return true; 53 return true;
48 } 54 }
49 55
50 void MojoMediaApplication::Create( 56 void MojoMediaApplication::Create(
51 mojo::ApplicationConnection* connection, 57 mojo::ApplicationConnection* connection,
52 mojo::InterfaceRequest<interfaces::ServiceFactory> request) { 58 mojo::InterfaceRequest<interfaces::ServiceFactory> request) {
53 // The created object is owned by the pipe. 59 // The created object is owned by the pipe.
54 new ServiceFactoryImpl(request.Pass(), connection->GetServiceProvider(), 60 new ServiceFactoryImpl(request.Pass(), connection->GetServiceProvider(),
55 media_log_, 61 media_log_,
56 app_impl_->app_lifetime_helper()->CreateAppRefCount()); 62 app_impl_->app_lifetime_helper()->CreateAppRefCount(),
63 mojo_media_client_.get());
57 } 64 }
58 65
59 } // namespace media 66 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_media_application.h ('k') | media/mojo/services/mojo_media_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698