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

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

Issue 504443002: Update mojo surfaces bindings and mojo/cc/ glue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gn fixes 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
« no previous file with comments | « mojo/examples/surfaces_app/child_impl.h ('k') | mojo/examples/surfaces_app/surfaces_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/surfaces_app/child_impl.cc
diff --git a/mojo/examples/surfaces_app/child_impl.cc b/mojo/examples/surfaces_app/child_impl.cc
index afefe09dc7540c3fdb035482ac6b96881c6f0739..963afb640ef7df7eec4d37ffb342f377c60d98f8 100644
--- a/mojo/examples/surfaces_app/child_impl.cc
+++ b/mojo/examples/surfaces_app/child_impl.cc
@@ -28,13 +28,16 @@ using cc::SolidColorDrawQuad;
using cc::DelegatedFrameData;
using cc::CompositorFrame;
-ChildImpl::ChildImpl(ApplicationConnection* surfaces_service_connection) {
- surfaces_service_connection->ConnectToService(&surface_);
- surface_.set_client(this);
+ChildImpl::ChildImpl(ApplicationConnection* surfaces_service_connection)
+ : weak_factory_(this) {
+ surfaces_service_connection->ConnectToService(&surfaces_service_);
+ surfaces_service_->CreateSurfaceConnection(base::Bind(
+ &ChildImpl::SurfaceConnectionCreated, weak_factory_.GetWeakPtr()));
}
ChildImpl::~ChildImpl() {
- surface_->DestroySurface(mojo::SurfaceId::From(id_));
+ if (surface_)
+ surface_->DestroySurface(mojo::SurfaceId::From(id_));
}
void ChildImpl::ProduceFrame(
@@ -48,7 +51,10 @@ void ChildImpl::ProduceFrame(
Draw();
}
-void ChildImpl::SetIdNamespace(uint32_t id_namespace) {
+void ChildImpl::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())
Draw();
« no previous file with comments | « mojo/examples/surfaces_app/child_impl.h ('k') | mojo/examples/surfaces_app/surfaces_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698