Index: gpu/command_buffer/client/gles2_implementation.h |
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h |
index 6ee901e2a05cb73a8f56c3556d51403e7ece9349..5e73c4da6c7ab1afdc1c43c6b99e306b5592095b 100644 |
--- a/gpu/command_buffer/client/gles2_implementation.h |
+++ b/gpu/command_buffer/client/gles2_implementation.h |
@@ -26,6 +26,7 @@ |
#include "gpu/command_buffer/client/context_support.h" |
#include "gpu/command_buffer/client/gles2_impl_export.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
+#include "gpu/command_buffer/client/gpu_control_client.h" |
#include "gpu/command_buffer/client/mapped_memory.h" |
#include "gpu/command_buffer/client/ref_counted.h" |
#include "gpu/command_buffer/client/share_group.h" |
@@ -111,12 +112,6 @@ class GLES2CmdHelper; |
class VertexArrayObjectManager; |
class QueryTracker; |
-class GLES2ImplementationErrorMessageCallback { |
- public: |
- virtual ~GLES2ImplementationErrorMessageCallback() { } |
- virtual void OnErrorMessage(const char* msg, int id) = 0; |
-}; |
- |
// This class emulates GLES2 over command buffers. It can be used by a client |
// program so that the program does not need deal with shared memory and command |
// buffer management. See gl2_lib.h. Note that there is a performance gain to |
@@ -126,6 +121,7 @@ class GLES2ImplementationErrorMessageCallback { |
class GLES2_IMPL_EXPORT GLES2Implementation |
: NON_EXPORTED_BASE(public GLES2Interface), |
NON_EXPORTED_BASE(public ContextSupport), |
+ NON_EXPORTED_BASE(public GpuControlClient), |
NON_EXPORTED_BASE(public base::trace_event::MemoryDumpProvider) { |
public: |
enum MappedMemoryLimit { |
@@ -213,6 +209,10 @@ class GLES2_IMPL_EXPORT GLES2Implementation |
const gfx::RectF& uv_rect) override; |
uint64_t ShareGroupTracingGUID() const override; |
+ void SetErrorMessageCallback( |
+ const base::Callback<void(const char*, int32_t)>& callback); |
+ void SetLostContextCallback(const base::Closure& callback); |
+ |
void GetProgramInfoCHROMIUMHelper(GLuint program, |
std::vector<int8_t>* result); |
GLint GetAttribLocationHelper(GLuint program, const char* name); |
@@ -264,11 +264,6 @@ class GLES2_IMPL_EXPORT GLES2Implementation |
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
base::trace_event::ProcessMemoryDump* pmd) override; |
- void SetErrorMessageCallback( |
- GLES2ImplementationErrorMessageCallback* callback) { |
- error_message_callback_ = callback; |
- } |
- |
ShareGroup* share_group() const { |
return share_group_.get(); |
} |
@@ -418,6 +413,10 @@ class GLES2_IMPL_EXPORT GLES2Implementation |
return static_cast<T>(GetResultBuffer()); |
} |
+ // GpuControlClient implementation. |
+ void OnGpuControlLostContext() final; |
+ void OnGpuControlErrorMessage(const char* message, int32_t id) final; |
+ |
void* GetResultBuffer(); |
int32_t GetResultShmId(); |
uint32_t GetResultShmOffset(); |
@@ -825,7 +824,11 @@ class GLES2_IMPL_EXPORT GLES2Implementation |
scoped_ptr<BufferTracker> buffer_tracker_; |
- GLES2ImplementationErrorMessageCallback* error_message_callback_; |
+ base::Callback<void(const char*, int32_t)> error_message_callback_; |
+ base::Closure lost_context_callback_; |
+#if DCHECK_IS_ON() |
+ bool lost_context_ = false; |
+#endif |
int current_trace_stack_; |