Index: gpu/command_buffer/client/gles2_implementation.cc |
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc |
index f8f21373ae3af3eb76652aa1da766490cf745f9b..00e30315934739facb61f2e16f529a6113d07718 100644 |
--- a/gpu/command_buffer/client/gles2_implementation.cc |
+++ b/gpu/command_buffer/client/gles2_implementation.cc |
@@ -161,7 +161,6 @@ GLES2Implementation::GLES2Implementation( |
base::SysInfo::AmountOfPhysicalMemory() / 20) |
: 0), |
#endif |
- error_message_callback_(NULL), |
current_trace_stack_(0), |
gpu_control_(gpu_control), |
capabilities_(gpu_control->GetCapabilities()), |
@@ -201,6 +200,8 @@ bool GLES2Implementation::Initialize( |
DCHECK_LE(starting_transfer_buffer_size, max_transfer_buffer_size); |
DCHECK_GE(min_transfer_buffer_size, kStartingOffset); |
+ gpu_control_->SetGpuControlClient(this); |
no sievers
2016/04/07 21:07:58
It's probably safer to unset this somewhere (in th
danakj
2016/04/07 21:45:18
Ya definitely.
|
+ |
if (!transfer_buffer_->Initialize( |
starting_transfer_buffer_size, |
kStartingOffset, |
@@ -549,10 +550,10 @@ void GLES2Implementation::SetGLError( |
if (msg) { |
last_error_ = msg; |
} |
- if (error_message_callback_) { |
+ if (!error_message_callback_.is_null()) { |
std::string temp(GLES2Util::GetStringError(error) + " : " + |
function_name + ": " + (msg ? msg : "")); |
- error_message_callback_->OnErrorMessage(temp.c_str(), 0); |
+ error_message_callback_.Run(temp.c_str(), 0); |
} |
error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |
@@ -5818,6 +5819,27 @@ uint64_t GLES2Implementation::ShareGroupTracingGUID() const { |
return share_group_->TracingGUID(); |
} |
+void GLES2Implementation::SetErrorMessageCallback( |
+ const base::Callback<void(const char*, int32_t)>& callback) { |
+ error_message_callback_ = callback; |
+} |
+ |
+void GLES2Implementation::SetLostContextCallback( |
+ const base::Closure& callback) { |
+ lost_context_callback_ = callback; |
+} |
+ |
+void GLES2Implementation::OnGpuControlLostContext() { |
+ if (!lost_context_callback_.is_null()) |
+ lost_context_callback_.Run(); |
+} |
+ |
+void GLES2Implementation::OnGpuControlErrorMessage(const char* message, |
+ int32_t id) { |
+ if (!error_message_callback_.is_null()) |
+ error_message_callback_.Run(message, id); |
+} |
+ |
GLuint64 GLES2Implementation::InsertFenceSyncCHROMIUM() { |
const uint64_t release = gpu_control_->GenerateFenceSyncRelease(); |
helper_->InsertFenceSyncCHROMIUM(release); |