Commit 2fdaa044 authored by kylechar's avatar kylechar Committed by Commit Bot

Refactor InProcessCommandBuffer::Service.

There is a lot of complexity in InProcessCommandBuffer and the internal
Service class makes things more complex. This CL attempts to clean this
up a bit.

1. Move InProcessCommandBuffer::Service into it's own file and rename to
   GpuCommandService. Improve comments and modernize code slightly.
2. Make GpuCommandService a subclass of RefCountedThreadSafe, rather
   than all of the subclasses of GpuCommandService and then manually
   forwarding calls to AddRef() and Release(). This was originally done
   because GpuCommandService was a pure interface, however that is no
   longer the case.
3. Remove passing around const refs to scoped_refptrs. We can just pass
   the scoped_refptr by value in these cases.

Bug: 832243
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ib6dc5212ba71e3645e2649b5db43f2c06fbb14e2
Reviewed-on: https://chromium-review.googlesource.com/1118618
Commit-Queue: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572272}
parent 118f0d2f
...@@ -28,13 +28,13 @@ namespace android_webview { ...@@ -28,13 +28,13 @@ namespace android_webview {
scoped_refptr<AwRenderThreadContextProvider> scoped_refptr<AwRenderThreadContextProvider>
AwRenderThreadContextProvider::Create( AwRenderThreadContextProvider::Create(
scoped_refptr<gl::GLSurface> surface, scoped_refptr<gl::GLSurface> surface,
scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor) {
return new AwRenderThreadContextProvider(surface, service); return new AwRenderThreadContextProvider(surface, std::move(task_executor));
} }
AwRenderThreadContextProvider::AwRenderThreadContextProvider( AwRenderThreadContextProvider::AwRenderThreadContextProvider(
scoped_refptr<gl::GLSurface> surface, scoped_refptr<gl::GLSurface> surface,
scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor) {
DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(main_thread_checker_.CalledOnValidThread());
// This is an onscreen context, wrapping the GLSurface given to us from // This is an onscreen context, wrapping the GLSurface given to us from
...@@ -66,9 +66,9 @@ AwRenderThreadContextProvider::AwRenderThreadContextProvider( ...@@ -66,9 +66,9 @@ AwRenderThreadContextProvider::AwRenderThreadContextProvider(
limits.min_transfer_buffer_size = 64 * 1024; limits.min_transfer_buffer_size = 64 * 1024;
context_ = std::make_unique<gpu::GLInProcessContext>(); context_ = std::make_unique<gpu::GLInProcessContext>();
context_->Initialize(service, surface, surface->IsOffscreen(), context_->Initialize(std::move(task_executor), surface,
gpu::kNullSurfaceHandle, attributes, limits, nullptr, surface->IsOffscreen(), gpu::kNullSurfaceHandle,
nullptr, nullptr, nullptr); attributes, limits, nullptr, nullptr, nullptr, nullptr);
context_->GetImplementation()->SetLostContextCallback(base::BindOnce( context_->GetImplementation()->SetLostContextCallback(base::BindOnce(
&AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this)));
......
...@@ -36,7 +36,7 @@ class AwRenderThreadContextProvider ...@@ -36,7 +36,7 @@ class AwRenderThreadContextProvider
public: public:
static scoped_refptr<AwRenderThreadContextProvider> Create( static scoped_refptr<AwRenderThreadContextProvider> Create(
scoped_refptr<gl::GLSurface> surface, scoped_refptr<gl::GLSurface> surface,
scoped_refptr<gpu::InProcessCommandBuffer::Service> service); scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor);
// Gives the GL internal format that should be used for calling CopyTexImage2D // Gives the GL internal format that should be used for calling CopyTexImage2D
// on the default framebuffer. // on the default framebuffer.
...@@ -61,7 +61,7 @@ class AwRenderThreadContextProvider ...@@ -61,7 +61,7 @@ class AwRenderThreadContextProvider
AwRenderThreadContextProvider( AwRenderThreadContextProvider(
scoped_refptr<gl::GLSurface> surface, scoped_refptr<gl::GLSurface> surface,
scoped_refptr<gpu::InProcessCommandBuffer::Service> service); scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor);
~AwRenderThreadContextProvider() override; ~AwRenderThreadContextProvider() override;
private: private:
......
...@@ -82,11 +82,11 @@ DeferredGpuCommandService::DeferredGpuCommandService( ...@@ -82,11 +82,11 @@ DeferredGpuCommandService::DeferredGpuCommandService(
const gpu::GpuPreferences& gpu_preferences, const gpu::GpuPreferences& gpu_preferences,
const gpu::GPUInfo& gpu_info, const gpu::GPUInfo& gpu_info,
const gpu::GpuFeatureInfo& gpu_feature_info) const gpu::GpuFeatureInfo& gpu_feature_info)
: gpu::InProcessCommandBuffer::Service(gpu_preferences, : gpu::CommandBufferTaskExecutor(gpu_preferences,
nullptr, gpu_feature_info,
nullptr, nullptr,
gpu_feature_info), nullptr),
sync_point_manager_(new gpu::SyncPointManager()), sync_point_manager_(std::make_unique<gpu::SyncPointManager>()),
gpu_info_(gpu_info) {} gpu_info_(gpu_info) {}
DeferredGpuCommandService::~DeferredGpuCommandService() { DeferredGpuCommandService::~DeferredGpuCommandService() {
...@@ -200,14 +200,6 @@ void DeferredGpuCommandService::RunTasks() { ...@@ -200,14 +200,6 @@ void DeferredGpuCommandService::RunTasks() {
} }
} }
void DeferredGpuCommandService::AddRef() const {
base::RefCountedThreadSafe<DeferredGpuCommandService>::AddRef();
}
void DeferredGpuCommandService::Release() const {
base::RefCountedThreadSafe<DeferredGpuCommandService>::Release();
}
bool DeferredGpuCommandService::BlockThreadOnWaitSyncToken() const { bool DeferredGpuCommandService::BlockThreadOnWaitSyncToken() const {
return true; return true;
} }
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#include "base/containers/queue.h" #include "base/containers/queue.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/threading/thread_local.h" #include "base/threading/thread_local.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info.h"
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/ipc/in_process_command_buffer.h" #include "gpu/ipc/in_process_command_buffer.h"
namespace gpu { namespace gpu {
...@@ -41,9 +41,7 @@ class ScopedAllowGL { ...@@ -41,9 +41,7 @@ class ScopedAllowGL {
DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL); DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL);
}; };
class DeferredGpuCommandService class DeferredGpuCommandService : public gpu::CommandBufferTaskExecutor {
: public gpu::InProcessCommandBuffer::Service,
public base::RefCountedThreadSafe<DeferredGpuCommandService> {
public: public:
static DeferredGpuCommandService* GetInstance(); static DeferredGpuCommandService* GetInstance();
...@@ -60,8 +58,6 @@ class DeferredGpuCommandService ...@@ -60,8 +58,6 @@ class DeferredGpuCommandService
// idle tasks during the idle run. // idle tasks during the idle run.
void PerformAllIdleWork(); void PerformAllIdleWork();
void AddRef() const override;
void Release() const override;
bool BlockThreadOnWaitSyncToken() const override; bool BlockThreadOnWaitSyncToken() const override;
const gpu::GPUInfo& gpu_info() const { return gpu_info_; } const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
...@@ -70,7 +66,6 @@ class DeferredGpuCommandService ...@@ -70,7 +66,6 @@ class DeferredGpuCommandService
protected: protected:
~DeferredGpuCommandService() override; ~DeferredGpuCommandService() override;
friend class base::RefCountedThreadSafe<DeferredGpuCommandService>;
private: private:
friend class ScopedAllowGL; friend class ScopedAllowGL;
......
...@@ -255,7 +255,7 @@ void PixelTest::SetUpGpuServiceOnGpuThread(base::WaitableEvent* event) { ...@@ -255,7 +255,7 @@ void PixelTest::SetUpGpuServiceOnGpuThread(base::WaitableEvent* event) {
gpu_service_->InitializeWithHost( gpu_service_->InitializeWithHost(
std::move(gpu_host_proxy), gpu::GpuProcessActivityFlags(), std::move(gpu_host_proxy), gpu::GpuProcessActivityFlags(),
nullptr /* sync_point_manager */, nullptr /* shutdown_event */); nullptr /* sync_point_manager */, nullptr /* shutdown_event */);
gpu_command_service_ = base::MakeRefCounted<gpu::GpuInProcessThreadService>( task_executor_ = base::MakeRefCounted<gpu::GpuInProcessThreadService>(
gpu_thread_->task_runner(), gpu_service_->sync_point_manager(), gpu_thread_->task_runner(), gpu_service_->sync_point_manager(),
gpu_service_->mailbox_manager(), gpu_service_->share_group(), gpu_service_->mailbox_manager(), gpu_service_->share_group(),
gpu_service_->gpu_feature_info(), gpu_service_->gpu_feature_info(),
...@@ -304,7 +304,7 @@ void PixelTest::SetUpSkiaRendererDDL() { ...@@ -304,7 +304,7 @@ void PixelTest::SetUpSkiaRendererDDL() {
auto* gpu_channel_manager_delegate = gpu_channel_manager->delegate(); auto* gpu_channel_manager_delegate = gpu_channel_manager->delegate();
child_context_provider_ = child_context_provider_ =
base::MakeRefCounted<viz::VizProcessContextProvider>( base::MakeRefCounted<viz::VizProcessContextProvider>(
gpu_command_service_, gpu::kNullSurfaceHandle, task_executor_, gpu::kNullSurfaceHandle,
gpu_memory_buffer_manager_.get(), image_factory, gpu_memory_buffer_manager_.get(), image_factory,
gpu_channel_manager_delegate, gpu::SharedMemoryLimits()); gpu_channel_manager_delegate, gpu::SharedMemoryLimits());
child_context_provider_->BindToCurrentThread(); child_context_provider_->BindToCurrentThread();
...@@ -313,7 +313,7 @@ void PixelTest::SetUpSkiaRendererDDL() { ...@@ -313,7 +313,7 @@ void PixelTest::SetUpSkiaRendererDDL() {
} }
void PixelTest::TearDownGpuServiceOnGpuThread(base::WaitableEvent* event) { void PixelTest::TearDownGpuServiceOnGpuThread(base::WaitableEvent* event) {
gpu_command_service_ = nullptr; task_executor_ = nullptr;
gpu_service_ = nullptr; gpu_service_ = nullptr;
event->Signal(); event->Signal();
} }
...@@ -330,7 +330,7 @@ void PixelTest::TearDown() { ...@@ -330,7 +330,7 @@ void PixelTest::TearDown() {
resource_provider_ = nullptr; resource_provider_ = nullptr;
output_surface_ = nullptr; output_surface_ = nullptr;
if (gpu_command_service_) { if (task_executor_) {
// Tear down the GPU service. // Tear down the GPU service.
base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED); base::WaitableEvent::InitialState::NOT_SIGNALED);
......
...@@ -83,7 +83,7 @@ class PixelTest : public testing::Test { ...@@ -83,7 +83,7 @@ class PixelTest : public testing::Test {
std::unique_ptr<base::Thread> io_thread_; std::unique_ptr<base::Thread> io_thread_;
std::unique_ptr<viz::GpuServiceImpl> gpu_service_; std::unique_ptr<viz::GpuServiceImpl> gpu_service_;
std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_;
scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor_;
viz::RendererSettings renderer_settings_; viz::RendererSettings renderer_settings_;
gfx::Size device_viewport_size_; gfx::Size device_viewport_size_;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "components/viz/service/gl/gpu_service_impl.h" #include "components/viz/service/gl/gpu_service_impl.h"
#include "gpu/command_buffer/client/shared_memory_limits.h" #include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/service/image_factory.h" #include "gpu/command_buffer/service/image_factory.h"
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/ipc/common/surface_handle.h" #include "gpu/ipc/common/surface_handle.h"
#include "gpu/ipc/service/gpu_channel_manager.h" #include "gpu/ipc/service/gpu_channel_manager.h"
#include "gpu/ipc/service/gpu_channel_manager_delegate.h" #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
...@@ -71,14 +72,14 @@ namespace viz { ...@@ -71,14 +72,14 @@ namespace viz {
GpuDisplayProvider::GpuDisplayProvider( GpuDisplayProvider::GpuDisplayProvider(
uint32_t restart_id, uint32_t restart_id,
GpuServiceImpl* gpu_service_impl, GpuServiceImpl* gpu_service_impl,
scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor,
gpu::GpuChannelManager* gpu_channel_manager, gpu::GpuChannelManager* gpu_channel_manager,
ServerSharedBitmapManager* server_shared_bitmap_manager, ServerSharedBitmapManager* server_shared_bitmap_manager,
bool headless, bool headless,
bool wait_for_all_pipeline_stages_before_draw) bool wait_for_all_pipeline_stages_before_draw)
: restart_id_(restart_id), : restart_id_(restart_id),
gpu_service_impl_(gpu_service_impl), gpu_service_impl_(gpu_service_impl),
gpu_service_(std::move(gpu_service)), task_executor_(std::move(task_executor)),
gpu_channel_manager_delegate_(gpu_channel_manager->delegate()), gpu_channel_manager_delegate_(gpu_channel_manager->delegate()),
gpu_memory_buffer_manager_( gpu_memory_buffer_manager_(
std::make_unique<InProcessGpuMemoryBufferManager>( std::make_unique<InProcessGpuMemoryBufferManager>(
...@@ -133,7 +134,7 @@ std::unique_ptr<Display> GpuDisplayProvider::CreateDisplay( ...@@ -133,7 +134,7 @@ std::unique_ptr<Display> GpuDisplayProvider::CreateDisplay(
gpu::ContextResult context_result = gpu::ContextResult::kTransientFailure; gpu::ContextResult context_result = gpu::ContextResult::kTransientFailure;
while (context_result != gpu::ContextResult::kSuccess) { while (context_result != gpu::ContextResult::kSuccess) {
context_provider = base::MakeRefCounted<VizProcessContextProvider>( context_provider = base::MakeRefCounted<VizProcessContextProvider>(
gpu_service_, surface_handle, gpu_memory_buffer_manager_.get(), task_executor_, surface_handle, gpu_memory_buffer_manager_.get(),
image_factory_, gpu_channel_manager_delegate_, image_factory_, gpu_channel_manager_delegate_,
gpu::SharedMemoryLimits()); gpu::SharedMemoryLimits());
context_result = context_provider->BindToCurrentThread(); context_result = context_provider->BindToCurrentThread();
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
namespace gpu { namespace gpu {
class GpuChannelManager; class GpuChannelManager;
class GpuChannelManagerDelegate; class GpuChannelManagerDelegate;
class CommandBufferTaskExecutor;
class ImageFactory; class ImageFactory;
} // namespace gpu } // namespace gpu
...@@ -38,14 +39,13 @@ class SoftwareOutputDevice; ...@@ -38,14 +39,13 @@ class SoftwareOutputDevice;
// In-process implementation of DisplayProvider. // In-process implementation of DisplayProvider.
class VIZ_SERVICE_EXPORT GpuDisplayProvider : public DisplayProvider { class VIZ_SERVICE_EXPORT GpuDisplayProvider : public DisplayProvider {
public: public:
GpuDisplayProvider( GpuDisplayProvider(uint32_t restart_id,
uint32_t restart_id, GpuServiceImpl* gpu_service_impl,
GpuServiceImpl* gpu_service_impl, scoped_refptr<gpu::CommandBufferTaskExecutor> gpu_service,
scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service, gpu::GpuChannelManager* gpu_channel_manager,
gpu::GpuChannelManager* gpu_channel_manager, ServerSharedBitmapManager* server_shared_bitmap_manager,
ServerSharedBitmapManager* server_shared_bitmap_manager, bool headless,
bool headless, bool wait_for_all_pipeline_stages_before_draw);
bool wait_for_all_pipeline_stages_before_draw);
~GpuDisplayProvider() override; ~GpuDisplayProvider() override;
// DisplayProvider implementation. // DisplayProvider implementation.
...@@ -67,7 +67,7 @@ class VIZ_SERVICE_EXPORT GpuDisplayProvider : public DisplayProvider { ...@@ -67,7 +67,7 @@ class VIZ_SERVICE_EXPORT GpuDisplayProvider : public DisplayProvider {
const uint32_t restart_id_; const uint32_t restart_id_;
GpuServiceImpl* const gpu_service_impl_; GpuServiceImpl* const gpu_service_impl_;
scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_service_; scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor_;
gpu::GpuChannelManagerDelegate* const gpu_channel_manager_delegate_; gpu::GpuChannelManagerDelegate* const gpu_channel_manager_delegate_;
std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_; std::unique_ptr<gpu::GpuMemoryBufferManager> gpu_memory_buffer_manager_;
gpu::ImageFactory* const image_factory_; gpu::ImageFactory* const image_factory_;
......
...@@ -51,7 +51,7 @@ gpu::ContextCreationAttribs CreateAttributes() { ...@@ -51,7 +51,7 @@ gpu::ContextCreationAttribs CreateAttributes() {
} // namespace } // namespace
VizProcessContextProvider::VizProcessContextProvider( VizProcessContextProvider::VizProcessContextProvider(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service, scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor,
gpu::SurfaceHandle surface_handle, gpu::SurfaceHandle surface_handle,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::ImageFactory* image_factory, gpu::ImageFactory* image_factory,
...@@ -60,7 +60,7 @@ VizProcessContextProvider::VizProcessContextProvider( ...@@ -60,7 +60,7 @@ VizProcessContextProvider::VizProcessContextProvider(
: attributes_(CreateAttributes()), : attributes_(CreateAttributes()),
context_(std::make_unique<gpu::GLInProcessContext>()), context_(std::make_unique<gpu::GLInProcessContext>()),
context_result_( context_result_(
context_->Initialize(std::move(service), context_->Initialize(std::move(task_executor),
nullptr, nullptr,
(surface_handle == gpu::kNullSurfaceHandle), (surface_handle == gpu::kNullSurfaceHandle),
surface_handle, surface_handle,
......
...@@ -41,7 +41,7 @@ class VIZ_SERVICE_EXPORT VizProcessContextProvider ...@@ -41,7 +41,7 @@ class VIZ_SERVICE_EXPORT VizProcessContextProvider
public ContextProvider { public ContextProvider {
public: public:
VizProcessContextProvider( VizProcessContextProvider(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service, scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor,
gpu::SurfaceHandle surface_handle, gpu::SurfaceHandle surface_handle,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::ImageFactory* image_factory, gpu::ImageFactory* image_factory,
......
...@@ -297,11 +297,11 @@ void VizMainImpl::CreateFrameSinkManager( ...@@ -297,11 +297,11 @@ void VizMainImpl::CreateFrameSinkManager(
void VizMainImpl::CreateFrameSinkManagerInternal( void VizMainImpl::CreateFrameSinkManagerInternal(
mojom::FrameSinkManagerParamsPtr params) { mojom::FrameSinkManagerParamsPtr params) {
DCHECK(!gpu_command_service_); DCHECK(!task_executor_);
DCHECK(gpu_service_); DCHECK(gpu_service_);
DCHECK(gpu_thread_task_runner_->BelongsToCurrentThread()); DCHECK(gpu_thread_task_runner_->BelongsToCurrentThread());
gpu_command_service_ = base::MakeRefCounted<gpu::GpuInProcessThreadService>( task_executor_ = base::MakeRefCounted<gpu::GpuInProcessThreadService>(
gpu_thread_task_runner_, gpu_service_->sync_point_manager(), gpu_thread_task_runner_, gpu_service_->sync_point_manager(),
gpu_service_->mailbox_manager(), gpu_service_->share_group(), gpu_service_->mailbox_manager(), gpu_service_->share_group(),
gpu_service_->gpu_feature_info(), gpu_service_->gpu_feature_info(),
...@@ -326,7 +326,7 @@ void VizMainImpl::CreateFrameSinkManagerOnCompositorThread( ...@@ -326,7 +326,7 @@ void VizMainImpl::CreateFrameSinkManagerOnCompositorThread(
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
display_provider_ = std::make_unique<GpuDisplayProvider>( display_provider_ = std::make_unique<GpuDisplayProvider>(
params->restart_id, gpu_service_.get(), gpu_command_service_, params->restart_id, gpu_service_.get(), task_executor_,
gpu_service_->gpu_channel_manager(), server_shared_bitmap_manager_.get(), gpu_service_->gpu_channel_manager(), server_shared_bitmap_manager_.get(),
command_line->HasSwitch(switches::kHeadless), command_line->HasSwitch(switches::kHeadless),
command_line->HasSwitch(switches::kRunAllCompositorStagesBeforeDraw)); command_line->HasSwitch(switches::kRunAllCompositorStagesBeforeDraw));
......
...@@ -159,8 +159,10 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain { ...@@ -159,8 +159,10 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain {
std::unique_ptr<gpu::GpuInit> gpu_init_; std::unique_ptr<gpu::GpuInit> gpu_init_;
std::unique_ptr<GpuServiceImpl> gpu_service_; std::unique_ptr<GpuServiceImpl> gpu_service_;
// The InCommandCommandBuffer::Service used by the frame sink manager. // This is created for OOP-D only. It allows the display compositor to use
scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; // InProcessCommandBuffer to send GPU commands to the GPU thread from the
// compositor thread.
scoped_refptr<gpu::CommandBufferTaskExecutor> task_executor_;
// If the gpu service is not yet ready then we stash pending // If the gpu service is not yet ready then we stash pending
// FrameSinkManagerParams. // FrameSinkManagerParams.
......
...@@ -6,6 +6,8 @@ import("//build/config/ui.gni") ...@@ -6,6 +6,8 @@ import("//build/config/ui.gni")
component("gl_in_process_context") { component("gl_in_process_context") {
sources = [ sources = [
"command_buffer_task_executor.cc",
"command_buffer_task_executor.h",
"gl_in_process_context.cc", "gl_in_process_context.cc",
"gl_in_process_context.h", "gl_in_process_context.h",
"gl_in_process_context_export.h", "gl_in_process_context_export.h",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/command_buffer/service/gpu_tracer.h"
#include "gpu/command_buffer/service/mailbox_manager_factory.h"
#include "gpu/command_buffer/service/memory_program_cache.h"
#include "gpu/command_buffer/service/program_cache.h"
#include "ui/gl/gl_share_group.h"
namespace gpu {
CommandBufferTaskExecutor::CommandBufferTaskExecutor(
const GpuPreferences& gpu_preferences,
const GpuFeatureInfo& gpu_feature_info,
MailboxManager* mailbox_manager,
scoped_refptr<gl::GLShareGroup> share_group)
: gpu_preferences_(gpu_preferences),
gpu_feature_info_(gpu_feature_info),
mailbox_manager_(mailbox_manager),
share_group_(share_group),
shader_translator_cache_(gpu_preferences_) {
if (!mailbox_manager_) {
// TODO(piman): have embedders own the mailbox manager.
owned_mailbox_manager_ = gles2::CreateMailboxManager(gpu_preferences_);
mailbox_manager_ = owned_mailbox_manager_.get();
}
}
CommandBufferTaskExecutor::~CommandBufferTaskExecutor() = default;
scoped_refptr<gl::GLShareGroup> CommandBufferTaskExecutor::share_group() {
if (!share_group_)
share_group_ = base::MakeRefCounted<gl::GLShareGroup>();
return share_group_;
}
gles2::Outputter* CommandBufferTaskExecutor::outputter() {
if (!outputter_) {
outputter_ =
std::make_unique<gles2::TraceOutputter>("InProcessCommandBuffer Trace");
}
return outputter_.get();
}
gles2::ProgramCache* CommandBufferTaskExecutor::program_cache() {
if (!program_cache_ &&
(gl::g_current_gl_driver->ext.b_GL_ARB_get_program_binary ||
gl::g_current_gl_driver->ext.b_GL_OES_get_program_binary) &&
!gpu_preferences().disable_gpu_program_cache) {
bool disable_disk_cache =
gpu_preferences_.disable_gpu_shader_disk_cache ||
gpu_feature_info_.IsWorkaroundEnabled(gpu::DISABLE_PROGRAM_DISK_CACHE);
program_cache_ = std::make_unique<gles2::MemoryProgramCache>(
gpu_preferences_.gpu_program_cache_size, disable_disk_cache,
gpu_feature_info_.IsWorkaroundEnabled(
gpu::DISABLE_PROGRAM_CACHING_FOR_TRANSFORM_FEEDBACK),
&activity_flags_);
}
return program_cache_.get();
}
} // namespace gpu
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_IPC_COMMAND_BUFFER_TASK_EXECUTOR_H_
#define GPU_IPC_COMMAND_BUFFER_TASK_EXECUTOR_H_
#include <memory>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "gpu/command_buffer/common/activity_flags.h"
#include "gpu/command_buffer/service/framebuffer_completeness_cache.h"
#include "gpu/command_buffer/service/image_manager.h"
#include "gpu/command_buffer/service/service_discardable_manager.h"
#include "gpu/command_buffer/service/shader_translator_cache.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_preferences.h"
#include "gpu/ipc/gl_in_process_context_export.h"
namespace gl {
class GLShareGroup;
}
namespace gpu {
class MailboxManager;
class SyncPointManager;
namespace gles2 {
class Outputter;
class ProgramCache;
} // namespace gles2
// Provides accessors for GPU service objects and the serializer interface to
// the GPU thread used by InProcessCommandBuffer.
class GL_IN_PROCESS_CONTEXT_EXPORT CommandBufferTaskExecutor
: public base::RefCountedThreadSafe<CommandBufferTaskExecutor> {
public:
CommandBufferTaskExecutor(const GpuPreferences& gpu_preferences,
const GpuFeatureInfo& gpu_feature_info,
MailboxManager* mailbox_manager,
scoped_refptr<gl::GLShareGroup> share_group);
// Queues a task to run as soon as possible.
virtual void ScheduleTask(base::OnceClosure task) = 0;
// Schedules |callback| to run at an appropriate time for performing delayed
// work.
virtual void ScheduleDelayedWork(base::OnceClosure task) = 0;
// Always use virtualized GL contexts if this returns true.
virtual bool ForceVirtualizedGLContexts() = 0;
virtual bool BlockThreadOnWaitSyncToken() const = 0;
virtual SyncPointManager* sync_point_manager() = 0;
const GpuPreferences& gpu_preferences() const { return gpu_preferences_; }
const GpuFeatureInfo& gpu_feature_info() const { return gpu_feature_info_; }
scoped_refptr<gl::GLShareGroup> share_group();
MailboxManager* mailbox_manager() { return mailbox_manager_; }
gles2::Outputter* outputter();
gles2::ProgramCache* program_cache();
gles2::ImageManager* image_manager() { return &image_manager_; }
ServiceDiscardableManager* discardable_manager() {
return &discardable_manager_;
}
gles2::ShaderTranslatorCache* shader_translator_cache() {
return &shader_translator_cache_;
}
gles2::FramebufferCompletenessCache* framebuffer_completeness_cache() {
return &framebuffer_completeness_cache_;
}
protected:
friend class base::RefCountedThreadSafe<CommandBufferTaskExecutor>;
virtual ~CommandBufferTaskExecutor();
private:
const GpuPreferences gpu_preferences_;
const GpuFeatureInfo gpu_feature_info_;
std::unique_ptr<MailboxManager> owned_mailbox_manager_;
MailboxManager* mailbox_manager_ = nullptr;
std::unique_ptr<gles2::Outputter> outputter_;
scoped_refptr<gl::GLShareGroup> share_group_;
std::unique_ptr<gles2::ProgramCache> program_cache_;
gles2::ImageManager image_manager_;
ServiceDiscardableManager discardable_manager_;
gles2::ShaderTranslatorCache shader_translator_cache_;
gles2::FramebufferCompletenessCache framebuffer_completeness_cache_;
// No-op default initialization is used in in-process mode.
GpuProcessActivityFlags activity_flags_;
DISALLOW_COPY_AND_ASSIGN(CommandBufferTaskExecutor);
};
} // namespace gpu
#endif // GPU_IPC_COMMAND_BUFFER_TASK_EXECUTOR_H_
...@@ -69,7 +69,7 @@ void GLInProcessContext::SetUpdateVSyncParametersCallback( ...@@ -69,7 +69,7 @@ void GLInProcessContext::SetUpdateVSyncParametersCallback(
} }
ContextResult GLInProcessContext::Initialize( ContextResult GLInProcessContext::Initialize(
scoped_refptr<InProcessCommandBuffer::Service> service, scoped_refptr<CommandBufferTaskExecutor> task_executor,
scoped_refptr<gl::GLSurface> surface, scoped_refptr<gl::GLSurface> surface,
bool is_offscreen, bool is_offscreen,
SurfaceHandle window, SurfaceHandle window,
...@@ -89,7 +89,8 @@ ContextResult GLInProcessContext::Initialize( ...@@ -89,7 +89,8 @@ ContextResult GLInProcessContext::Initialize(
DCHECK_GE(attribs.offscreen_framebuffer_size.width(), 0); DCHECK_GE(attribs.offscreen_framebuffer_size.width(), 0);
DCHECK_GE(attribs.offscreen_framebuffer_size.height(), 0); DCHECK_GE(attribs.offscreen_framebuffer_size.height(), 0);
command_buffer_ = std::make_unique<InProcessCommandBuffer>(service); command_buffer_ =
std::make_unique<InProcessCommandBuffer>(std::move(task_executor));
auto result = command_buffer_->Initialize( auto result = command_buffer_->Initialize(
surface, is_offscreen, window, attribs, /*share_command_buffer=*/nullptr, surface, is_offscreen, window, attribs, /*share_command_buffer=*/nullptr,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "gpu/command_buffer/common/context_creation_attribs.h" #include "gpu/command_buffer/common/context_creation_attribs.h"
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/ipc/gl_in_process_context_export.h" #include "gpu/ipc/gl_in_process_context_export.h"
#include "gpu/ipc/in_process_command_buffer.h" #include "gpu/ipc/in_process_command_buffer.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -41,7 +42,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { ...@@ -41,7 +42,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext {
// to correctly create a surface. // to correctly create a surface.
// |gpu_channel_manager| should be non-null when used in the GPU process. // |gpu_channel_manager| should be non-null when used in the GPU process.
ContextResult Initialize( ContextResult Initialize(
scoped_refptr<InProcessCommandBuffer::Service> service, scoped_refptr<CommandBufferTaskExecutor> task_executor,
scoped_refptr<gl::GLSurface> surface, scoped_refptr<gl::GLSurface> surface,
bool is_offscreen, bool is_offscreen,
SurfaceHandle window, SurfaceHandle window,
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "gpu/ipc/gpu_in_process_thread_service.h" #include "gpu/ipc/gpu_in_process_thread_service.h"
#include "base/lazy_instance.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
namespace gpu { namespace gpu {
...@@ -16,10 +15,10 @@ GpuInProcessThreadService::GpuInProcessThreadService( ...@@ -16,10 +15,10 @@ GpuInProcessThreadService::GpuInProcessThreadService(
scoped_refptr<gl::GLShareGroup> share_group, scoped_refptr<gl::GLShareGroup> share_group,
const GpuFeatureInfo& gpu_feature_info, const GpuFeatureInfo& gpu_feature_info,
const GpuPreferences& gpu_preferences) const GpuPreferences& gpu_preferences)
: gpu::InProcessCommandBuffer::Service(gpu_preferences, : gpu::CommandBufferTaskExecutor(gpu_preferences,
mailbox_manager, gpu_feature_info,
share_group, mailbox_manager,
gpu_feature_info), share_group),
task_runner_(task_runner), task_runner_(task_runner),
sync_point_manager_(sync_point_manager) {} sync_point_manager_(sync_point_manager) {}
...@@ -40,14 +39,6 @@ gpu::SyncPointManager* GpuInProcessThreadService::sync_point_manager() { ...@@ -40,14 +39,6 @@ gpu::SyncPointManager* GpuInProcessThreadService::sync_point_manager() {
return sync_point_manager_; return sync_point_manager_;
} }
void GpuInProcessThreadService::AddRef() const {
base::RefCountedThreadSafe<GpuInProcessThreadService>::AddRef();
}
void GpuInProcessThreadService::Release() const {
base::RefCountedThreadSafe<GpuInProcessThreadService>::Release();
}
bool GpuInProcessThreadService::BlockThreadOnWaitSyncToken() const { bool GpuInProcessThreadService::BlockThreadOnWaitSyncToken() const {
return false; return false;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/ipc/gl_in_process_context_export.h" #include "gpu/ipc/gl_in_process_context_export.h"
#include "gpu/ipc/in_process_command_buffer.h" #include "gpu/ipc/in_process_command_buffer.h"
#include "ui/gl/gl_share_group.h" #include "ui/gl/gl_share_group.h"
...@@ -17,8 +18,7 @@ namespace gpu { ...@@ -17,8 +18,7 @@ namespace gpu {
// Default Service class when no service is specified. GpuInProcessThreadService // Default Service class when no service is specified. GpuInProcessThreadService
// is used by Mus and unit tests. // is used by Mus and unit tests.
class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
: public gpu::InProcessCommandBuffer::Service, : public gpu::CommandBufferTaskExecutor {
public base::RefCountedThreadSafe<GpuInProcessThreadService> {
public: public:
GpuInProcessThreadService( GpuInProcessThreadService(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
...@@ -28,18 +28,14 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService ...@@ -28,18 +28,14 @@ class GL_IN_PROCESS_CONTEXT_EXPORT GpuInProcessThreadService
const GpuFeatureInfo& gpu_feature_info, const GpuFeatureInfo& gpu_feature_info,
const GpuPreferences& gpu_preferences); const GpuPreferences& gpu_preferences);
// gpu::InProcessCommandBuffer::Service implementation. // gpu::CommandBufferTaskExecutor implementation.
void ScheduleTask(base::OnceClosure task) override; void ScheduleTask(base::OnceClosure task) override;
void ScheduleDelayedWork(base::OnceClosure task) override; void ScheduleDelayedWork(base::OnceClosure task) override;
bool ForceVirtualizedGLContexts() override; bool ForceVirtualizedGLContexts() override;
gpu::SyncPointManager* sync_point_manager() override; gpu::SyncPointManager* sync_point_manager() override;
void AddRef() const override;
void Release() const override;
bool BlockThreadOnWaitSyncToken() const override; bool BlockThreadOnWaitSyncToken() const override;
private: private:
friend class base::RefCountedThreadSafe<GpuInProcessThreadService>;
~GpuInProcessThreadService() override; ~GpuInProcessThreadService() override;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
......
This diff is collapsed.
...@@ -17,21 +17,18 @@ ...@@ -17,21 +17,18 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/containers/queue.h" #include "base/containers/queue.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "gpu/command_buffer/client/gpu_control.h" #include "gpu/command_buffer/client/gpu_control.h"
#include "gpu/command_buffer/common/activity_flags.h"
#include "gpu/command_buffer/common/command_buffer.h" #include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/context_result.h" #include "gpu/command_buffer/common/context_result.h"
#include "gpu/command_buffer/service/command_buffer_service.h" #include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/context_group.h" #include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/decoder_client.h" #include "gpu/command_buffer/service/decoder_client.h"
#include "gpu/command_buffer/service/decoder_context.h" #include "gpu/command_buffer/service/decoder_context.h"
#include "gpu/command_buffer/service/image_manager.h"
#include "gpu/command_buffer/service/service_discardable_manager.h" #include "gpu/command_buffer/service/service_discardable_manager.h"
#include "gpu/command_buffer/service/service_transfer_cache.h" #include "gpu/command_buffer/service/service_transfer_cache.h"
#include "gpu/config/gpu_feature_info.h" #include "gpu/config/gpu_feature_info.h"
...@@ -50,7 +47,6 @@ class SequenceChecker; ...@@ -50,7 +47,6 @@ class SequenceChecker;
namespace gl { namespace gl {
class GLContext; class GLContext;
class GLShareGroup; class GLShareGroup;
class GLSurface;
} }
namespace gfx { namespace gfx {
...@@ -59,26 +55,15 @@ class Size; ...@@ -59,26 +55,15 @@ class Size;
} }
namespace gpu { namespace gpu {
struct ContextCreationAttribs;
class MailboxManager;
class ServiceDiscardableManager;
class SyncPointClientState;
class SyncPointOrderData;
class SyncPointManager;
struct SwapBuffersCompleteParams;
namespace gles2 {
class FramebufferCompletenessCache;
class Outputter;
class ProgramCache;
class ShaderTranslatorCache;
}
class GpuChannelManagerDelegate; class GpuChannelManagerDelegate;
class CommandBufferTaskExecutor;
class GpuMemoryBufferManager; class GpuMemoryBufferManager;
class ImageFactory; class ImageFactory;
class SyncPointClientState;
class SyncPointOrderData;
class TransferBufferManager; class TransferBufferManager;
struct ContextCreationAttribs;
struct SwapBuffersCompleteParams;
// This class provides a thread-safe interface to the global GPU service (for // This class provides a thread-safe interface to the global GPU service (for
// example GPU thread) when being run in single process mode. // example GPU thread) when being run in single process mode.
...@@ -91,9 +76,8 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer ...@@ -91,9 +76,8 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
public DecoderClient, public DecoderClient,
public ImageTransportSurfaceDelegate { public ImageTransportSurfaceDelegate {
public: public:
class Service; explicit InProcessCommandBuffer(
scoped_refptr<CommandBufferTaskExecutor> task_executer);
explicit InProcessCommandBuffer(const scoped_refptr<Service>& service);
~InProcessCommandBuffer() override; ~InProcessCommandBuffer() override;
// If |surface| is not null, use it directly; in this case, the command // If |surface| is not null, use it directly; in this case, the command
...@@ -202,64 +186,9 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer ...@@ -202,64 +186,9 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
static const int kGpuClientId; static const int kGpuClientId;
// The serializer interface to the GPU service (i.e. thread). CommandBufferTaskExecutor* service_for_testing() const {
class Service { return task_executor_.get();
public: }
Service(const GpuPreferences& gpu_preferences,
MailboxManager* mailbox_manager,
scoped_refptr<gl::GLShareGroup> share_group,
const GpuFeatureInfo& gpu_feature_info);
virtual ~Service();
virtual void AddRef() const = 0;
virtual void Release() const = 0;
// Queues a task to run as soon as possible.
virtual void ScheduleTask(base::OnceClosure task) = 0;
// Schedules |callback| to run at an appropriate time for performing delayed
// work.
virtual void ScheduleDelayedWork(base::OnceClosure task) = 0;
virtual bool ForceVirtualizedGLContexts() = 0;
virtual SyncPointManager* sync_point_manager() = 0;
virtual bool BlockThreadOnWaitSyncToken() const = 0;
const GpuPreferences& gpu_preferences();
const GpuFeatureInfo& gpu_feature_info() { return gpu_feature_info_; }
scoped_refptr<gl::GLShareGroup> share_group();
MailboxManager* mailbox_manager() { return mailbox_manager_; }
gles2::Outputter* outputter();
gles2::ProgramCache* program_cache();
gles2::ImageManager* image_manager() { return &image_manager_; }
ServiceDiscardableManager* discardable_manager() {
return &discardable_manager_;
}
gles2::ShaderTranslatorCache* shader_translator_cache() {
return &shader_translator_cache_;
}
gles2::FramebufferCompletenessCache* framebuffer_completeness_cache() {
return &framebuffer_completeness_cache_;
}
protected:
const GpuPreferences gpu_preferences_;
const GpuFeatureInfo gpu_feature_info_;
std::unique_ptr<MailboxManager> owned_mailbox_manager_;
MailboxManager* mailbox_manager_ = nullptr;
std::unique_ptr<gles2::Outputter> outputter_;
scoped_refptr<gl::GLShareGroup> share_group_;
std::unique_ptr<gles2::ProgramCache> program_cache_;
// No-op default initialization is used in in-process mode.
GpuProcessActivityFlags activity_flags_;
gles2::ImageManager image_manager_;
ServiceDiscardableManager discardable_manager_;
gles2::ShaderTranslatorCache shader_translator_cache_;
gles2::FramebufferCompletenessCache framebuffer_completeness_cache_;
};
Service* service_for_testing() const { return service_.get(); }
private: private:
struct InitializeOnGpuThreadParams { struct InitializeOnGpuThreadParams {
...@@ -361,7 +290,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer ...@@ -361,7 +290,7 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
std::unique_ptr<CommandBufferService> command_buffer_; std::unique_ptr<CommandBufferService> command_buffer_;
base::Lock command_buffer_lock_; base::Lock command_buffer_lock_;
base::WaitableEvent flush_event_; base::WaitableEvent flush_event_;
scoped_refptr<Service> service_; scoped_refptr<CommandBufferTaskExecutor> task_executor_;
// The group of contexts that share namespaces with this context. // The group of contexts that share namespaces with this context.
scoped_refptr<gles2::ContextGroup> context_group_; scoped_refptr<gles2::ContextGroup> context_group_;
......
...@@ -41,7 +41,7 @@ RasterInProcessContext::~RasterInProcessContext() { ...@@ -41,7 +41,7 @@ RasterInProcessContext::~RasterInProcessContext() {
} }
ContextResult RasterInProcessContext::Initialize( ContextResult RasterInProcessContext::Initialize(
scoped_refptr<InProcessCommandBuffer::Service> service, scoped_refptr<CommandBufferTaskExecutor> task_executor,
const ContextCreationAttribs& attribs, const ContextCreationAttribs& attribs,
const SharedMemoryLimits& memory_limits, const SharedMemoryLimits& memory_limits,
GpuMemoryBufferManager* gpu_memory_buffer_manager, GpuMemoryBufferManager* gpu_memory_buffer_manager,
...@@ -57,7 +57,8 @@ ContextResult RasterInProcessContext::Initialize( ...@@ -57,7 +57,8 @@ ContextResult RasterInProcessContext::Initialize(
} }
client_task_runner_ = base::MakeRefCounted<base::TestSimpleTaskRunner>(); client_task_runner_ = base::MakeRefCounted<base::TestSimpleTaskRunner>();
command_buffer_ = std::make_unique<InProcessCommandBuffer>(service); command_buffer_ =
std::make_unique<InProcessCommandBuffer>(std::move(task_executor));
auto result = command_buffer_->Initialize( auto result = command_buffer_->Initialize(
nullptr /* surface */, true /* is_offscreen */, kNullSurfaceHandle, nullptr /* surface */, true /* is_offscreen */, kNullSurfaceHandle,
attribs, nullptr /* share_command_buffer */, gpu_memory_buffer_manager, attribs, nullptr /* share_command_buffer */, gpu_memory_buffer_manager,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "gpu/ipc/command_buffer_task_executor.h"
#include "gpu/ipc/in_process_command_buffer.h" #include "gpu/ipc/in_process_command_buffer.h"
namespace base { namespace base {
...@@ -40,7 +41,7 @@ class RasterInProcessContext { ...@@ -40,7 +41,7 @@ class RasterInProcessContext {
// pairs. |gpu_channel_manager| should be non-null when used in the GPU // pairs. |gpu_channel_manager| should be non-null when used in the GPU
// process. // process.
ContextResult Initialize( ContextResult Initialize(
scoped_refptr<InProcessCommandBuffer::Service> service, scoped_refptr<CommandBufferTaskExecutor> task_executor,
const ContextCreationAttribs& attribs, const ContextCreationAttribs& attribs,
const SharedMemoryLimits& memory_limits, const SharedMemoryLimits& memory_limits,
GpuMemoryBufferManager* gpu_memory_buffer_manager, GpuMemoryBufferManager* gpu_memory_buffer_manager,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment