Commit 4ed92d7d authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

aw: Move kVizForWebView feature to viz

This CL moved kVizForWebView from android_webview:: to viz so it can be
reachable in renderers code to support viz for webview.

Bug: 805739
Change-Id: If89de11e2efa2acc49fc1920b2c240f08bcebd15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911389Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714659}
parent c9a597b9
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "base/supports_user_data.h" #include "base/supports_user_data.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "cc/base/math_util.h" #include "cc/base/math_util.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/quads/compositor_frame.h" #include "components/viz/common/quads/compositor_frame.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
...@@ -113,7 +114,7 @@ BrowserViewRenderer::BrowserViewRenderer( ...@@ -113,7 +114,7 @@ BrowserViewRenderer::BrowserViewRenderer(
on_new_picture_enable_(false), on_new_picture_enable_(false),
clear_view_(false), clear_view_(false),
offscreen_pre_raster_(false) { offscreen_pre_raster_(false) {
if (base::FeatureList::IsEnabled(features::kVizForWebView)) { if (::features::IsUsingVizForWebView()) {
root_frame_sink_proxy_ = std::make_unique<RootFrameSinkProxy>( root_frame_sink_proxy_ = std::make_unique<RootFrameSinkProxy>(
ui_task_runner_, ui_task_runner_,
base::BindRepeating(&BrowserViewRenderer::SetNeedsBeginFrames, base::BindRepeating(&BrowserViewRenderer::SetNeedsBeginFrames,
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h" #include "base/trace_event/traced_value.h"
#include "components/viz/common/features.h"
#include "components/viz/common/quads/compositor_frame.h" #include "components/viz/common/quads/compositor_frame.h"
namespace android_webview { namespace android_webview {
...@@ -192,7 +193,7 @@ void RenderThreadManager::DrawOnRT(bool save_restore, ...@@ -192,7 +193,7 @@ void RenderThreadManager::DrawOnRT(bool save_restore,
ScopedAllowGL allow_gl; ScopedAllowGL allow_gl;
if (!hardware_renderer_ && !IsInsideHardwareRelease() && if (!hardware_renderer_ && !IsInsideHardwareRelease() &&
HasFrameForHardwareRendererOnRT()) { HasFrameForHardwareRendererOnRT()) {
if (base::FeatureList::IsEnabled(features::kVizForWebView)) { if (::features::IsUsingVizForWebView()) {
RootFrameSinkGetter getter; RootFrameSinkGetter getter;
{ {
base::AutoLock lock(lock_); base::AutoLock lock(lock_);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "base/threading/thread_local.h" #include "base/threading/thread_local.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "components/viz/common/features.h"
namespace android_webview { namespace android_webview {
...@@ -329,7 +330,7 @@ ScopedAllowGL::~ScopedAllowGL() { ...@@ -329,7 +330,7 @@ ScopedAllowGL::~ScopedAllowGL() {
// static // static
TaskQueueWebView* TaskQueueWebView::GetInstance() { TaskQueueWebView* TaskQueueWebView::GetInstance() {
static TaskQueueWebView* task_queue = static TaskQueueWebView* task_queue =
base::FeatureList::IsEnabled(features::kVizForWebView) ::features::IsUsingVizForWebView()
? static_cast<TaskQueueWebView*>(new TaskQueueViz) ? static_cast<TaskQueueWebView*>(new TaskQueueViz)
: static_cast<TaskQueueWebView*>(new TaskQueueSingleThread); : static_cast<TaskQueueWebView*>(new TaskQueueSingleThread);
return task_queue; return task_queue;
......
...@@ -9,10 +9,6 @@ namespace features { ...@@ -9,10 +9,6 @@ namespace features {
// Alphabetical: // Alphabetical:
// Viz for WebView architecture.
const base::Feature kVizForWebView{"VizForWebView",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enable brotli compression support in WebView. // Enable brotli compression support in WebView.
const base::Feature kWebViewBrotliSupport{"WebViewBrotliSupport", const base::Feature kWebViewBrotliSupport{"WebViewBrotliSupport",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -14,7 +14,6 @@ namespace features { ...@@ -14,7 +14,6 @@ namespace features {
// alongside the definition of their values in the .cc file. // alongside the definition of their values in the .cc file.
// Alphabetical: // Alphabetical:
extern const base::Feature kVizForWebView;
extern const base::Feature kWebViewBrotliSupport; extern const base::Feature kWebViewBrotliSupport;
extern const base::Feature kWebViewConnectionlessSafeBrowsing; extern const base::Feature kWebViewConnectionlessSafeBrowsing;
extern const base::Feature kWebViewSniffMimeType; extern const base::Feature kWebViewSniffMimeType;
......
...@@ -365,7 +365,7 @@ gpu::SharedImageManager* GetSharedImageManager() { ...@@ -365,7 +365,7 @@ gpu::SharedImageManager* GetSharedImageManager() {
} }
viz::VizCompositorThreadRunner* GetVizCompositorThreadRunner() { viz::VizCompositorThreadRunner* GetVizCompositorThreadRunner() {
return base::FeatureList::IsEnabled(features::kVizForWebView) return ::features::IsUsingVizForWebView()
? VizCompositorThreadRunnerWebView::GetInstance() ? VizCompositorThreadRunnerWebView::GetInstance()
: nullptr; : nullptr;
} }
......
...@@ -49,6 +49,10 @@ const base::Feature kRecordSkPicture{"RecordSkPicture", ...@@ -49,6 +49,10 @@ const base::Feature kRecordSkPicture{"RecordSkPicture",
const base::Feature kDisableDeJelly{"DisableDeJelly", const base::Feature kDisableDeJelly{"DisableDeJelly",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Viz for WebView architecture.
const base::Feature kVizForWebView{"VizForWebView",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsVizDisplayCompositorEnabled() { bool IsVizDisplayCompositorEnabled() {
#if defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_MACOSX) || defined(OS_WIN)
// We can't remove the feature switch yet because OOP-D isn't enabled on all // We can't remove the feature switch yet because OOP-D isn't enabled on all
...@@ -103,4 +107,13 @@ bool IsRecordingSkPicture() { ...@@ -103,4 +107,13 @@ bool IsRecordingSkPicture() {
base::FeatureList::IsEnabled(kRecordSkPicture); base::FeatureList::IsEnabled(kRecordSkPicture);
} }
bool IsUsingVizForWebView() {
if (base::FeatureList::IsEnabled(kVizForWebView)) {
DCHECK(IsVizDisplayCompositorEnabled())
<< "Enabling VizForWebView requires VizDisplayCompositor";
return true;
}
return false;
}
} // namespace features } // namespace features
...@@ -17,6 +17,7 @@ VIZ_COMMON_EXPORT extern const base::Feature kUseSkiaRenderer; ...@@ -17,6 +17,7 @@ VIZ_COMMON_EXPORT extern const base::Feature kUseSkiaRenderer;
VIZ_COMMON_EXPORT extern const base::Feature kRecordSkPicture; VIZ_COMMON_EXPORT extern const base::Feature kRecordSkPicture;
VIZ_COMMON_EXPORT extern const base::Feature kVizDisplayCompositor; VIZ_COMMON_EXPORT extern const base::Feature kVizDisplayCompositor;
VIZ_COMMON_EXPORT extern const base::Feature kDisableDeJelly; VIZ_COMMON_EXPORT extern const base::Feature kDisableDeJelly;
VIZ_COMMON_EXPORT extern const base::Feature kVizForWebView;
VIZ_COMMON_EXPORT bool IsVizDisplayCompositorEnabled(); VIZ_COMMON_EXPORT bool IsVizDisplayCompositorEnabled();
VIZ_COMMON_EXPORT bool IsVizHitTestingDebugEnabled(); VIZ_COMMON_EXPORT bool IsVizHitTestingDebugEnabled();
...@@ -24,6 +25,7 @@ VIZ_COMMON_EXPORT bool IsVizHitTestingSurfaceLayerEnabled(); ...@@ -24,6 +25,7 @@ VIZ_COMMON_EXPORT bool IsVizHitTestingSurfaceLayerEnabled();
VIZ_COMMON_EXPORT bool IsUsingSkiaForGLReadback(); VIZ_COMMON_EXPORT bool IsUsingSkiaForGLReadback();
VIZ_COMMON_EXPORT bool IsUsingSkiaRenderer(); VIZ_COMMON_EXPORT bool IsUsingSkiaRenderer();
VIZ_COMMON_EXPORT bool IsRecordingSkPicture(); VIZ_COMMON_EXPORT bool IsRecordingSkPicture();
VIZ_COMMON_EXPORT bool IsUsingVizForWebView();
} // namespace features } // namespace features
......
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