Index: mojo/examples/compositor_app/compositor_app.cc |
diff --git a/mojo/examples/compositor_app/compositor_app.cc b/mojo/examples/compositor_app/compositor_app.cc |
index c169d14c1258c66549edb2fcf70ca63bef24c2f2..513379e6d0fcaf0e7d03291c9b9b0302f19b29d2 100644 |
--- a/mojo/examples/compositor_app/compositor_app.cc |
+++ b/mojo/examples/compositor_app/compositor_app.cc |
@@ -11,7 +11,6 @@ |
#include "mojo/public/cpp/application/application_impl.h" |
#include "mojo/public/cpp/system/core.h" |
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
-#include "mojo/services/public/interfaces/gpu/gpu.mojom.h" |
#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h" |
#include "ui/gfx/rect.h" |
@@ -29,22 +28,22 @@ |
viewport_->Create(Rect::From(gfx::Rect(10, 10, 800, 600))); |
viewport_->Show(); |
- // TODO(jamesr): Should be mojo:mojo_gpu_service |
- app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_); |
+ MessagePipe pipe; |
+ viewport_->CreateGLES2Context( |
+ MakeRequest<CommandBuffer>(pipe.handle0.Pass())); |
+ host_.reset(new CompositorHost(pipe.handle1.Pass())); |
} |
- virtual void OnCreated(uint64_t native_viewport_id) OVERRIDE { |
- CommandBufferPtr cb; |
- gpu_service_->CreateOnscreenGLES2Context( |
- native_viewport_id, Size::From(gfx::Size(800, 600)), Get(&cb)); |
- host_.reset(new CompositorHost(cb.PassMessagePipe())); |
+ virtual void OnCreated() OVERRIDE { |
} |
- virtual void OnDestroyed() OVERRIDE { base::MessageLoop::current()->Quit(); } |
+ virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE { |
+ base::MessageLoop::current()->Quit(); |
+ callback.Run(); |
+ } |
virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE { |
- if (host_) |
- host_->SetSize(gfx::Size(bounds->width, bounds->height)); |
+ host_->SetSize(gfx::Size(bounds->width, bounds->height)); |
} |
virtual void OnEvent(EventPtr event, |
@@ -54,7 +53,6 @@ |
private: |
NativeViewportPtr viewport_; |
- GpuPtr gpu_service_; |
scoped_ptr<CompositorHost> host_; |
DISALLOW_COPY_AND_ASSIGN(SampleApp); |
}; |