Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc

Issue 292743011: Pepper: Simplify Pnacl manifest id logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h" 5 #include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 9 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
10 #include "ppapi/cpp/var.h" 10 #include "ppapi/cpp/var.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 split_args->push_back('\x00'); 49 split_args->push_back('\x00');
50 } 50 }
51 } 51 }
52 52
53 } // namespace 53 } // namespace
54 54
55 PnaclTranslateThread::PnaclTranslateThread() : llc_subprocess_active_(false), 55 PnaclTranslateThread::PnaclTranslateThread() : llc_subprocess_active_(false),
56 ld_subprocess_active_(false), 56 ld_subprocess_active_(false),
57 done_(false), 57 done_(false),
58 compile_time_(0), 58 compile_time_(0),
59 manifest_id_(0),
60 obj_files_(NULL), 59 obj_files_(NULL),
61 nexe_file_(NULL), 60 nexe_file_(NULL),
62 coordinator_error_info_(NULL), 61 coordinator_error_info_(NULL),
63 resources_(NULL), 62 resources_(NULL),
64 coordinator_(NULL), 63 coordinator_(NULL),
65 plugin_(NULL) { 64 plugin_(NULL) {
66 NaClXMutexCtor(&subprocess_mu_); 65 NaClXMutexCtor(&subprocess_mu_);
67 NaClXMutexCtor(&cond_mu_); 66 NaClXMutexCtor(&cond_mu_);
68 NaClXCondVarCtor(&buffer_cond_); 67 NaClXCondVarCtor(&buffer_cond_);
69 } 68 }
70 69
71 void PnaclTranslateThread::RunTranslate( 70 void PnaclTranslateThread::RunTranslate(
72 const pp::CompletionCallback& finish_callback, 71 const pp::CompletionCallback& finish_callback,
73 int32_t manifest_id,
74 const std::vector<TempFile*>* obj_files, 72 const std::vector<TempFile*>* obj_files,
75 TempFile* nexe_file, 73 TempFile* nexe_file,
76 nacl::DescWrapper* invalid_desc_wrapper, 74 nacl::DescWrapper* invalid_desc_wrapper,
77 ErrorInfo* error_info, 75 ErrorInfo* error_info,
78 PnaclResources* resources, 76 PnaclResources* resources,
79 PP_PNaClOptions* pnacl_options, 77 PP_PNaClOptions* pnacl_options,
80 const nacl::string &architecture_attributes, 78 const nacl::string &architecture_attributes,
81 PnaclCoordinator* coordinator, 79 PnaclCoordinator* coordinator,
82 Plugin* plugin) { 80 Plugin* plugin) {
83 PLUGIN_PRINTF(("PnaclStreamingTranslateThread::RunTranslate)\n")); 81 PLUGIN_PRINTF(("PnaclStreamingTranslateThread::RunTranslate)\n"));
84 manifest_id_ = manifest_id;
85 obj_files_ = obj_files; 82 obj_files_ = obj_files;
86 nexe_file_ = nexe_file; 83 nexe_file_ = nexe_file;
87 invalid_desc_wrapper_ = invalid_desc_wrapper; 84 invalid_desc_wrapper_ = invalid_desc_wrapper;
88 coordinator_error_info_ = error_info; 85 coordinator_error_info_ = error_info;
89 resources_ = resources; 86 resources_ = resources;
90 pnacl_options_ = pnacl_options; 87 pnacl_options_ = pnacl_options;
91 architecture_attributes_ = architecture_attributes; 88 architecture_attributes_ = architecture_attributes;
92 coordinator_ = coordinator; 89 coordinator_ = coordinator;
93 plugin_ = plugin; 90 plugin_ = plugin;
94 91
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 llc_out_files.push_back(invalid_desc_wrapper_); 160 llc_out_files.push_back(invalid_desc_wrapper_);
164 161
165 pp::Core* core = pp::Module::Get()->core(); 162 pp::Core* core = pp::Module::Get()->core();
166 { 163 {
167 nacl::MutexLocker ml(&subprocess_mu_); 164 nacl::MutexLocker ml(&subprocess_mu_);
168 int64_t llc_start_time = NaClGetTimeOfDayMicroseconds(); 165 int64_t llc_start_time = NaClGetTimeOfDayMicroseconds();
169 PP_FileHandle llc_file_handle = resources_->TakeLlcFileHandle(); 166 PP_FileHandle llc_file_handle = resources_->TakeLlcFileHandle();
170 167
171 // On success, ownership of llc_file_handle is transferred. 168 // On success, ownership of llc_file_handle is transferred.
172 llc_subprocess_.reset(plugin_->LoadHelperNaClModule( 169 llc_subprocess_.reset(plugin_->LoadHelperNaClModule(
173 resources_->GetLlcUrl(), llc_file_handle, manifest_id_, &error_info)); 170 resources_->GetLlcUrl(), llc_file_handle, &error_info));
174 if (llc_subprocess_.get() == NULL) { 171 if (llc_subprocess_.get() == NULL) {
175 if (llc_file_handle != PP_kInvalidFileHandle) 172 if (llc_file_handle != PP_kInvalidFileHandle)
176 CloseFileHandle(llc_file_handle); 173 CloseFileHandle(llc_file_handle);
177 TranslateFailed(PP_NACL_ERROR_PNACL_LLC_SETUP, 174 TranslateFailed(PP_NACL_ERROR_PNACL_LLC_SETUP,
178 "Compile process could not be created: " + 175 "Compile process could not be created: " +
179 error_info.message()); 176 error_info.message());
180 return; 177 return;
181 } 178 }
182 179
183 llc_subprocess_active_ = true; 180 llc_subprocess_active_ = true;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper(); 331 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper();
335 pp::Core* core = pp::Module::Get()->core(); 332 pp::Core* core = pp::Module::Get()->core();
336 { 333 {
337 // Create LD process 334 // Create LD process
338 nacl::MutexLocker ml(&subprocess_mu_); 335 nacl::MutexLocker ml(&subprocess_mu_);
339 int64_t ld_start_time = NaClGetTimeOfDayMicroseconds(); 336 int64_t ld_start_time = NaClGetTimeOfDayMicroseconds();
340 PP_FileHandle ld_file_handle = resources_->TakeLdFileHandle(); 337 PP_FileHandle ld_file_handle = resources_->TakeLdFileHandle();
341 338
342 // On success, ownership of ld_file_handle is transferred. 339 // On success, ownership of ld_file_handle is transferred.
343 ld_subprocess_.reset(plugin_->LoadHelperNaClModule( 340 ld_subprocess_.reset(plugin_->LoadHelperNaClModule(
344 resources_->GetLdUrl(), ld_file_handle, manifest_id_, &error_info)); 341 resources_->GetLdUrl(), ld_file_handle, &error_info));
345 if (ld_subprocess_ == NULL) { 342 if (ld_subprocess_ == NULL) {
346 if (ld_file_handle != PP_kInvalidFileHandle) 343 if (ld_file_handle != PP_kInvalidFileHandle)
347 CloseFileHandle(ld_file_handle); 344 CloseFileHandle(ld_file_handle);
348 TranslateFailed(PP_NACL_ERROR_PNACL_LD_SETUP, 345 TranslateFailed(PP_NACL_ERROR_PNACL_LD_SETUP,
349 "Link process could not be created: " + 346 "Link process could not be created: " +
350 error_info.message()); 347 error_info.message());
351 return false; 348 return false;
352 } 349 }
353 ld_subprocess_active_ = true; 350 ld_subprocess_active_ = true;
354 core->CallOnMainThread(0, 351 core->CallOnMainThread(0,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 AbortSubprocesses(); 439 AbortSubprocesses();
443 if (translate_thread_ != NULL) 440 if (translate_thread_ != NULL)
444 NaClThreadJoin(translate_thread_.get()); 441 NaClThreadJoin(translate_thread_.get());
445 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); 442 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n"));
446 NaClCondVarDtor(&buffer_cond_); 443 NaClCondVarDtor(&buffer_cond_);
447 NaClMutexDtor(&cond_mu_); 444 NaClMutexDtor(&cond_mu_);
448 NaClMutexDtor(&subprocess_mu_); 445 NaClMutexDtor(&subprocess_mu_);
449 } 446 }
450 447
451 } // namespace plugin 448 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698