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

Unified Diff: examples/spinning_cube/gles2_client_impl.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.h ('k') | examples/spinning_cube/spinning_cube_app.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/spinning_cube/gles2_client_impl.cc
diff --git a/examples/spinning_cube/gles2_client_impl.cc b/examples/spinning_cube/gles2_client_impl.cc
index 7cbcc4965e62b85064472a1d5a6befc272e599e2..7ba8ca02dc133ab1f7be0684ef80f99e7bf36c94 100644
--- a/examples/spinning_cube/gles2_client_impl.cc
+++ b/examples/spinning_cube/gles2_client_impl.cc
@@ -11,6 +11,7 @@
#include <math.h>
#include <stdlib.h>
#include <cmath>
+#include <utility>
#include "mojo/public/c/gpu/MGL/mgl.h"
#include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
@@ -56,10 +57,11 @@ GLES2ClientImpl::GLES2ClientImpl(mojo::ContextProviderPtr context_provider)
waiting_to_draw_(false),
context_provider_(context_provider.Pass()),
context_(nullptr) {
- context_provider_->Create(nullptr,
- [this](mojo::CommandBufferPtr command_buffer) {
- ContextCreated(command_buffer.Pass());
- });
+ context_provider_->Create(
+ nullptr,
+ [this](mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) {
+ ContextCreated(std::move(command_buffer));
+ });
}
GLES2ClientImpl::~GLES2ClientImpl() {
@@ -132,12 +134,12 @@ void GLES2ClientImpl::HandleInputEvent(const mojo::Event& event) {
}
}
-void GLES2ClientImpl::ContextCreated(mojo::CommandBufferPtr command_buffer) {
- context_ = MGLCreateContext(
- MGL_API_VERSION_GLES2,
- command_buffer.PassInterfaceHandle().PassHandle().release().value(),
- MGL_NO_CONTEXT, &ContextLostThunk, this,
- mojo::Environment::GetDefaultAsyncWaiter());
+void GLES2ClientImpl::ContextCreated(
+ mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) {
+ context_ = MGLCreateContext(MGL_API_VERSION_GLES2,
+ command_buffer.PassHandle().release().value(),
+ MGL_NO_CONTEXT, &ContextLostThunk, this,
+ mojo::Environment::GetDefaultAsyncWaiter());
MGLMakeCurrent(context_);
cube_.Init();
WantToDraw();
@@ -147,10 +149,11 @@ void GLES2ClientImpl::ContextLost() {
cube_.OnGLContextLost();
MGLDestroyContext(context_);
context_ = nullptr;
- context_provider_->Create(nullptr,
- [this](mojo::CommandBufferPtr command_buffer) {
- ContextCreated(command_buffer.Pass());
- });
+ context_provider_->Create(
+ nullptr,
+ [this](mojo::InterfaceHandle<mojo::CommandBuffer> command_buffer) {
+ ContextCreated(std::move(command_buffer));
+ });
}
void GLES2ClientImpl::ContextLostThunk(void* closure) {
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.h ('k') | examples/spinning_cube/spinning_cube_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698