Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: services/ui/public/cpp/context_provider.cc

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: cleanup Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 auto task_runner = base::ThreadTaskRunnerHandle::Get();
22 context_ =
23 GLES2Context::CreateOffscreenContext(gpu_channel_host_, task_runner);
22 if (context_) { 24 if (context_) {
23 cache_controller_.reset( 25 cache_controller_.reset(new cc::ContextCacheController(
24 new cc::ContextCacheController(context_->context_support())); 26 context_->context_support(), std::move(task_runner)));
25 } 27 }
26 return !!context_; 28 return !!context_;
27 } 29 }
28 30
29 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { 31 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() {
30 return context_->interface(); 32 return context_->interface();
31 } 33 }
32 34
33 gpu::ContextSupport* ContextProvider::ContextSupport() { 35 gpu::ContextSupport* ContextProvider::ContextSupport() {
34 if (!context_) 36 if (!context_)
(...skipping 22 matching lines...) Expand all
57 base::Lock* ContextProvider::GetLock() { 59 base::Lock* ContextProvider::GetLock() {
58 // This context provider is not used on multiple threads. 60 // This context provider is not used on multiple threads.
59 NOTREACHED(); 61 NOTREACHED();
60 return nullptr; 62 return nullptr;
61 } 63 }
62 64
63 ContextProvider::~ContextProvider() { 65 ContextProvider::~ContextProvider() {
64 } 66 }
65 67
66 } // namespace ui 68 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698