Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3616)

Unified Diff: cc/surfaces/surfaces_pixeltest.cc

Issue 2506883002: Revert of Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/surfaces/surface_unittest.cc ('k') | cc/test/test_compositor_frame_sink.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surfaces_pixeltest.cc
diff --git a/cc/surfaces/surfaces_pixeltest.cc b/cc/surfaces/surfaces_pixeltest.cc
index f7acc26b4a26c72249dd60b005074d6be5c0e8d2..026db2d3cd0d0c45f7f2e266775b75426cfbb06f 100644
--- a/cc/surfaces/surfaces_pixeltest.cc
+++ b/cc/surfaces/surfaces_pixeltest.cc
@@ -21,10 +21,7 @@
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);
+static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
public:
@@ -34,9 +31,7 @@
class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
public:
- SurfacesPixelTest()
- : factory_(kArbitraryRootFrameSinkId, &manager_, &client_) {}
- ~SurfacesPixelTest() override { factory_.EvictSurface(); }
+ SurfacesPixelTest() : factory_(kArbitraryFrameSinkId, &manager_, &client_) {}
protected:
SurfaceManager manager_;
@@ -86,11 +81,13 @@
LocalFrameId root_local_frame_id = allocator_.GenerateId();
SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id);
+ factory_.Create(root_local_frame_id);
factory_.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame),
SurfaceFactory::DrawCallback());
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
CompositorFrame aggregated_frame = aggregator.Aggregate(root_surface_id);
+ factory_.Destroy(root_local_frame_id);
bool discard_alpha = false;
ExactPixelComparator pixel_comparator(discard_alpha);
@@ -103,13 +100,13 @@
// Draws a frame with simple surface embedding.
TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
gfx::Size child_size(200, 100);
- SurfaceFactory child_factory(kArbitraryChildFrameSinkId, &manager_, &client_);
LocalFrameId child_local_frame_id = allocator_.GenerateId();
- SurfaceId child_surface_id(child_factory.frame_sink_id(),
- child_local_frame_id);
+ SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id);
LocalFrameId root_local_frame_id = allocator_.GenerateId();
SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id);
+ factory_.Create(child_local_frame_id);
+ factory_.Create(root_local_frame_id);
{
gfx::Rect rect(device_viewport_size_);
RenderPassId id(1, 1);
@@ -163,9 +160,8 @@
CompositorFrame child_frame;
child_frame.render_pass_list.push_back(std::move(pass));
- child_factory.SubmitCompositorFrame(child_local_frame_id,
- std::move(child_frame),
- SurfaceFactory::DrawCallback());
+ factory_.SubmitCompositorFrame(child_local_frame_id, std::move(child_frame),
+ SurfaceFactory::DrawCallback());
}
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
@@ -177,8 +173,8 @@
EXPECT_TRUE(RunPixelTest(pass_list,
base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
pixel_comparator));
-
- child_factory.EvictSurface();
+ factory_.Destroy(root_local_frame_id);
+ factory_.Destroy(child_local_frame_id);
}
// Tests a surface quad that has a non-identity transform into its pass.
@@ -192,14 +188,15 @@
// 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_);
LocalFrameId left_child_local_id = allocator_.GenerateId();
- SurfaceId left_child_id(left_factory.frame_sink_id(), left_child_local_id);
+ SurfaceId left_child_id(factory_.frame_sink_id(), left_child_local_id);
LocalFrameId right_child_local_id = allocator_.GenerateId();
- SurfaceId right_child_id(right_factory.frame_sink_id(), right_child_local_id);
+ SurfaceId right_child_id(factory_.frame_sink_id(), right_child_local_id);
LocalFrameId root_local_frame_id = allocator_.GenerateId();
SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id);
+ factory_.Create(left_child_local_id);
+ factory_.Create(right_child_local_id);
+ factory_.Create(root_local_frame_id);
{
gfx::Rect rect(device_viewport_size_);
@@ -265,9 +262,8 @@
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());
+ factory_.SubmitCompositorFrame(left_child_local_id, std::move(child_frame),
+ SurfaceFactory::DrawCallback());
}
{
@@ -299,9 +295,8 @@
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());
+ factory_.SubmitCompositorFrame(right_child_local_id, std::move(child_frame),
+ SurfaceFactory::DrawCallback());
}
SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
@@ -315,8 +310,9 @@
base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
pixel_comparator));
- left_factory.EvictSurface();
- right_factory.EvictSurface();
+ factory_.Destroy(root_local_frame_id);
+ factory_.Destroy(left_child_local_id);
+ factory_.Destroy(right_child_local_id);
}
} // namespace
« no previous file with comments | « cc/surfaces/surface_unittest.cc ('k') | cc/test/test_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698