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 "mojo/cc/context_provider_mojo.h" | 5 #include "mojo/cc/context_provider_mojo.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 8 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
9 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" | 9 #include "third_party/mojo/src/mojo/public/cpp/environment/environment.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 | 12 |
13 ContextProviderMojo::ContextProviderMojo( | 13 ContextProviderMojo::ContextProviderMojo( |
14 ScopedMessagePipeHandle command_buffer_handle) | 14 ScopedMessagePipeHandle command_buffer_handle) |
15 : command_buffer_handle_(command_buffer_handle.Pass()) { | 15 : command_buffer_handle_(command_buffer_handle.Pass()), |
| 16 context_(nullptr) { |
16 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The | 17 // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The |
17 // implementation of which is used in CommandBufferDriver. | 18 // implementation of which is used in CommandBufferDriver. |
18 capabilities_.gpu.image = true; | 19 capabilities_.gpu.image = true; |
19 } | 20 } |
20 | 21 |
21 bool ContextProviderMojo::BindToCurrentThread() { | 22 bool ContextProviderMojo::BindToCurrentThread() { |
22 DCHECK(command_buffer_handle_.is_valid()); | 23 DCHECK(command_buffer_handle_.is_valid()); |
23 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), | 24 context_ = MojoGLES2CreateContext(command_buffer_handle_.release().value(), |
24 &ContextLostThunk, | 25 &ContextLostThunk, |
25 this, | 26 this, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ContextProviderMojo::~ContextProviderMojo() { | 61 ContextProviderMojo::~ContextProviderMojo() { |
61 context_gl_.reset(); | 62 context_gl_.reset(); |
62 if (context_) | 63 if (context_) |
63 MojoGLES2DestroyContext(context_); | 64 MojoGLES2DestroyContext(context_); |
64 } | 65 } |
65 | 66 |
66 void ContextProviderMojo::ContextLost() { | 67 void ContextProviderMojo::ContextLost() { |
67 } | 68 } |
68 | 69 |
69 } // namespace mojo | 70 } // namespace mojo |
OLD | NEW |