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

Unified Diff: mojo/examples/surfaces_app/child_gl_impl.cc

Issue 504443002: Update mojo surfaces bindings and mojo/cc/ glue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/examples/surfaces_app/child_gl_impl.cc
diff --git a/mojo/examples/surfaces_app/child_gl_impl.cc b/mojo/examples/surfaces_app/child_gl_impl.cc
index e669761686d613fa18b9f53365120d37b192eeea..d55582c6dd4d18d86ab9fc5f88b19e1e81b3b0e1 100644
--- a/mojo/examples/surfaces_app/child_gl_impl.cc
+++ b/mojo/examples/surfaces_app/child_gl_impl.cc
@@ -43,9 +43,12 @@ static void ContextLostThunk(void*) {
ChildGLImpl::ChildGLImpl(ApplicationConnection* surfaces_service_connection,
CommandBufferPtr command_buffer)
- : start_time_(base::TimeTicks::Now()), next_resource_id_(1) {
- surfaces_service_connection->ConnectToService(&surface_);
- surface_.set_client(this);
+ : start_time_(base::TimeTicks::Now()),
+ next_resource_id_(1),
+ weak_factory_(this) {
+ surfaces_service_connection->ConnectToService(&surfaces_service_);
+ surfaces_service_->CreateSurfaceConnection(base::Bind(
+ &ChildGLImpl::SurfaceConnectionCreated, weak_factory_.GetWeakPtr()));
context_ =
MojoGLES2CreateContext(command_buffer.PassMessagePipe().release().value(),
&ContextLostThunk,
@@ -70,14 +73,15 @@ void ChildGLImpl::ProduceFrame(
cube_.set_color(
SkColorGetR(color_), SkColorGetG(color_), SkColorGetB(color_));
produce_callback_ = callback;
- if (allocator_)
- AllocateSurface();
+ AllocateSurface();
}
-void ChildGLImpl::SetIdNamespace(uint32_t id_namespace) {
+void ChildGLImpl::SurfaceConnectionCreated(SurfacePtr surface,
+ uint32_t id_namespace) {
+ surface_ = surface.Pass();
+ surface_.set_client(this);
allocator_.reset(new cc::SurfaceIdAllocator(id_namespace));
- if (!produce_callback_.is_null())
- AllocateSurface();
+ AllocateSurface();
}
void ChildGLImpl::ReturnResources(Array<ReturnedResourcePtr> resources) {

Powered by Google App Engine
This is Rietveld 408576698