#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <stdint.h>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time_override.h"
#include "base/trace_event/process_memory_dump.h"
#include "cc/base/features.h"
#include "cc/layers/recording_source.h"
#include "cc/raster/raster_buffer.h"
#include "cc/raster/raster_source.h"
#include "cc/raster/synchronous_task_graph_runner.h"
#include "cc/resources/resource_pool.h"
#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_frame_sink.h"
#include "cc/test/fake_layer_tree_frame_sink_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_paint_image_generator.h"
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/fake_picture_layer_tiling_client.h"
#include "cc/test/fake_raster_query_queue.h"
#include "cc/test/fake_raster_source.h"
#include "cc/test/fake_recording_source.h"
#include "cc/test/fake_tile_manager.h"
#include "cc/test/fake_tile_task_manager.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/skia_common.h"
#include "cc/test/test_layer_tree_host_base.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_tile_priorities.h"
#include "cc/tiles/eviction_tile_priority_queue.h"
#include "cc/tiles/raster_tile_priority_queue.h"
#include "cc/tiles/tile.h"
#include "cc/tiles/tile_priority.h"
#include "cc/tiles/tiling_set_raster_queue_all.h"
#include "cc/trees/layer_tree_impl.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "components/viz/test/begin_frame_args_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageGenerator.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkSurface.h"
_;
Invoke;
Return;
StrictMock;
namespace cc {
namespace {
class SynchronousSimpleTaskRunner : public base::TestSimpleTaskRunner { … };
class FakeRasterBuffer : public RasterBuffer { … };
class TileManagerTilePriorityQueueTest : public TestLayerTreeHostBase { … };
TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { … }
TEST_F(TileManagerTilePriorityQueueTest,
RasterTilePriorityQueueAll_GetNextQueues) { … }
TEST_F(TileManagerTilePriorityQueueTest,
RasterTilePriorityQueueHighNonIdealTilings) { … }
TEST_F(TileManagerTilePriorityQueueTest,
RasterTilePriorityQueueHighLowTilings) { … }
TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { … }
TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeSoon) { … }
TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { … }
TEST_F(TileManagerTilePriorityQueueTest, DebugNameAppearsInMemoryDump) { … }
TEST_F(TileManagerTilePriorityQueueTest,
EvictionTilePriorityQueueWithOcclusion) { … }
TEST_F(TileManagerTilePriorityQueueTest,
EvictionTilePriorityQueueWithTransparentLayer) { … }
TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { … }
TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { … }
TEST_F(TileManagerTilePriorityQueueTest,
RasterTilePriorityQueueStaticViewport) { … }
TEST_F(TileManagerTilePriorityQueueTest,
RasterTilePriorityQueueMovingViewport) { … }
TEST_F(TileManagerTilePriorityQueueTest, SetIsLikelyToRequireADraw) { … }
TEST_F(TileManagerTilePriorityQueueTest,
SetIsLikelyToRequireADrawOnZeroMemoryBudget) { … }
TEST_F(TileManagerTilePriorityQueueTest,
SetIsLikelyToRequireADrawOnLimitedMemoryBudget) { … }
TEST_F(TileManagerTilePriorityQueueTest, DefaultMemoryPolicy) { … }
TEST_F(TileManagerTilePriorityQueueTest, RasterQueueAllUsesCorrectTileBounds) { … }
TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { … }
class TestSoftwareBacking : public ResourcePool::SoftwareBacking { … };
class TestSoftwareRasterBufferProvider : public FakeRasterBufferProviderImpl { … };
class TileManagerTest : public TestLayerTreeHostBase { … };
TEST_F(TileManagerTest, AllWorkFinished) { … }
TEST_F(TileManagerTest, ActivateAndDrawWhenOOM) { … }
class TileManagerOcclusionTest : public TileManagerTest { … };
TEST_F(TileManagerOcclusionTest, OccludedTileEvictedForVisibleTile) { … }
class PixelInspectTileManagerTest : public TileManagerTest { … };
TEST_F(PixelInspectTileManagerTest, LowResHasNoImage) { … }
class ActivationTasksDoNotBlockReadyToDrawTest : public TileManagerTest { … };
TEST_F(ActivationTasksDoNotBlockReadyToDrawTest,
ActivationTasksDoNotBlockReadyToDraw) { … }
class PartialRasterTileManagerTest : public TileManagerTest { … };
TEST_F(PartialRasterTileManagerTest, CancelledTasksHaveNoContentId) { … }
class VerifyResourceContentIdRasterBufferProvider
: public FakeRasterBufferProviderImpl { … };
void RunPartialRasterCheck(std::unique_ptr<LayerTreeHostImpl> host_impl,
bool partial_raster_enabled) { … }
void RunPartialTileDecodeCheck(std::unique_ptr<LayerTreeHostImpl> host_impl,
bool partial_raster_enabled) { … }
TEST_F(PartialRasterTileManagerTest, PartialRasterSuccessfullyEnabled) { … }
TEST_F(PartialRasterTileManagerTest, PartialTileImageDecode) { … }
TEST_F(PartialRasterTileManagerTest, CompleteTileImageDecode) { … }
TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { … }
class InvalidResourceRasterBufferProvider
: public FakeRasterBufferProviderImpl { … };
class InvalidResourceTileManagerTest : public TileManagerTest { … };
TEST_F(InvalidResourceTileManagerTest, InvalidResource) { … }
class MockReadyToDrawRasterBufferProviderImpl
: public FakeRasterBufferProviderImpl { … };
class TileManagerReadyToDrawTest : public TileManagerTest { … };
TEST_F(TileManagerReadyToDrawTest, SmoothActivationWaitsOnCallback) { … }
TEST_F(TileManagerReadyToDrawTest, NonSmoothActivationDoesNotWaitOnCallback) { … }
TEST_F(TileManagerReadyToDrawTest, HdrHeadroomPropagated) { … }
TEST_F(TileManagerReadyToDrawTest, SmoothDrawWaitsOnCallback) { … }
TEST_F(TileManagerReadyToDrawTest, NonSmoothDrawDoesNotWaitOnCallback) { … }
TEST_F(TileManagerReadyToDrawTest, NoCallbackWhenAlreadyReadyToDraw) { … }
TEST_F(TileManagerReadyToDrawTest, TilePrioritiesUpdated) { … }
TEST_F(TileManagerReadyToDrawTest, PrepaintTilesAreDroppedWhenIdle) { … }
TEST_F(TileManagerReadyToDrawTest, PrepaintTilesAreNotDropped) { … }
TEST_F(TileManagerReadyToDrawTest, PrepaintTilesContinuousIdleTime) { … }
void UpdateVisibleRect(FakePictureLayerImpl* layer,
const gfx::Rect visible_rect) { … }
TEST_F(TileManagerReadyToDrawTest, ReadyToDrawRespectsRequirementChange) { … }
TEST_F(TileManagerReadyToDrawTest, SetBackIsLikelyToRequireADrawToFalse) { … }
PaintImage MakeCheckerablePaintImage(const gfx::Size& size) { … }
class CheckerImagingTileManagerTest : public TestLayerTreeHostBase { … };
TEST_F(CheckerImagingTileManagerTest,
NoImageDecodeDependencyForCheckeredTiles) { … }
class EmptyCacheTileManagerTest : public TileManagerTest { … };
TEST_F(EmptyCacheTileManagerTest, AtRasterOnScreenTileRasterTasks) { … }
TEST_F(EmptyCacheTileManagerTest, AtRasterPrepaintTileRasterTasksSkipped) { … }
TEST_F(CheckerImagingTileManagerTest, BuildsImageDecodeQueueAsExpected) { … }
TEST_F(CheckerImagingTileManagerTest,
TileManagerCleanupClearsCheckerImagedDecodes) { … }
TEST_F(CheckerImagingTileManagerTest,
TileManagerCorrectlyPrioritizesCheckerImagedDecodes) { … }
class CheckerImagingTileManagerMemoryTest
: public CheckerImagingTileManagerTest { … };
TEST_F(CheckerImagingTileManagerMemoryTest, AddsAllNowTilesToImageDecodeQueue) { … }
class VerifyImageProviderRasterBuffer : public RasterBuffer { … };
class VerifyImageProviderRasterBufferProvider
: public FakeRasterBufferProviderImpl { … };
class SynchronousRasterTileManagerTest : public TileManagerTest { … };
TEST_F(SynchronousRasterTileManagerTest, AlwaysUseImageCache) { … }
class DecodedImageTrackerTileManagerTest : public TestLayerTreeHostBase { … };
TEST_F(DecodedImageTrackerTileManagerTest, DecodedImageTrackerDropsLocksOnUse) { … }
class HdrImageTileManagerTest : public CheckerImagingTileManagerTest { … };
TEST_F(HdrImageTileManagerTest, DecodeHdrImagesToHdrPq) { … }
TEST_F(HdrImageTileManagerTest, DecodeHdrImagesToHdrHlg) { … }
TEST_F(HdrImageTileManagerTest, DecodeHdrImagesToSdrSrgb) { … }
TEST_F(HdrImageTileManagerTest, DecodeHdrImagesToSdrP3) { … }
class TileManagerCheckRasterQueriesTest : public TileManagerTest { … };
TEST_F(TileManagerCheckRasterQueriesTest,
ChecksRasterQueriesInAllTilesDoneTask) { … }
class TileManagerTileReclaimTest : public TileManagerTest { … };
TEST_F(TileManagerTileReclaimTest, ReclaimOldPrepainTilesSimple) { … }
TEST_F(TileManagerTileReclaimTest, ReclaimOldPrepainTilesOldYoungTiles) { … }
}
}