#include "services/viz/public/cpp/gpu/context_provider_command_buffer.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h"
#include "build/build_config.h"
#include "components/viz/common/gpu/context_cache_controller.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_trace_implementation.h"
#include "gpu/command_buffer/client/gpu_switches.h"
#include "gpu/command_buffer/client/implementation_base.h"
#include "gpu/command_buffer/client/raster_cmd_helper.h"
#include "gpu/command_buffer/client/raster_implementation.h"
#include "gpu/command_buffer/client/raster_implementation_gles.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/client/webgpu_cmd_helper.h"
#include "gpu/command_buffer/client/webgpu_implementation.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/skia_utils.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/skia_limits.h"
#include "gpu/ipc/client/client_shared_image_interface.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "gpu/skia_bindings/gles2_implementation_with_grcontext_support.h"
#include "gpu/skia_bindings/grcontext_for_gles2_interface.h"
#include "services/viz/public/cpp/gpu/command_buffer_metrics.h"
#include "skia/buildflags.h"
#include "third_party/skia/include/core/SkTraceMemoryDump.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "ui/gl/trace_util.h"
class SkDiscardableMemory;
namespace viz {
ContextProviderCommandBuffer::ContextProviderCommandBuffer(
scoped_refptr<gpu::GpuChannelHost> channel,
int32_t stream_id,
gpu::SchedulingPriority stream_priority,
gpu::SurfaceHandle surface_handle,
const GURL& active_url,
bool automatic_flushes,
bool support_locking,
const gpu::SharedMemoryLimits& memory_limits,
const gpu::ContextCreationAttribs& attributes,
command_buffer_metrics::ContextType type,
base::SharedMemoryMapper* buffer_mapper)
: … { … }
ContextProviderCommandBuffer::~ContextProviderCommandBuffer() { … }
gpu::CommandBufferProxyImpl*
ContextProviderCommandBuffer::GetCommandBufferProxy() { … }
void ContextProviderCommandBuffer::AddRef() const { … }
void ContextProviderCommandBuffer::Release() const { … }
gpu::ContextResult ContextProviderCommandBuffer::BindToCurrentSequence() { … }
gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { … }
gpu::raster::RasterInterface* ContextProviderCommandBuffer::RasterInterface() { … }
gpu::ContextSupport* ContextProviderCommandBuffer::ContextSupport() { … }
class GrDirectContext* ContextProviderCommandBuffer::GrContext() { … }
gpu::SharedImageInterface*
ContextProviderCommandBuffer::SharedImageInterface() { … }
ContextCacheController* ContextProviderCommandBuffer::CacheController() { … }
void ContextProviderCommandBuffer::SetDefaultTaskRunner(
scoped_refptr<base::SingleThreadTaskRunner> default_task_runner) { … }
base::Lock* ContextProviderCommandBuffer::GetLock() { … }
const gpu::Capabilities& ContextProviderCommandBuffer::ContextCapabilities()
const { … }
const gpu::GpuFeatureInfo& ContextProviderCommandBuffer::GetGpuFeatureInfo()
const { … }
void ContextProviderCommandBuffer::OnLostContext() { … }
void ContextProviderCommandBuffer::AddObserver(ContextLostObserver* obs) { … }
void ContextProviderCommandBuffer::RemoveObserver(ContextLostObserver* obs) { … }
unsigned int ContextProviderCommandBuffer::GetGrGLTextureFormat(
SharedImageFormat format) const { … }
gpu::webgpu::WebGPUInterface* ContextProviderCommandBuffer::WebGPUInterface() { … }
bool ContextProviderCommandBuffer::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) { … }
}