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

Unified Diff: cc/test/layer_tree_pixel_test.cc

Issue 2144393003: cc: Allow TestDelegatingOutputSurface to be used for non-pixel tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/test/layer_tree_pixel_test.h ('k') | cc/test/pixel_test_delegating_output_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_pixel_test.cc
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 3070594b9021676abf247eeda3e2589655e0c732..1d8c5d39cc1d3f8bd7deea6e24cb49c32be476c7 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -14,14 +14,16 @@
#include "cc/layers/texture_layer.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
-#include "cc/output/direct_renderer.h"
+#include "cc/output/texture_mailbox_deleter.h"
#include "cc/resources/texture_mailbox.h"
+#include "cc/scheduler/begin_frame_source.h"
+#include "cc/scheduler/delay_based_time_source.h"
#include "cc/test/paths.h"
#include "cc/test/pixel_comparator.h"
-#include "cc/test/pixel_test_delegating_output_surface.h"
#include "cc/test/pixel_test_output_surface.h"
#include "cc/test/pixel_test_software_output_device.h"
#include "cc/test/pixel_test_utils.h"
+#include "cc/test/test_delegating_output_surface.h"
#include "cc/test/test_in_process_context_provider.h"
#include "cc/trees/layer_tree_impl.h"
#include "gpu/command_buffer/client/gl_in_process_context.h"
@@ -44,28 +46,56 @@ void LayerTreePixelTest::InitializeSettings(LayerTreeSettings* settings) {
}
std::unique_ptr<OutputSurface> LayerTreePixelTest::CreateOutputSurface() {
- scoped_refptr<TestInProcessContextProvider> compositor;
- scoped_refptr<TestInProcessContextProvider> worker;
- scoped_refptr<TestInProcessContextProvider> display;
+ // Always test Webview shenanigans.
+ gfx::Size surface_expansion_size(40, 60);
+
+ scoped_refptr<TestInProcessContextProvider> compositor_context_provider;
+ scoped_refptr<TestInProcessContextProvider> worker_context_provider;
+ scoped_refptr<TestInProcessContextProvider> display_context_provider;
+ std::unique_ptr<PixelTestOutputSurface> display_output_surface;
if (test_type_ == PIXEL_TEST_GL) {
- compositor = new TestInProcessContextProvider(nullptr);
- worker = new TestInProcessContextProvider(compositor.get());
- display = new TestInProcessContextProvider(nullptr);
+ compositor_context_provider = new TestInProcessContextProvider(nullptr);
+ worker_context_provider =
+ new TestInProcessContextProvider(compositor_context_provider.get());
+ display_context_provider = new TestInProcessContextProvider(nullptr);
+ bool flipped_output_surface = false;
+ display_output_surface = base::MakeUnique<PixelTestOutputSurface>(
+ std::move(display_context_provider), nullptr, flipped_output_surface);
+ } else {
+ std::unique_ptr<PixelTestSoftwareOutputDevice> software_output_device(
+ new PixelTestSoftwareOutputDevice);
+ software_output_device->set_surface_expansion_size(surface_expansion_size);
+ display_output_surface = base::MakeUnique<PixelTestOutputSurface>(
+ std::move(software_output_device));
}
- const bool allow_force_reclaim_resources = !HasImplThread();
- const bool synchronous_composite =
- !layer_tree_host()->settings().single_thread_proxy_scheduler;
- // Always test Webview shenanigans.
- const gfx::Size surface_expansion_size(40, 60);
- std::unique_ptr<PixelTestDelegatingOutputSurface> delegating_output_surface(
- new PixelTestDelegatingOutputSurface(
- std::move(compositor), std::move(worker), std::move(display),
- RendererSettings(), shared_bitmap_manager(),
- gpu_memory_buffer_manager(), surface_expansion_size,
- allow_force_reclaim_resources, synchronous_composite));
- delegating_output_surface->SetEnlargePassTextureAmount(
- enlarge_texture_amount_);
- return std::move(delegating_output_surface);
+ display_output_surface->set_surface_expansion_size(surface_expansion_size);
+
+ auto* task_runner = ImplThreadTaskRunner();
+ CHECK(task_runner);
+
+ std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source;
+ std::unique_ptr<DisplayScheduler> scheduler;
+ if (layer_tree_host()->settings().single_thread_proxy_scheduler) {
+ begin_frame_source.reset(new DelayBasedBeginFrameSource(
+ base::MakeUnique<DelayBasedTimeSource>(task_runner)));
+ scheduler.reset(new DisplayScheduler(
+ begin_frame_source.get(), task_runner,
+ display_output_surface->capabilities().max_frames_pending));
+ }
+
+ std::unique_ptr<Display> display(
+ new Display(shared_bitmap_manager(), gpu_memory_buffer_manager(),
+ RendererSettings(), std::move(begin_frame_source),
+ std::move(display_output_surface), std::move(scheduler),
+ base::MakeUnique<TextureMailboxDeleter>(task_runner)));
+ display->SetEnlargePassTextureAmountForTesting(enlarge_texture_amount_);
+
+ const bool context_shared_with_compositor = false;
+ const bool allow_force_reclaim_resources = true;
+ return base::MakeUnique<TestDelegatingOutputSurface>(
+ std::move(compositor_context_provider),
+ std::move(worker_context_provider), std::move(display),
+ context_shared_with_compositor, allow_force_reclaim_resources);
}
std::unique_ptr<CopyOutputRequest>
« no previous file with comments | « cc/test/layer_tree_pixel_test.h ('k') | cc/test/pixel_test_delegating_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698