#include "content/browser/renderer_host/delegated_frame_host.h"
#include <string>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "cc/base/switches.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/resources/release_callback.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/public/common/content_switches.h"
#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/dip_util.h"
namespace content {
namespace {
constexpr float kFrameContentCaptureQuality = …;
}
DelegatedFrameHost::DelegatedFrameHost(const viz::FrameSinkId& frame_sink_id,
DelegatedFrameHostClient* client,
bool should_register_frame_sink_id)
: … { … }
DelegatedFrameHost::~DelegatedFrameHost() { … }
void DelegatedFrameHost::AddObserverForTesting(Observer* observer) { … }
void DelegatedFrameHost::RemoveObserverForTesting(Observer* observer) { … }
void DelegatedFrameHost::WasShown(
const viz::LocalSurfaceId& new_local_surface_id,
const gfx::Size& new_dip_size,
blink::mojom::RecordContentToVisibleTimeRequestPtr
record_tab_switch_time_request) { … }
void DelegatedFrameHost::RequestSuccessfulPresentationTimeForNextFrame(
blink::mojom::RecordContentToVisibleTimeRequestPtr visible_time_request) { … }
void DelegatedFrameHost::CancelSuccessfulPresentationTimeRequest() { … }
bool DelegatedFrameHost::HasSavedFrame() const { … }
void DelegatedFrameHost::WasHidden(HiddenCause cause) { … }
void DelegatedFrameHost::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) { … }
void DelegatedFrameHost::CopyFromCompositingSurfaceAsTexture(
const gfx::Rect& src_subrect,
const gfx::Size& output_size,
viz::CopyOutputRequest::CopyOutputRequestCallback callback) { … }
void DelegatedFrameHost::CopyFromCompositingSurfaceInternal(
const gfx::Rect& src_subrect,
const gfx::Size& output_size,
viz::CopyOutputRequest::ResultFormat format,
viz::CopyOutputRequest::ResultDestination destination,
viz::CopyOutputRequest::CopyOutputRequestCallback callback) { … }
void DelegatedFrameHost::SetFrameEvictionStateAndNotifyObservers(
FrameEvictionState frame_eviction_state) { … }
bool DelegatedFrameHost::CanCopyFromCompositingSurface() const { … }
bool DelegatedFrameHost::HasPrimarySurface() const { … }
bool DelegatedFrameHost::HasFallbackSurface() const { … }
viz::SurfaceId DelegatedFrameHost::GetFallbackSurfaceIdForTesting() const { … }
void DelegatedFrameHost::EmbedSurface(
const viz::LocalSurfaceId& new_local_surface_id,
const gfx::Size& new_dip_size,
cc::DeadlinePolicy deadline_policy) { … }
SkColor DelegatedFrameHost::GetGutterColor() const { … }
void DelegatedFrameHost::OnFirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) { … }
void DelegatedFrameHost::OnFrameTokenChanged(uint32_t frame_token,
base::TimeTicks activation_time) { … }
void DelegatedFrameHost::ClearFallbackSurfaceForCommitPending() { … }
void DelegatedFrameHost::ResetFallbackToFirstNavigationSurface() { … }
void DelegatedFrameHost::EvictDelegatedFrame(
const std::vector<viz::SurfaceId>& surface_ids) { … }
viz::FrameEvictorClient::EvictIds
DelegatedFrameHost::CollectSurfaceIdsForEviction() const { … }
viz::SurfaceId DelegatedFrameHost::GetCurrentSurfaceId() const { … }
viz::SurfaceId DelegatedFrameHost::GetPreNavigationSurfaceId() const { … }
void DelegatedFrameHost::DidCopyStaleContent(
std::unique_ptr<viz::CopyOutputResult> result) { … }
void DelegatedFrameHost::ContinueDelegatedFrameEviction(
const std::vector<viz::SurfaceId>& surface_ids) { … }
void DelegatedFrameHost::OnCompositingShuttingDown(ui::Compositor* compositor) { … }
void DelegatedFrameHost::AttachToCompositor(ui::Compositor* compositor) { … }
void DelegatedFrameHost::DetachFromCompositor() { … }
void DelegatedFrameHost::DidNavigate() { … }
void DelegatedFrameHost::DidNavigateMainFramePreCommit() { … }
void DelegatedFrameHost::DidEnterBackForwardCache() { … }
void DelegatedFrameHost::WindowTitleChanged(const std::string& title) { … }
void DelegatedFrameHost::TakeFallbackContentFrom(DelegatedFrameHost* other) { … }
viz::SurfaceId DelegatedFrameHost::GetFirstSurfaceIdAfterNavigationForTesting()
const { … }
void DelegatedFrameHost::SetIsFrameSinkIdOwner(bool is_owner) { … }
bool DelegatedFrameHost::ShouldIncludeUiCompositorForEviction() { … }
}