diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 10:55:22 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 10:55:22 +0000 |
commit | 4f57fd3756fd5774c85670f40a8805d39af757e2 (patch) | |
tree | 13e93c7afed1f1c15cc15eb1b9ffcef23a43bcd0 /chrome/service/service_process.cc | |
parent | ef1c8617b7f658f1b5e6199729ba1bc9753b20ae (diff) | |
download | chromium_src-4f57fd3756fd5774c85670f40a8805d39af757e2.zip chromium_src-4f57fd3756fd5774c85670f40a8805d39af757e2.tar.gz chromium_src-4f57fd3756fd5774c85670f40a8805d39af757e2.tar.bz2 |
Initialize media library on service process startup.
BUG=73166
TEST=Enable Chromoting Host in Chrome, and try to connect to it. The service process should not crash trying to retrieve the VP8 codec.
Review URL: http://codereview.chromium.org/6539017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r-- | chrome/service/service_process.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index f490fb5..c46bb97 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -27,6 +27,7 @@ #include "chrome/service/service_process_prefs.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "media/base/media.h" #include "net/base/network_change_notifier.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -34,6 +35,9 @@ #if defined(ENABLE_REMOTING) #include "chrome/service/remoting/chromoting_host_manager.h" +#if defined(OS_MACOSX) +#include "base/mac/mac_util.h" +#endif // defined(OS_MACOSX) #endif // defined(ENABLED_REMOTING) ServiceProcess* g_service_process = NULL; @@ -160,11 +164,25 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop, PrepareRestartOnCrashEnviroment(command_line); #if defined(ENABLE_REMOTING) + // Load media codecs, required by the Chromoting host + bool initialized_media_library = false; +#if defined(OS_MACOSX) + FilePath bundle_path = base::mac::MainAppBundlePath(); + + initialized_media_library = + media::InitializeMediaLibrary(bundle_path.Append("Libraries")); +#else + FilePath module_path; + initialized_media_library = + PathService::Get(base::DIR_MODULE, &module_path) && + media::InitializeMediaLibrary(module_path); +#endif + // Initialize chromoting host manager. remoting_host_manager_ = new remoting::ChromotingHostManager(this); remoting_host_manager_->Initialize(message_loop, file_thread_->message_loop_proxy()); -#endif +#endif // ENABLE_REMOTING // Enable Cloud Print if needed. First check the command-line. bool cloud_print_proxy_enabled = @@ -224,8 +242,10 @@ void ServiceProcess::Shutdown() { #if defined(ENABLE_REMOTING) // During shutdown of remoting host it has some left over operations on // the UI thread. So we let the teardown to proceed asynchronously - remoting_host_manager_->Teardown( - NewRunnableFunction(&QuitMessageLoop, main_message_loop_)); + if (remoting_host_manager_.get()) { + remoting_host_manager_->Teardown( + NewRunnableFunction(&QuitMessageLoop, main_message_loop_)); + } #else // Quit the main message loop. main_message_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |