diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-19 08:11:31 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-19 08:11:31 +0000 |
commit | 7326c2ad62cb65cf964c8227c78f4623d0ea7502 (patch) | |
tree | 4e2b34f5056ccc6fa1ff6e57d0fcc78cf9793e1c /remoting/client | |
parent | 11878af0f94ae9c8782b1049d847a5ab207a8979 (diff) | |
download | chromium_src-7326c2ad62cb65cf964c8227c78f4623d0ea7502.zip chromium_src-7326c2ad62cb65cf964c8227c78f4623d0ea7502.tar.gz chromium_src-7326c2ad62cb65cf964c8227c78f4623d0ea7502.tar.bz2 |
Build remoting for PNaCl
BUG=276739
R=jamiewalch@chromium.org, rsleevi@chromium.org
Review URL: https://codereview.chromium.org/234023003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 43 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.h | 7 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_module.cc | 32 |
3 files changed, 71 insertions, 11 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 3504c71..8a07ecb 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" @@ -210,6 +215,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(); +#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); @@ -264,18 +287,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. +#if !defined(OS_NACL) if (!IsCallerAppOrExtension()) { LOG(ERROR) << "Not an app or extension"; return false; } +#endif // Start all the threads. context_.Start(); @@ -345,6 +365,9 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) { void ChromotingInstance::DidChangeFocus(bool has_focus) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); + if (!IsConnected()) + return; + input_handler_.DidChangeFocus(has_focus); } @@ -627,8 +650,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 { diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 0ed6d3d..f56074d 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -13,6 +13,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/thread_task_runner_handle.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_resource.h" @@ -45,6 +46,10 @@ class Module; class VarDictionary; } // namespace pp +namespace jingle_glue { +class JingleThreadWrapper; +} // namespace jingle_glue + namespace webrtc { class DesktopRegion; class DesktopSize; @@ -259,6 +264,8 @@ class ChromotingInstance : PepperPluginThreadDelegate plugin_thread_delegate_; scoped_refptr<PluginThreadTaskRunner> plugin_task_runner_; + scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; + scoped_ptr<jingle_glue::JingleThreadWrapper> thread_wrapper_; ClientContext context_; scoped_ptr<VideoRenderer> video_renderer_; scoped_ptr<PepperView> view_; diff --git a/remoting/client/plugin/pepper_module.cc b/remoting/client/plugin/pepper_module.cc new file mode 100644 index 0000000..b8e3bc5 --- /dev/null +++ b/remoting/client/plugin/pepper_module.cc @@ -0,0 +1,32 @@ +// Copyright 2014 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. + +#include "base/at_exit.h" +#include "base/compiler_specific.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "remoting/client/plugin/chromoting_instance.h" + +namespace remoting { + +class ChromotingModule : public pp::Module { + protected: + virtual pp::Instance* CreateInstance(PP_Instance instance) OVERRIDE { + pp::Instance* result = new ChromotingInstance(instance); + return result; + } + private: + base::AtExitManager at_exit_manager_; +}; + +} // namespace remoting + +namespace pp { + +// Factory function for your specialization of the Module object. +Module* CreateModule() { + return new remoting::ChromotingModule(); +} + +} // namespace pp |