Skip to content

Commit

Permalink
Remove unnecessary parameter from InProcessCommandBuffer::Initialize
Browse files Browse the repository at this point in the history
We always pass nullptr for |share_group| so just get rid of it.

Change-Id: I3c59a027748c885df02538f582b1309338f2dc8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1596842
Auto-Submit: Saman Sami <samans@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656834}
  • Loading branch information
Saman Sami authored and Commit Bot committed May 6, 2019
1 parent 9ebef8e commit 766fa71
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ void VizProcessContextProvider::InitializeContext(
GURL("chrome://gpu/VizProcessContextProvider::InitializeContext"));
context_result_ = command_buffer_->Initialize(
/*surface=*/nullptr, is_offscreen, surface_handle, attributes_,
/*share_command_buffer=*/nullptr, gpu_memory_buffer_manager,
image_factory, gpu_channel_manager_delegate,
gpu_memory_buffer_manager, image_factory, gpu_channel_manager_delegate,
base::ThreadTaskRunnerHandle::Get(), nullptr, nullptr);
if (context_result_ != gpu::ContextResult::kSuccess) {
DLOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
Expand Down
10 changes: 5 additions & 5 deletions gpu/ipc/gl_in_process_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ ContextResult GLInProcessContext::Initialize(
command_buffer_ = std::make_unique<InProcessCommandBuffer>(
task_executor, GURL("chrome://gpu/GLInProcessContext::Initialize"));

auto result = command_buffer_->Initialize(
surface, is_offscreen, window, attribs, /*share_command_buffer=*/nullptr,
gpu_memory_buffer_manager, image_factory,
/*gpu_channel_manager_delegate=*/nullptr, std::move(task_runner), nullptr,
nullptr);
auto result =
command_buffer_->Initialize(surface, is_offscreen, window, attribs,
gpu_memory_buffer_manager, image_factory,
/*gpu_channel_manager_delegate=*/nullptr,
std::move(task_runner), nullptr, nullptr);
if (result != ContextResult::kSuccess) {
DLOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
return result;
Expand Down
77 changes: 33 additions & 44 deletions gpu/ipc/in_process_command_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,13 @@ gpu::ContextResult InProcessCommandBuffer::Initialize(
bool is_offscreen,
SurfaceHandle surface_handle,
const ContextCreationAttribs& attribs,
InProcessCommandBuffer* share_group,
GpuMemoryBufferManager* gpu_memory_buffer_manager,
ImageFactory* image_factory,
GpuChannelManagerDelegate* gpu_channel_manager_delegate,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
gpu::raster::GrShaderCache* gr_shader_cache,
GpuProcessActivityFlags* activity_flags) {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
DCHECK(!share_group || task_executor_ == share_group->task_executor_);
TRACE_EVENT0("gpu", "InProcessCommandBuffer::Initialize")

is_offscreen_ = is_offscreen;
Expand All @@ -385,8 +383,8 @@ gpu::ContextResult InProcessCommandBuffer::Initialize(

Capabilities capabilities;
InitializeOnGpuThreadParams params(surface_handle, attribs, &capabilities,
share_group, image_factory,
gr_shader_cache, activity_flags);
image_factory, gr_shader_cache,
activity_flags);

base::OnceCallback<gpu::ContextResult(void)> init_task =
base::BindOnce(&InProcessCommandBuffer::InitializeOnGpuThread,
Expand Down Expand Up @@ -422,41 +420,36 @@ gpu::ContextResult InProcessCommandBuffer::InitializeOnGpuThread(
GpuDriverBugWorkarounds workarounds(
task_executor_->gpu_feature_info().enabled_gpu_driver_bug_workarounds);

if (params.share_command_buffer) {
context_group_ = params.share_command_buffer->context_group_;
} else {
std::unique_ptr<MemoryTracker> memory_tracker;
// Android WebView won't have a memory tracker.
if (task_executor_->ShouldCreateMemoryTracker()) {
const uint64_t client_tracing_id =
base::trace_event::MemoryDumpManager::GetInstance()
->GetTracingProcessId();
memory_tracker = std::make_unique<GpuCommandBufferMemoryTracker>(
kInProcessCommandBufferClientId, client_tracing_id,
command_buffer_id_.GetUnsafeValue(), params.attribs.context_type,
base::ThreadTaskRunnerHandle::Get());
}
std::unique_ptr<MemoryTracker> memory_tracker;
// Android WebView won't have a memory tracker.
if (task_executor_->ShouldCreateMemoryTracker()) {
const uint64_t client_tracing_id =
base::trace_event::MemoryDumpManager::GetInstance()
->GetTracingProcessId();
memory_tracker = std::make_unique<GpuCommandBufferMemoryTracker>(
kInProcessCommandBufferClientId, client_tracing_id,
command_buffer_id_.GetUnsafeValue(), params.attribs.context_type,
base::ThreadTaskRunnerHandle::Get());
}

gpu::GpuFeatureInfo gpu_feature_info = task_executor_->gpu_feature_info();
if (params.attribs.backed_by_surface_texture) {
gpu_feature_info.status_values[GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL] =
kGpuFeatureStatusDisabled;
}
auto feature_info =
base::MakeRefCounted<gles2::FeatureInfo>(workarounds, gpu_feature_info);
context_group_ = base::MakeRefCounted<gles2::ContextGroup>(
task_executor_->gpu_preferences(),
gles2::PassthroughCommandDecoderSupported(),
task_executor_->mailbox_manager(), std::move(memory_tracker),
task_executor_->shader_translator_cache(),
task_executor_->framebuffer_completeness_cache(), feature_info,
params.attribs.bind_generates_resource, task_executor_->image_manager(),
params.image_factory, nullptr /* progress_reporter */,
task_executor_->gpu_feature_info(),
task_executor_->discardable_manager(),
task_executor_->passthrough_discardable_manager(),
task_executor_->shared_image_manager());
gpu::GpuFeatureInfo gpu_feature_info = task_executor_->gpu_feature_info();
if (params.attribs.backed_by_surface_texture) {
gpu_feature_info.status_values[GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL] =
kGpuFeatureStatusDisabled;
}
auto feature_info =
base::MakeRefCounted<gles2::FeatureInfo>(workarounds, gpu_feature_info);
context_group_ = base::MakeRefCounted<gles2::ContextGroup>(
task_executor_->gpu_preferences(),
gles2::PassthroughCommandDecoderSupported(),
task_executor_->mailbox_manager(), std::move(memory_tracker),
task_executor_->shader_translator_cache(),
task_executor_->framebuffer_completeness_cache(), feature_info,
params.attribs.bind_generates_resource, task_executor_->image_manager(),
params.image_factory, nullptr /* progress_reporter */,
task_executor_->gpu_feature_info(), task_executor_->discardable_manager(),
task_executor_->passthrough_discardable_manager(),
task_executor_->shared_image_manager());

#if defined(OS_MACOSX)
// Virtualize PreferIntegratedGpu contexts by default on OS X to prevent
Expand Down Expand Up @@ -559,13 +552,9 @@ gpu::ContextResult InProcessCommandBuffer::InitializeOnGpuThread(
task_sequence_->GetSequenceId());

if (context_group_->use_passthrough_cmd_decoder()) {
// When using the passthrough command decoder, only share with other
// contexts in the explicitly requested share group.
if (params.share_command_buffer) {
gl_share_group_ = params.share_command_buffer->gl_share_group_;
} else {
gl_share_group_ = base::MakeRefCounted<gl::GLShareGroup>();
}
// When using the passthrough command decoder, never share with other
// contexts.
gl_share_group_ = base::MakeRefCounted<gl::GLShareGroup>();
} else {
// When using the validating command decoder, always use the global share
// group.
Expand Down
4 changes: 0 additions & 4 deletions gpu/ipc/in_process_command_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
bool is_offscreen,
SurfaceHandle surface_handle,
const ContextCreationAttribs& attribs,
InProcessCommandBuffer* share_group,
GpuMemoryBufferManager* gpu_memory_buffer_manager,
ImageFactory* image_factory,
GpuChannelManagerDelegate* gpu_channel_manager_delegate,
Expand Down Expand Up @@ -198,22 +197,19 @@ class GL_IN_PROCESS_CONTEXT_EXPORT InProcessCommandBuffer
SurfaceHandle surface_handle;
const ContextCreationAttribs& attribs;
Capabilities* capabilities; // Ouptut.
InProcessCommandBuffer* share_command_buffer;
ImageFactory* image_factory;
gpu::raster::GrShaderCache* gr_shader_cache;
GpuProcessActivityFlags* activity_flags;

InitializeOnGpuThreadParams(SurfaceHandle surface_handle,
const ContextCreationAttribs& attribs,
Capabilities* capabilities,
InProcessCommandBuffer* share_command_buffer,
ImageFactory* image_factory,
gpu::raster::GrShaderCache* gr_shader_cache,
GpuProcessActivityFlags* activity_flags)
: surface_handle(surface_handle),
attribs(attribs),
capabilities(capabilities),
share_command_buffer(share_command_buffer),
image_factory(image_factory),
gr_shader_cache(gr_shader_cache),
activity_flags(activity_flags) {}
Expand Down
6 changes: 3 additions & 3 deletions gpu/ipc/raster_in_process_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ ContextResult RasterInProcessContext::Initialize(
std::make_unique<InProcessCommandBuffer>(task_executor, GURL());
auto result = command_buffer_->Initialize(
nullptr /* surface */, true /* is_offscreen */, kNullSurfaceHandle,
attribs, nullptr /* share_command_buffer */, gpu_memory_buffer_manager,
image_factory, gpu_channel_manager_delegate, client_task_runner_,
gr_shader_cache, activity_flags);
attribs, gpu_memory_buffer_manager, image_factory,
gpu_channel_manager_delegate, client_task_runner_, gr_shader_cache,
activity_flags);
if (result != ContextResult::kSuccess) {
DLOG(ERROR) << "Failed to initialize InProcessCommmandBuffer";
return result;
Expand Down
3 changes: 1 addition & 2 deletions gpu/ipc/webgpu_in_process_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ ContextResult WebGPUInProcessContext::Initialize(

static const scoped_refptr<gl::GLSurface> surface = nullptr;
static constexpr bool is_offscreen = true;
static constexpr InProcessCommandBuffer* share_group = nullptr;
auto result = command_buffer_->Initialize(
surface, is_offscreen, kNullSurfaceHandle, attribs, share_group,
surface, is_offscreen, kNullSurfaceHandle, attribs,
gpu_memory_buffer_manager, image_factory, gpu_channel_manager_delegate,
client_task_runner_, nullptr, nullptr);
if (result != ContextResult::kSuccess) {
Expand Down

0 comments on commit 766fa71

Please sign in to comment.