diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-04 14:48:30 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-04 14:48:30 +0000 |
commit | c52d1593936f3d84dca0c470002397190263bfe1 (patch) | |
tree | f33dbd6b6bfd2d109bc9a05cdf10b27fcc9a056f /remoting | |
parent | 001e6018c6d04eb687987eb4d2c3d5c28047a2c0 (diff) | |
download | chromium_src-c52d1593936f3d84dca0c470002397190263bfe1.zip chromium_src-c52d1593936f3d84dca0c470002397190263bfe1.tar.gz chromium_src-c52d1593936f3d84dca0c470002397190263bfe1.tar.bz2 |
Future proof against things like http://crbug.com/91521
BUG=91521
TEST=Remove ffmpegsumo.so from a mac chrome build and attempt to use it as a client in a chromoting session.
Check your logs. You should see Media library not initialized. Also, plugin shouldn't crash.
Review URL: http://codereview.chromium.org/7562016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/client_context.cc | 20 | ||||
-rw-r--r-- | remoting/client/client_context.h | 10 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 12 |
3 files changed, 32 insertions, 10 deletions
diff --git a/remoting/client/client_context.cc b/remoting/client/client_context.cc index 5f6d139..7e5ee7a 100644 --- a/remoting/client/client_context.cc +++ b/remoting/client/client_context.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,13 +7,15 @@ #include <string> #include "base/threading/thread.h" +#include "remoting/client/plugin/pepper_util.h" #include "remoting/jingle_glue/jingle_thread.h" namespace remoting { ClientContext::ClientContext() : main_thread_("ChromotingClientMainThread"), - decode_thread_("ChromotingClientDecodeThread") { + decode_thread_("ChromotingClientDecodeThread"), + started_(false) { } ClientContext::~ClientContext() { @@ -21,16 +23,22 @@ ClientContext::~ClientContext() { void ClientContext::Start() { // Start all the threads. + DCHECK(CurrentlyOnPluginThread()); main_thread_.Start(); decode_thread_.Start(); jingle_thread_.Start(); + started_ = true; } void ClientContext::Stop() { - // Stop all the threads. - jingle_thread_.Stop(); - decode_thread_.Stop(); - main_thread_.Stop(); + DCHECK(CurrentlyOnPluginThread()); + if (started_) { + // Stop all the threads. + jingle_thread_.Stop(); + decode_thread_.Stop(); + main_thread_.Stop(); + started_ = false; + } } JingleThread* ClientContext::jingle_thread() { diff --git a/remoting/client/client_context.h b/remoting/client/client_context.h index 38c6088..c28c62e 100644 --- a/remoting/client/client_context.h +++ b/remoting/client/client_context.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,12 +13,13 @@ namespace remoting { // A class that manages threads and running context for the chromoting client -// process. +// process. This class is not designed to be subclassed. class ClientContext { public: ClientContext(); - virtual ~ClientContext(); + ~ClientContext(); + // Start and Stop must be called from the main plugin thread. void Start(); void Stop(); @@ -40,6 +41,9 @@ class ClientContext { // A thread that handles all decode operations. base::Thread decode_thread_; + // True if Start() was called on the context. + bool started_; + DISALLOW_COPY_AND_ASSIGN(ClientContext); }; diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 6fabb24..6a5e1bb 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -21,6 +21,7 @@ // crbug.com/74951 #include "content/renderer/p2p/ipc_network_manager.h" #include "content/renderer/p2p/ipc_socket_factory.h" +#include "media/base/media.h" #include "ppapi/c/dev/ppb_query_policy_dev.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/input_event.h" @@ -121,7 +122,9 @@ ChromotingInstance::~ChromotingInstance() { // before we can call Detach() on |view_proxy_|. context_.Stop(); - view_proxy_->Detach(); + if (view_proxy_.get()) { + view_proxy_->Detach(); + } } bool ChromotingInstance::Init(uint32_t argc, @@ -132,6 +135,13 @@ bool ChromotingInstance::Init(uint32_t argc, VLOG(1) << "Started ChromotingInstance::Init"; + // Check to make sure the media library is initialized. + // http://crbug.com/91521. + if (!media::IsMediaLibraryInitialized()) { + logger_.Log(logging::LOG_ERROR, "Media library not initialized."); + return false; + } + // Start all the threads. context_.Start(); |