| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 static void ContextLostThunk(void*) { | 43 static void ContextLostThunk(void*) { |
| 44 LOG(FATAL) << "Context lost"; | 44 LOG(FATAL) << "Context lost"; |
| 45 } | 45 } |
| 46 | 46 |
| 47 ChildGLImpl::ChildGLImpl(ApplicationConnection* surfaces_service_connection, | 47 ChildGLImpl::ChildGLImpl(ApplicationConnection* surfaces_service_connection, |
| 48 CommandBufferPtr command_buffer) | 48 CommandBufferPtr command_buffer) |
| 49 : id_namespace_(0u), | 49 : id_namespace_(0u), |
| 50 local_id_(1u), | 50 local_id_(1u), |
| 51 start_time_(base::TimeTicks::Now()), | 51 start_time_(base::TimeTicks::Now()), |
| 52 next_resource_id_(1) { | 52 next_resource_id_(1), |
| 53 returner_binding_(this) { |
| 53 surfaces_service_connection->ConnectToService(&surface_); | 54 surfaces_service_connection->ConnectToService(&surface_); |
| 54 surface_.set_client(this); | 55 surface_->GetIdNamespace( |
| 56 base::Bind(&ChildGLImpl::SetIdNamespace, base::Unretained(this))); |
| 57 ResourceReturnerPtr returner_ptr; |
| 58 returner_binding_.Bind(GetProxy(&returner_ptr)); |
| 59 surface_->SetResourceReturner(returner_ptr.Pass()); |
| 55 context_ = | 60 context_ = |
| 56 MojoGLES2CreateContext(command_buffer.PassMessagePipe().release().value(), | 61 MojoGLES2CreateContext(command_buffer.PassMessagePipe().release().value(), |
| 57 &ContextLostThunk, | 62 &ContextLostThunk, |
| 58 this, | 63 this, |
| 59 Environment::GetDefaultAsyncWaiter()); | 64 Environment::GetDefaultAsyncWaiter()); |
| 60 DCHECK(context_); | 65 DCHECK(context_); |
| 61 MojoGLES2MakeCurrent(context_); | 66 MojoGLES2MakeCurrent(context_); |
| 62 } | 67 } |
| 63 | 68 |
| 64 ChildGLImpl::~ChildGLImpl() { | 69 ChildGLImpl::~ChildGLImpl() { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure()); | 187 surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure()); |
| 183 | 188 |
| 184 base::MessageLoop::current()->PostDelayedTask( | 189 base::MessageLoop::current()->PostDelayedTask( |
| 185 FROM_HERE, | 190 FROM_HERE, |
| 186 base::Bind(&ChildGLImpl::Draw, base::Unretained(this)), | 191 base::Bind(&ChildGLImpl::Draw, base::Unretained(this)), |
| 187 base::TimeDelta::FromMilliseconds(50)); | 192 base::TimeDelta::FromMilliseconds(50)); |
| 188 } | 193 } |
| 189 | 194 |
| 190 } // namespace examples | 195 } // namespace examples |
| 191 } // namespace mojo | 196 } // namespace mojo |
| OLD | NEW |