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 "cc/output/context_cache_controller.h" | 10 #include "cc/output/context_cache_controller.h" |
11 #include "gpu/ipc/client/gpu_channel_host.h" | 11 #include "gpu/ipc/client/gpu_channel_host.h" |
12 #include "services/ui/public/cpp/gles2_context.h" | 12 #include "services/ui/public/cpp/gles2_context.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 ContextProvider::ContextProvider( | 16 ContextProvider::ContextProvider( |
17 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) | 17 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) |
18 : gpu_channel_host_(std::move(gpu_channel_host)) {} | 18 : gpu_channel_host_(std::move(gpu_channel_host)) {} |
19 | 19 |
20 bool ContextProvider::BindToCurrentThread() { | 20 bool ContextProvider::BindToCurrentThread() { |
21 context_ = GLES2Context::CreateOffscreenContext(gpu_channel_host_); | 21 context_ = GLES2Context::CreateOffscreenContext( |
| 22 gpu_channel_host_, base::ThreadTaskRunnerHandle::Get()); |
22 if (context_) { | 23 if (context_) { |
23 cache_controller_.reset( | 24 cache_controller_.reset(new cc::ContextCacheController( |
24 new cc::ContextCacheController(context_->context_support())); | 25 context_->context_support(), base::ThreadTaskRunnerHandle::Get())); |
25 } | 26 } |
26 return !!context_; | 27 return !!context_; |
27 } | 28 } |
28 | 29 |
29 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { | 30 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { |
30 return context_->interface(); | 31 return context_->interface(); |
31 } | 32 } |
32 | 33 |
33 gpu::ContextSupport* ContextProvider::ContextSupport() { | 34 gpu::ContextSupport* ContextProvider::ContextSupport() { |
34 if (!context_) | 35 if (!context_) |
(...skipping 22 matching lines...) Expand all Loading... |
57 base::Lock* ContextProvider::GetLock() { | 58 base::Lock* ContextProvider::GetLock() { |
58 // This context provider is not used on multiple threads. | 59 // This context provider is not used on multiple threads. |
59 NOTREACHED(); | 60 NOTREACHED(); |
60 return nullptr; | 61 return nullptr; |
61 } | 62 } |
62 | 63 |
63 ContextProvider::~ContextProvider() { | 64 ContextProvider::~ContextProvider() { |
64 } | 65 } |
65 | 66 |
66 } // namespace ui | 67 } // namespace ui |
OLD | NEW |