Commit bdc489c7 authored by kylechar's avatar kylechar Committed by Commit Bot

Delete SharedWorkerContextProviderFactory

It's not used anywhere.

Bug: 936425
Change-Id: Ifff668d1485060a6fa41e0b6f6a2452f45722e7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2005868Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732980}
parent f25ecf79
...@@ -43,23 +43,14 @@ source_set("gpu") { ...@@ -43,23 +43,14 @@ source_set("gpu") {
"//mojo/public/cpp/system", "//mojo/public/cpp/system",
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
"//services/viz/public/mojom", "//services/viz/public/mojom",
"//ui/base:features",
"//ui/gl", "//ui/gl",
] ]
if (use_aura || is_mac) {
public += [ "shared_worker_context_provider_factory.h" ]
sources += [ "shared_worker_context_provider_factory.cc" ]
}
} }
source_set("tests") { source_set("tests") {
testonly = true testonly = true
sources = [ sources = [ "gpu_unittest.cc" ]
"gpu_unittest.cc",
]
deps = [ deps = [
"//base", "//base",
......
...@@ -2,7 +2,6 @@ include_rules = [ ...@@ -2,7 +2,6 @@ include_rules = [
"+components/viz/common/gpu", "+components/viz/common/gpu",
"+gpu", "+gpu",
"+third_party/skia", "+third_party/skia",
"+ui/base/ui_base_features.h",
"+ui/gfx", "+ui/gfx",
"+ui/gl", "+ui/gl",
] ]
// 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 "services/viz/public/cpp/gpu/shared_worker_context_provider_factory.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/common/context_result.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "services/viz/public/cpp/gpu/context_provider_command_buffer.h"
#include "ui/base/ui_base_features.h"
namespace viz {
namespace {
bool CheckWorkerContextLost(RasterContextProvider* context_provider) {
if (!context_provider)
return false;
RasterContextProvider::ScopedRasterContextLock lock(context_provider);
return lock.RasterInterface()->GetGraphicsResetStatusKHR() != GL_NO_ERROR;
}
} // namespace
SharedWorkerContextProviderFactory::SharedWorkerContextProviderFactory(
int32_t stream_id,
gpu::SchedulingPriority priority,
const GURL& identifying_url,
command_buffer_metrics::ContextType context_type)
: stream_id_(stream_id),
priority_(priority),
identifying_url_(identifying_url),
context_type_(context_type) {}
SharedWorkerContextProviderFactory::~SharedWorkerContextProviderFactory() =
default;
void SharedWorkerContextProviderFactory::Reset() {
provider_ = nullptr;
}
gpu::ContextResult SharedWorkerContextProviderFactory::Validate(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
if (CheckWorkerContextLost(provider_.get()))
provider_ = nullptr;
if (provider_)
return gpu::ContextResult::kSuccess;
const auto& gpu_feature_info = gpu_channel_host->gpu_feature_info();
bool enable_oop_rasterization =
features::IsUiGpuRasterizationEnabled() &&
gpu_feature_info.status_values[gpu::GPU_FEATURE_TYPE_OOP_RASTERIZATION] ==
gpu::kGpuFeatureStatusEnabled;
bool enable_gpu_rasterization =
features::IsUiGpuRasterizationEnabled() && !enable_oop_rasterization;
// TODO(crbug.com/909568): refactor
// RenderThreadImpl::SharedCompositorWorkerContextProvider to use this.
const bool need_alpha_channel = false;
const bool support_locking = true;
const bool support_gles2_interface = enable_gpu_rasterization;
const bool support_raster_interface = true;
const bool support_grcontext = enable_gpu_rasterization;
const bool support_oopr = enable_oop_rasterization;
provider_ = CreateContextProvider(
std::move(gpu_channel_host), gpu_memory_buffer_manager,
gpu::kNullSurfaceHandle, need_alpha_channel, /*support_stencil=*/false,
support_locking, support_gles2_interface, support_raster_interface,
support_grcontext, support_oopr, context_type_);
auto result = provider_->BindToCurrentThread();
if (result != gpu::ContextResult::kSuccess)
provider_ = nullptr;
return result;
}
scoped_refptr<RasterContextProvider>
SharedWorkerContextProviderFactory::CreateContextProvider(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::SurfaceHandle surface_handle,
bool need_alpha_channel,
bool need_stencil_bits,
bool support_locking,
bool support_gles2_interface,
bool support_raster_interface,
bool support_grcontext,
bool support_oopr,
command_buffer_metrics::ContextType type) {
DCHECK(gpu_channel_host);
gpu::ContextCreationAttribs attributes;
attributes.alpha_size = need_alpha_channel ? 8 : -1;
attributes.depth_size = 0;
attributes.stencil_size = need_stencil_bits ? 8 : 0;
attributes.samples = 0;
attributes.sample_buffers = 0;
attributes.bind_generates_resource = false;
attributes.lose_context_when_out_of_memory = true;
attributes.buffer_preserved = false;
attributes.enable_gles2_interface = support_gles2_interface;
attributes.enable_raster_interface = support_raster_interface;
attributes.enable_oop_rasterization = support_oopr;
gpu::SharedMemoryLimits memory_limits =
gpu::SharedMemoryLimits::ForDisplayCompositor();
constexpr bool automatic_flushes = false;
return base::MakeRefCounted<ContextProviderCommandBuffer>(
std::move(gpu_channel_host), gpu_memory_buffer_manager, stream_id_,
priority_, surface_handle, identifying_url_, automatic_flushes,
support_locking, support_grcontext, memory_limits, attributes, type);
}
} // namespace viz
// 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 SERVICES_VIZ_PUBLIC_CPP_GPU_SHARED_WORKER_CONTEXT_PROVIDER_FACTORY_H_
#define SERVICES_VIZ_PUBLIC_CPP_GPU_SHARED_WORKER_CONTEXT_PROVIDER_FACTORY_H_
#include <stdint.h>
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "gpu/ipc/common/surface_handle.h"
#include "url/gurl.h"
namespace gpu {
class GpuChannelHost;
class GpuMemoryBufferManager;
enum class ContextResult;
enum class SchedulingPriority;
} // namespace gpu
namespace viz {
namespace command_buffer_metrics {
enum class ContextType;
}
class RasterContextProvider;
// SharedWorkerContextProviderFactory is responsible for creation, and owning
// RasterContextProvider.
class SharedWorkerContextProviderFactory {
public:
SharedWorkerContextProviderFactory(
int32_t stream_id,
gpu::SchedulingPriority priority,
const GURL& identifying_url,
command_buffer_metrics::ContextType context_type);
~SharedWorkerContextProviderFactory();
// Drops the reference to |provider_|. This ensures the next time Validate()
// is called a new RasterContextProvider is created.
void Reset();
// Validates |provider_|, and if necessary attempts to recreate. Returns
// creation status. Use provider() to access the created
// RasterContextProvider.
gpu::ContextResult Validate(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
scoped_refptr<RasterContextProvider> provider() { return provider_; }
private:
scoped_refptr<RasterContextProvider> CreateContextProvider(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::SurfaceHandle surface_handle,
bool need_alpha_channel,
bool need_stencil_bits,
bool support_locking,
bool support_gles2_interface,
bool support_raster_interface,
bool support_grcontext,
bool support_oopr,
command_buffer_metrics::ContextType type);
const int32_t stream_id_;
const gpu::SchedulingPriority priority_;
const GURL identifying_url_;
const command_buffer_metrics::ContextType context_type_;
scoped_refptr<RasterContextProvider> provider_;
DISALLOW_COPY_AND_ASSIGN(SharedWorkerContextProviderFactory);
};
} // namespace viz
#endif // SERVICES_VIZ_PUBLIC_CPP_GPU_SHARED_WORKER_CONTEXT_PROVIDER_FACTORY_H_
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