| Index: cc/surfaces/surfaces_pixeltest.cc
|
| diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc
|
| index b98098070350b2d6dac9e1ebb79ee8f30d011f6d..0b81474ccb5056c2fca63f031682f3f4f3b326d4 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,31 @@
|
| 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 kIsRoot = true;
|
| +constexpr bool kIsChildRoot = false;
|
| +constexpr bool kHandlesFrameSinkIdInvalidation = true;
|
| +constexpr bool kNeedsSyncPoints = true;
|
|
|
| class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
|
| public:
|
| SurfacesPixelTest()
|
| - : factory_(kArbitraryRootFrameSinkId, &manager_, &client_) {}
|
| - ~SurfacesPixelTest() override { factory_.EvictSurface(); }
|
| + : support_(
|
| + CompositorFrameSinkSupport::Create(nullptr,
|
| + &manager_,
|
| + kArbitraryRootFrameSinkId,
|
| + kIsRoot,
|
| + kHandlesFrameSinkIdInvalidation,
|
| + kNeedsSyncPoints)) {}
|
| + ~SurfacesPixelTest() override { support_->EvictFrame(); }
|
|
|
| protected:
|
| SurfaceManager manager_;
|
| LocalSurfaceIdAllocator allocator_;
|
| - EmptySurfaceFactoryClient client_;
|
| - SurfaceFactory factory_;
|
| + std::unique_ptr<CompositorFrameSinkSupport> support_;
|
| };
|
|
|
| SharedQuadState* CreateAndAppendTestSharedQuadState(
|
| @@ -85,9 +87,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 +104,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_);
|
| + std::unique_ptr<CompositorFrameSinkSupport> child_support =
|
| + CompositorFrameSinkSupport::Create(
|
| + nullptr, &manager_, kArbitraryChildFrameSinkId, kIsChildRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
|
| +
|
| 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 +143,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 +168,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 +182,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 +196,21 @@ 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_);
|
| + std::unique_ptr<CompositorFrameSinkSupport> left_support =
|
| + CompositorFrameSinkSupport::Create(
|
| + nullptr, &manager_, kArbitraryLeftFrameSinkId, kIsChildRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
|
| + std::unique_ptr<CompositorFrameSinkSupport> right_support =
|
| + CompositorFrameSinkSupport::Create(
|
| + nullptr, &manager_, kArbitraryRightFrameSinkId, kIsChildRoot,
|
| + kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
|
| 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 +243,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 +276,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 +309,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 +324,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
|
|
|