Chromium Code Reviews| Index: remoting/client/plugin/chromoting_instance.cc |
| diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc |
| index ef5f4281103794e0c6d1b9641f759fbe3953ca3a..5e248f53b4038dc6700a97eb2ba3b463415ff2e0 100644 |
| --- a/remoting/client/plugin/chromoting_instance.cc |
| +++ b/remoting/client/plugin/chromoting_instance.cc |
| @@ -8,6 +8,11 @@ |
| #include <string> |
| #include <vector> |
| +#if defined(OS_NACL) |
| +#include <sys/mount.h> |
| +#include <nacl_io/nacl_io.h> |
| +#endif |
| + |
| #include "base/bind.h" |
| #include "base/callback.h" |
| #include "base/json/json_reader.h" |
| @@ -21,7 +26,7 @@ |
| #include "base/values.h" |
| #include "crypto/random.h" |
| #include "jingle/glue/thread_wrapper.h" |
| -#include "media/base/media.h" |
| +#include "media/base/yuv_convert.h" |
| #include "net/socket/ssl_server_socket.h" |
| #include "ppapi/cpp/completion_callback.h" |
| #include "ppapi/cpp/dev/url_util_dev.h" |
| @@ -208,6 +213,24 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) |
| use_async_pin_dialog_(false), |
| use_media_source_rendering_(false), |
| weak_factory_(this) { |
| +#if defined(OS_NACL) |
| + // In NaCl global resources need to be initialized differently because they |
| + // are not shared with Chrome. |
| + thread_task_runner_handle_.reset( |
| + new base::ThreadTaskRunnerHandle(plugin_task_runner_)); |
| + thread_wrapper_.reset( |
| + new jingle_glue::JingleThreadWrapper(plugin_task_runner_)); |
| + media::InitializeCPUSpecificYUVConversions(); |
| +#else |
| + jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
|
Jamie
2014/04/14 22:23:42
Is this run on the same thread as it would have be
Sergey Ulanov
2014/04/14 23:16:51
Yes. All code in this file is executed on the main
|
| +#endif |
| + |
| +#if defined(OS_NACL) |
| + nacl_io_init_ppapi(pp_instance, pp::Module::Get()->get_browser_interface()); |
| + mount("", "/etc", "memfs", 0, ""); |
| + mount("", "/usr", "memfs", 0, ""); |
| +#endif |
| + |
| RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL); |
| RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); |
| @@ -262,25 +285,15 @@ 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()) { |
| - LOG(ERROR) << "Media library not initialized."; |
| - return false; |
| - } |
| - |
| - // Check that the calling content is part of an app or extension. |
| + // Check that the calling content is part of an app or extension. This is only |
| + // necessary for non-PNaCl version of the plugin. Also PPB_URLUtil_Dev doesn't |
| + // work in NaCl at the moment so the check fails in NaCl builds. |
|
Jamie
2014/04/14 22:23:42
Do we want this to work for non-extensions, or is
Sergey Ulanov
2014/04/14 23:16:51
We don't need this check for NaCl plugin. Pepper p
|
| +#if !defined(OS_NACL) |
| if (!IsCallerAppOrExtension()) { |
| LOG(ERROR) << "Not an app or extension"; |
| return false; |
| } |
| - |
| - // Enable support for SSL server sockets, which must be done as early as |
| - // possible, preferably before any NSS SSL sockets (client or server) have |
| - // been created. |
| - // It's possible that the hosting process has already made use of SSL, in |
| - // which case, there may be a slight race. |
| - net::EnableSSLServerSockets(); |
|
Jamie
2014/04/14 22:23:42
Did you intend to remove this? If so, please add s
Sergey Ulanov
2014/04/14 23:16:51
Yes, this is intentional. There is no reason to in
|
| +#endif |
| // Start all the threads. |
| context_.Start(); |
| @@ -350,6 +363,9 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) { |
| void ChromotingInstance::DidChangeFocus(bool has_focus) { |
| DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| + if (!IsConnected()) |
| + return; |
|
Jamie
2014/04/14 22:23:42
Is this required for this CL, or an unrelated bug-
Sergey Ulanov
2014/04/14 23:16:51
It fixes a bug that affects only NaCl build (I did
|
| + |
| input_handler_.DidChangeFocus(has_focus); |
| } |
| @@ -632,8 +648,6 @@ void ChromotingInstance::ConnectWithConfig(const ClientConfig& config, |
| const std::string& local_jid) { |
| DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| - jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| - |
| if (use_media_source_rendering_) { |
| video_renderer_.reset(new MediaSourceVideoRenderer(this)); |
| } else { |