| 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 "services/ui/public/cpp/context_provider.h" | 5 #include "services/ui/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 "services/ui/public/cpp/gles2_context.h" | 10 #include "services/ui/public/cpp/gles2_context.h" |
| 11 | 11 |
| 12 namespace ui { | 12 namespace ui { |
| 13 | 13 |
| 14 ContextProvider::ContextProvider() {} | 14 ContextProvider::ContextProvider(GpuService* gpu_service) |
| 15 : gpu_service_(gpu_service) {} |
| 15 | 16 |
| 16 bool ContextProvider::BindToCurrentThread() { | 17 bool ContextProvider::BindToCurrentThread() { |
| 17 context_ = GLES2Context::CreateOffscreenContext(std::vector<int32_t>()); | 18 context_ = GLES2Context::CreateOffscreenContext(gpu_service_); |
| 18 return !!context_; | 19 return !!context_; |
| 19 } | 20 } |
| 20 | 21 |
| 21 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { | 22 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { |
| 22 return context_->interface(); | 23 return context_->interface(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 gpu::ContextSupport* ContextProvider::ContextSupport() { | 26 gpu::ContextSupport* ContextProvider::ContextSupport() { |
| 26 if (!context_) | 27 if (!context_) |
| 27 return NULL; | 28 return NULL; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 45 base::Lock* ContextProvider::GetLock() { | 46 base::Lock* ContextProvider::GetLock() { |
| 46 // This context provider is not used on multiple threads. | 47 // This context provider is not used on multiple threads. |
| 47 NOTREACHED(); | 48 NOTREACHED(); |
| 48 return nullptr; | 49 return nullptr; |
| 49 } | 50 } |
| 50 | 51 |
| 51 ContextProvider::~ContextProvider() { | 52 ContextProvider::~ContextProvider() { |
| 52 } | 53 } |
| 53 | 54 |
| 54 } // namespace ui | 55 } // namespace ui |
| OLD | NEW |