Commit 253d362f authored by David 'Digit' Turner's avatar David 'Digit' Turner Committed by Commit Bot

viz: Refactor SharedBitmapManager::ChildAddedSharedBitmap

This CL implements step 2 in the refactoring described by
http://crbug.com/951391, which attemps to port the viz
component and service to use our new shared memory API
(base::SharedMemory is deprecated).

It modifies SharedBitmapManager::ChildAddedSharedBitmap
to accept WritableSharedMemoryMapping values directly.

This simplifies the implementation and gets rid of
Mojo handle usage to pass shared memory region, in
favor of the new base::UnsafeSharedMemoryRegion and
base::WritableSharedMemoryMapping types.

BUG=951391,795291
R=alexilin@chromium.org, enne@chromium.org, danakj@chromium.org, piman@chromium.org, samans@chromium.org, liberato@chromium.org

Change-Id: I0314f43f64fc4cd5591c65816b764adb97fe6b13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1571648
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658520}
parent c22af03b
...@@ -214,12 +214,11 @@ bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file, ...@@ -214,12 +214,11 @@ bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,
base::WritableSharedMemoryMapping PixelTest::AllocateSharedBitmapMemory( base::WritableSharedMemoryMapping PixelTest::AllocateSharedBitmapMemory(
const viz::SharedBitmapId& id, const viz::SharedBitmapId& id,
const gfx::Size& size) { const gfx::Size& size) {
base::MappedReadOnlyRegion mapped_region = base::MappedReadOnlyRegion shm =
viz::bitmap_allocation::AllocateSharedBitmap(size, viz::RGBA_8888); viz::bitmap_allocation::AllocateSharedBitmap(size, viz::RGBA_8888);
this->shared_bitmap_manager_->ChildAllocatedSharedBitmap( this->shared_bitmap_manager_->ChildAllocatedSharedBitmap(shm.region.Map(),
viz::bitmap_allocation::ToMojoHandle(std::move(mapped_region.region)), id);
id); return std::move(shm.mapping);
return std::move(mapped_region.mapping);
} }
viz::ResourceId PixelTest::AllocateAndFillSoftwareResource( viz::ResourceId PixelTest::AllocateAndFillSoftwareResource(
......
...@@ -73,11 +73,10 @@ static SharedBitmapId CreateAndFillSharedBitmap(SharedBitmapManager* manager, ...@@ -73,11 +73,10 @@ static SharedBitmapId CreateAndFillSharedBitmap(SharedBitmapManager* manager,
base::MappedReadOnlyRegion shm = base::MappedReadOnlyRegion shm =
bitmap_allocation::AllocateSharedBitmap(size, RGBA_8888); bitmap_allocation::AllocateSharedBitmap(size, RGBA_8888);
manager->ChildAllocatedSharedBitmap( manager->ChildAllocatedSharedBitmap(shm.region.Map(), shared_bitmap_id);
bitmap_allocation::ToMojoHandle(std::move(shm.region)), shared_bitmap_id); base::span<uint32_t> span =
shm.mapping.GetMemoryAsSpan<uint32_t>(size.GetArea());
auto* memory = static_cast<uint32_t*>(shm.mapping.memory()); std::fill(span.begin(), span.end(), value);
std::fill_n(memory, size.GetArea(), value);
return shared_bitmap_id; return shared_bitmap_id;
} }
......
...@@ -71,8 +71,7 @@ base::WritableSharedMemoryMapping AllocateAndRegisterSharedBitmapMemory( ...@@ -71,8 +71,7 @@ base::WritableSharedMemoryMapping AllocateAndRegisterSharedBitmapMemory(
SharedBitmapManager* shared_bitmap_manager) { SharedBitmapManager* shared_bitmap_manager) {
base::MappedReadOnlyRegion shm = base::MappedReadOnlyRegion shm =
bitmap_allocation::AllocateSharedBitmap(size, RGBA_8888); bitmap_allocation::AllocateSharedBitmap(size, RGBA_8888);
shared_bitmap_manager->ChildAllocatedSharedBitmap( shared_bitmap_manager->ChildAllocatedSharedBitmap(shm.region.Map(), id);
bitmap_allocation::ToMojoHandle(std::move(shm.region)), id);
return std::move(shm.mapping); return std::move(shm.mapping);
} }
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/shared_memory_mapping.h"
#include "components/viz/common/resources/shared_bitmap.h" #include "components/viz/common/resources/shared_bitmap.h"
#include "mojo/public/cpp/system/buffer.h"
namespace gfx { namespace gfx {
class Size; class Size;
...@@ -29,9 +29,10 @@ class SharedBitmapManager { ...@@ -29,9 +29,10 @@ class SharedBitmapManager {
const SharedBitmapId& id) = 0; const SharedBitmapId& id) = 0;
virtual base::UnguessableToken GetSharedBitmapTracingGUIDFromId( virtual base::UnguessableToken GetSharedBitmapTracingGUIDFromId(
const SharedBitmapId& id) = 0; const SharedBitmapId& id) = 0;
// Used in the display compositor to associate an id to a shm handle. // Used in the display compositor to associate an id to a shm mapping.
virtual bool ChildAllocatedSharedBitmap(mojo::ScopedSharedBufferHandle buffer, virtual bool ChildAllocatedSharedBitmap(
const SharedBitmapId& id) = 0; base::ReadOnlySharedMemoryMapping mapping,
const SharedBitmapId& id) = 0;
// Used in the display compositor to break an association of an id to a shm // Used in the display compositor to break an association of an id to a shm
// handle. // handle.
virtual void ChildDeletedSharedBitmap(const SharedBitmapId& id) = 0; virtual void ChildDeletedSharedBitmap(const SharedBitmapId& id) = 0;
......
...@@ -85,9 +85,8 @@ class SoftwareRendererTest : public testing::Test { ...@@ -85,9 +85,8 @@ class SoftwareRendererTest : public testing::Test {
// Registers the SharedBitmapId in the display compositor. // Registers the SharedBitmapId in the display compositor.
SharedBitmapId shared_bitmap_id = SharedBitmap::GenerateId(); SharedBitmapId shared_bitmap_id = SharedBitmap::GenerateId();
shared_bitmap_manager_->ChildAllocatedSharedBitmap( shared_bitmap_manager_->ChildAllocatedSharedBitmap(shm.region.Map(),
bitmap_allocation::ToMojoHandle(std::move(shm.region)), shared_bitmap_id);
shared_bitmap_id);
// Makes a resource id that refers to the registered SharedBitmapId. // Makes a resource id that refers to the registered SharedBitmapId.
return child_resource_provider_->ImportResource( return child_resource_provider_->ImportResource(
......
...@@ -29,9 +29,9 @@ class BitmapData : public base::RefCounted<BitmapData> { ...@@ -29,9 +29,9 @@ class BitmapData : public base::RefCounted<BitmapData> {
explicit BitmapData(base::ReadOnlySharedMemoryMapping mapping) explicit BitmapData(base::ReadOnlySharedMemoryMapping mapping)
: mapping_(std::move(mapping)) {} : mapping_(std::move(mapping)) {}
const void* memory() const { return mapping_.memory(); }
size_t size() const { return mapping_.size(); } size_t size() const { return mapping_.size(); }
const base::UnguessableToken& mapped_id() const { return mapping_.guid(); } const base::UnguessableToken& mapped_id() const { return mapping_.guid(); }
const void* memory() const { return mapping_.memory(); }
private: private:
friend class base::RefCounted<BitmapData>; friend class base::RefCounted<BitmapData>;
...@@ -43,9 +43,9 @@ class BitmapData : public base::RefCounted<BitmapData> { ...@@ -43,9 +43,9 @@ class BitmapData : public base::RefCounted<BitmapData> {
namespace { namespace {
// Holds a reference on the BitmapData so that the SharedMemory can outlive the // Holds a reference on the BitmapData so that the WritableSharedMemoryMapping
// SharedBitmapId registration as long as this SharedBitmap object is held // can outlive the SharedBitmapId registration as long as this SharedBitmap
// alive. // object is held alive.
class ServerSharedBitmap : public SharedBitmap { class ServerSharedBitmap : public SharedBitmap {
public: public:
// NOTE: bitmap_data->memory() is read-only but SharedBitmap expects a // NOTE: bitmap_data->memory() is read-only but SharedBitmap expects a
...@@ -79,15 +79,17 @@ std::unique_ptr<SharedBitmap> ServerSharedBitmapManager::GetSharedBitmapFromId( ...@@ -79,15 +79,17 @@ std::unique_ptr<SharedBitmap> ServerSharedBitmapManager::GetSharedBitmapFromId(
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto it = handle_map_.find(id); auto it = handle_map_.find(id);
if (it == handle_map_.end()) if (it == handle_map_.end()) {
return nullptr; return nullptr;
}
BitmapData* data = it->second.get(); BitmapData* data = it->second.get();
size_t bitmap_size; size_t bitmap_size;
if (!ResourceSizes::MaybeSizeInBytes(size, format, &bitmap_size) || if (!ResourceSizes::MaybeSizeInBytes(size, format, &bitmap_size) ||
bitmap_size > data->size()) bitmap_size > data->size()) {
return nullptr; return nullptr;
}
if (!data->memory()) { if (!data->memory()) {
return nullptr; return nullptr;
...@@ -107,7 +109,7 @@ ServerSharedBitmapManager::GetSharedBitmapTracingGUIDFromId( ...@@ -107,7 +109,7 @@ ServerSharedBitmapManager::GetSharedBitmapTracingGUIDFromId(
} }
bool ServerSharedBitmapManager::ChildAllocatedSharedBitmap( bool ServerSharedBitmapManager::ChildAllocatedSharedBitmap(
mojo::ScopedSharedBufferHandle buffer, base::ReadOnlySharedMemoryMapping mapping,
const SharedBitmapId& id) { const SharedBitmapId& id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
...@@ -115,15 +117,8 @@ bool ServerSharedBitmapManager::ChildAllocatedSharedBitmap( ...@@ -115,15 +117,8 @@ bool ServerSharedBitmapManager::ChildAllocatedSharedBitmap(
if (base::ContainsKey(handle_map_, id)) if (base::ContainsKey(handle_map_, id))
return false; return false;
base::ReadOnlySharedMemoryRegion region =
bitmap_allocation::FromMojoHandle(std::move(buffer));
// This function handles public API requests, so verify we unwrapped a shared // This function handles public API requests, so verify we unwrapped a shared
// memory handle before trying to use the handle. // memory handle before trying to use the handle.
if (!region.IsValid())
return false;
base::ReadOnlySharedMemoryMapping mapping = region.Map();
if (!mapping.IsValid()) if (!mapping.IsValid())
return false; return false;
......
...@@ -38,7 +38,7 @@ class VIZ_SERVICE_EXPORT ServerSharedBitmapManager ...@@ -38,7 +38,7 @@ class VIZ_SERVICE_EXPORT ServerSharedBitmapManager
const SharedBitmapId& id) override; const SharedBitmapId& id) override;
base::UnguessableToken GetSharedBitmapTracingGUIDFromId( base::UnguessableToken GetSharedBitmapTracingGUIDFromId(
const SharedBitmapId& id) override; const SharedBitmapId& id) override;
bool ChildAllocatedSharedBitmap(mojo::ScopedSharedBufferHandle buffer, bool ChildAllocatedSharedBitmap(base::ReadOnlySharedMemoryMapping mapping,
const SharedBitmapId& id) override; const SharedBitmapId& id) override;
void ChildDeletedSharedBitmap(const SharedBitmapId& id) override; void ChildDeletedSharedBitmap(const SharedBitmapId& id) override;
......
...@@ -36,8 +36,7 @@ TEST_F(ServerSharedBitmapManagerTest, TestCreate) { ...@@ -36,8 +36,7 @@ TEST_F(ServerSharedBitmapManagerTest, TestCreate) {
std::fill(span.begin(), span.end(), 0xff); std::fill(span.begin(), span.end(), 0xff);
SharedBitmapId id = SharedBitmap::GenerateId(); SharedBitmapId id = SharedBitmap::GenerateId();
manager()->ChildAllocatedSharedBitmap( manager()->ChildAllocatedSharedBitmap(shm.region.Map(), id);
bitmap_allocation::ToMojoHandle(std::move(shm.region)), id);
std::unique_ptr<SharedBitmap> large_bitmap; std::unique_ptr<SharedBitmap> large_bitmap;
large_bitmap = large_bitmap =
...@@ -95,8 +94,7 @@ TEST_F(ServerSharedBitmapManagerTest, AddDuplicate) { ...@@ -95,8 +94,7 @@ TEST_F(ServerSharedBitmapManagerTest, AddDuplicate) {
SharedBitmapId id = SharedBitmap::GenerateId(); SharedBitmapId id = SharedBitmap::GenerateId();
// NOTE: Duplicate the mapping to compare its content later. // NOTE: Duplicate the mapping to compare its content later.
manager()->ChildAllocatedSharedBitmap( manager()->ChildAllocatedSharedBitmap(shm.region.Map(), id);
bitmap_allocation::ToMojoHandle(std::move(shm.region)), id);
base::MappedReadOnlyRegion shm2 = base::MappedReadOnlyRegion shm2 =
bitmap_allocation::AllocateSharedBitmap(bitmap_size, RGBA_8888); bitmap_allocation::AllocateSharedBitmap(bitmap_size, RGBA_8888);
...@@ -104,8 +102,7 @@ TEST_F(ServerSharedBitmapManagerTest, AddDuplicate) { ...@@ -104,8 +102,7 @@ TEST_F(ServerSharedBitmapManagerTest, AddDuplicate) {
base::span<uint8_t> span2 = shm.mapping.GetMemoryAsSpan<uint8_t>(); base::span<uint8_t> span2 = shm.mapping.GetMemoryAsSpan<uint8_t>();
std::fill(span2.begin(), span2.end(), 0x00); std::fill(span2.begin(), span2.end(), 0x00);
manager()->ChildAllocatedSharedBitmap( manager()->ChildAllocatedSharedBitmap(shm2.region.Map(), id);
bitmap_allocation::ToMojoHandle(std::move(shm2.region)), id);
std::unique_ptr<SharedBitmap> shared_bitmap; std::unique_ptr<SharedBitmap> shared_bitmap;
shared_bitmap = manager()->GetSharedBitmapFromId(bitmap_size, RGBA_8888, id); shared_bitmap = manager()->GetSharedBitmapFromId(bitmap_size, RGBA_8888, id);
...@@ -125,8 +122,7 @@ TEST_F(ServerSharedBitmapManagerTest, SharedMemoryHandle) { ...@@ -125,8 +122,7 @@ TEST_F(ServerSharedBitmapManagerTest, SharedMemoryHandle) {
EXPECT_FALSE(shared_memory_guid.is_empty()); EXPECT_FALSE(shared_memory_guid.is_empty());
SharedBitmapId id = SharedBitmap::GenerateId(); SharedBitmapId id = SharedBitmap::GenerateId();
manager()->ChildAllocatedSharedBitmap( manager()->ChildAllocatedSharedBitmap(shm.region.Map(), id);
bitmap_allocation::ToMojoHandle(std::move(shm.region)), id);
base::UnguessableToken tracing_guid = base::UnguessableToken tracing_guid =
manager()->GetSharedBitmapTracingGUIDFromId(id); manager()->GetSharedBitmapTracingGUIDFromId(id);
...@@ -137,10 +133,10 @@ TEST_F(ServerSharedBitmapManagerTest, SharedMemoryHandle) { ...@@ -137,10 +133,10 @@ TEST_F(ServerSharedBitmapManagerTest, SharedMemoryHandle) {
TEST_F(ServerSharedBitmapManagerTest, InvalidScopedSharedBufferHandle) { TEST_F(ServerSharedBitmapManagerTest, InvalidScopedSharedBufferHandle) {
SharedBitmapId id = SharedBitmap::GenerateId(); SharedBitmapId id = SharedBitmap::GenerateId();
mojo::ScopedSharedBufferHandle invalid_handle( base::ReadOnlySharedMemoryMapping invalid_mapping;
mojo::SharedBufferHandle(0x1234567)); EXPECT_FALSE(invalid_mapping.IsValid());
EXPECT_FALSE( EXPECT_FALSE(
manager()->ChildAllocatedSharedBitmap(std::move(invalid_handle), id)); manager()->ChildAllocatedSharedBitmap(std::move(invalid_mapping), id));
// The client could still send an IPC to say it deleted the shared bitmap, // The client could still send an IPC to say it deleted the shared bitmap,
// even though it wasn't valid, which should be ignored. // even though it wasn't valid, which should be ignored.
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/quads/compositor_frame.h" #include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/common/surfaces/surface_info.h" #include "components/viz/common/surfaces/surface_info.h"
#include "components/viz/service/display/display.h" #include "components/viz/service/display/display.h"
#include "components/viz/service/display/shared_bitmap_manager.h" #include "components/viz/service/display/shared_bitmap_manager.h"
...@@ -324,8 +325,9 @@ bool CompositorFrameSinkSupport::DidAllocateSharedBitmap( ...@@ -324,8 +325,9 @@ bool CompositorFrameSinkSupport::DidAllocateSharedBitmap(
mojo::ScopedSharedBufferHandle buffer, mojo::ScopedSharedBufferHandle buffer,
const SharedBitmapId& id) { const SharedBitmapId& id) {
if (!frame_sink_manager_->shared_bitmap_manager()->ChildAllocatedSharedBitmap( if (!frame_sink_manager_->shared_bitmap_manager()->ChildAllocatedSharedBitmap(
std::move(buffer), id)) bitmap_allocation::FromMojoHandle(std::move(buffer)).Map(), id)) {
return false; return false;
}
owned_bitmaps_.insert(id); owned_bitmaps_.insert(id);
return true; return true;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "cc/trees/layer_tree_frame_sink_client.h" #include "cc/trees/layer_tree_frame_sink_client.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h" #include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/service/display/direct_renderer.h" #include "components/viz/service/display/direct_renderer.h"
#include "components/viz/service/display/output_surface.h" #include "components/viz/service/display/output_surface.h"
#include "components/viz/service/display/skia_output_surface.h" #include "components/viz/service/display/skia_output_surface.h"
...@@ -204,8 +205,8 @@ void TestLayerTreeFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { ...@@ -204,8 +205,8 @@ void TestLayerTreeFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) {
void TestLayerTreeFrameSink::DidAllocateSharedBitmap( void TestLayerTreeFrameSink::DidAllocateSharedBitmap(
mojo::ScopedSharedBufferHandle buffer, mojo::ScopedSharedBufferHandle buffer,
const SharedBitmapId& id) { const SharedBitmapId& id) {
bool ok = bool ok = shared_bitmap_manager_->ChildAllocatedSharedBitmap(
shared_bitmap_manager_->ChildAllocatedSharedBitmap(std::move(buffer), id); bitmap_allocation::FromMojoHandle(std::move(buffer)).Map(), id);
DCHECK(ok); DCHECK(ok);
owned_bitmaps_.insert(id); owned_bitmaps_.insert(id);
} }
......
...@@ -30,8 +30,7 @@ std::unique_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId( ...@@ -30,8 +30,7 @@ std::unique_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId(
return nullptr; return nullptr;
// NOTE: pixels needs to be writable for legacy reasons, but SharedBitmap // NOTE: pixels needs to be writable for legacy reasons, but SharedBitmap
// instances returned by a SharedBitmapManager are always read-only. // instances returned by a SharedBitmapManager are always read-only.
uint8_t* pixels = auto* pixels = static_cast<uint8_t*>(const_cast<void*>(it->second.memory()));
static_cast<uint8_t*>(const_cast<void*>(it->second.memory()));
return std::make_unique<SharedBitmap>(pixels); return std::make_unique<SharedBitmap>(pixels);
} }
...@@ -45,7 +44,7 @@ TestSharedBitmapManager::GetSharedBitmapTracingGUIDFromId( ...@@ -45,7 +44,7 @@ TestSharedBitmapManager::GetSharedBitmapTracingGUIDFromId(
} }
bool TestSharedBitmapManager::ChildAllocatedSharedBitmap( bool TestSharedBitmapManager::ChildAllocatedSharedBitmap(
mojo::ScopedSharedBufferHandle buffer, base::ReadOnlySharedMemoryMapping mapping,
const SharedBitmapId& id) { const SharedBitmapId& id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
...@@ -53,11 +52,6 @@ bool TestSharedBitmapManager::ChildAllocatedSharedBitmap( ...@@ -53,11 +52,6 @@ bool TestSharedBitmapManager::ChildAllocatedSharedBitmap(
// notification here should be about a bitmap that was previously allocated // notification here should be about a bitmap that was previously allocated
// with AllocateSharedBitmap(). // with AllocateSharedBitmap().
if (mapping_map_.find(id) == mapping_map_.end()) { if (mapping_map_.find(id) == mapping_map_.end()) {
base::ReadOnlySharedMemoryRegion region =
bitmap_allocation::FromMojoHandle(std::move(buffer));
DCHECK(region.IsValid());
base::ReadOnlySharedMemoryMapping mapping = region.Map();
DCHECK(mapping.IsValid());
mapping_map_.emplace(id, std::move(mapping)); mapping_map_.emplace(id, std::move(mapping));
} }
......
...@@ -26,7 +26,7 @@ class TestSharedBitmapManager : public SharedBitmapManager { ...@@ -26,7 +26,7 @@ class TestSharedBitmapManager : public SharedBitmapManager {
const SharedBitmapId& id) override; const SharedBitmapId& id) override;
base::UnguessableToken GetSharedBitmapTracingGUIDFromId( base::UnguessableToken GetSharedBitmapTracingGUIDFromId(
const SharedBitmapId& id) override; const SharedBitmapId& id) override;
bool ChildAllocatedSharedBitmap(mojo::ScopedSharedBufferHandle buffer, bool ChildAllocatedSharedBitmap(base::ReadOnlySharedMemoryMapping mapping,
const SharedBitmapId& id) override; const SharedBitmapId& id) override;
void ChildDeletedSharedBitmap(const SharedBitmapId& id) override; void ChildDeletedSharedBitmap(const SharedBitmapId& id) override;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/location.h" #include "base/location.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
...@@ -37,6 +36,7 @@ ...@@ -37,6 +36,7 @@
#include "cc/trees/render_frame_metadata.h" #include "cc/trees/render_frame_metadata.h"
#include "components/viz/common/features.h" #include "components/viz/common/features.h"
#include "components/viz/common/quads/compositor_frame.h" #include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/resources/bitmap_allocation.h"
#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/host/host_frame_sink_manager.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h" #include "content/browser/accessibility/browser_accessibility_state_impl.h"
...@@ -2354,8 +2354,9 @@ void RenderWidgetHostImpl::DidNotProduceFrame(const viz::BeginFrameAck& ack) { ...@@ -2354,8 +2354,9 @@ void RenderWidgetHostImpl::DidNotProduceFrame(const viz::BeginFrameAck& ack) {
void RenderWidgetHostImpl::DidAllocateSharedBitmap( void RenderWidgetHostImpl::DidAllocateSharedBitmap(
mojo::ScopedSharedBufferHandle buffer, mojo::ScopedSharedBufferHandle buffer,
const viz::SharedBitmapId& id) { const viz::SharedBitmapId& id) {
if (!shared_bitmap_manager_->ChildAllocatedSharedBitmap(std::move(buffer), if (!shared_bitmap_manager_->ChildAllocatedSharedBitmap(
id)) { viz::bitmap_allocation::FromMojoHandle(std::move(buffer)).Map(),
id)) {
bad_message::ReceivedBadMessage(GetProcess(), bad_message::ReceivedBadMessage(GetProcess(),
bad_message::RWH_SHARED_BITMAP); bad_message::RWH_SHARED_BITMAP);
} }
......
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