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

Unified Diff: cc/surfaces/surface_factory_unittest.cc

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit 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_factory.cc ('k') | cc/surfaces/surface_hittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory_unittest.cc
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
index 4964a291d7b883c346dc4519ff73ebee26e119f3..044aeb4b6dc63fe803212a680aee311cf98c9454 100644
--- a/cc/surfaces/surface_factory_unittest.cc
+++ b/cc/surfaces/surface_factory_unittest.cc
@@ -14,7 +14,6 @@
#include "cc/output/compositor_frame.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
-#include "cc/output/delegated_frame_data.h"
#include "cc/resources/resource_provider.h"
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_factory_client.h"
@@ -103,16 +102,14 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceObserver {
void SubmitCompositorFrameWithResources(ResourceId* resource_ids,
size_t num_resource_ids) {
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
+ CompositorFrame frame;
for (size_t i = 0u; i < num_resource_ids; ++i) {
TransferableResource resource;
resource.id = resource_ids[i];
resource.mailbox_holder.texture_target = GL_TEXTURE_2D;
resource.mailbox_holder.sync_token = frame_sync_token_;
- frame_data->resource_list.push_back(resource);
+ frame.resource_list.push_back(resource);
}
- CompositorFrame frame;
- frame.delegated_frame_data = std::move(frame_data);
factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
SurfaceFactory::DrawCallback());
EXPECT_EQ(last_created_surface_id_.local_frame_id(), local_frame_id_);
@@ -151,8 +148,7 @@ class SurfaceFactoryTest : public testing::Test, public SurfaceObserver {
void RefCurrentFrameResources() {
Surface* surface = manager_.GetSurfaceForId(
SurfaceId(factory_->frame_sink_id(), local_frame_id_));
- factory_->RefResources(
- surface->GetEligibleFrame().delegated_frame_data->resource_list);
+ factory_->RefResources(surface->GetEligibleFrame().resource_list);
}
protected:
@@ -445,10 +441,8 @@ TEST_F(SurfaceFactoryTest, BlankNoIndexIncrement) {
Surface* surface = manager_.GetSurfaceForId(surface_id);
ASSERT_NE(nullptr, surface);
EXPECT_EQ(2, surface->frame_index());
- CompositorFrame frame;
- frame.delegated_frame_data.reset(new DelegatedFrameData);
- factory_->SubmitCompositorFrame(local_frame_id, std::move(frame),
+ factory_->SubmitCompositorFrame(local_frame_id, CompositorFrame(),
SurfaceFactory::DrawCallback());
EXPECT_EQ(2, surface->frame_index());
EXPECT_EQ(last_created_surface_id().local_frame_id(), local_frame_id);
@@ -466,12 +460,10 @@ void CreateSurfaceDrawCallback(SurfaceFactory* factory,
TEST_F(SurfaceFactoryTest, AddDuringDestroy) {
LocalFrameId local_frame_id(6, kArbitraryToken);
factory_->Create(local_frame_id);
- CompositorFrame frame;
- frame.delegated_frame_data.reset(new DelegatedFrameData);
uint32_t execute_count = 0;
factory_->SubmitCompositorFrame(
- local_frame_id, std::move(frame),
+ local_frame_id, CompositorFrame(),
base::Bind(&CreateSurfaceDrawCallback, base::Unretained(factory_.get()),
&execute_count));
EXPECT_EQ(0u, execute_count);
@@ -488,13 +480,11 @@ TEST_F(SurfaceFactoryTest, DestroyAll) {
LocalFrameId id(7, kArbitraryToken);
factory_->Create(id);
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
TransferableResource resource;
resource.id = 1;
resource.mailbox_holder.texture_target = GL_TEXTURE_2D;
- frame_data->resource_list.push_back(resource);
CompositorFrame frame;
- frame.delegated_frame_data = std::move(frame_data);
+ frame.resource_list.push_back(resource);
uint32_t execute_count = 0;
factory_->SubmitCompositorFrame(id, std::move(frame),
base::Bind(&DrawCallback, &execute_count));
@@ -509,13 +499,11 @@ TEST_F(SurfaceFactoryTest, Reset) {
LocalFrameId id(7, kArbitraryToken);
factory_->Create(id);
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
TransferableResource resource;
resource.id = 1;
resource.mailbox_holder.texture_target = GL_TEXTURE_2D;
- frame_data->resource_list.push_back(resource);
CompositorFrame frame;
- frame.delegated_frame_data = std::move(frame_data);
+ frame.resource_list.push_back(resource);
uint32_t execute_count = 0;
factory_->SubmitCompositorFrame(id, std::move(frame),
base::Bind(&DrawCallback, &execute_count));
@@ -542,11 +530,9 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
SurfaceSequence(kArbitraryFrameSinkId, 4));
factory_->Destroy(local_frame_id2);
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
CompositorFrame frame;
frame.metadata.satisfies_sequences.push_back(6);
frame.metadata.satisfies_sequences.push_back(4);
- frame.delegated_frame_data = std::move(frame_data);
DCHECK(manager_.GetSurfaceForId(id2));
factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
SurfaceFactory::DrawCallback());
@@ -599,12 +585,10 @@ TEST_F(SurfaceFactoryTest, DestroyCycle) {
// Give id2 a frame that references local_frame_id_.
{
std::unique_ptr<RenderPass> render_pass(RenderPass::Create());
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
- frame_data->render_pass_list.push_back(std::move(render_pass));
CompositorFrame frame;
+ frame.render_pass_list.push_back(std::move(render_pass));
frame.metadata.referenced_surfaces.push_back(
SurfaceId(factory_->frame_sink_id(), local_frame_id_));
- frame.delegated_frame_data = std::move(frame_data);
factory_->SubmitCompositorFrame(local_frame_id2, std::move(frame),
SurfaceFactory::DrawCallback());
EXPECT_EQ(last_created_surface_id().local_frame_id(), local_frame_id2);
@@ -614,11 +598,9 @@ TEST_F(SurfaceFactoryTest, DestroyCycle) {
// Give local_frame_id_ a frame that references id2.
{
std::unique_ptr<RenderPass> render_pass(RenderPass::Create());
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
- frame_data->render_pass_list.push_back(std::move(render_pass));
CompositorFrame frame;
+ frame.render_pass_list.push_back(std::move(render_pass));
frame.metadata.referenced_surfaces.push_back(id2);
- frame.delegated_frame_data = std::move(frame_data);
factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
SurfaceFactory::DrawCallback());
EXPECT_EQ(last_created_surface_id().local_frame_id(), local_frame_id_);
@@ -651,12 +633,10 @@ void CopyRequestTestCallback(bool* called,
TEST_F(SurfaceFactoryTest, DuplicateCopyRequest) {
{
std::unique_ptr<RenderPass> render_pass(RenderPass::Create());
- std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
- frame_data->render_pass_list.push_back(std::move(render_pass));
CompositorFrame frame;
+ frame.render_pass_list.push_back(std::move(render_pass));
frame.metadata.referenced_surfaces.push_back(
SurfaceId(factory_->frame_sink_id(), local_frame_id_));
- frame.delegated_frame_data = std::move(frame_data);
factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame),
SurfaceFactory::DrawCallback());
EXPECT_EQ(last_created_surface_id().local_frame_id(), local_frame_id_);
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surface_hittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698