| 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 "components/mus/public/cpp/context_provider.h" | 5 #include "components/mus/public/cpp/context_provider.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/mus/public/cpp/gles2_context.h" | 10 #include "components/mus/public/cpp/gles2_context.h" |
| 11 | 11 |
| 12 namespace mus { | 12 namespace mus { |
| 13 | 13 |
| 14 ContextProvider::ContextProvider( | 14 ContextProvider::ContextProvider( |
| 15 mojo::ScopedMessagePipeHandle command_buffer_handle) | 15 mojo::ScopedMessagePipeHandle command_buffer_handle) |
| 16 : command_buffer_handle_(std::move(command_buffer_handle)), | 16 : command_buffer_handle_(std::move(command_buffer_handle)), |
| 17 context_(nullptr) { | 17 context_(nullptr) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool ContextProvider::BindToCurrentThread() { | 20 bool ContextProvider::BindToCurrentThread() { |
| 21 DCHECK(command_buffer_handle_.is_valid()); | |
| 22 std::unique_ptr<GLES2Context> context(new GLES2Context( | 21 std::unique_ptr<GLES2Context> context(new GLES2Context( |
| 23 std::vector<int32_t>(), std::move(command_buffer_handle_), | 22 std::vector<int32_t>(), std::move(command_buffer_handle_))); |
| 24 &ContextLostThunk, this)); | |
| 25 if (context->Initialize()) | 23 if (context->Initialize()) |
| 26 context_ = std::move(context); | 24 context_ = std::move(context); |
| 27 return !!context_; | 25 return !!context_; |
| 28 } | 26 } |
| 29 | 27 |
| 30 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { | 28 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { |
| 31 return context_->interface(); | 29 return context_->interface(); |
| 32 } | 30 } |
| 33 | 31 |
| 34 gpu::ContextSupport* ContextProvider::ContextSupport() { | 32 gpu::ContextSupport* ContextProvider::ContextSupport() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 | 51 |
| 54 base::Lock* ContextProvider::GetLock() { | 52 base::Lock* ContextProvider::GetLock() { |
| 55 // This context provider is not used on multiple threads. | 53 // This context provider is not used on multiple threads. |
| 56 NOTREACHED(); | 54 NOTREACHED(); |
| 57 return nullptr; | 55 return nullptr; |
| 58 } | 56 } |
| 59 | 57 |
| 60 ContextProvider::~ContextProvider() { | 58 ContextProvider::~ContextProvider() { |
| 61 } | 59 } |
| 62 | 60 |
| 63 void ContextProvider::ContextLost() {} | |
| 64 | |
| 65 } // namespace mus | 61 } // namespace mus |
| OLD | NEW |