diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 08:04:52 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 08:04:52 +0000 |
commit | 6b6e7ee27ce2b3beccebbcb3dc8ca75bb1dfa067 (patch) | |
tree | 9058ee953710757d8990179764059bbd610fd93c /gpu | |
parent | 51a5ca5516eccfb0369a02cf7cd1696ca9da23ac (diff) | |
download | chromium_src-6b6e7ee27ce2b3beccebbcb3dc8ca75bb1dfa067.zip chromium_src-6b6e7ee27ce2b3beccebbcb3dc8ca75bb1dfa067.tar.gz chromium_src-6b6e7ee27ce2b3beccebbcb3dc8ca75bb1dfa067.tar.bz2 |
Add IPC to allow gpu process to send message for console back to renderer
BUG=107294
TEST=none
Review URL: http://codereview.chromium.org/8917027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114191 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/common/command_buffer.h | 7 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 9 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_mock.h | 1 |
4 files changed, 21 insertions, 0 deletions
diff --git a/gpu/command_buffer/common/command_buffer.h b/gpu/command_buffer/common/command_buffer.h index e44df7f..ec4cc14 100644 --- a/gpu/command_buffer/common/command_buffer.h +++ b/gpu/command_buffer/common/command_buffer.h @@ -60,6 +60,13 @@ class CommandBuffer { uint32 generation; }; + struct ConsoleMessage { + // An user supplied id. + int32 id; + // The message. + std::string message; + }; + CommandBuffer() { } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 6c6e4e4..8510f85 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -521,6 +521,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, const base::Callback<void(gfx::Size)>& callback); virtual void SetSwapBuffersCallback(const base::Closure& callback); + virtual void SetMsgCallback(const MsgCallback& callback); virtual void SetStreamTextureManager(StreamTextureManager* manager); virtual bool GetServiceTextureId(uint32 client_texture_id, @@ -1424,6 +1425,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, base::Callback<void(gfx::Size)> resize_callback_; base::Closure swap_buffers_callback_; + MsgCallback msg_callback_; StreamTextureManager* stream_texture_manager_; @@ -2593,6 +2595,10 @@ void GLES2DecoderImpl::SetSwapBuffersCallback(const base::Closure& callback) { swap_buffers_callback_ = callback; } +void GLES2DecoderImpl::SetMsgCallback(const MsgCallback& callback) { + msg_callback_ = callback; +} + void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { stream_texture_manager_ = manager; } @@ -4568,6 +4574,9 @@ void GLES2DecoderImpl::SetGLError(GLenum error, const char* msg) { if (msg) { last_error_ = msg; LOG(ERROR) << last_error_; + if (!msg_callback_.is_null()) { + msg_callback_.Run(0, GLES2Util::GetStringEnum(error) + " : " + msg); + } } error_bits_ |= GLES2Util::GLErrorToErrorBit(error); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index d5004bb..0d6849d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -43,6 +43,7 @@ struct DisallowedFeatures { class GLES2Decoder : public CommonDecoder { public: typedef error::Error Error; + typedef base::Callback<void(int32 id, const std::string& msg)> MsgCallback; // Creates a decoder. static GLES2Decoder* Create(ContextGroup* group); @@ -133,6 +134,9 @@ class GLES2Decoder : public CommonDecoder { int width, int height) = 0; + // A callback for messages from the decoder. + virtual void SetMsgCallback(const MsgCallback& callback) = 0; + protected: GLES2Decoder(); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index 2a94ba0..fb0151a 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -66,6 +66,7 @@ class MockGLES2Decoder : public GLES2Decoder { unsigned type, int width, int height)); + MOCK_METHOD1(SetMsgCallback, void(const MsgCallback& callback)); DISALLOW_COPY_AND_ASSIGN(MockGLES2Decoder); }; |