chromium/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu_debug_capture.cc

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

#include "components/viz/service/display_embedder/skia_output_surface_impl_on_gpu_debug_capture.h"

#include <memory>
#include <vector>

#include "build/build_config.h"
#include "components/viz/common/buildflags.h"
#include "components/viz/common/features.h"
#include "components/viz/common/viz_utils.h"
#include "components/viz/service/debugger/viz_debugger.h"
#include "components/viz/service/display_embedder/image_context_impl.h"
#include "components/viz/service/display_embedder/output_presenter_gl.h"
#include "components/viz/service/display_embedder/skia_output_device.h"
#include "components/viz/service/display_embedder/skia_output_device_buffer_queue.h"
#include "components/viz/service/display_embedder/skia_output_device_gl.h"
#include "components/viz/service/display_embedder/skia_output_device_offscreen.h"
#include "components/viz/service/display_embedder/skia_output_device_webview.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency.h"
#include "components/viz/service/display_embedder/skia_render_copy_results.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/shared_image/shared_image_factory.h"
#include "gpu/vulkan/buildflags.h"
#include "skia/buildflags.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"
#include "third_party/skia/include/gpu/graphite/Context.h"
#include "ui/gfx/color_space.h"

// We only include the functionality for gpu buffer capture iif the visual
// debugger is enabled at a build level
#if VIZ_DEBUGGER_IS_ON()

namespace {

DBG_FLAG_FBOOL("skia_gpu.buffer_capture.low_res", buffer_capture_low_res)

struct DebuggerCaptureBufferSharedImageInfo {};

void DebuggerCaptureBufferCallback(
    void* si_info_raw,
    std::unique_ptr<const SkSurface::AsyncReadResult> async_result) {}
}  // namespace

namespace viz {
void AttemptDebuggerBufferCapture(
    ImageContextImpl* context,
    gpu::SharedContextState* context_state,
    gpu::SharedImageRepresentationFactory* representation_factory) {}

}  // namespace viz
#else
namespace viz {
void AttemptDebuggerBufferCapture(
    ImageContextImpl* context,
    gpu::SharedContextState* context_state,
    gpu::SharedImageRepresentationFactory* representation_factory);
}  // namespace viz
#endif  // VIZ_DEBUGGER_IS_ON()