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

Unified Diff: mojo/examples/sample_app/sample_app.cc

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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/sample_app/gles2_client_impl.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2abeb6ab34affe9907da6a17616c45f47be304aa..2e126b0a5a0fb7c76a4696fca4ba511a4811b502 100644
--- a/mojo/examples/sample_app/sample_app.cc
+++ b/mojo/examples/sample_app/sample_app.cc
@@ -7,7 +7,6 @@
#include "mojo/examples/sample_app/gles2_client_impl.h"
#include "mojo/public/cpp/application/application.h"
-#include "mojo/public/cpp/bindings/allocation_scope.h"
#include "mojo/public/cpp/gles2/gles2.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/cpp/system/macros.h"
@@ -31,13 +30,12 @@ class SampleApp : public Application, public NativeViewportClient {
ConnectTo("mojo:mojo_native_viewport_service", &viewport_);
viewport_.set_client(this);
- AllocationScope scope;
- Rect::Builder rect;
- rect.set_x(10);
- rect.set_y(10);
- rect.set_width(800);
- rect.set_height(600);
- viewport_->Create(rect.Finish());
+ RectPtr rect(Rect::New());
+ rect->x = 10;
+ rect->y = 10;
+ rect->width = 800;
+ rect->height = 600;
+ viewport_->Create(rect.Pass());
viewport_->Show();
MessagePipe gles2_pipe;
@@ -52,18 +50,19 @@ class SampleApp : public Application, public NativeViewportClient {
RunLoop::current()->Quit();
}
- virtual void OnBoundsChanged(const Rect& bounds) MOJO_OVERRIDE {
- AllocationScope scope;
- Size::Builder size;
- size.set_width(bounds.width());
- size.set_height(bounds.height());
- gles2_client_->SetSize(size.Finish());
+ virtual void OnBoundsChanged(RectPtr bounds) MOJO_OVERRIDE {
+ assert(bounds);
+ SizePtr size(Size::New());
+ size->width = bounds->width;
+ size->height = bounds->height;
+ gles2_client_->SetSize(*size);
}
- virtual void OnEvent(const Event& event,
+ virtual void OnEvent(EventPtr event,
const Callback<void()>& callback) MOJO_OVERRIDE {
- if (!event.location().is_null())
- gles2_client_->HandleInputEvent(event);
+ assert(event);
+ if (event->location)
+ gles2_client_->HandleInputEvent(*event);
callback.Run();
}
« no previous file with comments | « mojo/examples/sample_app/gles2_client_impl.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698