Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 9706042: Plumb client side synthesized GL messages to JS Console (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)) {
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h ('k') | gpu/command_buffer/client/gles2_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698