diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 05:00:26 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 05:00:26 +0000 |
commit | a9b16dd01eea5070cab620a1177a05a6b43677ee (patch) | |
tree | 69efee3fc88d36da9d9462e96bc7609b1f74b1b2 /content | |
parent | e0001c50836c2de0f95549fb901f4f23b4ab0a0b (diff) | |
download | chromium_src-a9b16dd01eea5070cab620a1177a05a6b43677ee.zip chromium_src-a9b16dd01eea5070cab620a1177a05a6b43677ee.tar.gz chromium_src-a9b16dd01eea5070cab620a1177a05a6b43677ee.tar.bz2 |
The tricky part about logging to the console is that many of the errors are generated by invalid resources, from which we have no context. This means we don't know the instance to send the error message of.
Plumbing this through in a way that works proved much harder than I expected. I added log functions to the PpapiGlobals so that we can call it easily from all places. It can either go off an instance (like PPB_Console does) or a module, or nothing. In the module case, all consoles associated with all instances in the module get the log message, in the no context case, all consoles associated with any pepper plugin get the message.
In the IPC proxy, we know the module from whence the error came since there's a unique process for it. So proxied errors with no context when run out of process get translated into errors with PP_Module context. In the common case, there's only one instance for a module, so this works out nicely.
I added some logging ability to resources and added some errors to Graphics2D and URLLoader. We can add messages to more classes as the need arises. I added some advice on writing them to the chromium pepper page.
Review URL: https://chromiumcodereview.appspot.com/9160017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.cc | 7 | ||||
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc index 3277f1b..154826c 100644 --- a/content/ppapi_plugin/ppapi_thread.cc +++ b/content/ppapi_plugin/ppapi_thread.cc @@ -147,6 +147,8 @@ void PpapiThread::Unregister(uint32 plugin_dispatcher_id) { } void PpapiThread::OnMsgLoadPlugin(const FilePath& path) { + SavePluginName(path); + std::string error; base::ScopedNativeLibrary library(base::LoadNativeLibrary(path, &error)); @@ -319,3 +321,8 @@ bool PpapiThread::SetupRendererChannel(base::ProcessHandle host_process_handle, // lifetime of the attached channel. return true; } + +void PpapiThread::SavePluginName(const FilePath& path) { + ppapi::proxy::PluginGlobals::Get()->set_plugin_name( + path.BaseName().AsUTF8Unsafe()); +} diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h index bff66db..0784dd3 100644 --- a/content/ppapi_plugin/ppapi_thread.h +++ b/content/ppapi_plugin/ppapi_thread.h @@ -64,6 +64,9 @@ class PpapiThread : public ChildThread, int renderer_id, IPC::ChannelHandle* handle); + // Sets up the name of the plugin for logging using the given path. + void SavePluginName(const FilePath& path); + // True if running in a broker process rather than a normal plugin process. bool is_broker_; |