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

Unified Diff: cc/test/test_delegating_output_surface.cc

Issue 2193293004: cc: Make LayerTreeTests use a DelegatingRenderer and Display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-layertreetest: windows-pixeltests-default-renderer-settings Created 4 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
Index: cc/test/test_delegating_output_surface.cc
diff --git a/cc/test/test_delegating_output_surface.cc b/cc/test/test_delegating_output_surface.cc
index 8f586cf18f7e7c11a374a95c0fa3ca12b59d85f5..d626a3d9aa4f02aca5883408e3f907f8e57285b3 100644
--- a/cc/test/test_delegating_output_surface.cc
+++ b/cc/test/test_delegating_output_surface.cc
@@ -24,7 +24,8 @@ TestDelegatingOutputSurface::TestDelegatingOutputSurface(
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
const RendererSettings& renderer_settings,
base::SingleThreadTaskRunner* task_runner,
- bool synchronous_composite)
+ bool synchronous_composite,
+ bool force_disable_reclaim_resources)
: OutputSurface(std::move(compositor_context_provider),
std::move(worker_context_provider),
nullptr),
@@ -37,6 +38,9 @@ TestDelegatingOutputSurface::TestDelegatingOutputSurface(
if (!synchronous_composite) {
begin_frame_source.reset(new DelayBasedBeginFrameSource(
base::MakeUnique<DelayBasedTimeSource>(task_runner)));
+ begin_frame_source->SetAuthoritativeVSyncInterval(
+ base::TimeDelta::FromMilliseconds(1000.f /
+ renderer_settings.refresh_rate));
scheduler.reset(new DisplayScheduler(
begin_frame_source.get(), task_runner,
display_output_surface->capabilities().max_frames_pending));
@@ -52,8 +56,9 @@ TestDelegatingOutputSurface::TestDelegatingOutputSurface(
capabilities_.delegated_rendering = true;
// Since this OutputSurface and the Display are tightly coupled and in the
// same process/thread, the LayerTreeHostImpl can reclaim resources from
- // the Display.
- capabilities_.can_force_reclaim_resources = true;
+ // the Display. But we allow tests to disable this to mimic an out-of-process
+ // Display.
+ capabilities_.can_force_reclaim_resources = !force_disable_reclaim_resources;
capabilities_.delegated_sync_points_required =
!context_shared_with_compositor;
}
@@ -107,6 +112,9 @@ void TestDelegatingOutputSurface::DetachFromClient() {
}
void TestDelegatingOutputSurface::SwapBuffers(CompositorFrame frame) {
+ if (test_client_)
+ test_client_->DisplayReceivedCompositorFrame(frame);
+
if (delegated_surface_id_.is_null()) {
delegated_surface_id_ = surface_id_allocator_->GenerateId();
surface_factory_->Create(delegated_surface_id_);
@@ -122,7 +130,7 @@ void TestDelegatingOutputSurface::SwapBuffers(CompositorFrame frame) {
surface_factory_->SubmitCompositorFrame(
delegated_surface_id_, std::move(frame),
- base::Bind(&TestDelegatingOutputSurface::DrawCallback,
+ base::Bind(&TestDelegatingOutputSurface::DidDrawCallback,
weak_ptrs_.GetWeakPtr(), synchronous));
for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_)
@@ -130,11 +138,11 @@ void TestDelegatingOutputSurface::SwapBuffers(CompositorFrame frame) {
std::move(copy_request));
copy_requests_.clear();
- if (!display_->has_scheduler())
+ if (synchronous)
display_->DrawAndSwap();
}
-void TestDelegatingOutputSurface::DrawCallback(bool synchronous) {
+void TestDelegatingOutputSurface::DidDrawCallback(bool synchronous) {
// This is the frame ack to unthrottle the next frame, not actually a notice
// that drawing is done.
if (synchronous) {
@@ -186,4 +194,16 @@ void TestDelegatingOutputSurface::DisplaySetMemoryPolicy(
SetMemoryPolicy(policy);
}
+void TestDelegatingOutputSurface::DisplayWillDrawAndSwap(
+ bool will_draw_and_swap,
+ const RenderPassList& render_passes) {
+ if (test_client_)
+ test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes);
+}
+
+void TestDelegatingOutputSurface::DisplayDidDrawAndSwap() {
+ if (test_client_)
+ test_client_->DisplayDidDrawAndSwap();
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698