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

Unified Diff: services/ui/public/cpp/gles2_context.cc

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: fix unittests 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/public/cpp/gles2_context.cc
diff --git a/services/ui/public/cpp/gles2_context.cc b/services/ui/public/cpp/gles2_context.cc
index ba8cc3b52da86db84e863a761dc6e9cc5cfa2064..93f3dd6e5492fbe9d6b522ad94935b5488151589 100644
--- a/services/ui/public/cpp/gles2_context.cc
+++ b/services/ui/public/cpp/gles2_context.cc
@@ -26,7 +26,8 @@ GLES2Context::GLES2Context() {}
GLES2Context::~GLES2Context() {}
bool GLES2Context::Initialize(
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
DCHECK(gpu_channel_host);
gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget;
// TODO(penghuang): support shared group.
@@ -36,8 +37,6 @@ bool GLES2Context::Initialize(
gpu::gles2::ContextCreationAttribHelper attributes;
// TODO(penghuang): figure a useful active_url.
GURL active_url;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner =
- base::ThreadTaskRunnerHandle::Get();
command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create(
std::move(gpu_channel_host), surface_handle, shared_command_buffer,
stream_id, stream_priority, attributes, active_url,
@@ -74,14 +73,16 @@ bool GLES2Context::Initialize(
// static
std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext(
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
if (!gpu_channel_host)
return nullptr;
// Return the GLES2Context only if it is successfully initialized. If
// initialization fails, then return null.
std::unique_ptr<GLES2Context> gles2_context(new GLES2Context);
- if (!gles2_context->Initialize(std::move(gpu_channel_host)))
+ if (!gles2_context->Initialize(std::move(gpu_channel_host),
+ std::move(task_runner)))
gles2_context.reset();
return gles2_context;
}

Powered by Google App Engine
This is Rietveld 408576698