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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1864723003: Make lost context and error message callbacks on GpuControl go to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: errorcallback: . Created 4 years, 8 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: 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);
+
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);

Powered by Google App Engine
This is Rietveld 408576698