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