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

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

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: specify ownership in the Bind call Created 6 years, 5 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_impl.cc
diff --git a/mojo/examples/surfaces_app/child_impl.cc b/mojo/examples/surfaces_app/child_impl.cc
index 52118f028f5b8f3b4578e654f55c9e040255b57d..5f91b5a29b451525ede7821ee93b815a2313f90d 100644
--- a/mojo/examples/surfaces_app/child_impl.cc
+++ b/mojo/examples/surfaces_app/child_impl.cc
@@ -27,30 +27,9 @@ using cc::SolidColorDrawQuad;
using cc::DelegatedFrameData;
using cc::CompositorFrame;
-class SurfaceClientImpl : public surfaces::SurfaceClient {
- public:
- explicit SurfaceClientImpl(ChildImpl* impl) : impl_(impl) {}
- virtual ~SurfaceClientImpl() {}
-
- // surfaces::SurfaceClient implementation
- virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE {
- impl_->SetIdNamespace(id_namespace);
- }
-
- virtual void ReturnResources(
- Array<surfaces::ReturnedResourcePtr> resources) OVERRIDE {
- DCHECK(!resources.size());
- }
-
- private:
- ChildImpl* impl_;
-};
-
-ChildImpl::ChildImpl(ApplicationConnection* connection, Context* context)
- : surface_client_(new SurfaceClientImpl(this)) {
- context->ShellConnection("mojo:mojo_surfaces_service")
- ->ConnectToService(&surface_);
- surface_.set_client(surface_client_.get());
+ChildImpl::ChildImpl(ApplicationConnection* surfaces_service_connection) {
+ surfaces_service_connection->ConnectToService(&surface_);
+ surface_.set_client(this);
}
ChildImpl::~ChildImpl() {
@@ -74,6 +53,11 @@ void ChildImpl::SetIdNamespace(uint32_t id_namespace) {
Draw();
}
+void ChildImpl::ReturnResources(
+ Array<surfaces::ReturnedResourcePtr> resources) {
+ DCHECK(!resources.size());
+}
+
void ChildImpl::Draw() {
id_ = allocator_->GenerateId();
surface_->CreateSurface(mojo::surfaces::SurfaceId::From(id_),

Powered by Google App Engine
This is Rietveld 408576698