OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifdef _MSC_VER | 5 #ifdef _MSC_VER |
6 // Do not warn about use of std::copy with raw pointers. | 6 // Do not warn about use of std::copy with raw pointers. |
7 #pragma warning(disable : 4996) | 7 #pragma warning(disable : 4996) |
8 #endif | 8 #endif |
9 | 9 |
10 #include "native_client/src/trusted/plugin/plugin.h" | 10 #include "native_client/src/trusted/plugin/plugin.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 new_service_runtime->Start(wrapper, | 615 new_service_runtime->Start(wrapper, |
616 error_info, | 616 error_info, |
617 manifest_base_url()); | 617 manifest_base_url()); |
618 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", | 618 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", |
619 service_runtime_started)); | 619 service_runtime_started)); |
620 if (!service_runtime_started) { | 620 if (!service_runtime_started) { |
621 return false; | 621 return false; |
622 } | 622 } |
623 | 623 |
624 // Try to start the Chrome IPC-based proxy. | 624 // Try to start the Chrome IPC-based proxy. |
625 const PPB_NaCl_Private* ppb_nacl = GetNaclInterface(); | 625 if (nacl_interface_->StartPpapiProxy(pp_instance())) { |
626 if (ppb_nacl->StartPpapiProxy(pp_instance())) { | |
627 using_ipc_proxy_ = true; | 626 using_ipc_proxy_ = true; |
628 // We need to explicitly schedule this here. It is normally called in | 627 // We need to explicitly schedule this here. It is normally called in |
629 // response to starting the SRPC proxy. | 628 // response to starting the SRPC proxy. |
630 CHECK(init_done_cb.pp_completion_callback().func != NULL); | 629 CHECK(init_done_cb.pp_completion_callback().func != NULL); |
631 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon, started ipc proxy.\n")); | 630 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon, started ipc proxy.\n")); |
632 pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb, PP_OK); | 631 pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb, PP_OK); |
633 } | 632 } |
634 return true; | 633 return true; |
635 } | 634 } |
636 | 635 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
859 if (NULL != LookupArgument(kNaClManifestAttribute)) { | 858 if (NULL != LookupArgument(kNaClManifestAttribute)) { |
860 PLUGIN_PRINTF(("Plugin::Init:" | 859 PLUGIN_PRINTF(("Plugin::Init:" |
861 " WARNING: 'nacl' property is incorrect. Use 'src'.\n")); | 860 " WARNING: 'nacl' property is incorrect. Use 'src'.\n")); |
862 } | 861 } |
863 } else { | 862 } else { |
864 // Issue a GET for the manifest_url. The manifest file will be parsed to | 863 // Issue a GET for the manifest_url. The manifest file will be parsed to |
865 // determine the nexe URL. | 864 // determine the nexe URL. |
866 // Sets src property to full manifest URL. | 865 // Sets src property to full manifest URL. |
867 RequestNaClManifest(manifest_url); | 866 RequestNaClManifest(manifest_url); |
868 } | 867 } |
868 nacl_interface_ = GetNaclInterface(); | |
dmichael (off chromium)
2012/06/25 22:24:18
Since you're in the neighborhood, could you rename
Derek Schuff
2012/06/25 22:33:10
Done.
| |
869 } | 869 } |
870 | 870 |
871 PLUGIN_PRINTF(("Plugin::Init (status=%d)\n", status)); | 871 PLUGIN_PRINTF(("Plugin::Init (status=%d)\n", status)); |
872 return status; | 872 return status; |
873 } | 873 } |
874 | 874 |
875 | 875 |
876 Plugin::Plugin(PP_Instance pp_instance) | 876 Plugin::Plugin(PP_Instance pp_instance) |
877 : pp::InstancePrivate(pp_instance), | 877 : pp::InstancePrivate(pp_instance), |
878 scriptable_plugin_(NULL), | 878 scriptable_plugin_(NULL), |
879 argc_(-1), | 879 argc_(-1), |
880 argn_(NULL), | 880 argn_(NULL), |
881 argv_(NULL), | 881 argv_(NULL), |
882 main_subprocess_("main subprocess", NULL, NULL), | 882 main_subprocess_("main subprocess", NULL, NULL), |
883 nacl_ready_state_(UNSENT), | 883 nacl_ready_state_(UNSENT), |
884 nexe_error_reported_(false), | 884 nexe_error_reported_(false), |
885 wrapper_factory_(NULL), | 885 wrapper_factory_(NULL), |
886 last_error_string_(""), | 886 last_error_string_(""), |
887 ppapi_proxy_(NULL), | 887 ppapi_proxy_(NULL), |
888 enable_dev_interfaces_(false), | 888 enable_dev_interfaces_(false), |
889 init_time_(0), | 889 init_time_(0), |
890 ready_time_(0), | 890 ready_time_(0), |
891 nexe_size_(0), | 891 nexe_size_(0), |
892 time_of_last_progress_event_(0), | 892 time_of_last_progress_event_(0), |
893 using_ipc_proxy_(false) { | 893 using_ipc_proxy_(false) { |
dmichael (off chromium)
2012/06/25 22:24:18
please init nacl_interface_ to NULL.
I'd also sug
Derek Schuff
2012/06/25 22:33:10
Done.
| |
894 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" | 894 PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" |
895 NACL_PRId32")\n", static_cast<void*>(this), pp_instance)); | 895 NACL_PRId32")\n", static_cast<void*>(this), pp_instance)); |
896 callback_factory_.Initialize(this); | 896 callback_factory_.Initialize(this); |
897 nexe_downloader_.Initialize(this); | 897 nexe_downloader_.Initialize(this); |
898 } | 898 } |
899 | 899 |
900 | 900 |
901 Plugin::~Plugin() { | 901 Plugin::~Plugin() { |
902 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); | 902 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); |
903 | 903 |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1915 static_cast<uint32_t>(text.size())); | 1915 static_cast<uint32_t>(text.size())); |
1916 const PPB_Console_Dev* console_interface = | 1916 const PPB_Console_Dev* console_interface = |
1917 static_cast<const PPB_Console_Dev*>( | 1917 static_cast<const PPB_Console_Dev*>( |
1918 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 1918 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
1919 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1919 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
1920 var_interface->Release(prefix); | 1920 var_interface->Release(prefix); |
1921 var_interface->Release(str); | 1921 var_interface->Release(str); |
1922 } | 1922 } |
1923 | 1923 |
1924 } // namespace plugin | 1924 } // namespace plugin |
OLD | NEW |