Index: mojo/examples/sample_app/sample_app.cc |
diff --git a/mojo/examples/sample_app/sample_app.cc b/mojo/examples/sample_app/sample_app.cc |
index 92a5303cada6c8c3e61ef28d202b49b290da4ae3..222205a3baa76a25b4904612ad3e8fa5f1b9526c 100644 |
--- a/mojo/examples/sample_app/sample_app.cc |
+++ b/mojo/examples/sample_app/sample_app.cc |
@@ -12,7 +12,6 @@ |
#include "mojo/public/cpp/system/core.h" |
#include "mojo/public/cpp/system/macros.h" |
#include "mojo/public/cpp/utility/run_loop.h" |
-#include "mojo/services/public/interfaces/gpu/gpu.mojom.h" |
#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h" |
namespace examples { |
@@ -31,9 +30,6 @@ |
app->ConnectToService("mojo:mojo_native_viewport_service", &viewport_); |
viewport_.set_client(this); |
- // TODO(jamesr): Should be mojo:mojo_gpu_service |
- app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_); |
- |
mojo::RectPtr rect(mojo::Rect::New()); |
rect->x = 10; |
rect->y = 10; |
@@ -41,27 +37,27 @@ |
rect->height = 600; |
viewport_->Create(rect.Pass()); |
viewport_->Show(); |
- } |
- virtual void OnCreated(uint64_t native_viewport_id) MOJO_OVERRIDE { |
- mojo::SizePtr size = mojo::Size::New(); |
- size->width = 800; |
- size->height = 600; |
mojo::CommandBufferPtr command_buffer; |
- gpu_service_->CreateOnscreenGLES2Context( |
- native_viewport_id, size.Pass(), Get(&command_buffer)); |
+ viewport_->CreateGLES2Context(Get(&command_buffer)); |
gles2_client_.reset(new GLES2ClientImpl(command_buffer.Pass())); |
} |
- virtual void OnDestroyed() MOJO_OVERRIDE { mojo::RunLoop::current()->Quit(); } |
+ virtual void OnCreated() MOJO_OVERRIDE { |
+ } |
+ |
+ virtual void OnDestroyed( |
+ const mojo::Callback<void()>& callback) MOJO_OVERRIDE { |
+ mojo::RunLoop::current()->Quit(); |
+ callback.Run(); |
+ } |
virtual void OnBoundsChanged(mojo::RectPtr bounds) MOJO_OVERRIDE { |
assert(bounds); |
mojo::SizePtr size(mojo::Size::New()); |
size->width = bounds->width; |
size->height = bounds->height; |
- if (gles2_client_) |
- gles2_client_->SetSize(*size); |
+ gles2_client_->SetSize(*size); |
} |
virtual void OnEvent(mojo::EventPtr event, |
@@ -75,7 +71,6 @@ |
private: |
scoped_ptr<GLES2ClientImpl> gles2_client_; |
mojo::NativeViewportPtr viewport_; |
- mojo::GpuPtr gpu_service_; |
DISALLOW_COPY_AND_ASSIGN(SampleApp); |
}; |