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

Unified Diff: cc/surfaces/surface_aggregator_perftest.cc

Issue 2830203002: Remove SurfaceFactory in SurfaceAggregatorPerfTest (Closed)
Patch Set: Rebase Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator_perftest.cc
diff --git a/cc/surfaces/surface_aggregator_perftest.cc b/cc/surfaces/surface_aggregator_perftest.cc
index 9f5e09374d2f19f06aeaa7f027229886368171a0..e057c6afc9ec45b075cf442be537713c8635134b 100644
--- a/cc/surfaces/surface_aggregator_perftest.cc
+++ b/cc/surfaces/surface_aggregator_perftest.cc
@@ -7,14 +7,11 @@
#include "cc/output/compositor_frame.h"
#include "cc/quads/surface_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
-#include "cc/surfaces/framesink_manager_client.h"
+#include "cc/surfaces/compositor_frame_sink_support.h"
#include "cc/surfaces/surface_aggregator.h"
-#include "cc/surfaces/surface_factory.h"
#include "cc/surfaces/surface_manager.h"
-#include "cc/surfaces/surface_resource_holder_client.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_resource_provider.h"
-#include "cc/test/stub_surface_factory_client.h"
#include "cc/test/test_context_provider.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,17 +20,14 @@
namespace cc {
namespace {
+constexpr bool kIsRoot = true;
+constexpr bool kIsChildRoot = false;
+constexpr bool kHandlesFrameSinkIdInvalidation = true;
+constexpr bool kNeedsSyncPoints = true;
+
static const base::UnguessableToken kArbitraryToken =
base::UnguessableToken::Create();
-class StubSurfaceResourceHolderClient : public SurfaceResourceHolderClient {
- public:
- StubSurfaceResourceHolderClient() = default;
- ~StubSurfaceResourceHolderClient() override = default;
-
- void ReturnResources(const ReturnedResourceArray& resources) override {}
-};
-
class SurfaceAggregatorPerfTest : public testing::Test {
public:
SurfaceAggregatorPerfTest() {
@@ -51,11 +45,13 @@ class SurfaceAggregatorPerfTest : public testing::Test {
bool optimize_damage,
bool full_damage,
const std::string& name) {
- std::vector<std::unique_ptr<SurfaceFactory>> child_factories(num_surfaces);
- for (int i = 0; i < num_surfaces; i++)
- child_factories[i].reset(new SurfaceFactory(
- FrameSinkId(1, i + 1), &manager_, &stub_surface_factory_client_,
- &stub_surface_resource_holder_client_));
+ std::vector<std::unique_ptr<CompositorFrameSinkSupport>> child_supports(
+ num_surfaces);
+ for (int i = 0; i < num_surfaces; i++) {
+ child_supports[i] = CompositorFrameSinkSupport::Create(
+ nullptr, &manager_, FrameSinkId(1, i + 1), kIsChildRoot,
+ kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
+ }
aggregator_.reset(new SurfaceAggregator(&manager_, resource_provider_.get(),
optimize_damage));
for (int i = 0; i < num_surfaces; i++) {
@@ -72,11 +68,11 @@ class SurfaceAggregatorPerfTest : public testing::Test {
TextureDrawQuad* quad =
pass->CreateAndAppendDrawQuad<TextureDrawQuad>();
- const gfx::Rect rect(0, 0, 1, 1);
+ const gfx::Rect rect(0, 0, 1, 2);
const gfx::Rect opaque_rect;
// Half of rects should be visible with partial damage.
gfx::Rect visible_rect =
- j % 2 == 0 ? gfx::Rect(0, 0, 1, 1) : gfx::Rect(1, 1, 1, 1);
+ j % 2 == 0 ? gfx::Rect(0, 0, 1, 2) : gfx::Rect(0, 1, 1, 1);
bool needs_blending = false;
bool premultiplied_alpha = false;
const gfx::PointF uv_top_left;
@@ -102,14 +98,14 @@ class SurfaceAggregatorPerfTest : public testing::Test {
}
frame.render_pass_list.push_back(std::move(pass));
- child_factories[i]->SubmitCompositorFrame(
- local_surface_id, std::move(frame), SurfaceFactory::DrawCallback(),
- SurfaceFactory::WillDrawCallback());
+ child_supports[i]->SubmitCompositorFrame(local_surface_id,
+ std::move(frame));
}
- SurfaceFactory root_factory(FrameSinkId(1, num_surfaces + 1), &manager_,
- &stub_surface_factory_client_,
- &stub_surface_resource_holder_client_);
+ std::unique_ptr<CompositorFrameSinkSupport> root_support =
+ CompositorFrameSinkSupport::Create(
+ nullptr, &manager_, FrameSinkId(1, num_surfaces + 1), kIsRoot,
+ kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
timer_.Reset();
do {
std::unique_ptr<RenderPass> pass(RenderPass::Create());
@@ -131,9 +127,8 @@ class SurfaceAggregatorPerfTest : public testing::Test {
frame.render_pass_list.push_back(std::move(pass));
- root_factory.SubmitCompositorFrame(
- LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame),
- SurfaceFactory::DrawCallback(), SurfaceFactory::WillDrawCallback());
+ root_support->SubmitCompositorFrame(
+ LocalSurfaceId(num_surfaces + 1, kArbitraryToken), std::move(frame));
CompositorFrame aggregated = aggregator_->Aggregate(
SurfaceId(FrameSinkId(1, num_surfaces + 1),
@@ -144,14 +139,12 @@ class SurfaceAggregatorPerfTest : public testing::Test {
perf_test::PrintResult("aggregator_speed", "", name, timer_.LapsPerSecond(),
"runs/s", true);
for (int i = 0; i < num_surfaces; i++)
- child_factories[i]->EvictSurface();
- root_factory.EvictSurface();
+ child_supports[i]->EvictFrame();
+ root_support->EvictFrame();
}
protected:
SurfaceManager manager_;
- StubSurfaceResourceHolderClient stub_surface_resource_holder_client_;
- StubSurfaceFactoryClient stub_surface_factory_client_;
scoped_refptr<TestContextProvider> context_provider_;
std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_;
std::unique_ptr<ResourceProvider> resource_provider_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698