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

Side by Side Diff: examples/spinning_cube/spinning_cube_app.cc

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase ontop of master, address trung's comments Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.cc ('k') | examples/ui/noodles/noodles_app.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <assert.h> 5 #include <assert.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "examples/spinning_cube/gles2_client_impl.h" 12 #include "examples/spinning_cube/gles2_client_impl.h"
12 #include "mojo/public/c/system/main.h" 13 #include "mojo/public/c/system/main.h"
13 #include "mojo/public/cpp/application/application_connection.h" 14 #include "mojo/public/cpp/application/application_connection.h"
14 #include "mojo/public/cpp/application/application_delegate.h" 15 #include "mojo/public/cpp/application/application_delegate.h"
15 #include "mojo/public/cpp/application/application_impl.h" 16 #include "mojo/public/cpp/application/application_impl.h"
16 #include "mojo/public/cpp/application/application_runner.h" 17 #include "mojo/public/cpp/application/application_runner.h"
17 #include "mojo/public/cpp/system/core.h" 18 #include "mojo/public/cpp/system/core.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void OnEvent(mojo::EventPtr event, 69 void OnEvent(mojo::EventPtr event,
69 const mojo::Callback<void()>& callback) override { 70 const mojo::Callback<void()>& callback) override {
70 assert(event); 71 assert(event);
71 if (event->pointer_data.get()) 72 if (event->pointer_data.get())
72 gles2_client_->HandleInputEvent(*event); 73 gles2_client_->HandleInputEvent(*event);
73 callback.Run(); 74 callback.Run();
74 } 75 }
75 76
76 private: 77 private:
77 void SetEventDispatcher() { 78 void SetEventDispatcher() {
78 mojo::NativeViewportEventDispatcherPtr ptr; 79 mojo::InterfaceHandle<mojo::NativeViewportEventDispatcher> ptr;
79 dispatcher_binding_.Bind(GetProxy(&ptr)); 80 dispatcher_binding_.Bind(GetProxy(&ptr));
80 viewport_->SetEventDispatcher(ptr.Pass()); 81 viewport_->SetEventDispatcher(std::move(ptr));
81 } 82 }
82 83
83 void OnViewportConnectionError() { mojo::RunLoop::current()->Quit(); } 84 void OnViewportConnectionError() { mojo::RunLoop::current()->Quit(); }
84 85
85 scoped_ptr<GLES2ClientImpl> gles2_client_; 86 scoped_ptr<GLES2ClientImpl> gles2_client_;
86 mojo::NativeViewportPtr viewport_; 87 mojo::NativeViewportPtr viewport_;
87 mojo::ContextProviderPtr onscreen_context_provider_; 88 mojo::ContextProviderPtr onscreen_context_provider_;
88 mojo::Binding<NativeViewportEventDispatcher> dispatcher_binding_; 89 mojo::Binding<NativeViewportEventDispatcher> dispatcher_binding_;
89 90
90 DISALLOW_COPY_AND_ASSIGN(SpinningCubeApp); 91 DISALLOW_COPY_AND_ASSIGN(SpinningCubeApp);
91 }; 92 };
92 93
93 } // namespace examples 94 } // namespace examples
94 95
95 MojoResult MojoMain(MojoHandle application_request) { 96 MojoResult MojoMain(MojoHandle application_request) {
96 mojo::ApplicationRunner runner(std::unique_ptr<examples::SpinningCubeApp>( 97 mojo::ApplicationRunner runner(std::unique_ptr<examples::SpinningCubeApp>(
97 new examples::SpinningCubeApp())); 98 new examples::SpinningCubeApp()));
98 return runner.Run(application_request); 99 return runner.Run(application_request);
99 } 100 }
OLDNEW
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.cc ('k') | examples/ui/noodles/noodles_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698