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

Side by Side Diff: cc/test/pixel_test_delegating_output_surface.cc

Issue 2075343003: Use a cc::Display for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mailbox-test
Patch Set: layouttests-display2: rebase 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 unified diff | Download patch
« no previous file with comments | « cc/test/pixel_test_delegating_output_surface.h ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/pixel_test_delegating_output_surface.h" 5 #include "cc/test/pixel_test_delegating_output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "cc/test/pixel_test_software_output_device.h" 21 #include "cc/test/pixel_test_software_output_device.h"
22 #include "cc/test/test_in_process_context_provider.h" 22 #include "cc/test/test_in_process_context_provider.h"
23 23
24 static constexpr uint32_t kCompositorSurfaceNamespace = 1; 24 static constexpr uint32_t kCompositorSurfaceNamespace = 1;
25 25
26 namespace cc { 26 namespace cc {
27 27
28 PixelTestDelegatingOutputSurface::PixelTestDelegatingOutputSurface( 28 PixelTestDelegatingOutputSurface::PixelTestDelegatingOutputSurface(
29 scoped_refptr<ContextProvider> compositor_context_provider, 29 scoped_refptr<ContextProvider> compositor_context_provider,
30 scoped_refptr<ContextProvider> worker_context_provider, 30 scoped_refptr<ContextProvider> worker_context_provider,
31 scoped_refptr<ContextProvider> display_context_provider,
32 const RendererSettings& renderer_settings,
31 SharedBitmapManager* shared_bitmap_manager, 33 SharedBitmapManager* shared_bitmap_manager,
32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 34 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
35 const gfx::Size& surface_expansion_size,
33 bool allow_force_reclaim_resources, 36 bool allow_force_reclaim_resources,
34 bool synchronous_composite) 37 bool synchronous_composite)
35 : OutputSurface(std::move(compositor_context_provider), 38 : OutputSurface(std::move(compositor_context_provider),
36 std::move(worker_context_provider), 39 std::move(worker_context_provider),
37 nullptr), 40 nullptr),
38 shared_bitmap_manager_(shared_bitmap_manager), 41 shared_bitmap_manager_(shared_bitmap_manager),
39 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 42 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
43 surface_expansion_size_(surface_expansion_size),
40 allow_force_reclaim_resources_(allow_force_reclaim_resources), 44 allow_force_reclaim_resources_(allow_force_reclaim_resources),
41 synchronous_composite_(synchronous_composite), 45 synchronous_composite_(synchronous_composite),
46 renderer_settings_(renderer_settings),
47 display_context_provider_(std::move(display_context_provider)),
42 surface_manager_(new SurfaceManager), 48 surface_manager_(new SurfaceManager),
43 surface_id_allocator_( 49 surface_id_allocator_(
44 new SurfaceIdAllocator(kCompositorSurfaceNamespace)), 50 new SurfaceIdAllocator(kCompositorSurfaceNamespace)),
45 surface_factory_(new SurfaceFactory(surface_manager_.get(), this)), 51 surface_factory_(new SurfaceFactory(surface_manager_.get(), this)),
46 weak_ptrs_(this) { 52 weak_ptrs_(this) {
47 capabilities_.delegated_rendering = true; 53 capabilities_.delegated_rendering = true;
48 capabilities_.can_force_reclaim_resources = allow_force_reclaim_resources_; 54 capabilities_.can_force_reclaim_resources = allow_force_reclaim_resources_;
49 55
50 surface_id_allocator_->RegisterSurfaceIdNamespace(surface_manager_.get()); 56 surface_id_allocator_->RegisterSurfaceIdNamespace(surface_manager_.get());
51 } 57 }
52 58
53 PixelTestDelegatingOutputSurface::~PixelTestDelegatingOutputSurface() {} 59 PixelTestDelegatingOutputSurface::~PixelTestDelegatingOutputSurface() {}
54 60
55 bool PixelTestDelegatingOutputSurface::BindToClient( 61 bool PixelTestDelegatingOutputSurface::BindToClient(
56 OutputSurfaceClient* client) { 62 OutputSurfaceClient* client) {
57 if (!OutputSurface::BindToClient(client)) 63 if (!OutputSurface::BindToClient(client))
58 return false; 64 return false;
59 65
60 surface_manager_->RegisterSurfaceFactoryClient( 66 surface_manager_->RegisterSurfaceFactoryClient(
61 surface_id_allocator_->id_namespace(), this); 67 surface_id_allocator_->id_namespace(), this);
62 68
63 // Always test Webview shenanigans.
64 gfx::Size surface_expansion_size(40, 60);
65
66 // The PixelTestOutputSurface is owned by the Display. 69 // The PixelTestOutputSurface is owned by the Display.
67 std::unique_ptr<PixelTestOutputSurface> output_surface; 70 std::unique_ptr<PixelTestOutputSurface> output_surface;
68 71
69 if (!context_provider()) { 72 if (!context_provider()) {
70 std::unique_ptr<PixelTestSoftwareOutputDevice> software_output_device( 73 std::unique_ptr<PixelTestSoftwareOutputDevice> software_output_device(
71 new PixelTestSoftwareOutputDevice); 74 new PixelTestSoftwareOutputDevice);
72 software_output_device->set_surface_expansion_size(surface_expansion_size); 75 software_output_device->set_surface_expansion_size(surface_expansion_size_);
73 output_surface = base::MakeUnique<PixelTestOutputSurface>( 76 output_surface = base::MakeUnique<PixelTestOutputSurface>(
74 std::move(software_output_device)); 77 std::move(software_output_device));
75 } else { 78 } else {
76 scoped_refptr<TestInProcessContextProvider> context(
77 new TestInProcessContextProvider(nullptr));
78 bool flipped_output_surface = false; 79 bool flipped_output_surface = false;
79 output_surface = base::MakeUnique<PixelTestOutputSurface>( 80 output_surface = base::MakeUnique<PixelTestOutputSurface>(
80 std::move(context), nullptr, flipped_output_surface); 81 std::move(display_context_provider_), nullptr, flipped_output_surface);
81 } 82 }
82 output_surface->set_surface_expansion_size(surface_expansion_size); 83 output_surface->set_surface_expansion_size(surface_expansion_size_);
83 84
84 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); 85 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get();
85 CHECK(task_runner); 86 CHECK(task_runner);
86 87
87 std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source; 88 std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source;
88 std::unique_ptr<DisplayScheduler> scheduler; 89 std::unique_ptr<DisplayScheduler> scheduler;
89 if (!synchronous_composite_) { 90 if (!synchronous_composite_) {
90 begin_frame_source.reset(new BackToBackBeginFrameSource( 91 begin_frame_source.reset(new DelayBasedBeginFrameSource(
91 base::MakeUnique<DelayBasedTimeSource>(task_runner))); 92 base::MakeUnique<DelayBasedTimeSource>(task_runner)));
92 scheduler.reset(new DisplayScheduler( 93 scheduler.reset(new DisplayScheduler(
93 begin_frame_source.get(), task_runner, 94 begin_frame_source.get(), task_runner,
94 output_surface->capabilities().max_frames_pending)); 95 output_surface->capabilities().max_frames_pending));
95 } 96 }
96 97
97 display_.reset(new Display( 98 display_.reset(new Display(
98 surface_manager_.get(), shared_bitmap_manager_, 99 surface_manager_.get(), shared_bitmap_manager_,
99 gpu_memory_buffer_manager_, RendererSettings(), 100 gpu_memory_buffer_manager_, renderer_settings_,
100 surface_id_allocator_->id_namespace(), std::move(begin_frame_source), 101 surface_id_allocator_->id_namespace(), std::move(begin_frame_source),
101 std::move(output_surface), std::move(scheduler), 102 std::move(output_surface), std::move(scheduler),
102 base::MakeUnique<TextureMailboxDeleter>(task_runner))); 103 base::MakeUnique<TextureMailboxDeleter>(task_runner)));
103 display_->SetEnlargePassTextureAmountForTesting(enlarge_pass_texture_amount_); 104 display_->SetEnlargePassTextureAmountForTesting(enlarge_pass_texture_amount_);
104 105
105 display_->Initialize(&display_client_); 106 display_->Initialize(&display_client_);
106 return true; 107 return true;
107 } 108 }
108 109
109 void PixelTestDelegatingOutputSurface::DetachFromClient() { 110 void PixelTestDelegatingOutputSurface::DetachFromClient() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 ack.resources = resources; 180 ack.resources = resources;
180 client_->ReclaimResources(&ack); 181 client_->ReclaimResources(&ack);
181 } 182 }
182 183
183 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( 184 void PixelTestDelegatingOutputSurface::SetBeginFrameSource(
184 BeginFrameSource* begin_frame_source) { 185 BeginFrameSource* begin_frame_source) {
185 client_->SetBeginFrameSource(begin_frame_source); 186 client_->SetBeginFrameSource(begin_frame_source);
186 } 187 }
187 188
188 } // namespace cc 189 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/pixel_test_delegating_output_surface.h ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698