diff options
author | dschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-20 19:37:05 +0000 |
---|---|---|
committer | dschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-20 19:37:05 +0000 |
commit | d9de574a92e1aa0bea965ff895be639e3c9d7c43 (patch) | |
tree | 5dac5c8946897a8206696b3defe624aac60cf439 /ppapi/native_client | |
parent | af18c2f60261ce93c24b21ebc261c6a1cdafb976 (diff) | |
download | chromium_src-d9de574a92e1aa0bea965ff895be639e3c9d7c43.zip chromium_src-d9de574a92e1aa0bea965ff895be639e3c9d7c43.tar.gz chromium_src-d9de574a92e1aa0bea965ff895be639e3c9d7c43.tar.bz2 |
Initialize translate_finish_error_ in PnaclCoordinator
Also plumb service runtime errors in the translation processes
back to the coordinator explicitly.
R=jvoung@google.com,sehr@google.com,roberm@google.com
BUG=none
TEST=nacl_integration (but only on nacl integration bots, not chromium bots)
Review URL: https://chromiumcodereview.appspot.com/10575025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
4 files changed, 28 insertions, 18 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index b03784b..897c6c5 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -227,7 +227,8 @@ PnaclCoordinator::PnaclCoordinator( const nacl::string& pexe_url, const nacl::string& cache_identity, const pp::CompletionCallback& translate_notify_callback) - : plugin_(plugin), + : translate_finish_error_(PP_OK), + plugin_(plugin), translate_notify_callback_(translate_notify_callback), file_system_(new pp::FileSystem(plugin, PP_FILESYSTEMTYPE_LOCALTEMPORARY)), manifest_(new ExtensionManifest(plugin->url_util())), diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_streaming_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_streaming_translate_thread.cc index 287612f..e46d265 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_streaming_translate_thread.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_streaming_translate_thread.cc @@ -35,7 +35,7 @@ void PnaclStreamingTranslateThread::RunTranslate( nexe_file_ = nexe_file; pexe_wrapper_ = NULL; // The streaming translator doesn't use a pexe desc. DCHECK(pexe_wrapper == NULL); - error_info_ = error_info; + coordinator_error_info_ = error_info; resources_ = resources; plugin_ = plugin; @@ -83,10 +83,12 @@ void PnaclStreamingTranslateThread::PutBytes(std::vector<char>* bytes, } void PnaclStreamingTranslateThread::DoTranslate() { + ErrorInfo error_info; nacl::scoped_ptr<NaClSubprocess> llc_subprocess( - StartSubprocess(PnaclUrls::GetLlcUrl(), manifest_)); + StartSubprocess(PnaclUrls::GetLlcUrl(), manifest_, &error_info)); if (llc_subprocess == NULL) { - TranslateFailed("Compile process could not be created."); + TranslateFailed("Compile process could not be created: " + + error_info.message()); return; } // Run LLC. diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc index d497243..8aa00df 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc @@ -18,7 +18,7 @@ PnaclTranslateThread::PnaclTranslateThread() : subprocesses_should_die_(false), obj_file_(NULL), nexe_file_(NULL), pexe_wrapper_(NULL), - error_info_(NULL), + coordinator_error_info_(NULL), resources_(NULL), plugin_(NULL) { NaClXMutexCtor(&subprocess_mu_); @@ -40,7 +40,7 @@ void PnaclTranslateThread::RunTranslate( obj_file_ = obj_file; nexe_file_ = nexe_file; pexe_wrapper_ = pexe_wrapper; - error_info_ = error_info; + coordinator_error_info_ = error_info; resources_ = resources; plugin_ = plugin; @@ -63,12 +63,13 @@ void PnaclTranslateThread::RunTranslate( NaClSubprocess* PnaclTranslateThread::StartSubprocess( const nacl::string& url_for_nexe, - const Manifest* manifest) { + const Manifest* manifest, + ErrorInfo* error_info) { PLUGIN_PRINTF(("PnaclTranslateThread::StartSubprocess (url_for_nexe=%s)\n", url_for_nexe.c_str())); nacl::DescWrapper* wrapper = resources_->WrapperForUrl(url_for_nexe); nacl::scoped_ptr<NaClSubprocess> subprocess( - plugin_->LoadHelperNaClModule(wrapper, manifest, error_info_)); + plugin_->LoadHelperNaClModule(wrapper, manifest, error_info)); if (subprocess.get() == NULL) { PLUGIN_PRINTF(( "PnaclTranslateThread::StartSubprocess: subprocess creation failed\n")); @@ -84,10 +85,12 @@ void WINAPI PnaclTranslateThread::DoTranslateThread(void* arg) { } void PnaclTranslateThread::DoTranslate() { + ErrorInfo error_info; nacl::scoped_ptr<NaClSubprocess> llc_subprocess( - StartSubprocess(PnaclUrls::GetLlcUrl(), manifest_)); + StartSubprocess(PnaclUrls::GetLlcUrl(), manifest_, &error_info)); if (llc_subprocess == NULL) { - TranslateFailed("Compile process could not be created."); + TranslateFailed("Compile process could not be created: " + + error_info.message()); return; } // Run LLC. @@ -130,10 +133,12 @@ bool PnaclTranslateThread::RunLdSubprocess(int is_shared_library, const nacl::string& soname, const nacl::string& lib_dependencies ) { + ErrorInfo error_info; nacl::scoped_ptr<NaClSubprocess> ld_subprocess( - StartSubprocess(PnaclUrls::GetLdUrl(), ld_manifest_)); + StartSubprocess(PnaclUrls::GetLdUrl(), ld_manifest_, &error_info)); if (ld_subprocess == NULL) { - TranslateFailed("Link process could not be created."); + TranslateFailed("Link process could not be created: " + + error_info.message()); return false; } // Run LD. @@ -170,11 +175,12 @@ void PnaclTranslateThread::TranslateFailed(const nacl::string& error_string) { PLUGIN_PRINTF(("PnaclTranslateThread::TranslateFailed (error_string='%s')\n", error_string.c_str())); pp::Core* core = pp::Module::Get()->core(); - if (error_info_->message().empty()) { + if (coordinator_error_info_->message().empty()) { // Only use our message if one hasn't already been set by the coordinator // (e.g. pexe load failed). - error_info_->SetReport(ERROR_UNKNOWN, - nacl::string("PnaclCoordinator: ") + error_string); + coordinator_error_info_->SetReport(ERROR_UNKNOWN, + nacl::string("PnaclCoordinator: ") + + error_string); } core->CallOnMainThread(0, report_translate_finished_, PP_ERROR_FAILED); } diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h index 86f5888..5277739 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h @@ -10,6 +10,7 @@ #include "native_client/src/include/nacl_string.h" #include "native_client/src/shared/platform/nacl_threads.h" #include "native_client/src/shared/platform/nacl_sync_checked.h" +#include "native_client/src/trusted/plugin/plugin_error.h" #include "ppapi/cpp/completion_callback.h" @@ -20,7 +21,6 @@ class DescWrapper; namespace plugin { -class ErrorInfo; class LocalTempFile; class Manifest; class NaClSubprocess; @@ -50,7 +50,8 @@ class PnaclTranslateThread { protected: // Starts an individual llc or ld subprocess used for translation. NaClSubprocess* StartSubprocess(const nacl::string& url, - const Manifest* manifest); + const Manifest* manifest, + ErrorInfo* error_info); // Helper thread entry point for translation. Takes a pointer to // PnaclTranslateThread and calls DoTranslate(). static void WINAPI DoTranslateThread(void* arg); @@ -78,7 +79,7 @@ class PnaclTranslateThread { LocalTempFile* obj_file_; LocalTempFile* nexe_file_; nacl::DescWrapper* pexe_wrapper_; - ErrorInfo* error_info_; + ErrorInfo* coordinator_error_info_; PnaclResources* resources_; Plugin* plugin_; private: |