| Index: cc/surfaces/surfaces_pixeltest.cc
|
| diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc
|
| index b98098070350b2d6dac9e1ebb79ee8f30d011f6d..724b6537a1f60a15b4c0106c498793f58face6e5 100644
|
| --- a/cc/surfaces/surfaces_pixeltest.cc
|
| +++ b/cc/surfaces/surfaces_pixeltest.cc
|
| @@ -6,11 +6,10 @@
|
| #include "cc/quads/render_pass.h"
|
| #include "cc/quads/solid_color_draw_quad.h"
|
| #include "cc/quads/surface_draw_quad.h"
|
| +#include "cc/surfaces/compositor_frame_sink_support.h"
|
| #include "cc/surfaces/local_surface_id_allocator.h"
|
| #include "cc/surfaces/surface.h"
|
| #include "cc/surfaces/surface_aggregator.h"
|
| -#include "cc/surfaces/surface_factory.h"
|
| -#include "cc/surfaces/surface_factory_client.h"
|
| #include "cc/surfaces/surface_manager.h"
|
| #include "cc/test/pixel_comparator.h"
|
| #include "cc/test/pixel_test.h"
|
| @@ -21,28 +20,28 @@
|
| namespace cc {
|
| namespace {
|
|
|
| -static constexpr FrameSinkId kArbitraryRootFrameSinkId(1, 1);
|
| -static constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2);
|
| -static constexpr FrameSinkId kArbitraryLeftFrameSinkId(3, 3);
|
| -static constexpr FrameSinkId kArbitraryRightFrameSinkId(4, 4);
|
| -
|
| -class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
|
| - public:
|
| - void ReturnResources(const ReturnedResourceArray& resources) override {}
|
| - void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {}
|
| -};
|
| +constexpr FrameSinkId kArbitraryRootFrameSinkId(1, 1);
|
| +constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2);
|
| +constexpr FrameSinkId kArbitraryLeftFrameSinkId(3, 3);
|
| +constexpr FrameSinkId kArbitraryRightFrameSinkId(4, 4);
|
| +constexpr bool handles_frame_sink_id_invalidation = true;
|
| +constexpr bool needs_sync_points = true;
|
|
|
| class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
|
| public:
|
| SurfacesPixelTest()
|
| - : factory_(kArbitraryRootFrameSinkId, &manager_, &client_) {}
|
| - ~SurfacesPixelTest() override { factory_.EvictSurface(); }
|
| + : support_(nullptr,
|
| + &manager_,
|
| + kArbitraryRootFrameSinkId,
|
| + true /* is_root */,
|
| + true /* handles_frame_sink_id_invalidation */,
|
| + true /* needs_sync_points */) {}
|
| + ~SurfacesPixelTest() override { support_.EvictFrame(); }
|
|
|
| protected:
|
| SurfaceManager manager_;
|
| LocalSurfaceIdAllocator allocator_;
|
| - EmptySurfaceFactoryClient client_;
|
| - SurfaceFactory factory_;
|
| + CompositorFrameSinkSupport support_;
|
| };
|
|
|
| SharedQuadState* CreateAndAppendTestSharedQuadState(
|
| @@ -85,9 +84,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) {
|
| root_frame.render_pass_list.push_back(std::move(pass));
|
|
|
| LocalSurfaceId root_local_surface_id = allocator_.GenerateId();
|
| - SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id);
|
| - factory_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame),
|
| - SurfaceFactory::DrawCallback());
|
| + SurfaceId root_surface_id(support_.frame_sink_id(), root_local_surface_id);
|
| + support_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame));
|
|
|
| SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
|
| CompositorFrame aggregated_frame = aggregator.Aggregate(root_surface_id);
|
| @@ -103,12 +101,16 @@ TEST_F(SurfacesPixelTest, DrawSimpleFrame) {
|
| // Draws a frame with simple surface embedding.
|
| TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
|
| gfx::Size child_size(200, 100);
|
| - SurfaceFactory child_factory(kArbitraryChildFrameSinkId, &manager_, &client_);
|
| + constexpr bool is_root = false;
|
| + CompositorFrameSinkSupport child_support(
|
| + nullptr, &manager_, kArbitraryChildFrameSinkId, is_root,
|
| + handles_frame_sink_id_invalidation, needs_sync_points);
|
| +
|
| LocalSurfaceId child_local_surface_id = allocator_.GenerateId();
|
| - SurfaceId child_surface_id(child_factory.frame_sink_id(),
|
| + SurfaceId child_surface_id(child_support.frame_sink_id(),
|
| child_local_surface_id);
|
| LocalSurfaceId root_local_surface_id = allocator_.GenerateId();
|
| - SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id);
|
| + SurfaceId root_surface_id(support_.frame_sink_id(), root_local_surface_id);
|
|
|
| {
|
| gfx::Rect rect(device_viewport_size_);
|
| @@ -138,8 +140,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
|
| CompositorFrame root_frame;
|
| root_frame.render_pass_list.push_back(std::move(pass));
|
|
|
| - factory_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame),
|
| - SurfaceFactory::DrawCallback());
|
| + support_.SubmitCompositorFrame(root_local_surface_id,
|
| + std::move(root_frame));
|
| }
|
|
|
| {
|
| @@ -163,9 +165,8 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
|
| CompositorFrame child_frame;
|
| child_frame.render_pass_list.push_back(std::move(pass));
|
|
|
| - child_factory.SubmitCompositorFrame(child_local_surface_id,
|
| - std::move(child_frame),
|
| - SurfaceFactory::DrawCallback());
|
| + child_support.SubmitCompositorFrame(child_local_surface_id,
|
| + std::move(child_frame));
|
| }
|
|
|
| SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
|
| @@ -178,7 +179,7 @@ TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
|
| base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
|
| pixel_comparator));
|
|
|
| - child_factory.EvictSurface();
|
| + child_support.EvictFrame();
|
| }
|
|
|
| // Tests a surface quad that has a non-identity transform into its pass.
|
| @@ -192,14 +193,19 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
|
| // bottom_blue_quad (100x100 @ 0x100)
|
| // right_child -> top_blue_quad (100x100 @ 0x0),
|
| // bottom_green_quad (100x100 @ 0x100)
|
| - SurfaceFactory left_factory(kArbitraryLeftFrameSinkId, &manager_, &client_);
|
| - SurfaceFactory right_factory(kArbitraryRightFrameSinkId, &manager_, &client_);
|
| + constexpr bool is_root = false;
|
| + CompositorFrameSinkSupport left_support(
|
| + nullptr, &manager_, kArbitraryLeftFrameSinkId, is_root,
|
| + handles_frame_sink_id_invalidation, needs_sync_points);
|
| + CompositorFrameSinkSupport right_support(
|
| + nullptr, &manager_, kArbitraryRightFrameSinkId, is_root,
|
| + handles_frame_sink_id_invalidation, needs_sync_points);
|
| LocalSurfaceId left_child_local_id = allocator_.GenerateId();
|
| - SurfaceId left_child_id(left_factory.frame_sink_id(), left_child_local_id);
|
| + SurfaceId left_child_id(left_support.frame_sink_id(), left_child_local_id);
|
| LocalSurfaceId right_child_local_id = allocator_.GenerateId();
|
| - SurfaceId right_child_id(right_factory.frame_sink_id(), right_child_local_id);
|
| + SurfaceId right_child_id(right_support.frame_sink_id(), right_child_local_id);
|
| LocalSurfaceId root_local_surface_id = allocator_.GenerateId();
|
| - SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id);
|
| + SurfaceId root_surface_id(support_.frame_sink_id(), root_local_surface_id);
|
|
|
| {
|
| gfx::Rect rect(device_viewport_size_);
|
| @@ -232,8 +238,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
|
| CompositorFrame root_frame;
|
| root_frame.render_pass_list.push_back(std::move(pass));
|
|
|
| - factory_.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame),
|
| - SurfaceFactory::DrawCallback());
|
| + support_.SubmitCompositorFrame(root_local_surface_id,
|
| + std::move(root_frame));
|
| }
|
|
|
| {
|
| @@ -265,9 +271,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
|
| CompositorFrame child_frame;
|
| child_frame.render_pass_list.push_back(std::move(pass));
|
|
|
| - left_factory.SubmitCompositorFrame(left_child_local_id,
|
| - std::move(child_frame),
|
| - SurfaceFactory::DrawCallback());
|
| + left_support.SubmitCompositorFrame(left_child_local_id,
|
| + std::move(child_frame));
|
| }
|
|
|
| {
|
| @@ -299,9 +304,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
|
| CompositorFrame child_frame;
|
| child_frame.render_pass_list.push_back(std::move(pass));
|
|
|
| - right_factory.SubmitCompositorFrame(right_child_local_id,
|
| - std::move(child_frame),
|
| - SurfaceFactory::DrawCallback());
|
| + right_support.SubmitCompositorFrame(right_child_local_id,
|
| + std::move(child_frame));
|
| }
|
|
|
| SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
|
| @@ -315,8 +319,8 @@ TEST_F(SurfacesPixelTest, DrawAggregatedFrameWithSurfaceTransforms) {
|
| base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
|
| pixel_comparator));
|
|
|
| - left_factory.EvictSurface();
|
| - right_factory.EvictSurface();
|
| + left_support.EvictFrame();
|
| + right_support.EvictFrame();
|
| }
|
|
|
| } // namespace
|
|
|