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

Unified Diff: cc/test/test_compositor_frame_sink.cc

Issue 2633563003: Revert of Remove ForceReclaimResources (Closed)
Patch Set: Created 3 years, 11 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/test/test_compositor_frame_sink.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_compositor_frame_sink.cc
diff --git a/cc/test/test_compositor_frame_sink.cc b/cc/test/test_compositor_frame_sink.cc
index 416fd17a65316387f18a2e680bc6dab7e5992c19..25eb8e5589a86674b095957124b1f3b3e9ff0f9f 100644
--- a/cc/test/test_compositor_frame_sink.cc
+++ b/cc/test/test_compositor_frame_sink.cc
@@ -26,7 +26,8 @@
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
const RendererSettings& renderer_settings,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- bool synchronous_composite)
+ bool synchronous_composite,
+ bool force_disable_reclaim_resources)
: CompositorFrameSink(std::move(compositor_context_provider),
std::move(worker_context_provider),
gpu_memory_buffer_manager,
@@ -40,6 +41,11 @@
surface_factory_(
new SurfaceFactory(frame_sink_id_, surface_manager_.get(), this)),
weak_ptr_factory_(this) {
+ // Since this CompositorFrameSink and the Display are tightly coupled and in
+ // the same process/thread, the LayerTreeHostImpl can reclaim resources from
+ // 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;
// Always use sync tokens so that code paths in resource provider that deal
// with sync tokens are tested.
capabilities_.delegated_sync_points_required = true;
@@ -166,6 +172,13 @@
client_->DidReceiveCompositorFrameAck();
}
+void TestCompositorFrameSink::ForceReclaimResources() {
+ if (capabilities_.can_force_reclaim_resources &&
+ delegated_local_frame_id_.is_valid()) {
+ surface_factory_->ClearSurface();
+ }
+}
+
void TestCompositorFrameSink::ReturnResources(
const ReturnedResourceArray& resources) {
client_->ReclaimResources(resources);
« no previous file with comments | « cc/test/test_compositor_frame_sink.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698