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

Unified Diff: gpu/command_buffer/client/gl_in_process_context.cc

Issue 2275113002: Provide task runner to GLES2Impl / CommandBuffer at creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-cleanup4
Patch Set: cleanup Created 4 years, 4 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: gpu/command_buffer/client/gl_in_process_context.cc
diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc
index c87f23396c7d7d5096f012fd9d4962715d78ac8d..b70f57b6c43ac1f428978f00ae441d92c622ff3a 100644
--- a/gpu/command_buffer/client/gl_in_process_context.cc
+++ b/gpu/command_buffer/client/gl_in_process_context.cc
@@ -26,6 +26,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
@@ -103,6 +104,15 @@ bool GLInProcessContextImpl::Initialize(
DCHECK_GE(attribs.offscreen_framebuffer_size.width(), 0);
DCHECK_GE(attribs.offscreen_framebuffer_size.height(), 0);
+ // Setup the task runner which will be used by both the CommandBuffer and
+ // GLES2Implementation.
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner;
+ // If a surface is provided, we are running in a webview and do not have a
+ // task runner.
+ if (!surface) {
+ task_runner = base::ThreadTaskRunnerHandle::Get();
+ }
+
command_buffer_.reset(new InProcessCommandBuffer(service));
scoped_refptr<gles2::ShareGroup> share_group;
@@ -116,13 +126,9 @@ bool GLInProcessContextImpl::Initialize(
DCHECK(share_command_buffer);
}
- if (!command_buffer_->Initialize(surface,
- is_offscreen,
- window,
- attribs,
- share_command_buffer,
- gpu_memory_buffer_manager,
- image_factory)) {
+ if (!command_buffer_->Initialize(
+ surface, is_offscreen, window, attribs, share_command_buffer,
+ gpu_memory_buffer_manager, image_factory, task_runner)) {
DLOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
return false;
}
@@ -144,14 +150,11 @@ bool GLInProcessContextImpl::Initialize(
const bool support_client_side_arrays = false;
// Create the object exposing the OpenGL API.
- gles2_implementation_.reset(
- new gles2::GLES2Implementation(gles2_helper_.get(),
- share_group.get(),
- transfer_buffer_.get(),
- bind_generates_resource,
- attribs.lose_context_when_out_of_memory,
- support_client_side_arrays,
- command_buffer_.get()));
+ gles2_implementation_.reset(new gles2::GLES2Implementation(
+ gles2_helper_.get(), share_group.get(), transfer_buffer_.get(),
+ bind_generates_resource, attribs.lose_context_when_out_of_memory,
+ support_client_side_arrays, command_buffer_.get(),
+ std::move(task_runner)));
if (!gles2_implementation_->Initialize(
mem_limits.start_transfer_buffer_size,

Powered by Google App Engine
This is Rietveld 408576698