diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 21:43:34 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 21:43:34 +0000 |
commit | 4db78f084fbe3f5ecce8b8a9170c0ae7eb07843f (patch) | |
tree | 95c22925282df2383eb405f497005882ff247e30 /components | |
parent | 3e627c39c71510b325fb00861aa23db912afb776 (diff) | |
download | chromium_src-4db78f084fbe3f5ecce8b8a9170c0ae7eb07843f.zip chromium_src-4db78f084fbe3f5ecce8b8a9170c0ae7eb07843f.tar.gz chromium_src-4db78f084fbe3f5ecce8b8a9170c0ae7eb07843f.tar.bz2 |
Pepper: Move AddToConsole() to PPB_NaCl_Private.
BUG=239656
R=dmichael@chromium.org
Review URL: https://codereview.chromium.org/203373005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/nacl/renderer/ppb_nacl_private_impl.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index 9160252..8730878 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -44,6 +44,9 @@ namespace { +// Forward declare LogToConsole() we can use it in other functions here. +void LogToConsole(PP_Instance instance, const char* message); + base::LazyInstance<scoped_refptr<PnaclTranslationResourceHost> > g_pnacl_resource_host = LAZY_INSTANCE_INITIALIZER; @@ -512,6 +515,7 @@ void SetReadOnlyProperty(PP_Instance instance, void ReportLoadError(PP_Instance instance, PP_NaClError error, const char* error_message, + const char* console_message, PP_Bool is_installed) { // Check that we are on the main renderer thread. DCHECK(content::RenderThread::Get()); @@ -525,8 +529,6 @@ void ReportLoadError(PP_Instance 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); @@ -546,6 +548,10 @@ void ReportLoadError(PP_Instance instance, plugin_instance->SetEmbedProperty( ppapi::StringVar::StringToPPVar("lastError"), ppapi::StringVar::StringToPPVar(error_string)); + + std::string console_string = std::string("NaCl module load failed: ") + + std::string(console_message); + LogToConsole(instance, console_string.c_str()); } void InstanceDestroyed(PP_Instance instance) { @@ -582,6 +588,14 @@ PP_UrlSchemeType GetUrlScheme(PP_Var url) { return PP_SCHEME_OTHER; } +void LogToConsole(PP_Instance instance, const char* message) { + std::string source("NativeClient"); + ppapi::PpapiGlobals::Get()->LogWithSource(instance, + PP_LOGLEVEL_LOG, + source, + std::string(message)); +} + const PPB_NaCl_Private nacl_interface = { &LaunchSelLdr, &StartPpapiProxy, @@ -601,7 +615,8 @@ const PPB_NaCl_Private nacl_interface = { &InstanceDestroyed, &NaClDebugStubEnabled, &GetSandboxArch, - &GetUrlScheme + &GetUrlScheme, + &LogToConsole }; } // namespace |