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

Unified Diff: cc/surfaces/display_unittest.cc

Issue 2966803002: Limit the size of latency info storage (Closed)
Patch Set: Separate the checks for clarity Created 3 years, 5 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/display.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/display_unittest.cc
diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc
index 4bd0f4e13230cab12dcf9245b28e4d1d54fe7e19..5b16888ce536f73ed202563d528bdc39199fa3d7 100644
--- a/cc/surfaces/display_unittest.cc
+++ b/cc/surfaces/display_unittest.cc
@@ -435,6 +435,65 @@ TEST_F(DisplayTest, DisplayDamaged) {
TearDownDisplay();
}
+// Check LatencyInfo storage is cleaned up if it exceeds the limit.
+TEST_F(DisplayTest, MaxLatencyInfoCap) {
+ RendererSettings settings;
+ settings.partial_swap_enabled = true;
+ settings.finish_rendering_on_resize = true;
+ SetUpDisplay(settings, nullptr);
+ gfx::ColorSpace color_space_1 = gfx::ColorSpace::CreateXYZD50();
+ gfx::ColorSpace color_space_2 = gfx::ColorSpace::CreateSCRGBLinear();
+
+ StubDisplayClient client;
+ display_->Initialize(&client, &manager_);
+ display_->SetColorSpace(color_space_1, color_space_1);
+
+ LocalSurfaceId local_surface_id(id_allocator_.GenerateId());
+ display_->SetLocalSurfaceId(local_surface_id, 1.f);
+
+ scheduler_->ResetDamageForTest();
+ display_->Resize(gfx::Size(100, 100));
+
+ RenderPassList pass_list;
+ std::unique_ptr<RenderPass> pass = RenderPass::Create();
+ pass->output_rect = gfx::Rect(0, 0, 100, 100);
+ pass->damage_rect = gfx::Rect(10, 10, 1, 1);
+ pass->id = 1u;
+ pass_list.push_back(std::move(pass));
+
+ scheduler_->ResetDamageForTest();
+ SubmitCompositorFrame(&pass_list, local_surface_id);
+
+ display_->DrawAndSwap();
+
+ // This is the same as LatencyInfo::kMaxLatencyInfoNumber.
+ const size_t max_latency_info_count = 100;
+ for (size_t i = 0; i <= max_latency_info_count; ++i) {
+ pass = RenderPass::Create();
+ pass->output_rect = gfx::Rect(0, 0, 100, 100);
+ pass->damage_rect = gfx::Rect(10, 10, 0, 0);
+ pass->id = 1u;
+
+ pass_list.push_back(std::move(pass));
+ scheduler_->ResetDamageForTest();
+
+ CompositorFrame frame = test::MakeCompositorFrame();
+ pass_list.swap(frame.render_pass_list);
+ frame.metadata.latency_info.push_back(ui::LatencyInfo());
+
+ support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
+
+ display_->DrawAndSwap();
+
+ if (i < max_latency_info_count)
+ EXPECT_EQ(i + 1, display_->stored_latency_info_size_for_testing());
+ else
+ EXPECT_EQ(0u, display_->stored_latency_info_size_for_testing());
+ }
+
+ TearDownDisplay();
+}
+
class MockedContext : public TestWebGraphicsContext3D {
public:
MOCK_METHOD0(shallowFinishCHROMIUM, void());
« no previous file with comments | « cc/surfaces/display.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698