Commit 75e9e3fd authored by teravest@chromium.org's avatar teravest@chromium.org

Pepper: Simplify Pnacl manifest id logic.

This removes some unnecessary manifest_id storage and passing to make manifest
behavior clearer in the trusted plugin. Helper NaCl Modules (llc and ld) always
use the "Pnacl Manifest" for resolving keys, as there is no relevant
json-formatted NMF available.

BUG=239656
R=dmichael@chromium.org

Review URL: https://codereview.chromium.org/292743011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272582 0039d316-1c4b-4281-b951-d872f2087c98
parent 8b248450
......@@ -253,7 +253,6 @@ bool Plugin::LoadNaClModuleContinuationIntern() {
NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url,
PP_FileHandle file_handle,
int32_t manifest_id,
ErrorInfo* error_info) {
nacl::scoped_ptr<NaClSubprocess> nacl_subprocess(
new NaClSubprocess("helper module", NULL, NULL));
......@@ -279,6 +278,10 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url,
false /* enable_dyncode_syscalls */,
false /* enable_exception_handling */,
true /* enable_crash_throttling */);
// Helper NaCl modules always use the PNaCl manifest, as there is no
// corresponding NMF.
int32_t manifest_id = nacl_interface_->CreatePnaclManifest(pp_instance());
if (!LoadNaClModuleFromBackgroundThread(file_handle, nacl_subprocess.get(),
manifest_id, params)) {
return NULL;
......
......@@ -113,7 +113,6 @@ class Plugin : public pp::Instance {
// Returns NULL or the NaClSubprocess of the new helper NaCl module.
NaClSubprocess* LoadHelperNaClModule(const nacl::string& helper_url,
PP_FileHandle file_handle,
int32_t manifest_id,
ErrorInfo* error_info);
enum LengthComputable {
......
......@@ -129,8 +129,6 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative(
new PnaclCoordinator(plugin, pexe_url,
pnacl_options,
translate_notify_callback);
PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest_id=%d)\n",
coordinator->manifest_id_));
coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds();
int cpus = plugin->nacl_interface()->GetNumberOfProcessors();
......@@ -153,8 +151,6 @@ PnaclCoordinator::PnaclCoordinator(
plugin_(plugin),
translate_notify_callback_(translate_notify_callback),
translation_finished_reported_(false),
manifest_id_(
GetNaClInterface()->CreatePnaclManifest(plugin->pp_instance())),
pexe_url_(pexe_url),
pnacl_options_(pnacl_options),
architecture_attributes_(GetArchitectureAttributes(plugin)),
......@@ -619,7 +615,6 @@ void PnaclCoordinator::RunTranslate(int32_t pp_error) {
CHECK(translate_thread_ != NULL);
translate_thread_->RunTranslate(report_translate_finished,
manifest_id_,
&obj_files_,
temp_nexe_file_.get(),
invalid_desc_wrapper_.get(),
......
......@@ -201,9 +201,6 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> {
pp::CompletionCallbackFactory<PnaclCoordinator,
pp::ThreadSafeThreadTraits> callback_factory_;
// The manifest used by resource loading and ld + llc's reverse service
// to look up objects and libraries.
int32_t manifest_id_;
// An auxiliary class that manages downloaded resources (llc and ld nexes).
nacl::scoped_ptr<PnaclResources> resources_;
......
......@@ -56,7 +56,6 @@ PnaclTranslateThread::PnaclTranslateThread() : llc_subprocess_active_(false),
ld_subprocess_active_(false),
done_(false),
compile_time_(0),
manifest_id_(0),
obj_files_(NULL),
nexe_file_(NULL),
coordinator_error_info_(NULL),
......@@ -70,7 +69,6 @@ PnaclTranslateThread::PnaclTranslateThread() : llc_subprocess_active_(false),
void PnaclTranslateThread::RunTranslate(
const pp::CompletionCallback& finish_callback,
int32_t manifest_id,
const std::vector<TempFile*>* obj_files,
TempFile* nexe_file,
nacl::DescWrapper* invalid_desc_wrapper,
......@@ -81,7 +79,6 @@ void PnaclTranslateThread::RunTranslate(
PnaclCoordinator* coordinator,
Plugin* plugin) {
PLUGIN_PRINTF(("PnaclStreamingTranslateThread::RunTranslate)\n"));
manifest_id_ = manifest_id;
obj_files_ = obj_files;
nexe_file_ = nexe_file;
invalid_desc_wrapper_ = invalid_desc_wrapper;
......@@ -170,7 +167,7 @@ void PnaclTranslateThread::DoTranslate() {
// On success, ownership of llc_file_handle is transferred.
llc_subprocess_.reset(plugin_->LoadHelperNaClModule(
resources_->GetLlcUrl(), llc_file_handle, manifest_id_, &error_info));
resources_->GetLlcUrl(), llc_file_handle, &error_info));
if (llc_subprocess_.get() == NULL) {
if (llc_file_handle != PP_kInvalidFileHandle)
CloseFileHandle(llc_file_handle);
......@@ -341,7 +338,7 @@ bool PnaclTranslateThread::RunLdSubprocess() {
// On success, ownership of ld_file_handle is transferred.
ld_subprocess_.reset(plugin_->LoadHelperNaClModule(
resources_->GetLdUrl(), ld_file_handle, manifest_id_, &error_info));
resources_->GetLdUrl(), ld_file_handle, &error_info));
if (ld_subprocess_ == NULL) {
if (ld_file_handle != PP_kInvalidFileHandle)
CloseFileHandle(ld_file_handle);
......
......@@ -42,7 +42,6 @@ class PnaclTranslateThread {
// Start the translation process. It will continue to run and consume data
// as it is passed in with PutBytes.
void RunTranslate(const pp::CompletionCallback& finish_callback,
int32_t manifest_id,
const std::vector<TempFile*>* obj_files,
TempFile* nexe_file,
nacl::DescWrapper* invalid_desc_wrapper,
......@@ -110,7 +109,6 @@ class PnaclTranslateThread {
int64_t compile_time_;
// Data about the translation files, owned by the coordinator
int32_t manifest_id_;
const std::vector<TempFile*>* obj_files_;
TempFile* nexe_file_;
nacl::DescWrapper* invalid_desc_wrapper_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment