OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "examples/surfaces_app/child_gl_impl.h" | 5 #include "examples/surfaces_app/child_gl_impl.h" |
6 | 6 |
7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 start_time_(base::TimeTicks::Now()), | 52 start_time_(base::TimeTicks::Now()), |
53 next_resource_id_(1), | 53 next_resource_id_(1), |
54 returner_binding_(this), | 54 returner_binding_(this), |
55 binding_(this, request.Pass()) { | 55 binding_(this, request.Pass()) { |
56 surfaces_service_connection->ConnectToService(&surface_); | 56 surfaces_service_connection->ConnectToService(&surface_); |
57 surface_->GetIdNamespace( | 57 surface_->GetIdNamespace( |
58 base::Bind(&ChildGLImpl::SetIdNamespace, base::Unretained(this))); | 58 base::Bind(&ChildGLImpl::SetIdNamespace, base::Unretained(this))); |
59 ResourceReturnerPtr returner_ptr; | 59 ResourceReturnerPtr returner_ptr; |
60 returner_binding_.Bind(GetProxy(&returner_ptr)); | 60 returner_binding_.Bind(GetProxy(&returner_ptr)); |
61 surface_->SetResourceReturner(returner_ptr.Pass()); | 61 surface_->SetResourceReturner(returner_ptr.Pass()); |
62 context_ = | 62 context_ = MojoGLES2CreateContext( |
63 MojoGLES2CreateContext(command_buffer.PassMessagePipe().release().value(), | 63 command_buffer.PassInterface().PassHandle().release().value(), |
64 &ContextLostThunk, | 64 &ContextLostThunk, this, Environment::GetDefaultAsyncWaiter()); |
65 this, | |
66 Environment::GetDefaultAsyncWaiter()); | |
67 DCHECK(context_); | 65 DCHECK(context_); |
68 MojoGLES2MakeCurrent(context_); | 66 MojoGLES2MakeCurrent(context_); |
69 } | 67 } |
70 | 68 |
71 ChildGLImpl::~ChildGLImpl() { | 69 ChildGLImpl::~ChildGLImpl() { |
72 MojoGLES2DestroyContext(context_); | 70 MojoGLES2DestroyContext(context_); |
73 surface_->DestroySurface(local_id_); | 71 surface_->DestroySurface(local_id_); |
74 } | 72 } |
75 | 73 |
76 void ChildGLImpl::ProduceFrame(ColorPtr color, | 74 void ChildGLImpl::ProduceFrame(ColorPtr color, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure()); | 197 surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure()); |
200 | 198 |
201 base::MessageLoop::current()->PostDelayedTask( | 199 base::MessageLoop::current()->PostDelayedTask( |
202 FROM_HERE, | 200 FROM_HERE, |
203 base::Bind(&ChildGLImpl::Draw, base::Unretained(this)), | 201 base::Bind(&ChildGLImpl::Draw, base::Unretained(this)), |
204 base::TimeDelta::FromMilliseconds(50)); | 202 base::TimeDelta::FromMilliseconds(50)); |
205 } | 203 } |
206 | 204 |
207 } // namespace examples | 205 } // namespace examples |
208 } // namespace mojo | 206 } // namespace mojo |
OLD | NEW |