summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 23:15:39 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 23:15:39 +0000
commit4d2a5ef9bb7839affe7dfcd457d1a9ffa8ab77ed (patch)
tree1e598cf27106d7985c1caca48f8ced9185ea67c6 /webkit
parent5cf80027697f120f7962c00693270bfe6cff82ac (diff)
downloadchromium_src-4d2a5ef9bb7839affe7dfcd457d1a9ffa8ab77ed.zip
chromium_src-4d2a5ef9bb7839affe7dfcd457d1a9ffa8ab77ed.tar.gz
chromium_src-4d2a5ef9bb7839affe7dfcd457d1a9ffa8ab77ed.tar.bz2
Route GPU process console messages through pepper.
Hook up this warning messages, just like we do for webgl. BUG=107296 TEST= Review URL: http://codereview.chromium.org/9702058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h7
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.cc31
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.h1
3 files changed, 39 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index ab388cc..9bd49fa 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -192,6 +192,13 @@ class PluginDelegate {
virtual void SetContextLostCallback(
const base::Callback<void()>& callback) = 0;
+ // Set an optional callback that will be invoked when the GPU process
+ // sends a console message.
+ typedef base::Callback<void(const std::string&, int)>
+ ConsoleMessageCallback;
+ virtual void SetOnConsoleMessageCallback(
+ const ConsoleMessageCallback& callback) = 0;
+
// Run the callback once the channel has been flushed.
virtual bool Echo(const base::Callback<void()>& callback) = 0;
};
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
index 842b191..ce43ded 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
@@ -6,13 +6,24 @@
#include "base/bind.h"
#include "base/message_loop.h"
+#include "base/utf_string_conversions.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "ppapi/c/ppp_graphics_3d.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/resource_helper.h"
using ppapi::thunk::PPB_Graphics3D_API;
+using WebKit::WebConsoleMessage;
+using WebKit::WebFrame;
+using WebKit::WebPluginContainer;
+using WebKit::WebString;
namespace webkit {
namespace ppapi {
@@ -221,9 +232,29 @@ bool PPB_Graphics3D_Impl::InitRaw(PP_Resource share_context,
platform_context_->SetContextLostCallback(
base::Bind(&PPB_Graphics3D_Impl::OnContextLost,
weak_ptr_factory_.GetWeakPtr()));
+
+ platform_context_->SetOnConsoleMessageCallback(
+ base::Bind(&PPB_Graphics3D_Impl::OnConsoleMessage,
+ weak_ptr_factory_.GetWeakPtr()));
return true;
}
+void PPB_Graphics3D_Impl::OnConsoleMessage(const std::string& message,
+ int id) {
+ if (!bound_to_instance_)
+ return;
+ WebPluginContainer* container =
+ ResourceHelper::GetPluginInstance(this)->container();
+ if (!container)
+ return;
+ WebFrame* frame = container->element().document().frame();
+ if (!frame)
+ return;
+ WebConsoleMessage console_message = WebConsoleMessage(
+ WebConsoleMessage::LevelError, WebString(UTF8ToUTF16(message)));
+ frame->addMessageToConsole(console_message);
+}
+
void PPB_Graphics3D_Impl::OnSwapBuffers() {
if (HasPendingSwap()) {
// If we're off-screen, no need to trigger and wait for compositing.
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
index 0a9c402..62c7055 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
@@ -75,6 +75,7 @@ class PPB_Graphics3D_Impl : public ::ppapi::PPB_Graphics3D_Shared {
// Notifications received from the GPU process.
void OnSwapBuffers();
void OnContextLost();
+ void OnConsoleMessage(const std::string& msg, int id);
// Notifications sent to plugin.
void SendContextLost();