Commit 116bd95e authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

aw: Split kVizForWebView feature

This CL splits kVizForWebView feature flag into kVizForWebView and
kVizFrameSubmissionForWebView. As we made decision to try reuse old
path for frame submission the code that implements it needs to be
under different flag.

Bug: 805739
Change-Id: I0040cc0af8305d75612315967afa3bbf3915456a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015496Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734267}
parent cabe8afc
......@@ -42,6 +42,11 @@ const base::Feature kDisableDeJelly{"DisableDeJelly",
const base::Feature kVizForWebView{"VizForWebView",
base::FEATURE_DISABLED_BY_DEFAULT};
// Submit CompositorFrame from SynchronousLayerTreeFrameSink directly to viz in
// WebView.
const base::Feature kVizFrameSubmissionForWebView{
"VizFrameSubmissionForWebView", base::FEATURE_DISABLED_BY_DEFAULT};
// Whether we should use the real buffers corresponding to overlay candidates in
// order to do a pageflip test rather than allocating test buffers.
const base::Feature kUseRealBuffersForPageFlipTest{
......@@ -81,6 +86,15 @@ bool IsUsingVizForWebView() {
return base::FeatureList::IsEnabled(kVizForWebView);
}
bool IsUsingVizFrameSubmissionForWebView() {
if (base::FeatureList::IsEnabled(kVizFrameSubmissionForWebView)) {
DCHECK(IsUsingVizForWebView())
<< "kVizFrameSubmissionForWebView requires kVizForWebView";
return true;
}
return false;
}
bool IsUsingPreferredIntervalForVideo() {
return base::FeatureList::IsEnabled(kUsePreferredIntervalForVideo);
}
......
......@@ -16,6 +16,7 @@ VIZ_COMMON_EXPORT extern const base::Feature kUseSkiaRenderer;
VIZ_COMMON_EXPORT extern const base::Feature kRecordSkPicture;
VIZ_COMMON_EXPORT extern const base::Feature kDisableDeJelly;
VIZ_COMMON_EXPORT extern const base::Feature kVizForWebView;
VIZ_COMMON_EXPORT extern const base::Feature kVizFrameSubmissionForWebView;
VIZ_COMMON_EXPORT extern const base::Feature kUsePreferredIntervalForVideo;
VIZ_COMMON_EXPORT extern const base::Feature kUseRealBuffersForPageFlipTest;
......@@ -24,6 +25,7 @@ VIZ_COMMON_EXPORT bool IsUsingSkiaForGLReadback();
VIZ_COMMON_EXPORT bool IsUsingSkiaRenderer();
VIZ_COMMON_EXPORT bool IsRecordingSkPicture();
VIZ_COMMON_EXPORT bool IsUsingVizForWebView();
VIZ_COMMON_EXPORT bool IsUsingVizFrameSubmissionForWebView();
VIZ_COMMON_EXPORT bool IsUsingPreferredIntervalForVideo();
VIZ_COMMON_EXPORT bool ShouldUseRealBuffersForPageFlipTest();
......
......@@ -171,7 +171,8 @@ SynchronousLayerTreeFrameSink::SynchronousLayerTreeFrameSink(
unbound_compositor_frame_sink_(std::move(compositor_frame_sink_remote)),
unbound_client_(std::move(client_receiver)),
synthetic_begin_frame_source_(std::move(synthetic_begin_frame_source)),
viz_for_webview_enabled_(features::IsUsingVizForWebView()) {
viz_frame_submission_enabled_(
features::IsUsingVizFrameSubmissionForWebView()) {
DCHECK(registry_);
DCHECK(sender_);
thread_checker_.DetachFromThread();
......@@ -192,7 +193,7 @@ bool SynchronousLayerTreeFrameSink::BindToClient(
if (!cc::LayerTreeFrameSink::BindToClient(sink_client))
return false;
if (viz_for_webview_enabled_) {
if (viz_frame_submission_enabled_) {
compositor_frame_sink_.Bind(std::move(unbound_compositor_frame_sink_));
client_receiver_.Bind(std::move(unbound_client_), compositor_task_runner_);
}
......@@ -396,7 +397,7 @@ void SynchronousLayerTreeFrameSink::SubmitCompositorFrame(
frame.metadata.local_surface_id_allocation_time =
child_local_surface_id_allocation_.allocation_time();
if (viz_for_webview_enabled_) {
if (viz_frame_submission_enabled_) {
frame.metadata.begin_frame_ack =
viz::BeginFrameAck::CreateManualAckWithDamage();
......@@ -409,8 +410,8 @@ void SynchronousLayerTreeFrameSink::SubmitCompositorFrame(
submit_frame = std::move(frame);
}
}
// NOTE: submit_frame will be empty if viz_for_webview_enabled_ enabled, but
// it won't be used upstream
// NOTE: submit_frame will be empty if viz_frame_submission_enabled_ enabled,
// but it won't be used upstream
sync_client_->SubmitCompositorFrame(layer_tree_frame_sink_id_,
std::move(submit_frame));
did_submit_frame_ = true;
......@@ -566,7 +567,7 @@ bool SynchronousLayerTreeFrameSink::CalledOnValidThread() const {
void SynchronousLayerTreeFrameSink::DidReceiveCompositorFrameAck(
const std::vector<viz::ReturnedResource>& resources) {
DCHECK(CalledOnValidThread());
DCHECK(viz_for_webview_enabled_);
DCHECK(viz_frame_submission_enabled_);
client_->ReclaimResources(resources);
// client_->DidReceiveCompositorFrameAck() is called just after frame
// submission so cc won't be throttled on actual draw which can happen late
......@@ -576,7 +577,7 @@ void SynchronousLayerTreeFrameSink::DidReceiveCompositorFrameAck(
void SynchronousLayerTreeFrameSink::OnBeginFrame(
const viz::BeginFrameArgs& args,
const viz::FrameTimingDetailsMap& timing_details) {
DCHECK(viz_for_webview_enabled_);
DCHECK(viz_frame_submission_enabled_);
// We do not receive BeginFrames via CompositorFrameSink, so we do not forward
// it to cc. We still might get one with FrameTimingDetailsMap, so we report
......@@ -592,12 +593,12 @@ void SynchronousLayerTreeFrameSink::OnBeginFrame(
void SynchronousLayerTreeFrameSink::ReclaimResources(
const std::vector<viz::ReturnedResource>& resources) {
DCHECK(CalledOnValidThread());
DCHECK(viz_for_webview_enabled_);
DCHECK(viz_frame_submission_enabled_);
client_->ReclaimResources(resources);
}
void SynchronousLayerTreeFrameSink::OnBeginFramePausedChanged(bool paused) {
DCHECK(viz_for_webview_enabled_);
DCHECK(viz_frame_submission_enabled_);
}
void SynchronousLayerTreeFrameSink::OnNeedsBeginFrames(
......@@ -610,7 +611,7 @@ void SynchronousLayerTreeFrameSink::OnNeedsBeginFrames(
void SynchronousLayerTreeFrameSink::DidPresentCompositorFrame(
const viz::FrameTimingDetailsMap& timing_details) {
DCHECK(!viz_for_webview_enabled_ || timing_details.empty());
DCHECK(!viz_frame_submission_enabled_ || timing_details.empty());
if (!client_)
return;
......
......@@ -221,7 +221,7 @@ class SynchronousLayerTreeFrameSink
base::ThreadChecker thread_checker_;
// Indicates that webview using viz
bool viz_for_webview_enabled_;
const bool viz_frame_submission_enabled_;
bool begin_frames_paused_ = false;
bool needs_begin_frames_ = false;
......
......@@ -28,7 +28,8 @@ SynchronousCompositorProxy::SynchronousCompositorProxy(
use_in_process_zero_copy_software_draw_(
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess)),
using_viz_for_webview_(features::IsUsingVizForWebView()),
viz_frame_submission_enabled_(
features::IsUsingVizFrameSubmissionForWebView()),
page_scale_factor_(0.f),
min_page_scale_factor_(0.f),
max_page_scale_factor_(0.f),
......@@ -232,7 +233,7 @@ void SynchronousCompositorProxy::SubmitCompositorFrame(
if (hardware_draw_reply_) {
// For viz the CF was submitted directly via CompositorFrameSink
DCHECK(frame || using_viz_for_webview_);
DCHECK(frame || viz_frame_submission_enabled_);
std::move(hardware_draw_reply_)
.Run(common_renderer_params, layer_tree_frame_sink_id,
NextMetadataVersion(), std::move(frame));
......
......@@ -120,7 +120,7 @@ class SynchronousCompositorProxy : public ui::SynchronousInputHandler,
mojo::AssociatedReceiver<mojom::SynchronousCompositor> receiver_{this};
const bool use_in_process_zero_copy_software_draw_;
const bool using_viz_for_webview_;
const bool viz_frame_submission_enabled_;
bool needs_begin_frames_ = false;
......
......@@ -1780,7 +1780,7 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink(
#if defined(OS_ANDROID)
if (GetContentClient()->UsingSynchronousCompositing()) {
// TODO(ericrk): Collapse with non-webview registration below.
if (features::IsUsingVizForWebView()) {
if (features::IsUsingVizFrameSubmissionForWebView()) {
frame_sink_provider_->CreateForWidget(
render_widget->routing_id(),
std::move(compositor_frame_sink_receiver),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment