chromium/gpu/command_buffer/service/shared_image/test_image_backing.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gpu/command_buffer/service/shared_image/test_image_backing.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/shared_image_format_service_utils.h"
#include "skia/ext/legacy_display_globals.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
#include "third_party/skia/include/gpu/mock/GrMockTypes.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"

namespace gpu {
namespace {
class TestGLTextureImageRepresentation : public GLTextureImageRepresentation {};

class TestGLTexturePassthroughImageRepresentation
    : public GLTexturePassthroughImageRepresentation {};

class TestSkiaImageRepresentation : public SkiaGaneshImageRepresentation {};

class TestDawnImageRepresentation : public DawnImageRepresentation {};

class TestMetalSkiaGraphiteImageRepresentation
    : public SkiaGraphiteImageRepresentation {};

}  // namespace

TestImageBacking::TestImageBacking(const Mailbox& mailbox,
                                   viz::SharedImageFormat format,
                                   const gfx::Size& size,
                                   const gfx::ColorSpace& color_space,
                                   GrSurfaceOrigin surface_origin,
                                   SkAlphaType alpha_type,
                                   SharedImageUsageSet usage,
                                   size_t estimated_size,
                                   GLuint texture_id)
    :{}

TestImageBacking::TestImageBacking(const Mailbox& mailbox,
                                   viz::SharedImageFormat format,
                                   const gfx::Size& size,
                                   const gfx::ColorSpace& color_space,
                                   GrSurfaceOrigin surface_origin,
                                   SkAlphaType alpha_type,
                                   SharedImageUsageSet usage,
                                   size_t estimated_size)
    :{}

TestImageBacking::~TestImageBacking() {}

bool TestImageBacking::GetUploadFromMemoryCalledAndReset() {}

bool TestImageBacking::GetReadbackToMemoryCalledAndReset() {}

SharedImageBackingType TestImageBacking::GetType() const {}

gfx::Rect TestImageBacking::ClearedRect() const {}

void TestImageBacking::SetClearedRect(const gfx::Rect& cleared_rect) {}

void TestImageBacking::SetPurgeable(bool purgeable) {}

bool TestImageBacking::UploadFromMemory(const std::vector<SkPixmap>& pixmap) {}

bool TestImageBacking::ReadbackToMemory(const std::vector<SkPixmap>& pixmaps) {}

std::unique_ptr<GLTextureImageRepresentation>
TestImageBacking::ProduceGLTexture(SharedImageManager* manager,
                                   MemoryTypeTracker* tracker) {}

std::unique_ptr<GLTexturePassthroughImageRepresentation>
TestImageBacking::ProduceGLTexturePassthrough(SharedImageManager* manager,
                                              MemoryTypeTracker* tracker) {}

std::unique_ptr<SkiaGaneshImageRepresentation>
TestImageBacking::ProduceSkiaGanesh(
    SharedImageManager* manager,
    MemoryTypeTracker* tracker,
    scoped_refptr<SharedContextState> context_state) {}

std::unique_ptr<DawnImageRepresentation> TestImageBacking::ProduceDawn(
    SharedImageManager* manager,
    MemoryTypeTracker* tracker,
    const wgpu::Device& device,
    wgpu::BackendType backend_type,
    std::vector<wgpu::TextureFormat> view_formats,
    scoped_refptr<SharedContextState> context_state) {}

std::unique_ptr<SkiaGraphiteImageRepresentation>
TestImageBacking::ProduceSkiaGraphite(
    SharedImageManager* manager,
    MemoryTypeTracker* tracker,
    scoped_refptr<SharedContextState> context_state) {}

std::unique_ptr<OverlayImageRepresentation> TestImageBacking::ProduceOverlay(
    SharedImageManager* manager,
    MemoryTypeTracker* tracker) {}

bool TestOverlayImageRepresentation::BeginReadAccess(
    gfx::GpuFenceHandle& acquire_fence) {}

void TestOverlayImageRepresentation::EndReadAccess(
    gfx::GpuFenceHandle release_fence) {}

#if BUILDFLAG(IS_ANDROID)
std::unique_ptr<base::android::ScopedHardwareBufferFenceSync>
TestOverlayImageRepresentation::GetAHardwareBufferFenceSync() {
  return nullptr;
}
#endif

#if BUILDFLAG(IS_APPLE)
bool TestOverlayImageRepresentation::IsInUseByWindowServer() const {
  return static_cast<TestImageBacking*>(backing())->in_use_by_window_server();
}
#endif  // BUILDFLAG(IS_APPLE)

}  // namespace gpu