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

Unified Diff: cc/surfaces/surface_hittest_unittest.cc

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nits Created 4 years, 6 months 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_display_output_surface_unittest.cc ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_hittest_unittest.cc
diff --git a/cc/surfaces/surface_hittest_unittest.cc b/cc/surfaces/surface_hittest_unittest.cc
index 54a5b3647019105f41e2688a56c46ad9cdb2030a..59adb8fa7513a58ff1ccf1d818155223163c814a 100644
--- a/cc/surfaces/surface_hittest_unittest.cc
+++ b/cc/surfaces/surface_hittest_unittest.cc
@@ -66,8 +66,7 @@ TEST(SurfaceHittestTest, Hittest_BadCompositorFrameDoesNotCrash) {
// Creates a root surface.
gfx::Rect root_rect(300, 300);
RenderPass* root_pass = nullptr;
- std::unique_ptr<CompositorFrame> root_frame =
- CreateCompositorFrame(root_rect, &root_pass);
+ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass);
// Add a reference to a non-existant child surface on the root surface.
SurfaceId child_surface_id(3, 0xdeadbeef, 0);
@@ -82,7 +81,9 @@ TEST(SurfaceHittestTest, Hittest_BadCompositorFrameDoesNotCrash) {
SurfaceIdAllocator root_allocator(2);
SurfaceId root_surface_id = root_allocator.GenerateId();
factory.Create(root_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ std::unique_ptr<CompositorFrame> root_frame_copy(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
{
@@ -105,14 +106,15 @@ TEST(SurfaceHittestTest, Hittest_SingleSurface) {
// Creates a root surface.
gfx::Rect root_rect(300, 300);
RenderPass* root_pass = nullptr;
- std::unique_ptr<CompositorFrame> root_frame =
- CreateCompositorFrame(root_rect, &root_pass);
+ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass);
// Submit the root frame.
SurfaceIdAllocator root_allocator(2);
SurfaceId root_surface_id = root_allocator.GenerateId();
factory.Create(root_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ std::unique_ptr<CompositorFrame> root_frame_copy(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
TestCase tests[] = {
{
@@ -136,8 +138,7 @@ TEST(SurfaceHittestTest, Hittest_ChildSurface) {
// Creates a root surface.
gfx::Rect root_rect(300, 300);
RenderPass* root_pass = nullptr;
- std::unique_ptr<CompositorFrame> root_frame =
- CreateCompositorFrame(root_rect, &root_pass);
+ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass);
// Add a reference to the child surface on the root surface.
SurfaceIdAllocator child_allocator(3);
@@ -156,13 +157,14 @@ TEST(SurfaceHittestTest, Hittest_ChildSurface) {
SurfaceIdAllocator root_allocator(2);
SurfaceId root_surface_id = root_allocator.GenerateId();
factory.Create(root_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ std::unique_ptr<CompositorFrame> root_frame_copy(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
// Creates a child surface.
RenderPass* child_pass = nullptr;
- std::unique_ptr<CompositorFrame> child_frame =
- CreateCompositorFrame(child_rect, &child_pass);
+ CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass);
// Add a solid quad in the child surface.
gfx::Rect child_solid_quad_rect(100, 100);
@@ -176,7 +178,9 @@ TEST(SurfaceHittestTest, Hittest_ChildSurface) {
// Submit the frame.
factory.Create(child_surface_id);
- factory.SubmitCompositorFrame(child_surface_id, std::move(child_frame),
+ std::unique_ptr<CompositorFrame> child_frame_copy(new CompositorFrame);
+ *child_frame_copy = std::move(child_frame);
+ factory.SubmitCompositorFrame(child_surface_id, std::move(child_frame_copy),
SurfaceFactory::DrawCallback());
TestCase tests[] = {
@@ -230,7 +234,9 @@ TEST(SurfaceHittestTest, Hittest_ChildSurface) {
root_rect,
child_rect,
child_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ root_frame_copy.reset(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
// Verify that point (100, 100) no longer falls on the child surface.
@@ -269,8 +275,7 @@ TEST(SurfaceHittestTest, Hittest_InvalidRenderPassDrawQuad) {
// Creates a root surface.
gfx::Rect root_rect(300, 300);
RenderPass* root_pass = nullptr;
- std::unique_ptr<CompositorFrame> root_frame =
- CreateCompositorFrame(root_rect, &root_pass);
+ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass);
// Create a RenderPassDrawQuad to a non-existant RenderPass.
CreateRenderPassDrawQuad(root_pass,
@@ -296,13 +301,14 @@ TEST(SurfaceHittestTest, Hittest_InvalidRenderPassDrawQuad) {
SurfaceIdAllocator root_allocator(2);
SurfaceId root_surface_id = root_allocator.GenerateId();
factory.Create(root_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ std::unique_ptr<CompositorFrame> root_frame_copy(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
// Creates a child surface.
RenderPass* child_pass = nullptr;
- std::unique_ptr<CompositorFrame> child_frame =
- CreateCompositorFrame(child_rect, &child_pass);
+ CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass);
// Add a solid quad in the child surface.
gfx::Rect child_solid_quad_rect(100, 100);
@@ -316,7 +322,9 @@ TEST(SurfaceHittestTest, Hittest_InvalidRenderPassDrawQuad) {
// Submit the frame.
factory.Create(child_surface_id);
- factory.SubmitCompositorFrame(child_surface_id, std::move(child_frame),
+ std::unique_ptr<CompositorFrame> child_frame_copy(new CompositorFrame);
+ *child_frame_copy = std::move(child_frame);
+ factory.SubmitCompositorFrame(child_surface_id, std::move(child_frame_copy),
SurfaceFactory::DrawCallback());
TestCase tests[] = {
@@ -390,9 +398,9 @@ TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
&render_pass_list);
RenderPass* root_pass = nullptr;
- std::unique_ptr<CompositorFrame> root_frame =
+ CompositorFrame root_frame =
CreateCompositorFrameWithRenderPassList(&render_pass_list);
- root_pass = root_frame->delegated_frame_data->render_pass_list.back().get();
+ root_pass = root_frame.delegated_frame_data->render_pass_list.back().get();
// Create a RenderPassDrawQuad.
gfx::Rect render_pass_quad_rect(100, 100);
@@ -404,7 +412,7 @@ TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
// Add a solid quad in the child render pass.
RenderPass* child_render_pass =
- root_frame->delegated_frame_data->render_pass_list.front().get();
+ root_frame.delegated_frame_data->render_pass_list.front().get();
gfx::Rect child_solid_quad_rect(100, 100);
CreateSolidColorDrawQuad(child_render_pass,
gfx::Transform(),
@@ -415,7 +423,9 @@ TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
SurfaceIdAllocator root_allocator(1);
SurfaceId root_surface_id = root_allocator.GenerateId();
factory.Create(root_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ std::unique_ptr<CompositorFrame> root_frame_copy(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
TestCase tests[] = {
@@ -475,8 +485,7 @@ TEST(SurfaceHittestTest, Hittest_SingleSurface_WithInsetsDelegate) {
// Creates a root surface.
gfx::Rect root_rect(300, 300);
RenderPass* root_pass = nullptr;
- std::unique_ptr<CompositorFrame> root_frame =
- CreateCompositorFrame(root_rect, &root_pass);
+ CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass);
// Add a reference to the child surface on the root surface.
SurfaceIdAllocator child_allocator(3);
@@ -494,13 +503,14 @@ TEST(SurfaceHittestTest, Hittest_SingleSurface_WithInsetsDelegate) {
SurfaceIdAllocator root_allocator(2);
SurfaceId root_surface_id = root_allocator.GenerateId();
factory.Create(root_surface_id);
- factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
+ std::unique_ptr<CompositorFrame> root_frame_copy(new CompositorFrame);
+ *root_frame_copy = std::move(root_frame);
+ factory.SubmitCompositorFrame(root_surface_id, std::move(root_frame_copy),
SurfaceFactory::DrawCallback());
// Creates a child surface.
RenderPass* child_pass = nullptr;
- std::unique_ptr<CompositorFrame> child_frame =
- CreateCompositorFrame(child_rect, &child_pass);
+ CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass);
// Add a solid quad in the child surface.
gfx::Rect child_solid_quad_rect(190, 190);
@@ -512,7 +522,9 @@ TEST(SurfaceHittestTest, Hittest_SingleSurface_WithInsetsDelegate) {
// Submit the frame.
factory.Create(child_surface_id);
- factory.SubmitCompositorFrame(child_surface_id, std::move(child_frame),
+ std::unique_ptr<CompositorFrame> frame_copy(new CompositorFrame);
+ *frame_copy = std::move(child_frame);
+ factory.SubmitCompositorFrame(child_surface_id, std::move(frame_copy),
SurfaceFactory::DrawCallback());
TestCase test_expectations_without_insets[] = {
« no previous file with comments | « cc/surfaces/surface_display_output_surface_unittest.cc ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698