Index: components/nacl/renderer/plugin/pnacl_coordinator.cc |
diff --git a/components/nacl/renderer/plugin/pnacl_coordinator.cc b/components/nacl/renderer/plugin/pnacl_coordinator.cc |
index 9d5bca47fb1e427b35d1ea543bf059a9a0ad232b..8283349c1b850fde98daa5fd7b710f837457eb07 100644 |
--- a/components/nacl/renderer/plugin/pnacl_coordinator.cc |
+++ b/components/nacl/renderer/plugin/pnacl_coordinator.cc |
@@ -101,8 +101,12 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative( |
GetNaClInterface()->SetPNaClStartTime(plugin->pp_instance()); |
int cpus = plugin->nacl_interface()->GetNumberOfProcessors(); |
- coordinator->split_module_count_ = std::min(4, std::max(1, cpus)); |
- |
+ coordinator->num_threads_ = std::min(4, std::max(1, cpus)); |
+ if (pnacl_options.use_subzero) { |
+ coordinator->split_module_count_ = 1; |
+ } else { |
+ coordinator->split_module_count_ = coordinator->num_threads_; |
+ } |
// First start a network request for the pexe, to tickle the component |
// updater's On-Demand resource throttler, and to get Last-Modified/ETag |
// cache information. We can cancel the request later if there's |
@@ -116,18 +120,19 @@ PnaclCoordinator::PnaclCoordinator( |
const std::string& pexe_url, |
const PP_PNaClOptions& pnacl_options, |
const pp::CompletionCallback& translate_notify_callback) |
- : translate_finish_error_(PP_OK), |
- plugin_(plugin), |
- translate_notify_callback_(translate_notify_callback), |
- translation_finished_reported_(false), |
- pexe_url_(pexe_url), |
- pnacl_options_(pnacl_options), |
- architecture_attributes_(GetArchitectureAttributes(plugin)), |
- split_module_count_(1), |
- error_already_reported_(false), |
- pexe_size_(0), |
- pexe_bytes_compiled_(0), |
- expected_pexe_size_(-1) { |
+ : translate_finish_error_(PP_OK), |
+ plugin_(plugin), |
+ translate_notify_callback_(translate_notify_callback), |
+ translation_finished_reported_(false), |
+ pexe_url_(pexe_url), |
+ pnacl_options_(pnacl_options), |
+ architecture_attributes_(GetArchitectureAttributes(plugin)), |
+ split_module_count_(0), |
+ num_threads_(0), |
+ error_already_reported_(false), |
+ pexe_size_(0), |
+ pexe_bytes_compiled_(0), |
+ expected_pexe_size_(-1) { |
callback_factory_.Initialize(this); |
} |
@@ -314,7 +319,7 @@ void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size, |
// The component updater's resource throttles + OnDemand update/install |
// should block the URL request until the compiler is present. Now we |
// can load the resources (e.g. llc and ld nexes). |
- resources_.reset(new PnaclResources(plugin_)); |
+ resources_.reset(new PnaclResources(plugin_, pnacl_options_.use_subzero)); |
CHECK(resources_ != NULL); |
// The first step of loading resources: read the resource info file. |
@@ -336,7 +341,7 @@ void PnaclCoordinator::BitcodeStreamCacheMiss(int64_t expected_pexe_size, |
expected_pexe_size_ = expected_pexe_size; |
- for (int i = 0; i < split_module_count_; i++) { |
+ for (size_t i = 0; i < split_module_count_; i++) { |
PP_FileHandle obj_handle = |
plugin_->nacl_interface()->CreateTemporaryFile(plugin_->pp_instance()); |
nacl::scoped_ptr<TempFile> temp_file(new TempFile(plugin_, obj_handle)); |
@@ -441,16 +446,11 @@ void PnaclCoordinator::RunTranslate(int32_t pp_error) { |
callback_factory_.NewCallback(&PnaclCoordinator::TranslateFinished); |
CHECK(translate_thread_ != NULL); |
- translate_thread_->RunTranslate(report_translate_finished, |
- &obj_files_, |
- temp_nexe_file_.get(), |
- invalid_desc_wrapper_.get(), |
- &error_info_, |
- resources_.get(), |
- &pnacl_options_, |
- architecture_attributes_, |
- this, |
- plugin_); |
+ translate_thread_->RunTranslate(report_translate_finished, &obj_files_, |
+ num_threads_, temp_nexe_file_.get(), |
+ invalid_desc_wrapper_.get(), &error_info_, |
+ resources_.get(), &pnacl_options_, |
+ architecture_attributes_, this, plugin_); |
} |
} // namespace plugin |