#include "content/browser/renderer_host/render_frame_metadata_provider_impl.h"
#include "base/auto_reset.h"
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/frame_token_message_queue.h"
namespace content {
RenderFrameMetadataProviderImpl::RenderFrameMetadataProviderImpl(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
FrameTokenMessageQueue* frame_token_message_queue)
: … { … }
RenderFrameMetadataProviderImpl::~RenderFrameMetadataProviderImpl() = default;
void RenderFrameMetadataProviderImpl::AddObserver(Observer* observer) { … }
void RenderFrameMetadataProviderImpl::RemoveObserver(Observer* observer) { … }
void RenderFrameMetadataProviderImpl::Bind(
mojo::PendingReceiver<cc::mojom::RenderFrameMetadataObserverClient>
client_receiver,
mojo::PendingRemote<cc::mojom::RenderFrameMetadataObserver> observer) { … }
#if BUILDFLAG(IS_ANDROID)
void RenderFrameMetadataProviderImpl::UpdateRootScrollOffsetUpdateFrequency(
cc::mojom::RootScrollOffsetUpdateFrequency frequency) {
if (!render_frame_metadata_observer_remote_) {
pending_root_scroll_offset_update_frequency_ = frequency;
return;
}
render_frame_metadata_observer_remote_->UpdateRootScrollOffsetUpdateFrequency(
frequency);
}
#endif
void RenderFrameMetadataProviderImpl::ReportAllFrameSubmissionsForTesting(
bool enabled) { … }
const cc::RenderFrameMetadata&
RenderFrameMetadataProviderImpl::LastRenderFrameMetadata() { … }
void RenderFrameMetadataProviderImpl::
OnRenderFrameMetadataChangedAfterActivation(
cc::RenderFrameMetadata metadata,
base::TimeTicks activation_time) { … }
void RenderFrameMetadataProviderImpl::OnFrameTokenFrameSubmissionForTesting(
base::TimeTicks activation_time) { … }
void RenderFrameMetadataProviderImpl::SetLastRenderFrameMetadataForTest(
cc::RenderFrameMetadata metadata) { … }
void RenderFrameMetadataProviderImpl::OnRenderFrameMetadataChanged(
uint32_t frame_token,
const cc::RenderFrameMetadata& metadata) { … }
void RenderFrameMetadataProviderImpl::OnFrameSubmissionForTesting(
uint32_t frame_token) { … }
#if BUILDFLAG(IS_ANDROID)
void RenderFrameMetadataProviderImpl::OnRootScrollOffsetChanged(
const gfx::PointF& root_scroll_offset) {
for (Observer& observer : observers_)
observer.OnRootScrollOffsetChanged(root_scroll_offset);
}
#endif
}