Index: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
index a7225176ee9588907acfc8df5116ad8eb14c97cd..6924e42caedf519ba2897f7928c589a3c3b7f0b9 100644 |
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc |
@@ -44,6 +44,26 @@ void ClearSharedContexts() { |
} // namespace anonymous |
+class WebGraphicsContext3DErrorMessageCallback |
+ : public gpu::gles2::GLES2Implementation::ErrorMessageCallback { |
+ public: |
+ WebGraphicsContext3DErrorMessageCallback( |
+ WebGraphicsContext3DCommandBufferImpl* context) |
+ : context_(context) { |
+ } |
+ |
+ virtual void OnErrorMessage(const char* msg, int id) OVERRIDE; |
+ |
+ private: |
+ WebGraphicsContext3DCommandBufferImpl* context_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebGraphicsContext3DErrorMessageCallback); |
+}; |
+ |
+void WebGraphicsContext3DErrorMessageCallback::OnErrorMessage( |
+ const char* msg, int id) { |
+ context_->OnErrorMessage(msg, id); |
+} |
WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( |
int surface_id, |
@@ -72,6 +92,10 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( |
WebGraphicsContext3DCommandBufferImpl:: |
~WebGraphicsContext3DCommandBufferImpl() { |
+ if (gl_) { |
+ gl_->SetErrorMessageCallback(NULL); |
+ } |
+ |
if (host_) { |
if (host_->WillGpuSwitchOccur(false, gpu_preference_)) { |
host_->ForciblyCloseChannel(); |
@@ -213,6 +237,10 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { |
base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnErrorMessage, |
weak_ptr_factory_.GetWeakPtr())); |
+ client_error_message_callback_.reset( |
+ new WebGraphicsContext3DErrorMessageCallback(this)); |
+ gl_->SetErrorMessageCallback(client_error_message_callback_.get()); |
+ |
// TODO(gman): Remove this. |
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
if (command_line.HasSwitch(switches::kDisableGLSLTranslator)) { |