#include "components/viz/service/surfaces/surface_saved_frame.h"
#include <GLES2/gl2.h>
#include <algorithm>
#include <iterator>
#include <utility>
#include "base/containers/flat_set.h"
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "base/types/pass_key.h"
#include "components/viz/common/color_space_utils.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/blit_request.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/quads/compositor_frame_transition_directive.h"
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/draw_quad.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "components/viz/common/transition_utils.h"
#include "components/viz/service/surfaces/surface.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/ipc/common/surface_handle.h"
#include "services/viz/public/mojom/compositing/compositor_render_pass_id.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/point.h"
namespace viz {
namespace {
constexpr gfx::Size kDefaultTextureSizeForTesting = …;
constexpr auto kResultFormat = …;
constexpr auto kResultDestination = …;
size_t GetSharedPassIndex(
const std::vector<CompositorFrameTransitionDirective::SharedElement>&
shared_elements,
CompositorRenderPassId render_pass_id) { … }
}
std::unique_ptr<SurfaceSavedFrame> SurfaceSavedFrame::CreateForTesting(
CompositorFrameTransitionDirective directive) { … }
SurfaceSavedFrame::SurfaceSavedFrame(
CompositorFrameTransitionDirective directive,
gpu::SharedImageInterface* shared_image_interface)
: … { … }
SurfaceSavedFrame::SurfaceSavedFrame(
base::PassKey<SurfaceSavedFrame>,
CompositorFrameTransitionDirective directive)
: … { … }
SurfaceSavedFrame::~SurfaceSavedFrame() { … }
base::flat_set<ViewTransitionElementResourceId>
SurfaceSavedFrame::GetEmptyResourceIds() const { … }
bool SurfaceSavedFrame::IsValid() const { … }
void SurfaceSavedFrame::RequestCopyOfOutput(
Surface* surface,
CopyFinishedCallback finished_callback) { … }
void SurfaceSavedFrame::DispatchCopyDoneCallback() { … }
std::unique_ptr<CopyOutputRequest> SurfaceSavedFrame::CreateCopyRequestIfNeeded(
const CompositorRenderPass& render_pass,
bool is_software,
gfx::ContentColorUsage content_color_usage) { … }
bool SurfaceSavedFrame::IsSharedElementRenderPass(
CompositorRenderPassId pass_id) const { … }
size_t SurfaceSavedFrame::ExpectedResultCount() const { … }
void SurfaceSavedFrame::NotifyCopyOfOutputComplete(
size_t shared_index,
std::unique_ptr<CopyOutputResult> output_copy) { … }
SurfaceSavedFrame::FrameResult SurfaceSavedFrame::TakeResult() { … }
void SurfaceSavedFrame::CompleteSavedFrameForTesting() { … }
SurfaceSavedFrame::RenderPassDrawData::RenderPassDrawData() = default;
SurfaceSavedFrame::RenderPassDrawData::RenderPassDrawData(
const CompositorRenderPass& render_pass)
: … { … }
SurfaceSavedFrame::OutputCopyResult::OutputCopyResult() = default;
SurfaceSavedFrame::OutputCopyResult::OutputCopyResult(
OutputCopyResult&& other) { … }
SurfaceSavedFrame::OutputCopyResult::~OutputCopyResult() { … }
SurfaceSavedFrame::OutputCopyResult&
SurfaceSavedFrame::OutputCopyResult::operator=(OutputCopyResult&& other) { … }
SurfaceSavedFrame::FrameResult::FrameResult() = default;
SurfaceSavedFrame::FrameResult::FrameResult(FrameResult&& other) = default;
SurfaceSavedFrame::FrameResult::~FrameResult() = default;
SurfaceSavedFrame::FrameResult& SurfaceSavedFrame::FrameResult::operator=(
FrameResult&& other) = default;
}