Commit e9806340 authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

aw: Create SharedBitmapManager with viz

With Viz For WebView enabled we support surface embedding. Some
embeddees (e.g Unaccelerated OffscreenCanvas) will try to fallback
to SharedBitmaps for resources.

This CL adds SharedBitmapManager to avoid crash. We can't draw this
bitmaps, but for resourceless software draw we do not support
embedding and we don't support software compositing on Android,
so the draw won't happen either way.

Bug: 1055877
Change-Id: I9e3073a46f4d2b0b63b1025489b48e91be15f71c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072655
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744660}
parent e891c323
......@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/synchronization/waitable_event.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
namespace android_webview {
......@@ -58,10 +59,15 @@ VizCompositorThreadRunnerWebView::VizCompositorThreadRunnerWebView()
void VizCompositorThreadRunnerWebView::InitFrameSinkManagerOnViz() {
DCHECK_CALLED_ON_VALID_THREAD(viz_thread_checker_);
// The SharedBitmapManager is null as we do not support or use software
// compositing on Android.
// Android doesn't support software compositing, but in some cases
// unaccelerated canvas can use SharedBitmaps as resource so we create
// SharedBitmapManager anyway.
// TODO(1056184): Stop using SharedBitmapManager after fixing fallback to
// SharedBitmap.
server_shared_bitmap_manager_ =
std::make_unique<viz::ServerSharedBitmapManager>();
frame_sink_manager_ = std::make_unique<viz::FrameSinkManagerImpl>(
/*shared_bitmap_manager=*/nullptr);
server_shared_bitmap_manager_.get());
}
viz::FrameSinkManagerImpl*
......
......@@ -20,6 +20,7 @@ class Location;
namespace viz {
class FrameSinkManagerImpl;
class ServerSharedBitmapManager;
} // namespace viz
namespace android_webview {
......@@ -77,6 +78,7 @@ class VizCompositorThreadRunnerWebView : public viz::VizCompositorThreadRunner {
// Only accessed on |viz_task_runner_|.
THREAD_CHECKER(viz_thread_checker_);
std::unique_ptr<viz::ServerSharedBitmapManager> server_shared_bitmap_manager_;
std::unique_ptr<viz::FrameSinkManagerImpl> frame_sink_manager_;
DISALLOW_COPY_AND_ASSIGN(VizCompositorThreadRunnerWebView);
......
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