diff options
23 files changed, 372 insertions, 271 deletions
diff --git a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc index dec90e3..9e7b83f 100644 --- a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc +++ b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc @@ -110,10 +110,8 @@ NaClBrowserDelegateImpl::NaClBrowserDelegateImpl( NaClBrowserDelegateImpl::~NaClBrowserDelegateImpl() { } -void NaClBrowserDelegateImpl::ShowNaClInfobar(int render_process_id, - int render_view_id, - int error_id) { - DCHECK_EQ(PP_NACL_MANIFEST_MISSING_ARCH, error_id); +void NaClBrowserDelegateImpl::ShowMissingArchInfobar(int render_process_id, + int render_view_id) { content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::Bind(&NaClInfoBarDelegate::Create, render_process_id, diff --git a/chrome/browser/nacl_host/nacl_browser_delegate_impl.h b/chrome/browser/nacl_host/nacl_browser_delegate_impl.h index 674d517..44b0754a 100644 --- a/chrome/browser/nacl_host/nacl_browser_delegate_impl.h +++ b/chrome/browser/nacl_host/nacl_browser_delegate_impl.h @@ -14,8 +14,8 @@ class NaClBrowserDelegateImpl : public NaClBrowserDelegate { explicit NaClBrowserDelegateImpl(extensions::InfoMap* extension_info_map); virtual ~NaClBrowserDelegateImpl(); - virtual void ShowNaClInfobar(int render_process_id, int render_view_id, - int error_id) OVERRIDE; + virtual void ShowMissingArchInfobar(int render_process_id, + int render_view_id) OVERRIDE; virtual bool DialogsAreSuppressed() OVERRIDE; virtual bool GetCacheDirectory(base::FilePath* cache_dir) OVERRIDE; virtual bool GetPluginDirectory(base::FilePath* plugin_dir) OVERRIDE; diff --git a/chrome/test/nacl/nacl_browsertest_uma.cc b/chrome/test/nacl/nacl_browsertest_uma.cc index 69201c7..c6a3fba 100644 --- a/chrome/test/nacl/nacl_browsertest_uma.cc +++ b/chrome/test/nacl/nacl_browsertest_uma.cc @@ -5,7 +5,7 @@ #include "chrome/test/base/uma_histogram_helper.h" #include "chrome/test/nacl/nacl_browsertest_util.h" #include "native_client/src/trusted/service_runtime/nacl_error_code.h" -#include "ppapi/native_client/src/trusted/plugin/plugin_error.h" +#include "ppapi/c/private/ppb_nacl_private.h" namespace { @@ -20,7 +20,7 @@ NACL_BROWSER_TEST_F(NaClBrowserTest, SuccessfulLoadUMA, { // Did the plugin report success? histograms.ExpectUniqueSample("NaCl.LoadStatus.Plugin", - plugin::ERROR_LOAD_SUCCESS, 1); + PP_NACL_ERROR_LOAD_SUCCESS, 1); // Did the sel_ldr report success? histograms.ExpectUniqueSample("NaCl.LoadStatus.SelLdr", @@ -55,4 +55,4 @@ NACL_BROWSER_TEST_F(NaClBrowserTest, SuccessfulLoadUMA, { // TODO(ncbray) convert the rest of nacl_uma.py (currently in the NaCl repo.) // Test validation failures and crashes. -} // namespace anonymous +} // namespace diff --git a/components/nacl/browser/nacl_browser_delegate.h b/components/nacl/browser/nacl_browser_delegate.h index 30bf467..2cdff83 100644 --- a/components/nacl/browser/nacl_browser_delegate.h +++ b/components/nacl/browser/nacl_browser_delegate.h @@ -28,9 +28,10 @@ class NaClBrowserDelegate { public: virtual ~NaClBrowserDelegate() {} - // Show an infobar to the user. - virtual void ShowNaClInfobar(int render_process_id, int render_view_id, - int error_id) = 0; + // Show an infobar to the user to indicate the client architecture was not + // covered by the manifest. + virtual void ShowMissingArchInfobar(int render_process_id, + int render_view_id) = 0; // Returns whether dialogs are allowed. This is used to decide if to add the // command line switch kNoErrorDialogs. virtual bool DialogsAreSuppressed() = 0; diff --git a/components/nacl/browser/nacl_host_message_filter.cc b/components/nacl/browser/nacl_host_message_filter.cc index cef4fdc..de4d1d4 100644 --- a/components/nacl/browser/nacl_host_message_filter.cc +++ b/components/nacl/browser/nacl_host_message_filter.cc @@ -50,7 +50,8 @@ bool NaClHostMessageFilter::OnMessageReceived(const IPC::Message& message, OnGetNexeFd) IPC_MESSAGE_HANDLER(NaClHostMsg_ReportTranslationFinished, OnTranslationFinished) - IPC_MESSAGE_HANDLER(NaClHostMsg_NaClErrorStatus, OnNaClErrorStatus) + IPC_MESSAGE_HANDLER(NaClHostMsg_MissingArchError, + OnMissingArchError) IPC_MESSAGE_HANDLER_DELAY_REPLY(NaClHostMsg_OpenNaClExecutable, OnOpenNaClExecutable) IPC_MESSAGE_HANDLER(NaClHostMsg_NaClGetNumProcessors, @@ -167,10 +168,9 @@ void NaClHostMessageFilter::OnTranslationFinished(int instance, bool success) { render_process_id_, instance, success); } -void NaClHostMessageFilter::OnNaClErrorStatus(int render_view_id, - int error_id) { - nacl::NaClBrowser::GetDelegate()->ShowNaClInfobar(render_process_id_, - render_view_id, error_id); +void NaClHostMessageFilter::OnMissingArchError(int render_view_id) { + nacl::NaClBrowser::GetDelegate()-> + ShowMissingArchInfobar(render_process_id_, render_view_id); } void NaClHostMessageFilter::OnOpenNaClExecutable(int render_view_id, diff --git a/components/nacl/browser/nacl_host_message_filter.h b/components/nacl/browser/nacl_host_message_filter.h index 843a340..71bd9d2 100644 --- a/components/nacl/browser/nacl_host_message_filter.h +++ b/components/nacl/browser/nacl_host_message_filter.h @@ -59,7 +59,7 @@ class NaClHostMessageFilter : public content::BrowserMessageFilter { int pp_instance, const PnaclCacheInfo& cache_info); void OnTranslationFinished(int instance, bool success); - void OnNaClErrorStatus(int render_view_id, int error_id); + void OnMissingArchError(int render_view_id); void OnOpenNaClExecutable(int render_view_id, const GURL& file_url, IPC::Message* reply_msg); diff --git a/components/nacl/browser/test_nacl_browser_delegate.cc b/components/nacl/browser/test_nacl_browser_delegate.cc index d0b5607..e89548f 100644 --- a/components/nacl/browser/test_nacl_browser_delegate.cc +++ b/components/nacl/browser/test_nacl_browser_delegate.cc @@ -8,9 +8,8 @@ TestNaClBrowserDelegate::TestNaClBrowserDelegate() {} TestNaClBrowserDelegate::~TestNaClBrowserDelegate() {} -void TestNaClBrowserDelegate::ShowNaClInfobar(int render_process_id, - int render_view_id, - int error_id) {} +void TestNaClBrowserDelegate::ShowMissingArchInfobar(int render_process_id, + int render_view_id) {} bool TestNaClBrowserDelegate::DialogsAreSuppressed() { return false; diff --git a/components/nacl/browser/test_nacl_browser_delegate.h b/components/nacl/browser/test_nacl_browser_delegate.h index 2e8e5f6..5c58350 100644 --- a/components/nacl/browser/test_nacl_browser_delegate.h +++ b/components/nacl/browser/test_nacl_browser_delegate.h @@ -22,9 +22,8 @@ class TestNaClBrowserDelegate : public NaClBrowserDelegate { public: TestNaClBrowserDelegate(); virtual ~TestNaClBrowserDelegate(); - virtual void ShowNaClInfobar(int render_process_id, - int render_view_id, - int error_id) OVERRIDE; + virtual void ShowMissingArchInfobar(int render_process_id, + int render_view_id) OVERRIDE; virtual bool DialogsAreSuppressed() OVERRIDE; virtual bool GetCacheDirectory(base::FilePath* cache_dir) OVERRIDE; virtual bool GetPluginDirectory(base::FilePath* plugin_dir) OVERRIDE; diff --git a/components/nacl/common/nacl_host_messages.h b/components/nacl/common/nacl_host_messages.h index db3b8c8..3565b8c 100644 --- a/components/nacl/common/nacl_host_messages.h +++ b/components/nacl/common/nacl_host_messages.h @@ -88,10 +88,10 @@ IPC_MESSAGE_CONTROL2(NaClHostMsg_ReportTranslationFinished, int /* instance */, bool /* success */) -// A renderer sends this to the browser process to report an error. -IPC_MESSAGE_CONTROL2(NaClHostMsg_NaClErrorStatus, - int /* render_view_id */, - int /* Error ID */) +// A renderer sends this to the browser process to report when the client +// architecture is not listed in the manifest. +IPC_MESSAGE_CONTROL1(NaClHostMsg_MissingArchError, + int /* render_view_id */) // A renderer sends this to the browser process when it wants to // open a NaCl executable file from an installed application directory. diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index 5c32d4c..0c9eeb5 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "components/nacl/common/nacl_host_messages.h" #include "components/nacl/common/nacl_types.h" @@ -68,6 +69,19 @@ typedef std::map<PP_Instance, InstanceInfo> InstanceInfoMap; base::LazyInstance<InstanceInfoMap> g_instance_info = LAZY_INSTANCE_INITIALIZER; +void HistogramEnumerate(const std::string& name, + int32_t sample, + int32_t boundary_value) { + base::HistogramBase* counter = + base::LinearHistogram::FactoryGet( + name, + 1, + boundary_value, + boundary_value + 1, + base::HistogramBase::kUmaTargetedHistogramFlag); + counter->Add(sample); +} + static int GetRoutingID(PP_Instance instance) { // Check that we are on the main renderer thread. DCHECK(content::RenderThread::Get()); @@ -320,21 +334,6 @@ void ReportTranslationFinished(PP_Instance instance, PP_Bool success) { g_pnacl_resource_host.Get()->ReportTranslationFinished(instance, success); } -PP_ExternalPluginResult ReportNaClError(PP_Instance instance, - PP_NaClError error_id) { - IPC::Sender* sender = content::RenderThread::Get(); - - if (!sender->Send( - new NaClHostMsg_NaClErrorStatus( - // TODO(dschuff): does this enum need to be sent as an int, - // or is it safe to include the appropriate headers in - // render_messages.h? - GetRoutingID(instance), static_cast<int>(error_id)))) { - return PP_EXTERNAL_PLUGIN_FAILED; - } - return PP_EXTERNAL_PLUGIN_OK; -} - PP_FileHandle OpenNaClExecutable(PP_Instance instance, const char* file_url, uint64_t* nonce_lo, @@ -385,6 +384,14 @@ blink::WebString EventTypeToString(PP_NaClEventType event_type) { } struct ProgressEvent { + explicit ProgressEvent(PP_Instance instance_param, + PP_NaClEventType event_type_param) + : instance(instance_param), + event_type(event_type_param), + length_is_computable(false), + loaded_bytes(0), + total_bytes(0) { + } PP_Instance instance; PP_NaClEventType event_type; std::string resource_url; @@ -401,9 +408,7 @@ void DispatchEvent(PP_Instance instance, PP_Bool length_is_computable, uint64_t loaded_bytes, uint64_t total_bytes) { - ProgressEvent p; - p.instance = instance; - p.event_type = event_type; + ProgressEvent p(instance, event_type); p.length_is_computable = PP_ToBool(length_is_computable); p.loaded_bytes = loaded_bytes; p.total_bytes = total_bytes; @@ -471,6 +476,36 @@ void SetReadOnlyProperty(PP_Instance instance, plugin_instance->SetEmbedProperty(key, value); } +void ReportLoadError(PP_Instance instance, + PP_NaClError error, + PP_Bool is_installed) { + // Check that we are on the main renderer thread. + DCHECK(content::RenderThread::Get()); + + if (error == PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH) { + // A special case: the manifest may otherwise be valid but is missing + // a program/file compatible with the user's sandbox. + IPC::Sender* sender = content::RenderThread::Get(); + sender->Send( + new NaClHostMsg_MissingArchError(GetRoutingID(instance))); + } + // TODO(dmichael): Move the following actions here: + // - Set ready state to DONE. + // - Set last error string. + // - Print error message to JavaScript console. + + // Inform JavaScript that loading encountered an error and is complete. + DispatchEvent(instance, PP_NACL_EVENT_ERROR, NULL, PP_FALSE, 0, 0); + DispatchEvent(instance, PP_NACL_EVENT_LOADEND, NULL, PP_FALSE, 0, 0); + + HistogramEnumerate("NaCl.LoadStatus.Plugin", error, + PP_NACL_ERROR_MAX); + std::string uma_name = (is_installed == PP_TRUE) ? + "NaCl.LoadStatus.Plugin.InstalledApp" : + "NaCl.LoadStatus.Plugin.NotInstalledApp"; + HistogramEnumerate(uma_name, error, PP_NACL_ERROR_MAX); +} + const PPB_NaCl_Private nacl_interface = { &LaunchSelLdr, &StartPpapiProxy, @@ -482,10 +517,10 @@ const PPB_NaCl_Private nacl_interface = { &GetNumberOfProcessors, &GetNexeFd, &ReportTranslationFinished, - &ReportNaClError, &OpenNaClExecutable, &DispatchEvent, - &SetReadOnlyProperty + &SetReadOnlyProperty, + &ReportLoadError }; } // namespace diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl index 718b749..57e883a 100644 --- a/ppapi/api/private/ppb_nacl_private.idl +++ b/ppapi/api/private/ppb_nacl_private.idl @@ -15,13 +15,94 @@ label Chrome { #include "ppapi/c/private/ppb_instance_private.h" #endinl -/** NaCl-specific errors that should be reported to the user */ +/** NaCl-specific errors that should be reported to the user. + * These error codes are reported via UMA so, if you edit them: + * 1) make sure you understand UMA first. + * 2) update src/tools/histograms/histograms.xml in + * svn://svn.chromium.org/chrome-internal/trunk/src-internal + * Values are explicitly specified to make sure they don't shift around when + * edited, and also to make reading about:histograms easier. + */ enum PP_NaClError { - /** - * The manifest program element does not contain a program usable on the - * user's architecture - */ - PP_NACL_MANIFEST_MISSING_ARCH = 0 + PP_NACL_ERROR_LOAD_SUCCESS = 0, + PP_NACL_ERROR_LOAD_ABORTED = 1, + PP_NACL_ERROR_UNKNOWN = 2, + PP_NACL_ERROR_MANIFEST_RESOLVE_URL = 3, + PP_NACL_ERROR_MANIFEST_LOAD_URL = 4, + PP_NACL_ERROR_MANIFEST_STAT = 5, + PP_NACL_ERROR_MANIFEST_TOO_LARGE = 6, + PP_NACL_ERROR_MANIFEST_OPEN = 7, + PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC = 8, + PP_NACL_ERROR_MANIFEST_READ = 9, + PP_NACL_ERROR_MANIFEST_PARSING = 10, + PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE = 11, + PP_NACL_ERROR_MANIFEST_GET_NEXE_URL = 12, + PP_NACL_ERROR_NEXE_LOAD_URL = 13, + PP_NACL_ERROR_NEXE_ORIGIN_PROTOCOL = 14, + PP_NACL_ERROR_NEXE_FH_DUP = 15, + PP_NACL_ERROR_NEXE_STAT = 16, + PP_NACL_ERROR_ELF_CHECK_IO = 17, + PP_NACL_ERROR_ELF_CHECK_FAIL = 18, + PP_NACL_ERROR_SEL_LDR_INIT = 19, + PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER = 20, + PP_NACL_ERROR_SEL_LDR_FD = 21, + PP_NACL_ERROR_SEL_LDR_LAUNCH = 22, + /* Deprecated, safe to reuse the value because it's never logged in UMA. + PP_NACL_ERROR_SEL_LDR_COMMUNICATION = 23, */ + PP_NACL_ERROR_SEL_LDR_SEND_NEXE = 24, + PP_NACL_ERROR_SEL_LDR_HANDLE_PASSING = 25, + PP_NACL_ERROR_SEL_LDR_START_MODULE = 26, + PP_NACL_ERROR_SEL_LDR_START_STATUS = 27, + PP_NACL_ERROR_SRPC_CONNECTION_FAIL = 28, + PP_NACL_ERROR_START_PROXY_CHECK_PPP = 29, + PP_NACL_ERROR_START_PROXY_ALLOC = 30, + PP_NACL_ERROR_START_PROXY_MODULE = 31, + PP_NACL_ERROR_START_PROXY_INSTANCE = 32, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL = 33, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP = 34, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36, + PP_NACL_ERROR_START_PROXY_CRASH = 37, + PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38, + PP_NACL_ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39, + PP_NACL_ERROR_PNACL_CACHE_OPEN_NOACCESS = 40, + PP_NACL_ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41, + PP_NACL_ERROR_PNACL_CACHE_OPEN_NOSPACE = 42, + PP_NACL_ERROR_PNACL_CACHE_OPEN_OTHER = 43, + PP_NACL_ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49, + PP_NACL_ERROR_PNACL_CACHE_FETCH_NOACCESS = 50, + PP_NACL_ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51, + PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER = 52, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57, + PP_NACL_ERROR_PNACL_RESOURCE_FETCH = 58, + PP_NACL_ERROR_PNACL_PEXE_FETCH_ABORTED = 59, + PP_NACL_ERROR_PNACL_PEXE_FETCH_NOACCESS = 60, + PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER = 61, + PP_NACL_ERROR_PNACL_THREAD_CREATE = 62, + PP_NACL_ERROR_PNACL_LLC_SETUP = 63, + PP_NACL_ERROR_PNACL_LD_SETUP = 64, + PP_NACL_ERROR_PNACL_LLC_INTERNAL = 65, + PP_NACL_ERROR_PNACL_LD_INTERNAL = 66, + PP_NACL_ERROR_PNACL_CREATE_TEMP = 67, + /* This entry is no longer used, but should not be removed, because UMA + numbers need to be kept consistent. */ + PP_NACL_ERROR_PNACL_NOT_ENABLED = 68, + PP_NACL_ERROR_MANIFEST_NOACCESS_URL = 69, + PP_NACL_ERROR_NEXE_NOACCESS_URL = 70, + PP_NACL_ERROR_PNACL_CRASH_THROTTLED = 71, + + /* If you add a code, read the enum comment above on how to update + histograms. */ + PP_NACL_ERROR_MAX }; /** Event types that NaCl may use when reporting load progress or errors. */ @@ -152,10 +233,6 @@ interface PPB_NaCl_Private { void ReportTranslationFinished([in] PP_Instance instance, [in] PP_Bool success); - /* Display a UI message to the user. */ - PP_ExternalPluginResult ReportNaClError([in] PP_Instance instance, - [in] PP_NaClError message_id); - /* Opens a NaCl executable file in the application's extension directory * corresponding to the file URL and returns a file descriptor, or an invalid * handle on failure. |metadata| is left unchanged on failure. @@ -182,4 +259,9 @@ interface PPB_NaCl_Private { void SetReadOnlyProperty([in] PP_Instance instance, [in] PP_Var key, [in] PP_Var value); + + /* Report an error that occured while attempting to load a nexe. */ + void ReportLoadError([in] PP_Instance instance, + [in] PP_NaClError error, + [in] PP_Bool is_installed); }; diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index 8ad1a27..c8397bf 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Mon Feb 10 11:05:29 2014. */ +/* From private/ppb_nacl_private.idl modified Mon Feb 24 12:10:24 2014. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ @@ -32,13 +32,93 @@ * @addtogroup Enums * @{ */ -/** NaCl-specific errors that should be reported to the user */ +/** NaCl-specific errors that should be reported to the user. + * These error codes are reported via UMA so, if you edit them: + * 1) make sure you understand UMA first. + * 2) update src/tools/histograms/histograms.xml in + * svn://svn.chromium.org/chrome-internal/trunk/src-internal + * Values are explicitly specified to make sure they don't shift around when + * edited, and also to make reading about:histograms easier. + */ typedef enum { - /** - * The manifest program element does not contain a program usable on the - * user's architecture + PP_NACL_ERROR_LOAD_SUCCESS = 0, + PP_NACL_ERROR_LOAD_ABORTED = 1, + PP_NACL_ERROR_UNKNOWN = 2, + PP_NACL_ERROR_MANIFEST_RESOLVE_URL = 3, + PP_NACL_ERROR_MANIFEST_LOAD_URL = 4, + PP_NACL_ERROR_MANIFEST_STAT = 5, + PP_NACL_ERROR_MANIFEST_TOO_LARGE = 6, + PP_NACL_ERROR_MANIFEST_OPEN = 7, + PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC = 8, + PP_NACL_ERROR_MANIFEST_READ = 9, + PP_NACL_ERROR_MANIFEST_PARSING = 10, + PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE = 11, + PP_NACL_ERROR_MANIFEST_GET_NEXE_URL = 12, + PP_NACL_ERROR_NEXE_LOAD_URL = 13, + PP_NACL_ERROR_NEXE_ORIGIN_PROTOCOL = 14, + PP_NACL_ERROR_NEXE_FH_DUP = 15, + PP_NACL_ERROR_NEXE_STAT = 16, + PP_NACL_ERROR_ELF_CHECK_IO = 17, + PP_NACL_ERROR_ELF_CHECK_FAIL = 18, + PP_NACL_ERROR_SEL_LDR_INIT = 19, + PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER = 20, + PP_NACL_ERROR_SEL_LDR_FD = 21, + PP_NACL_ERROR_SEL_LDR_LAUNCH = 22, + /* Deprecated, safe to reuse the value because it's never logged in UMA. + */ + PP_NACL_ERROR_SEL_LDR_SEND_NEXE = 24, + PP_NACL_ERROR_SEL_LDR_HANDLE_PASSING = 25, + PP_NACL_ERROR_SEL_LDR_START_MODULE = 26, + PP_NACL_ERROR_SEL_LDR_START_STATUS = 27, + PP_NACL_ERROR_SRPC_CONNECTION_FAIL = 28, + PP_NACL_ERROR_START_PROXY_CHECK_PPP = 29, + PP_NACL_ERROR_START_PROXY_ALLOC = 30, + PP_NACL_ERROR_START_PROXY_MODULE = 31, + PP_NACL_ERROR_START_PROXY_INSTANCE = 32, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL = 33, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP = 34, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35, + PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36, + PP_NACL_ERROR_START_PROXY_CRASH = 37, + PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38, + PP_NACL_ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39, + PP_NACL_ERROR_PNACL_CACHE_OPEN_NOACCESS = 40, + PP_NACL_ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41, + PP_NACL_ERROR_PNACL_CACHE_OPEN_NOSPACE = 42, + PP_NACL_ERROR_PNACL_CACHE_OPEN_OTHER = 43, + PP_NACL_ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48, + PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49, + PP_NACL_ERROR_PNACL_CACHE_FETCH_NOACCESS = 50, + PP_NACL_ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51, + PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER = 52, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56, + PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57, + PP_NACL_ERROR_PNACL_RESOURCE_FETCH = 58, + PP_NACL_ERROR_PNACL_PEXE_FETCH_ABORTED = 59, + PP_NACL_ERROR_PNACL_PEXE_FETCH_NOACCESS = 60, + PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER = 61, + PP_NACL_ERROR_PNACL_THREAD_CREATE = 62, + PP_NACL_ERROR_PNACL_LLC_SETUP = 63, + PP_NACL_ERROR_PNACL_LD_SETUP = 64, + PP_NACL_ERROR_PNACL_LLC_INTERNAL = 65, + PP_NACL_ERROR_PNACL_LD_INTERNAL = 66, + PP_NACL_ERROR_PNACL_CREATE_TEMP = 67, + /* This entry is no longer used, but should not be removed, because UMA + */ + PP_NACL_ERROR_PNACL_NOT_ENABLED = 68, + PP_NACL_ERROR_MANIFEST_NOACCESS_URL = 69, + PP_NACL_ERROR_NEXE_NOACCESS_URL = 70, + PP_NACL_ERROR_PNACL_CRASH_THROTTLED = 71, + /* If you add a code, read the enum comment above on how to update */ - PP_NACL_MANIFEST_MISSING_ARCH = 0 + PP_NACL_ERROR_MAX } PP_NaClError; /** Event types that NaCl may use when reporting load progress or errors. */ @@ -165,9 +245,6 @@ struct PPB_NaCl_Private_1_0 { * the plugin.) */ void (*ReportTranslationFinished)(PP_Instance instance, PP_Bool success); - /* Display a UI message to the user. */ - PP_ExternalPluginResult (*ReportNaClError)(PP_Instance instance, - PP_NaClError message_id); /* Opens a NaCl executable file in the application's extension directory * corresponding to the file URL and returns a file descriptor, or an invalid * handle on failure. |metadata| is left unchanged on failure. @@ -191,6 +268,10 @@ struct PPB_NaCl_Private_1_0 { void (*SetReadOnlyProperty)(PP_Instance instance, struct PP_Var key, struct PP_Var value); + /* Report an error that occured while attempting to load a nexe. */ + void (*ReportLoadError)(PP_Instance instance, + PP_NaClError error, + PP_Bool is_installed); }; typedef struct PPB_NaCl_Private_1_0 PPB_NaCl_Private; diff --git a/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/ppapi/native_client/src/trusted/plugin/json_manifest.cc index 5af2e68..be9b01b 100644 --- a/ppapi/native_client/src/trusted/plugin/json_manifest.cc +++ b/ppapi/native_client/src/trusted/plugin/json_manifest.cc @@ -255,7 +255,7 @@ bool IsValidISADictionary(const Json::Value& dictionary, // An ISA to URL dictionary has to be an object. if (!dictionary.isObject()) { - error_info->SetReport(ERROR_MANIFEST_SCHEMA_VALIDATE, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE, nacl::string("manifest: ") + parent_key + " property is not an ISA to URL dictionary"); return false; @@ -310,7 +310,7 @@ bool IsValidISADictionary(const Json::Value& dictionary, parent_key != kProgramKey && !IsValidUrlSpec(property_value, property_name, parent_key, sandbox_isa, &error_string))) { - error_info->SetReport(ERROR_MANIFEST_SCHEMA_VALIDATE, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE, nacl::string("manifest: ") + error_string); return false; } @@ -322,7 +322,7 @@ bool IsValidISADictionary(const Json::Value& dictionary, property_name.c_str())); if (!IsValidUrlSpec(property_value, property_name, parent_key, sandbox_isa, &error_string)) { - error_info->SetReport(ERROR_MANIFEST_SCHEMA_VALIDATE, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE, nacl::string("manifest: ") + error_string); return false; } @@ -334,7 +334,7 @@ bool IsValidISADictionary(const Json::Value& dictionary, if (!has_portable) { error_info->SetReport( - ERROR_MANIFEST_PROGRAM_MISSING_ARCH, + PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH, nacl::string("manifest: no version of ") + parent_key + " given for portable."); return false; @@ -347,7 +347,7 @@ bool IsValidISADictionary(const Json::Value& dictionary, if (!has_isa && !has_portable) { error_info->SetReport( - ERROR_MANIFEST_PROGRAM_MISSING_ARCH, + PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH, nacl::string("manifest: no version of ") + parent_key + " given for current arch and no portable version found."); return false; @@ -378,7 +378,7 @@ bool JsonManifest::Init(const nacl::string& manifest_json, Json::Reader reader; if (!reader.parse(manifest_json, dictionary_)) { std::string json_error = reader.getFormatedErrorMessages(); - error_info->SetReport(ERROR_MANIFEST_PARSING, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_PARSING, "manifest JSON parsing failed: " + json_error); return false; } @@ -394,7 +394,7 @@ bool JsonManifest::MatchesSchema(ErrorInfo* error_info) { } if (!dictionary_.isObject()) { error_info->SetReport( - ERROR_MANIFEST_SCHEMA_VALIDATE, + PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE, "manifest: is not a json dictionary."); return false; } @@ -416,7 +416,7 @@ bool JsonManifest::MatchesSchema(ErrorInfo* error_info) { // A manifest file must have a program section. if (!dictionary_.isMember(kProgramKey)) { error_info->SetReport( - ERROR_MANIFEST_SCHEMA_VALIDATE, + PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE, nacl::string("manifest: missing '") + kProgramKey + "' section."); return false; } @@ -453,7 +453,7 @@ bool JsonManifest::MatchesSchema(ErrorInfo* error_info) { const Json::Value& files = dictionary_[kFilesKey]; if (!files.isObject()) { error_info->SetReport( - ERROR_MANIFEST_SCHEMA_VALIDATE, + PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE, nacl::string("manifest: '") + kFilesKey + "' is not a dictionary."); } Json::Value::Members members = files.getMemberNames(); @@ -483,7 +483,7 @@ bool JsonManifest::GetURLFromISADictionary(const Json::Value& dictionary, // a matching entry (sandbox_isa_ or portable) for NaCl. if (!IsValidISADictionary(dictionary, parent_key, sandbox_isa_, true, error_info)) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, "architecture " + sandbox_isa_ + " is not found for file " + parent_key); return false; @@ -524,7 +524,7 @@ bool JsonManifest::GetKeyUrl(const Json::Value& dictionary, ErrorInfo* error_info) const { DCHECK(full_url != NULL && pnacl_options != NULL && error_info != NULL); if (!dictionary.isMember(key)) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, "file key not found in manifest"); return false; } @@ -547,7 +547,7 @@ bool JsonManifest::ResolveURL(const nacl::string& relative_url, relative_url); if (!resolved_url.is_string()) { error_info->SetReport( - ERROR_MANIFEST_RESOLVE_URL, + PP_NACL_ERROR_MANIFEST_RESOLVE_URL, "could not resolve url '" + relative_url + "' relative to manifest base url '" + manifest_base_url_.c_str() + "'."); @@ -608,7 +608,7 @@ bool JsonManifest::ResolveKey(const nacl::string& key, } nacl::string::const_iterator p = find(key.begin(), key.end(), '/'); if (p == key.end()) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, nacl::string("ResolveKey: invalid key, no slash: ") + key); return false; @@ -617,7 +617,7 @@ bool JsonManifest::ResolveKey(const nacl::string& key, // generalize to permit other sections? nacl::string prefix(key.begin(), p); if (prefix != kFilesKey) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, nacl::string("ResolveKey: invalid key: not \"files\"" " prefix: ") + key); return false; @@ -628,13 +628,13 @@ bool JsonManifest::ResolveKey(const nacl::string& key, const Json::Value& files = dictionary_[kFilesKey]; if (!files.isObject()) { error_info->SetReport( - ERROR_MANIFEST_RESOLVE_URL, + PP_NACL_ERROR_MANIFEST_RESOLVE_URL, nacl::string("ResolveKey: no \"files\" dictionary")); return false; } if (!files.isMember(rest)) { error_info->SetReport( - ERROR_MANIFEST_RESOLVE_URL, + PP_NACL_ERROR_MANIFEST_RESOLVE_URL, nacl::string("ResolveKey: no such \"files\" entry: ") + key); return false; } diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 279d21a..97669a8 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -236,15 +236,16 @@ void Plugin::HistogramEnumerateOsArch(const std::string& sandbox_isa) { HistogramEnumerate("NaCl.Client.OSArch", os_arch, kNaClOSArchMax, -1); } -void Plugin::HistogramEnumerateLoadStatus(PluginErrorCode error_code, +void Plugin::HistogramEnumerateLoadStatus(PP_NaClError error_code, bool is_installed) { - HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, ERROR_MAX, - ERROR_UNKNOWN); + HistogramEnumerate("NaCl.LoadStatus.Plugin", error_code, PP_NACL_ERROR_MAX, + PP_NACL_ERROR_UNKNOWN); // Gather data to see if being installed changes load outcomes. const char* name = is_installed ? "NaCl.LoadStatus.Plugin.InstalledApp" : "NaCl.LoadStatus.Plugin.NotInstalledApp"; - HistogramEnumerate(name, error_code, ERROR_MAX, ERROR_UNKNOWN); + HistogramEnumerate(name, error_code, PP_NACL_ERROR_MAX, + PP_NACL_ERROR_UNKNOWN); } void Plugin::HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, @@ -365,7 +366,7 @@ void Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, static_cast<void*>(service_runtime))); if (NULL == service_runtime) { error_info.SetReport( - ERROR_SEL_LDR_INIT, + PP_NACL_ERROR_SEL_LDR_INIT, "sel_ldr init failure " + main_subprocess_.description()); ReportLoadError(error_info); return; @@ -404,7 +405,7 @@ bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) { // less confusing for developers. NaClLog(LOG_ERROR, "LoadNaClModuleContinuationIntern: " "StartSrpcServices failed\n"); - error_info->SetReport(ERROR_START_PROXY_MODULE, + error_info->SetReport(PP_NACL_ERROR_START_PROXY_MODULE, "could not initialize module."); return false; } @@ -421,11 +422,11 @@ bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) { } else if (ipc_result == PP_EXTERNAL_PLUGIN_ERROR_MODULE) { NaClLog(LOG_ERROR, "LoadNaClModuleContinuationIntern: " "Got PP_EXTERNAL_PLUGIN_ERROR_MODULE\n"); - error_info->SetReport(ERROR_START_PROXY_MODULE, + error_info->SetReport(PP_NACL_ERROR_START_PROXY_MODULE, "could not initialize module."); return false; } else if (ipc_result == PP_EXTERNAL_PLUGIN_ERROR_INSTANCE) { - error_info->SetReport(ERROR_START_PROXY_INSTANCE, + error_info->SetReport(PP_NACL_ERROR_START_PROXY_INSTANCE, "could not create instance."); return false; } @@ -440,7 +441,7 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper, nacl::scoped_ptr<NaClSubprocess> nacl_subprocess( new NaClSubprocess("helper module", NULL, NULL)); if (NULL == nacl_subprocess.get()) { - error_info->SetReport(ERROR_SEL_LDR_INIT, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_INIT, "unable to allocate helper subprocess."); return NULL; } @@ -475,7 +476,7 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper, // manifest is a per-plugin-instance object, not a per // NaClSubprocess object. if (!nacl_subprocess->StartSrpcServices()) { - error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL, + error_info->SetReport(PP_NACL_ERROR_SRPC_CONNECTION_FAIL, "SRPC connection failure for " + nacl_subprocess->description()); return NULL; @@ -710,18 +711,19 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { if (pp_error == PP_ERROR_ABORTED) { ReportLoadAbort(); } else if (pp_error == PP_ERROR_NOACCESS) { - error_info.SetReport(ERROR_NEXE_NOACCESS_URL, + error_info.SetReport(PP_NACL_ERROR_NEXE_NOACCESS_URL, "access to nexe url was denied."); ReportLoadError(error_info); } else { - error_info.SetReport(ERROR_NEXE_LOAD_URL, "could not load nexe url."); + error_info.SetReport(PP_NACL_ERROR_NEXE_LOAD_URL, + "could not load nexe url."); ReportLoadError(error_info); } return; } int32_t file_desc_ok_to_close = DUP(info.get_desc()); if (file_desc_ok_to_close == NACL_NO_FILE_DESC) { - error_info.SetReport(ERROR_NEXE_FH_DUP, + error_info.SetReport(PP_NACL_ERROR_NEXE_FH_DUP, "could not duplicate loaded file handle."); ReportLoadError(error_info); return; @@ -729,7 +731,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { struct stat stat_buf; if (0 != fstat(file_desc_ok_to_close, &stat_buf)) { CLOSE(file_desc_ok_to_close); - error_info.SetReport(ERROR_NEXE_STAT, "could not stat nexe file."); + error_info.SetReport(PP_NACL_ERROR_NEXE_STAT, "could not stat nexe file."); ReportLoadError(error_info); return; } @@ -843,7 +845,7 @@ void Plugin::NexeDidCrash(int32_t pp_error) { // The error is not quite right. In particular, the crash // reported by this path could be due to NaCl application // crashes that occur after the PPAPI proxy has started. - error_info.SetReport(ERROR_START_PROXY_CRASH, + error_info.SetReport(PP_NACL_ERROR_START_PROXY_CRASH, "Nexe crashed during startup"); ReportLoadError(error_info); } @@ -929,7 +931,7 @@ void Plugin::NaClManifestBufferReady(int32_t pp_error) { if (pp_error == PP_ERROR_ABORTED) { ReportLoadAbort(); } else { - error_info.SetReport(ERROR_MANIFEST_LOAD_URL, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_LOAD_URL, "could not load manifest url."); ReportLoadError(error_info); } @@ -939,14 +941,14 @@ void Plugin::NaClManifestBufferReady(int32_t pp_error) { const std::deque<char>& buffer = nexe_downloader_.buffer(); size_t buffer_size = buffer.size(); if (buffer_size > kNaClManifestMaxFileBytes) { - error_info.SetReport(ERROR_MANIFEST_TOO_LARGE, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_TOO_LARGE, "manifest file too large."); ReportLoadError(error_info); return; } nacl::scoped_array<char> json_buffer(new char[buffer_size + 1]); if (json_buffer == NULL) { - error_info.SetReport(ERROR_MANIFEST_MEMORY_ALLOC, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC, "could not allocate manifest memory."); ReportLoadError(error_info); return; @@ -976,11 +978,11 @@ void Plugin::NaClManifestFileDidOpen(int32_t pp_error) { if (pp_error == PP_ERROR_ABORTED) { ReportLoadAbort(); } else if (pp_error == PP_ERROR_NOACCESS) { - error_info.SetReport(ERROR_MANIFEST_NOACCESS_URL, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_NOACCESS_URL, "access to manifest url was denied."); ReportLoadError(error_info); } else { - error_info.SetReport(ERROR_MANIFEST_LOAD_URL, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_LOAD_URL, "could not load manifest url."); ReportLoadError(error_info); } @@ -999,23 +1001,23 @@ void Plugin::NaClManifestFileDidOpen(int32_t pp_error) { CHECK(0); break; case file_utils::PLUGIN_FILE_ERROR_MEM_ALLOC: - error_info.SetReport(ERROR_MANIFEST_MEMORY_ALLOC, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC, "could not allocate manifest memory."); break; case file_utils::PLUGIN_FILE_ERROR_OPEN: - error_info.SetReport(ERROR_MANIFEST_OPEN, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_OPEN, "could not open manifest file."); break; case file_utils::PLUGIN_FILE_ERROR_FILE_TOO_LARGE: - error_info.SetReport(ERROR_MANIFEST_TOO_LARGE, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_TOO_LARGE, "manifest file too large."); break; case file_utils::PLUGIN_FILE_ERROR_STAT: - error_info.SetReport(ERROR_MANIFEST_STAT, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_STAT, "could not stat manifest file."); break; case file_utils::PLUGIN_FILE_ERROR_READ: - error_info.SetReport(ERROR_MANIFEST_READ, + error_info.SetReport(PP_NACL_ERROR_MANIFEST_READ, "could not read manifest file."); break; } @@ -1085,7 +1087,7 @@ void Plugin::RequestNaClManifest(const nacl::string& url) { if (!nmf_resolved_url.is_string()) { ErrorInfo error_info; error_info.SetReport( - ERROR_MANIFEST_RESOLVE_URL, + PP_NACL_ERROR_MANIFEST_RESOLVE_URL, nacl::string("could not resolve URL \"") + url.c_str() + "\" relative to \"" + plugin_base_url().c_str() + "\"."); ReportLoadError(error_info); @@ -1233,21 +1235,16 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable, PP_NACL_EVENT_LOADEND, url, length_computable, loaded_bytes, total_bytes); // UMA - HistogramEnumerateLoadStatus(ERROR_LOAD_SUCCESS, is_installed_); + HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_SUCCESS, is_installed_); } void Plugin::ReportLoadError(const ErrorInfo& error_info) { PLUGIN_PRINTF(("Plugin::ReportLoadError (error='%s')\n", error_info.message().c_str())); - // For errors the user (and not just the developer) should know about, - // report them to the renderer so the browser can display a message. - if (error_info.error_code() == ERROR_MANIFEST_PROGRAM_MISSING_ARCH) { - // A special case: the manifest may otherwise be valid but is missing - // a program/file compatible with the user's sandbox. - nacl_interface()->ReportNaClError(pp_instance(), - PP_NACL_MANIFEST_MISSING_ARCH); - } + nacl_interface_->ReportLoadError(pp_instance(), + error_info.error_code(), + PP_FromBool(is_installed_)); // Set the readyState attribute to indicate we need to start over. set_nacl_ready_state(DONE); @@ -1258,12 +1255,6 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { set_last_error_string(message); AddToConsole(nacl::string("NaCl module load failed: ") + error_info.console_message()); - // Inform JavaScript that loading encountered an error and is complete. - EnqueueProgressEvent(PP_NACL_EVENT_ERROR); - EnqueueProgressEvent(PP_NACL_EVENT_LOADEND); - - // UMA - HistogramEnumerateLoadStatus(error_info.error_code(), is_installed_); } @@ -1281,7 +1272,7 @@ void Plugin::ReportLoadAbort() { EnqueueProgressEvent(PP_NACL_EVENT_LOADEND); // UMA - HistogramEnumerateLoadStatus(ERROR_LOAD_ABORTED, is_installed_); + HistogramEnumerateLoadStatus(PP_NACL_ERROR_LOAD_ABORTED, is_installed_); } void Plugin::UpdateDownloadProgress( diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 7906f79..04b058d 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -272,7 +272,7 @@ class Plugin : public pp::Instance { int maximum, int out_of_range_replacement); void HistogramEnumerateOsArch(const std::string& sandbox_isa); - void HistogramEnumerateLoadStatus(PluginErrorCode error_code, + void HistogramEnumerateLoadStatus(PP_NaClError error_code, bool is_installed); void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code, bool is_installed); diff --git a/ppapi/native_client/src/trusted/plugin/plugin_error.h b/ppapi/native_client/src/trusted/plugin/plugin_error.h index 4ec0b51..180b1b0 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin_error.h +++ b/ppapi/native_client/src/trusted/plugin/plugin_error.h @@ -14,95 +14,10 @@ #include <string> #include "native_client/src/include/nacl_macros.h" +#include "ppapi/c/private/ppb_nacl_private.h" namespace plugin { -// These error codes are reported via UMA so, if you edit them: -// 1) make sure you understand UMA, first. -// 2) update src/tools/histograms/histograms.xml in -// svn://svn.chromium.org/chrome-internal/trunk/src-internal -// Values are explicitly specified to make sure they don't shift around when -// edited, and also to make reading about:histograms easier. -enum PluginErrorCode { - ERROR_LOAD_SUCCESS = 0, - ERROR_LOAD_ABORTED = 1, - ERROR_UNKNOWN = 2, - ERROR_MANIFEST_RESOLVE_URL = 3, - ERROR_MANIFEST_LOAD_URL = 4, - ERROR_MANIFEST_STAT = 5, - ERROR_MANIFEST_TOO_LARGE = 6, - ERROR_MANIFEST_OPEN = 7, - ERROR_MANIFEST_MEMORY_ALLOC = 8, - ERROR_MANIFEST_READ = 9, - ERROR_MANIFEST_PARSING = 10, - ERROR_MANIFEST_SCHEMA_VALIDATE = 11, - ERROR_MANIFEST_GET_NEXE_URL = 12, - ERROR_NEXE_LOAD_URL = 13, - ERROR_NEXE_ORIGIN_PROTOCOL = 14, - ERROR_NEXE_FH_DUP = 15, - ERROR_NEXE_STAT = 16, - ERROR_ELF_CHECK_IO = 17, - ERROR_ELF_CHECK_FAIL = 18, - ERROR_SEL_LDR_INIT = 19, - ERROR_SEL_LDR_CREATE_LAUNCHER = 20, - ERROR_SEL_LDR_FD = 21, - ERROR_SEL_LDR_LAUNCH = 22, - // Deprecated, safe to reuse the # because never logged in UMA. - // ERROR_SEL_LDR_COMMUNICATION = 23, - ERROR_SEL_LDR_SEND_NEXE = 24, - ERROR_SEL_LDR_HANDLE_PASSING = 25, - ERROR_SEL_LDR_START_MODULE = 26, - ERROR_SEL_LDR_START_STATUS = 27, - ERROR_SRPC_CONNECTION_FAIL = 28, - ERROR_START_PROXY_CHECK_PPP = 29, - ERROR_START_PROXY_ALLOC = 30, - ERROR_START_PROXY_MODULE = 31, - ERROR_START_PROXY_INSTANCE = 32, - ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL = 33, - ERROR_SEL_LDR_COMMUNICATION_REV_SETUP = 34, - ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35, - ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36, - ERROR_START_PROXY_CRASH = 37, - ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38, - ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39, - ERROR_PNACL_CACHE_OPEN_NOACCESS = 40, - ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41, - ERROR_PNACL_CACHE_OPEN_NOSPACE = 42, - ERROR_PNACL_CACHE_OPEN_OTHER = 43, - ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44, - ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45, - ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46, - ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47, - ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48, - ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49, - ERROR_PNACL_CACHE_FETCH_NOACCESS = 50, - ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51, - ERROR_PNACL_CACHE_FETCH_OTHER = 52, - ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53, - ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54, - ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55, - ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56, - ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57, - ERROR_PNACL_RESOURCE_FETCH = 58, - ERROR_PNACL_PEXE_FETCH_ABORTED = 59, - ERROR_PNACL_PEXE_FETCH_NOACCESS = 60, - ERROR_PNACL_PEXE_FETCH_OTHER = 61, - ERROR_PNACL_THREAD_CREATE = 62, - ERROR_PNACL_LLC_SETUP = 63, - ERROR_PNACL_LD_SETUP = 64, - ERROR_PNACL_LLC_INTERNAL = 65, - ERROR_PNACL_LD_INTERNAL = 66, - ERROR_PNACL_CREATE_TEMP = 67, - // This entry is no longer used, but should not be removed, because UMA - // numbers need to be kept consistent. - ERROR_PNACL_NOT_ENABLED = 68, - ERROR_MANIFEST_NOACCESS_URL = 69, - ERROR_NEXE_NOACCESS_URL = 70, - ERROR_PNACL_CRASH_THROTTLED = 71, - // If you add a code, read the enum comment above on how to update histograms. - ERROR_MAX -}; - class ErrorInfo { public: ErrorInfo() { @@ -110,10 +25,10 @@ class ErrorInfo { } void Reset() { - SetReport(ERROR_UNKNOWN, std::string()); + SetReport(PP_NACL_ERROR_UNKNOWN, std::string()); } - void SetReport(PluginErrorCode error_code, const std::string& message) { + void SetReport(PP_NaClError error_code, const std::string& message) { error_code_ = error_code; message_ = message; console_message_ = message; @@ -124,7 +39,7 @@ class ErrorInfo { // the lastError property. This is used to report internal errors which // may easily change in new versions of the browser and we don't want apps // to come to depend on the details of these errors. - void SetReportWithConsoleOnlyError(PluginErrorCode error_code, + void SetReportWithConsoleOnlyError(PP_NaClError error_code, const std::string& message, const std::string& console_message) { error_code_ = error_code; @@ -132,7 +47,7 @@ class ErrorInfo { console_message_ = message + "; " + console_message; } - PluginErrorCode error_code() const { + PP_NaClError error_code() const { return error_code_; } @@ -150,7 +65,7 @@ class ErrorInfo { } private: - PluginErrorCode error_code_; + PP_NaClError error_code_; std::string message_; std::string console_message_; NACL_DISALLOW_COPY_AND_ASSIGN(ErrorInfo); diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index 3461a19..64dfdda 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -48,7 +48,7 @@ class PnaclManifest : public Manifest { UNREFERENCED_PARAMETER(pnacl_options); UNREFERENCED_PARAMETER(error_info); PLUGIN_PRINTF(("PnaclManifest does not contain a program\n")); - error_info->SetReport(ERROR_MANIFEST_GET_NEXE_URL, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_GET_NEXE_URL, "pnacl manifest does not contain a program."); return false; } @@ -80,7 +80,7 @@ class PnaclManifest : public Manifest { const nacl::string kFilesPrefix = "files/"; size_t files_prefix_pos = key.find(kFilesPrefix); if (files_prefix_pos == nacl::string::npos) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + error_info->SetReport(PP_NACL_ERROR_MANIFEST_RESOLVE_URL, "key did not start with files/"); return false; } @@ -263,13 +263,13 @@ nacl::DescWrapper* PnaclCoordinator::ReleaseTranslatedFD() { return temp_nexe_file_->release_read_wrapper(); } -void PnaclCoordinator::ReportNonPpapiError(enum PluginErrorCode err_code, +void PnaclCoordinator::ReportNonPpapiError(PP_NaClError err_code, const nacl::string& message) { error_info_.SetReport(err_code, message); ExitWithError(); } -void PnaclCoordinator::ReportPpapiError(enum PluginErrorCode err_code, +void PnaclCoordinator::ReportPpapiError(PP_NaClError err_code, int32_t pp_error, const nacl::string& message) { nacl::stringstream ss; @@ -386,18 +386,18 @@ void PnaclCoordinator::NexeReadDidOpen(int32_t pp_error) { NACL_PRId32 ")\n", pp_error)); if (pp_error != PP_OK) { if (pp_error == PP_ERROR_FILENOTFOUND) { - ReportPpapiError(ERROR_PNACL_CACHE_FETCH_NOTFOUND, + ReportPpapiError(PP_NACL_ERROR_PNACL_CACHE_FETCH_NOTFOUND, pp_error, "Failed to open translated nexe (not found)."); return; } if (pp_error == PP_ERROR_NOACCESS) { - ReportPpapiError(ERROR_PNACL_CACHE_FETCH_NOACCESS, + ReportPpapiError(PP_NACL_ERROR_PNACL_CACHE_FETCH_NOACCESS, pp_error, "Failed to open translated nexe (no access)."); return; } - ReportPpapiError(ERROR_PNACL_CACHE_FETCH_OTHER, + ReportPpapiError(PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER, pp_error, "Failed to open translated nexe."); return; @@ -422,7 +422,7 @@ void PnaclCoordinator::OpenBitcodeStream() { translate_thread_.reset(new PnaclTranslateThread()); if (translate_thread_ == NULL) { ReportNonPpapiError( - ERROR_PNACL_THREAD_CREATE, + PP_NACL_ERROR_PNACL_THREAD_CREATE, "PnaclCoordinator: could not allocate translation thread."); return; } @@ -431,7 +431,7 @@ void PnaclCoordinator::OpenBitcodeStream() { callback_factory_.NewCallback(&PnaclCoordinator::BitcodeStreamDidOpen); if (!streaming_downloader_->OpenStream(pexe_url_, cb, this)) { ReportNonPpapiError( - ERROR_PNACL_PEXE_FETCH_OTHER, + PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER, nacl::string("PnaclCoordinator: failed to open stream ") + pexe_url_); return; } @@ -506,7 +506,7 @@ void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { temp_nexe_file_->existing_handle(), cb.pp_completion_callback()); if (nexe_fd_err < PP_OK_COMPLETIONPENDING) { - ReportPpapiError(ERROR_PNACL_CREATE_TEMP, nexe_fd_err, + ReportPpapiError(PP_NACL_ERROR_PNACL_CREATE_TEMP, nexe_fd_err, nacl::string("Call to GetNexeFd failed")); } } @@ -517,14 +517,14 @@ void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) { is_cache_hit_ == PP_TRUE, *temp_nexe_file_->existing_handle())); if (pp_error < PP_OK) { - ReportPpapiError(ERROR_PNACL_CREATE_TEMP, pp_error, + ReportPpapiError(PP_NACL_ERROR_PNACL_CREATE_TEMP, pp_error, nacl::string("GetNexeFd failed")); return; } if (*temp_nexe_file_->existing_handle() == PP_kInvalidFileHandle) { ReportNonPpapiError( - ERROR_PNACL_CREATE_TEMP, + PP_NACL_ERROR_PNACL_CREATE_TEMP, nacl::string( "PnaclCoordinator: Got bad temp file handle from GetNexeFd")); return; @@ -569,16 +569,16 @@ void PnaclCoordinator::BitcodeStreamDidFinish(int32_t pp_error) { // objects or writing to the files. translate_finish_error_ = pp_error; if (pp_error == PP_ERROR_ABORTED) { - error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_ABORTED, + error_info_.SetReport(PP_NACL_ERROR_PNACL_PEXE_FETCH_ABORTED, "PnaclCoordinator: pexe load failed (aborted)."); } if (pp_error == PP_ERROR_NOACCESS) { - error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_NOACCESS, + error_info_.SetReport(PP_NACL_ERROR_PNACL_PEXE_FETCH_NOACCESS, "PnaclCoordinator: pexe load failed (no access)."); } else { nacl::stringstream ss; ss << "PnaclCoordinator: pexe load failed (pp_error=" << pp_error << ")."; - error_info_.SetReport(ERROR_PNACL_PEXE_FETCH_OTHER, ss.str()); + error_info_.SetReport(PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER, ss.str()); } translate_thread_->AbortSubprocesses(); } else { @@ -652,7 +652,7 @@ void PnaclCoordinator::ObjectFileDidOpen(int32_t pp_error) { PLUGIN_PRINTF(("PnaclCoordinator::ObjectFileDidOpen (pp_error=%" NACL_PRId32 ")\n", pp_error)); if (pp_error != PP_OK) { - ReportPpapiError(ERROR_PNACL_CREATE_TEMP, + ReportPpapiError(PP_NACL_ERROR_PNACL_CREATE_TEMP, pp_error, "Failed to open scratch object file."); return; diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h index 9475b9e..3b533ab 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h @@ -95,11 +95,11 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { // Run |translate_notify_callback_| with an error condition that is not // PPAPI specific. Also set ErrorInfo report. - void ReportNonPpapiError(PluginErrorCode err, const nacl::string& message); + void ReportNonPpapiError(PP_NaClError err, const nacl::string& message); // Run when faced with a PPAPI error condition. Bring control back to the // plugin by invoking the |translate_notify_callback_|. // Also set ErrorInfo report. - void ReportPpapiError(PluginErrorCode err, + void ReportPpapiError(PP_NaClError err, int32_t pp_error, const nacl::string& message); // Bring control back to the plugin by invoking the // |translate_notify_callback_|. This does not set the ErrorInfo report, diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc index d712bc4..800f119 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc @@ -151,7 +151,7 @@ void PnaclResources::ReadResourceInfo( } void PnaclResources::ReadResourceInfoError(const nacl::string& msg) { - coordinator_->ReportNonPpapiError(ERROR_PNACL_RESOURCE_FETCH, msg); + coordinator_->ReportNonPpapiError(PP_NACL_ERROR_PNACL_RESOURCE_FETCH, msg); } bool PnaclResources::ParseResourceInfo(const nacl::string& buf, @@ -208,7 +208,7 @@ void PnaclResources::StartLoad( if (!manifest_->ResolveURL(url_with_platform_prefix, &full_url, &error_info)) { coordinator_->ReportNonPpapiError( - ERROR_PNACL_RESOURCE_FETCH, + PP_NACL_ERROR_PNACL_RESOURCE_FETCH, nacl::string("failed to resolve ") + url_with_platform_prefix + ": " + error_info.message() + "."); @@ -222,7 +222,7 @@ void PnaclResources::StartLoad( // not actually installed. This shouldn't actually occur since // ReadResourceInfo() should happen first, and error out. coordinator_->ReportNonPpapiError( - ERROR_PNACL_RESOURCE_FETCH, + PP_NACL_ERROR_PNACL_RESOURCE_FETCH, nacl::string("The Portable Native Client (pnacl) component is not " "installed. Please consult chrome://components for more " "information.")); 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 2093aaf..179d88e 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc @@ -59,7 +59,7 @@ void PnaclTranslateThread::RunTranslate( report_translate_finished_ = finish_callback; translate_thread_.reset(new NaClThread); if (translate_thread_ == NULL) { - TranslateFailed(ERROR_PNACL_THREAD_CREATE, + TranslateFailed(PP_NACL_ERROR_PNACL_THREAD_CREATE, "could not allocate thread struct."); return; } @@ -68,7 +68,7 @@ void PnaclTranslateThread::RunTranslate( DoTranslateThread, this, kArbitraryStackSize)) { - TranslateFailed(ERROR_PNACL_THREAD_CREATE, + TranslateFailed(PP_NACL_ERROR_PNACL_THREAD_CREATE, "could not create thread."); translate_thread_.reset(NULL); } @@ -149,7 +149,7 @@ void PnaclTranslateThread::DoTranslate() { llc_subprocess_.reset( StartSubprocess(resources_->GetLlcUrl(), manifest_, &error_info)); if (llc_subprocess_ == NULL) { - TranslateFailed(ERROR_PNACL_LLC_SETUP, + TranslateFailed(PP_NACL_ERROR_PNACL_LLC_SETUP, "Compile process could not be created: " + error_info.message()); return; @@ -219,11 +219,11 @@ void PnaclTranslateThread::DoTranslate() { if (llc_subprocess_->srpc_client()->GetLastError() == NACL_SRPC_RESULT_APP_ERROR) { // The error message is only present if the error was returned from llc - TranslateFailed(ERROR_PNACL_LLC_INTERNAL, + TranslateFailed(PP_NACL_ERROR_PNACL_LLC_INTERNAL, nacl::string("Stream init failed: ") + nacl::string(params.outs()[0]->arrays.str)); } else { - TranslateFailed(ERROR_PNACL_LLC_INTERNAL, + TranslateFailed(PP_NACL_ERROR_PNACL_LLC_INTERNAL, "Stream init internal error"); } return; @@ -258,7 +258,7 @@ void PnaclTranslateThread::DoTranslate() { // and call StreamEnd, which returns a string describing the error, // which we can then send to the Javascript console. Otherwise just // fail here, since the translator has probably crashed or asserted. - TranslateFailed(ERROR_PNACL_LLC_INTERNAL, + TranslateFailed(PP_NACL_ERROR_PNACL_LLC_INTERNAL, "Compile stream chunk failed. " "The PNaCl translator has probably crashed."); return; @@ -282,10 +282,10 @@ void PnaclTranslateThread::DoTranslate() { if (llc_subprocess_->srpc_client()->GetLastError() == NACL_SRPC_RESULT_APP_ERROR) { // The error string is only present if the error was sent back from llc. - TranslateFailed(ERROR_PNACL_LLC_INTERNAL, + TranslateFailed(PP_NACL_ERROR_PNACL_LLC_INTERNAL, params.outs()[3]->arrays.str); } else { - TranslateFailed(ERROR_PNACL_LLC_INTERNAL, + TranslateFailed(PP_NACL_ERROR_PNACL_LLC_INTERNAL, "Compile StreamEnd internal error"); } return; @@ -328,7 +328,7 @@ bool PnaclTranslateThread::RunLdSubprocess(int modules_used, for (i = 0; i < obj_files_->size(); i++) { // Reset object file for reading first. if (!(*obj_files_)[i]->Reset()) { - TranslateFailed(ERROR_PNACL_LD_SETUP, + TranslateFailed(PP_NACL_ERROR_PNACL_LD_SETUP, "Link process could not reset object file"); return false; } @@ -347,7 +347,7 @@ bool PnaclTranslateThread::RunLdSubprocess(int modules_used, ld_subprocess_.reset( StartSubprocess(resources_->GetLdUrl(), manifest_, &error_info)); if (ld_subprocess_ == NULL) { - TranslateFailed(ERROR_PNACL_LD_SETUP, + TranslateFailed(PP_NACL_ERROR_PNACL_LD_SETUP, "Link process could not be created: " + error_info.message()); return false; @@ -397,7 +397,7 @@ bool PnaclTranslateThread::RunLdSubprocess(int modules_used, lib_dependencies.c_str()); } if (!success) { - TranslateFailed(ERROR_PNACL_LD_INTERNAL, + TranslateFailed(PP_NACL_ERROR_PNACL_LD_INTERNAL, "link failed."); return false; } @@ -414,7 +414,7 @@ bool PnaclTranslateThread::RunLdSubprocess(int modules_used, } void PnaclTranslateThread::TranslateFailed( - enum PluginErrorCode err_code, + PP_NaClError err_code, const nacl::string& error_string) { PLUGIN_PRINTF(("PnaclTranslateThread::TranslateFailed (error_string='%s')\n", error_string.c_str())); 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 11473b4..dc9971b 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h @@ -83,7 +83,7 @@ class PnaclTranslateThread { // Runs the streaming translation. Called from the helper thread. void DoTranslate() ; // Signal that Pnacl translation failed, from the translation thread only. - void TranslateFailed(enum PluginErrorCode err_code, + void TranslateFailed(PP_NaClError err_code, const nacl::string& error_string); // Run the LD subprocess, returning true on success bool RunLdSubprocess(int modules_used, diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 0cadd94..5a18f5a 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -277,7 +277,7 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( nacl::MutexLocker take(&mu_); *p->op_complete_ptr = true; // done... p->file_info->desc = -1; // but failed. - p->error_info->SetReport(ERROR_MANIFEST_OPEN, + p->error_info->SetReport(PP_NACL_ERROR_MANIFEST_OPEN, "ServiceRuntime: StreamAsFile failed"); NaClXCondVarBroadcast(&cv_); return; @@ -298,7 +298,7 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( "OpenManifestEntry_MainThreadContinuation: " "GetReadonlyPnaclFd failed\n"); // TODO(jvoung): Separate the error codes? - p->error_info->SetReport(ERROR_MANIFEST_OPEN, + p->error_info->SetReport(PP_NACL_ERROR_MANIFEST_OPEN, "ServiceRuntime: GetPnaclFd failed"); } nacl::MutexLocker take(&mu_); @@ -319,7 +319,7 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( *p->op_complete_ptr = true; // done... p->file_info->desc = -1; // but failed. p->error_info->SetReport( - ERROR_MANIFEST_OPEN, + PP_NACL_ERROR_MANIFEST_OPEN, "ServiceRuntime: Translating OpenManifestEntry files not supported"); NaClXCondVarBroadcast(&cv_); return; @@ -346,7 +346,7 @@ void PluginReverseInterface::StreamAsFile_MainThreadContinuation( NaClLog(4, "StreamAsFile_MainThreadContinuation: !PP_OK, setting desc -1\n"); p->file_info->desc = -1; - p->error_info->SetReport(ERROR_MANIFEST_OPEN, + p->error_info->SetReport(PP_NACL_ERROR_MANIFEST_OPEN, "Plugin StreamAsFile failed at callback"); } *p->op_complete_ptr = true; @@ -478,13 +478,13 @@ bool ServiceRuntime::LoadModule(nacl::DescWrapper* nacl_desc, CHECK(nacl_desc); // Create the command channel to the sel_ldr and load the nexe from nacl_desc. if (!subprocess_->SetupCommand(&command_channel_)) { - error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, "ServiceRuntime: command channel creation failed"); return false; } if (!subprocess_->LoadModule(&command_channel_, nacl_desc)) { - error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL, "ServiceRuntime: load module failed"); return false; } @@ -501,7 +501,7 @@ bool ServiceRuntime::InitReverseService(ErrorInfo* error_info) { &out_conn_cap); if (NACL_SRPC_RESULT_OK != rpc_result) { - error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_REV_SETUP, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP, "ServiceRuntime: reverse setup rpc failed"); return false; } @@ -512,7 +512,7 @@ bool ServiceRuntime::InitReverseService(ErrorInfo* error_info) { nacl::DescWrapper* conn_cap = plugin_->wrapper_factory()->MakeGenericCleanup( out_conn_cap); if (conn_cap == NULL) { - error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_WRAPPER, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_WRAPPER, "ServiceRuntime: wrapper allocation failure"); return false; } @@ -520,7 +520,7 @@ bool ServiceRuntime::InitReverseService(ErrorInfo* error_info) { NaClLog(4, "ServiceRuntime::InitReverseService: starting reverse service\n"); reverse_service_ = new nacl::ReverseService(conn_cap, rev_interface_->Ref()); if (!reverse_service_->Start()) { - error_info->SetReport(ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE, "ServiceRuntime: starting reverse services failed"); return false; } @@ -538,7 +538,7 @@ bool ServiceRuntime::StartModule(ErrorInfo* error_info) { &load_status); if (NACL_SRPC_RESULT_OK != rpc_result) { - error_info->SetReport(ERROR_SEL_LDR_START_MODULE, + error_info->SetReport(PP_NACL_ERROR_SEL_LDR_START_MODULE, "ServiceRuntime: could not start nacl module"); return false; } @@ -549,7 +549,7 @@ bool ServiceRuntime::StartModule(ErrorInfo* error_info) { } if (LOAD_OK != load_status) { error_info->SetReport( - ERROR_SEL_LDR_START_STATUS, + PP_NACL_ERROR_SEL_LDR_START_STATUS, NaClErrorString(static_cast<NaClErrorCode>(load_status))); return false; } @@ -567,7 +567,7 @@ void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params, if (main_service_runtime_) { ErrorInfo error_info; error_info.SetReport( - ERROR_SEL_LDR_CREATE_LAUNCHER, + PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER, "ServiceRuntime: failed to create sel_ldr launcher"); plugin_->ReportLoadError(error_info); } @@ -604,7 +604,7 @@ void ServiceRuntime::StartSelLdrContinuation(int32_t pp_error, } ErrorInfo error_info; error_info.SetReportWithConsoleOnlyError( - ERROR_SEL_LDR_LAUNCH, + PP_NACL_ERROR_SEL_LDR_LAUNCH, "ServiceRuntime: failed to start", error_message); plugin_->ReportLoadError(error_info); diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 84a3dd7..f2bcefb9 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -3185,11 +3185,6 @@ static void Pnacl_M25_PPB_NaCl_Private_ReportTranslationFinished(PP_Instance ins iface->ReportTranslationFinished(instance, success); } -static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) { - const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->ReportNaClError(instance, message_id); -} - static PP_FileHandle Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; return iface->OpenNaClExecutable(instance, file_url, file_token_lo, file_token_hi); @@ -3205,6 +3200,11 @@ static void Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty(PP_Instance instance, iface->SetReadOnlyProperty(instance, *key, *value); } +static void Pnacl_M25_PPB_NaCl_Private_ReportLoadError(PP_Instance instance, PP_NaClError error, PP_Bool is_installed) { + const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; + iface->ReportLoadError(instance, error, is_installed); +} + /* End wrapper methods for PPB_NaCl_Private_1_0 */ /* Begin wrapper methods for PPB_NetAddress_Private_0_1 */ @@ -5086,10 +5086,10 @@ static struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .GetNumberOfProcessors = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_GetNumberOfProcessors, .GetNexeFd = (int32_t (*)(PP_Instance instance, const char* pexe_url, uint32_t abi_version, uint32_t opt_level, const char* last_modified, const char* etag, PP_Bool has_no_store_header, const char* sandbox_isa, const char* extra_flags, PP_Bool* is_hit, PP_FileHandle* nexe_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_GetNexeFd, .ReportTranslationFinished = (void (*)(PP_Instance instance, PP_Bool success))&Pnacl_M25_PPB_NaCl_Private_ReportTranslationFinished, - .ReportNaClError = (PP_ExternalPluginResult (*)(PP_Instance instance, PP_NaClError message_id))&Pnacl_M25_PPB_NaCl_Private_ReportNaClError, .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable, .DispatchEvent = (void (*)(PP_Instance instance, PP_NaClEventType event_type, const char* resource_url, PP_Bool length_is_computable, uint64_t loaded_bytes, uint64_t total_bytes))&Pnacl_M25_PPB_NaCl_Private_DispatchEvent, - .SetReadOnlyProperty = (void (*)(PP_Instance instance, struct PP_Var key, struct PP_Var value))&Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty + .SetReadOnlyProperty = (void (*)(PP_Instance instance, struct PP_Var key, struct PP_Var value))&Pnacl_M25_PPB_NaCl_Private_SetReadOnlyProperty, + .ReportLoadError = (void (*)(PP_Instance instance, PP_NaClError error, PP_Bool is_installed))&Pnacl_M25_PPB_NaCl_Private_ReportLoadError }; static struct PPB_NetAddress_Private_0_1 Pnacl_Wrappers_PPB_NetAddress_Private_0_1 = { |