Chromium Code Reviews| Index: content/common/gpu/client/context_provider_command_buffer.cc |
| diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc |
| index 7c5e7fb64a50b6b3fa0544c589f53e03835c87e3..44af9e07a2301fe19fbbc9c8c36f85c54d9096ff 100644 |
| --- a/content/common/gpu/client/context_provider_command_buffer.cc |
| +++ b/content/common/gpu/client/context_provider_command_buffer.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/callback_helpers.h" |
| #include "base/command_line.h" |
| #include "base/strings/stringprintf.h" |
| +#include "base/thread_task_runner_handle.h" |
| #include "cc/output/managed_memory_policy.h" |
| #include "content/common/gpu/client/command_buffer_metrics.h" |
| #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| @@ -141,11 +142,15 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() { |
| // This command buffer is a client-side proxy to the command buffer in the |
| // GPU process. |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| + default_task_runner_; |
| + if (!task_runner) |
| + task_runner = base::ThreadTaskRunnerHandle::Get(); |
| command_buffer_ = channel_->CreateCommandBuffer( |
| surface_handle_, gfx::Size(), shared_command_buffer, |
| gpu::GpuChannelHost::kDefaultStreamId, |
| gpu::GpuChannelHost::kDefaultStreamPriority, serialized_attributes, |
| - active_url_, gpu_preference_); |
| + active_url_, gpu_preference_, task_runner); |
|
piman
2016/05/11 17:06:14
nit: std::move(task_runner)
|
| // The command buffer takes ownership of the |channel_|, so no need to keep |
| // a reference around here. |
| channel_ = nullptr; |
| @@ -281,6 +286,12 @@ void ContextProviderCommandBuffer::SetupLock() { |
| command_buffer_->SetLock(&context_lock_); |
| } |
| +void ContextProviderCommandBuffer::SetDefaultTaskRunner( |
| + scoped_refptr<base::SingleThreadTaskRunner> default_task_runner) { |
| + DCHECK(!bind_succeeded_); |
| + default_task_runner_ = default_task_runner; |
|
piman
2016/05/11 17:06:14
nit: std::move(default_task_runner)
|
| +} |
| + |
| base::Lock* ContextProviderCommandBuffer::GetLock() { |
| return &context_lock_; |
| } |