chromium/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.cc

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

#include "third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h"

#include <utility>

#include "base/debug/stack_trace.h"
#include "base/not_fatal_until.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "components/viz/common/features.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/resources/release_callback.h"
#include "services/viz/public/mojom/compositing/frame_timing_details.mojom-blink.h"
#include "services/viz/public/mojom/hit_test/hit_test_region_list.mojom-blink.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/frame_sinks/embedded_frame_sink.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_graphics_context_3d_provider.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource.h"
#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"
#include "third_party/blink/renderer/platform/graphics/offscreen_canvas_placeholder.h"
#include "third_party/blink/renderer/platform/graphics/resource_id_traits.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "ui/gfx/mojom/presentation_feedback.mojom-blink.h"

namespace blink {

struct CanvasResourceDispatcher::FrameResource {};

CanvasResourceDispatcher::CanvasResourceDispatcher(
    CanvasResourceDispatcherClient* client,
    scoped_refptr<base::SingleThreadTaskRunner> task_runner,
    scoped_refptr<base::SingleThreadTaskRunner>
        agent_group_scheduler_compositor_task_runner,
    uint32_t client_id,
    uint32_t sink_id,
    int canvas_id,
    const gfx::Size& size)
    :{}

CanvasResourceDispatcher::~CanvasResourceDispatcher() = default;

namespace {

void UpdatePlaceholderImage(
    int placeholder_canvas_id,
    scoped_refptr<blink::CanvasResource>&& canvas_resource,
    viz::ResourceId resource_id) {}

void UpdatePlaceholderDispatcher(
    base::WeakPtr<CanvasResourceDispatcher> dispatcher,
    scoped_refptr<base::SingleThreadTaskRunner> task_runner,
    int placeholder_canvas_id) {}

}  // namespace

void CanvasResourceDispatcher::PostImageToPlaceholderIfNotBlocked(
    scoped_refptr<CanvasResource>&& canvas_resource,
    viz::ResourceId resource_id) {}

void CanvasResourceDispatcher::PostImageToPlaceholder(
    scoped_refptr<CanvasResource>&& canvas_resource,
    viz::ResourceId resource_id) {}

void CanvasResourceDispatcher::DispatchFrameSync(
    scoped_refptr<CanvasResource>&& canvas_resource,
    base::TimeTicks commit_start_time,
    const SkIRect& damage_rect,
    bool needs_vertical_flip,
    bool is_opaque) {}

void CanvasResourceDispatcher::DispatchFrame(
    scoped_refptr<CanvasResource>&& canvas_resource,
    base::TimeTicks commit_start_time,
    const SkIRect& damage_rect,
    bool needs_vertical_flip,
    bool is_opaque) {}

bool CanvasResourceDispatcher::PrepareFrame(
    scoped_refptr<CanvasResource>&& canvas_resource,
    base::TimeTicks commit_start_time,
    const SkIRect& damage_rect,
    bool needs_vertical_flip,
    bool is_opaque,
    viz::CompositorFrame* frame) {}

void CanvasResourceDispatcher::DidReceiveCompositorFrameAck(
    WTF::Vector<viz::ReturnedResource> resources) {}

void CanvasResourceDispatcher::SetNeedsBeginFrame(bool needs_begin_frame) {}

void CanvasResourceDispatcher::SetSuspendAnimation(bool suspend_animation) {}

void CanvasResourceDispatcher::SetNeedsBeginFrameInternal() {}

bool CanvasResourceDispatcher::HasTooManyPendingFrames() const {}

void CanvasResourceDispatcher::OnBeginFrame(
    const viz::BeginFrameArgs& begin_frame_args,
    const WTF::HashMap<uint32_t, viz::FrameTimingDetails>&,
    bool frame_ack,
    WTF::Vector<viz::ReturnedResource> resources) {}

void CanvasResourceDispatcher::ReclaimResources(
    WTF::Vector<viz::ReturnedResource> resources) {}

void CanvasResourceDispatcher::ReclaimResource(
    viz::ResourceId resource_id,
    scoped_refptr<CanvasResource>&& canvas_resource) {}

bool CanvasResourceDispatcher::VerifyImageSize(const gfx::Size& image_size) {}

void CanvasResourceDispatcher::Reshape(const gfx::Size& size) {}

void CanvasResourceDispatcher::DidAllocateSharedBitmap(
    base::ReadOnlySharedMemoryRegion region,
    const viz::SharedBitmapId& id) {}

void CanvasResourceDispatcher::DidDeleteSharedBitmap(
    const viz::SharedBitmapId& id) {}

void CanvasResourceDispatcher::SetFilterQuality(
    cc::PaintFlags::FilterQuality filter_quality) {}

void CanvasResourceDispatcher::SetPlaceholderCanvasDispatcher(
    int placeholder_canvas_id) {}

void CanvasResourceDispatcher::ReclaimResourceInternal(
    viz::ResourceId resource_id,
    scoped_refptr<CanvasResource>&& canvas_resource) {}

void CanvasResourceDispatcher::ReclaimResourceInternal(
    const ResourceMap::iterator& it) {}

}  // namespace blink