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

Unified Diff: mojo/gles2/gles2_context.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: .get 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: mojo/gles2/gles2_context.cc
diff --git a/mojo/gles2/gles2_context.cc b/mojo/gles2/gles2_context.cc
index 90ba14e8c957a8d4d5edce7ca41098126a1d0f92..58b86bd90d9d8e9d494b0f4c680c606d9e86a0fd 100644
--- a/mojo/gles2/gles2_context.cc
+++ b/mojo/gles2/gles2_context.cc
@@ -28,7 +28,7 @@ GLES2Context::GLES2Context(const std::vector<int32_t>& attribs,
mojo::ScopedMessagePipeHandle command_buffer_handle,
MojoGLES2ContextLost lost_callback,
void* closure)
- : command_buffer_(this, attribs, std::move(command_buffer_handle)),
+ : command_buffer_(attribs, std::move(command_buffer_handle)),
lost_callback_(lost_callback),
closure_(closure) {}
@@ -57,12 +57,18 @@ bool GLES2Context::Initialize() {
lose_context_when_out_of_memory,
support_client_side_arrays,
&command_buffer_));
- return implementation_->Initialize(kDefaultStartTransferBufferSize,
- kDefaultMinTransferBufferSize,
- kDefaultMaxTransferBufferSize,
- gpu::gles2::GLES2Implementation::kNoLimit);
+ if (!implementation_->Initialize(kDefaultStartTransferBufferSize,
+ kDefaultMinTransferBufferSize,
+ kDefaultMaxTransferBufferSize,
+ gpu::gles2::GLES2Implementation::kNoLimit))
+ return false;
+ implementation_->SetLostContextCallback(
+ base::Bind(&GLES2Context::OnLostContext, base::Unretained(this)));
+ return true;
}
-void GLES2Context::ContextLost() { lost_callback_(closure_); }
+void GLES2Context::OnLostContext() {
+ lost_callback_(closure_);
+}
} // namespace gles2

Powered by Google App Engine
This is Rietveld 408576698