Delete AllocateSharedBitmap
Now we don't use AllocateSharedBitmap after converting SharedBitmap to SharedImage. CreateSharedImage is the one for software compositing. Bug: 40064122 Change-Id: I43dcd5319f083aa19eb15ee4d18074aad76f7792 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6182348 Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org> Auto-Submit: Maggie Chen <magchen@chromium.org> Commit-Queue: Maggie Chen <magchen@chromium.org> Cr-Commit-Position: refs/heads/main@{#1408802}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
03e19352fd
commit
3ba50a50a4
cc
components/viz
common
service
compositor_frame_fuzzer
frame_sinks
content/web_test/renderer
third_party/blink/renderer/platform/graphics/gpu
@ -22,7 +22,6 @@
|
||||
#include "components/viz/common/features.h"
|
||||
#include "components/viz/common/quads/solid_color_draw_quad.h"
|
||||
#include "components/viz/common/quads/texture_draw_quad.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/resources/platform_color.h"
|
||||
|
||||
namespace cc {
|
||||
|
@ -121,7 +121,6 @@
|
||||
#include "components/viz/common/quads/shared_element_draw_quad.h"
|
||||
#include "components/viz/common/quads/shared_quad_state.h"
|
||||
#include "components/viz/common/quads/solid_color_draw_quad.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/resources/platform_color.h"
|
||||
#include "components/viz/common/resources/shared_image_format.h"
|
||||
#include "components/viz/common/resources/shared_image_format_utils.h"
|
||||
|
@ -222,8 +222,6 @@ viz_component("common") {
|
||||
"quads/tile_draw_quad.h",
|
||||
"quads/video_hole_draw_quad.cc",
|
||||
"quads/video_hole_draw_quad.h",
|
||||
"resources/bitmap_allocation.cc",
|
||||
"resources/bitmap_allocation.h",
|
||||
"resources/peak_gpu_memory_callback.cc",
|
||||
"resources/peak_gpu_memory_callback.h",
|
||||
"resources/peak_gpu_memory_tracker.h",
|
||||
|
@ -1,66 +0,0 @@
|
||||
// Copyright 2018 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "base/debug/alias.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/read_only_shared_memory_region.h"
|
||||
#include "base/process/memory.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/viz/common/resources/resource_sizes.h"
|
||||
#include "mojo/public/cpp/system/platform_handle.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
namespace viz {
|
||||
|
||||
namespace {
|
||||
// Collect extra information for debugging bitmap creation failures.
|
||||
void CollectMemoryUsageAndDie(const gfx::Size& size,
|
||||
SharedImageFormat format,
|
||||
size_t alloc_size) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
DWORD last_error = GetLastError();
|
||||
base::debug::Alias(&last_error);
|
||||
#endif
|
||||
|
||||
int width = size.width();
|
||||
int height = size.height();
|
||||
|
||||
base::debug::Alias(&width);
|
||||
base::debug::Alias(&height);
|
||||
base::debug::Alias(&format);
|
||||
|
||||
base::TerminateBecauseOutOfMemory(alloc_size);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace bitmap_allocation {
|
||||
|
||||
base::MappedReadOnlyRegion AllocateSharedBitmap(const gfx::Size& size,
|
||||
SharedImageFormat format) {
|
||||
DCHECK(format.IsBitmapFormatSupported())
|
||||
<< "(format = " << format.ToString() << ")";
|
||||
size_t bytes = 0;
|
||||
if (!ResourceSizes::MaybeSizeInBytes(size, format, &bytes)) {
|
||||
DLOG(ERROR) << "AllocateMappedBitmap with size that overflows";
|
||||
CollectMemoryUsageAndDie(size, format, std::numeric_limits<int>::max());
|
||||
}
|
||||
|
||||
base::MappedReadOnlyRegion shm =
|
||||
base::ReadOnlySharedMemoryRegion::Create(bytes);
|
||||
if (!shm.IsValid()) {
|
||||
DLOG(ERROR) << "Browser failed to allocate shared memory";
|
||||
CollectMemoryUsageAndDie(size, format, bytes);
|
||||
}
|
||||
return shm;
|
||||
}
|
||||
|
||||
} // namespace bitmap_allocation
|
||||
|
||||
} // namespace viz
|
@ -1,30 +0,0 @@
|
||||
// Copyright 2018 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef COMPONENTS_VIZ_COMMON_RESOURCES_BITMAP_ALLOCATION_H_
|
||||
#define COMPONENTS_VIZ_COMMON_RESOURCES_BITMAP_ALLOCATION_H_
|
||||
|
||||
#include "base/memory/read_only_shared_memory_region.h"
|
||||
#include "components/viz/common/resources/shared_image_format.h"
|
||||
#include "components/viz/common/viz_common_export.h"
|
||||
|
||||
namespace gfx {
|
||||
class Size;
|
||||
} // namespace gfx
|
||||
|
||||
namespace viz {
|
||||
|
||||
namespace bitmap_allocation {
|
||||
|
||||
// Allocates a read-only shared memory region and its writable mapping to hold
|
||||
// |size| pixels in specific |format|. Crashes if allocation does not succeed.
|
||||
VIZ_COMMON_EXPORT base::MappedReadOnlyRegion AllocateSharedBitmap(
|
||||
const gfx::Size& size,
|
||||
SharedImageFormat format);
|
||||
|
||||
} // namespace bitmap_allocation
|
||||
|
||||
} // namespace viz
|
||||
|
||||
#endif // COMPONENTS_VIZ_COMMON_RESOURCES_BITMAP_ALLOCATION_H_
|
@ -12,7 +12,6 @@
|
||||
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
|
||||
#include "components/viz/common/quads/solid_color_draw_quad.h"
|
||||
#include "components/viz/common/quads/tile_draw_quad.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/resources/resource_sizes.h"
|
||||
#include "gpu/command_buffer/client/client_shared_image.h"
|
||||
#include "gpu/command_buffer/client/test_shared_image_interface.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "base/run_loop.h"
|
||||
#include "components/viz/common/quads/solid_color_draw_quad.h"
|
||||
#include "components/viz/common/quads/surface_draw_quad.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/surfaces/surface_range.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "components/viz/common/quads/compositor_frame.h"
|
||||
#include "components/viz/common/quads/compositor_frame_metadata.h"
|
||||
#include "components/viz/common/quads/compositor_render_pass.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/surfaces/surface_info.h"
|
||||
#include "components/viz/common/surfaces/video_capture_target.h"
|
||||
#include "components/viz/common/viz_utils.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "cc/layers/texture_layer.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/resources/shared_image_format.h"
|
||||
#include "content/web_test/renderer/test_runner.h"
|
||||
#include "content/web_test/renderer/web_frame_test_proxy.h"
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "base/numerics/ostream_operators.h"
|
||||
#include "build/build_config.h"
|
||||
#include "cc/layers/texture_layer.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/resources/resource_sizes.h"
|
||||
#include "components/viz/common/resources/shared_bitmap.h"
|
||||
#include "components/viz/common/resources/shared_image_format.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "base/memory/read_only_shared_memory_region.h"
|
||||
#include "cc/layers/texture_layer.h"
|
||||
#include "components/viz/common/resources/bitmap_allocation.h"
|
||||
#include "components/viz/common/resources/shared_bitmap.h"
|
||||
#include "components/viz/common/resources/shared_image_format_utils.h"
|
||||
#include "components/viz/common/resources/transferable_resource.h"
|
||||
|
Reference in New Issue
Block a user