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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 | 115 |
116 // Up to 33 minutes. | 116 // Up to 33 minutes. |
117 const int64_t kTimeLargeMin = 100; // in ms | 117 const int64_t kTimeLargeMin = 100; // in ms |
118 const int64_t kTimeLargeMax = 2000000; // in ms | 118 const int64_t kTimeLargeMax = 2000000; // in ms |
119 const uint32_t kTimeLargeBuckets = 100; | 119 const uint32_t kTimeLargeBuckets = 100; |
120 | 120 |
121 const int64_t kSizeKBMin = 1; | 121 const int64_t kSizeKBMin = 1; |
122 const int64_t kSizeKBMax = 512*1024; // very large .nexe | 122 const int64_t kSizeKBMax = 512*1024; // very large .nexe |
123 const uint32_t kSizeKBBuckets = 100; | 123 const uint32_t kSizeKBBuckets = 100; |
124 | 124 |
125 const PPB_NaCl_Private* GetNaclInterface() { | 125 const PPB_NaCl_Private* GetNaClInterface() { |
jvoung (off chromium)
2012/06/25 22:42:29
Is there really a reason to still have this helper
Derek Schuff
2012/06/25 22:49:07
I don't know if it's the preferred way, exactly. C
| |
126 pp::Module *module = pp::Module::Get(); | 126 pp::Module *module = pp::Module::Get(); |
127 CHECK(module); | 127 CHECK(module); |
128 return static_cast<const PPB_NaCl_Private*>( | 128 return static_cast<const PPB_NaCl_Private*>( |
129 module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); | 129 module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); |
130 } | 130 } |
131 | 131 |
132 const PPB_UMA_Private* GetUMAInterface() { | 132 const PPB_UMA_Private* GetUMAInterface() { |
133 pp::Module *module = pp::Module::Get(); | 133 pp::Module *module = pp::Module::Get(); |
134 CHECK(module); | 134 CHECK(module); |
135 return static_cast<const PPB_UMA_Private*>( | 135 return static_cast<const PPB_UMA_Private*>( |
(...skipping 479 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
883 nacl_ready_state_(UNSENT), | 882 nacl_ready_state_(UNSENT), |
884 nexe_error_reported_(false), | 883 nexe_error_reported_(false), |
885 wrapper_factory_(NULL), | 884 wrapper_factory_(NULL), |
886 last_error_string_(""), | 885 last_error_string_(""), |
887 ppapi_proxy_(NULL), | 886 ppapi_proxy_(NULL), |
888 enable_dev_interfaces_(false), | 887 enable_dev_interfaces_(false), |
889 init_time_(0), | 888 init_time_(0), |
890 ready_time_(0), | 889 ready_time_(0), |
891 nexe_size_(0), | 890 nexe_size_(0), |
892 time_of_last_progress_event_(0), | 891 time_of_last_progress_event_(0), |
893 using_ipc_proxy_(false) { | 892 using_ipc_proxy_(false), |
893 nacl_interface_(NULL) { | |
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 nacl_interface_ = GetNaClInterface(); | |
899 CHECK(nacl_interface_ != NULL); | |
dmichael (off chromium)
2012/06/25 22:42:34
nit: In chromium, I'm used to just seeing/writing
Derek Schuff
2012/06/25 22:49:07
all the CHECKs in this particular file seem to use
| |
898 } | 900 } |
899 | 901 |
900 | 902 |
901 Plugin::~Plugin() { | 903 Plugin::~Plugin() { |
902 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); | 904 int64_t shutdown_start = NaClGetTimeOfDayMicroseconds(); |
903 | 905 |
904 PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, scriptable_plugin=%p)\n", | 906 PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, scriptable_plugin=%p)\n", |
905 static_cast<void*>(this), | 907 static_cast<void*>(this), |
906 static_cast<void*>(scriptable_plugin()))); | 908 static_cast<void*>(scriptable_plugin()))); |
907 // Destroy the coordinator while the rest of the data is still there | 909 // Destroy the coordinator while the rest of the data is still there |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1915 static_cast<uint32_t>(text.size())); | 1917 static_cast<uint32_t>(text.size())); |
1916 const PPB_Console_Dev* console_interface = | 1918 const PPB_Console_Dev* console_interface = |
1917 static_cast<const PPB_Console_Dev*>( | 1919 static_cast<const PPB_Console_Dev*>( |
1918 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); | 1920 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); |
1919 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); | 1921 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); |
1920 var_interface->Release(prefix); | 1922 var_interface->Release(prefix); |
1921 var_interface->Release(str); | 1923 var_interface->Release(str); |
1922 } | 1924 } |
1923 | 1925 |
1924 } // namespace plugin | 1926 } // namespace plugin |
OLD | NEW |