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

Side by Side Diff: ui/compositor/test/in_process_context_factory.cc

Issue 2036563002: Delete OnscreenDisplayClient and TopLevelDisplayClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: onscreendisplayclient: webview-scoped-allow-gl-for-hardwarerenderer-constructor Created 4 years, 6 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 | « ui/compositor/test/in_process_context_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "cc/output/compositor_frame.h" 14 #include "cc/output/compositor_frame.h"
15 #include "cc/output/context_provider.h" 15 #include "cc/output/context_provider.h"
16 #include "cc/output/output_surface_client.h" 16 #include "cc/output/output_surface_client.h"
17 #include "cc/surfaces/onscreen_display_client.h"
18 #include "cc/surfaces/surface_display_output_surface.h" 17 #include "cc/surfaces/surface_display_output_surface.h"
19 #include "cc/surfaces/surface_id_allocator.h" 18 #include "cc/surfaces/surface_id_allocator.h"
20 #include "cc/test/pixel_test_output_surface.h" 19 #include "cc/test/pixel_test_output_surface.h"
21 #include "cc/test/test_shared_bitmap_manager.h" 20 #include "cc/test/test_shared_bitmap_manager.h"
22 #include "gpu/command_buffer/client/context_support.h" 21 #include "gpu/command_buffer/client/context_support.h"
23 #include "gpu/command_buffer/client/gles2_interface.h" 22 #include "gpu/command_buffer/client/gles2_interface.h"
24 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 23 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
25 #include "ui/compositor/compositor_switches.h" 24 #include "ui/compositor/compositor_switches.h"
26 #include "ui/compositor/layer.h" 25 #include "ui/compositor/layer.h"
27 #include "ui/compositor/reflector.h" 26 #include "ui/compositor/reflector.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 attribs.samples = 0; 141 attribs.samples = 0;
143 attribs.sample_buffers = 0; 142 attribs.sample_buffers = 0;
144 attribs.fail_if_major_perf_caveat = false; 143 attribs.fail_if_major_perf_caveat = false;
145 attribs.bind_generates_resource = false; 144 attribs.bind_generates_resource = false;
146 scoped_refptr<InProcessContextProvider> context_provider = 145 scoped_refptr<InProcessContextProvider> context_provider =
147 InProcessContextProvider::Create( 146 InProcessContextProvider::Create(
148 attribs, shared_worker_context_provider_.get(), 147 attribs, shared_worker_context_provider_.get(),
149 &gpu_memory_buffer_manager_, &image_factory_, compositor->widget(), 148 &gpu_memory_buffer_manager_, &image_factory_, compositor->widget(),
150 "UICompositor"); 149 "UICompositor");
151 150
152 std::unique_ptr<cc::OutputSurface> real_output_surface; 151 std::unique_ptr<cc::OutputSurface> display_output_surface;
153 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source( 152 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source(
154 new cc::SyntheticBeginFrameSource(compositor->task_runner().get(), 153 new cc::SyntheticBeginFrameSource(compositor->task_runner().get(),
155 cc::BeginFrameArgs::DefaultInterval())); 154 cc::BeginFrameArgs::DefaultInterval()));
156 155
157 if (use_test_surface_) { 156 if (use_test_surface_) {
158 bool flipped_output_surface = false; 157 bool flipped_output_surface = false;
159 real_output_surface = base::WrapUnique(new cc::PixelTestOutputSurface( 158 display_output_surface = base::WrapUnique(new cc::PixelTestOutputSurface(
160 context_provider, shared_worker_context_provider_, 159 context_provider, shared_worker_context_provider_,
161 flipped_output_surface, std::move(begin_frame_source))); 160 flipped_output_surface, std::move(begin_frame_source)));
162 } else { 161 } else {
163 real_output_surface = base::WrapUnique(new DirectOutputSurface( 162 display_output_surface = base::WrapUnique(new DirectOutputSurface(
164 context_provider, shared_worker_context_provider_, 163 context_provider, shared_worker_context_provider_,
165 std::move(begin_frame_source))); 164 std::move(begin_frame_source)));
166 } 165 }
167 166
168 if (surface_manager_) { 167 if (surface_manager_) {
169 std::unique_ptr<cc::OnscreenDisplayClient> display_client( 168 std::unique_ptr<cc::Display> display(new cc::Display(
170 new cc::OnscreenDisplayClient( 169 surface_manager_, GetSharedBitmapManager(), GetGpuMemoryBufferManager(),
171 std::move(real_output_surface), surface_manager_, 170 compositor->GetRendererSettings(),
172 GetSharedBitmapManager(), GetGpuMemoryBufferManager(), 171 compositor->surface_id_allocator()->id_namespace(),
173 compositor->GetRendererSettings(), compositor->task_runner(), 172 compositor->task_runner().get(), std::move(display_output_surface)));
174 compositor->surface_id_allocator()->id_namespace()));
175 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( 173 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface(
176 new cc::SurfaceDisplayOutputSurface( 174 new cc::SurfaceDisplayOutputSurface(
177 surface_manager_, compositor->surface_id_allocator(), 175 surface_manager_, compositor->surface_id_allocator(), display.get(),
178 context_provider, shared_worker_context_provider_)); 176 context_provider, shared_worker_context_provider_));
179 display_client->set_surface_output_surface(surface_output_surface.get());
180 surface_output_surface->set_display_client(display_client.get());
181 177
182 compositor->SetOutputSurface(std::move(surface_output_surface)); 178 compositor->SetOutputSurface(std::move(surface_output_surface));
183 179
184 delete per_compositor_data_[compositor.get()]; 180 per_compositor_data_[compositor.get()] = std::move(display);
185 per_compositor_data_[compositor.get()] = display_client.release();
186 } else { 181 } else {
187 compositor->SetOutputSurface(std::move(real_output_surface)); 182 compositor->SetOutputSurface(std::move(display_output_surface));
188 } 183 }
189 } 184 }
190 185
191 std::unique_ptr<Reflector> InProcessContextFactory::CreateReflector( 186 std::unique_ptr<Reflector> InProcessContextFactory::CreateReflector(
192 Compositor* mirrored_compositor, 187 Compositor* mirrored_compositor,
193 Layer* mirroring_layer) { 188 Layer* mirroring_layer) {
194 return base::WrapUnique(new FakeReflector); 189 return base::WrapUnique(new FakeReflector);
195 } 190 }
196 191
197 void InProcessContextFactory::RemoveReflector(Reflector* reflector) { 192 void InProcessContextFactory::RemoveReflector(Reflector* reflector) {
(...skipping 11 matching lines...) Expand all
209 if (shared_main_thread_contexts_.get() && 204 if (shared_main_thread_contexts_.get() &&
210 !shared_main_thread_contexts_->BindToCurrentThread()) 205 !shared_main_thread_contexts_->BindToCurrentThread())
211 shared_main_thread_contexts_ = NULL; 206 shared_main_thread_contexts_ = NULL;
212 207
213 return shared_main_thread_contexts_; 208 return shared_main_thread_contexts_;
214 } 209 }
215 210
216 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) { 211 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {
217 if (!per_compositor_data_.count(compositor)) 212 if (!per_compositor_data_.count(compositor))
218 return; 213 return;
219 delete per_compositor_data_[compositor];
220 per_compositor_data_.erase(compositor); 214 per_compositor_data_.erase(compositor);
221 } 215 }
222 216
223 bool InProcessContextFactory::DoesCreateTestContexts() { 217 bool InProcessContextFactory::DoesCreateTestContexts() {
224 return context_factory_for_test_; 218 return context_factory_for_test_;
225 } 219 }
226 220
227 uint32_t InProcessContextFactory::GetImageTextureTarget( 221 uint32_t InProcessContextFactory::GetImageTextureTarget(
228 gfx::BufferFormat format, 222 gfx::BufferFormat format,
229 gfx::BufferUsage usage) { 223 gfx::BufferUsage usage) {
(...skipping 23 matching lines...) Expand all
253 } 247 }
254 248
255 cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() { 249 cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() {
256 return surface_manager_; 250 return surface_manager_;
257 } 251 }
258 252
259 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, 253 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor,
260 const gfx::Size& size) { 254 const gfx::Size& size) {
261 if (!per_compositor_data_.count(compositor)) 255 if (!per_compositor_data_.count(compositor))
262 return; 256 return;
263 per_compositor_data_[compositor]->display()->Resize(size); 257 per_compositor_data_[compositor]->Resize(size);
264 } 258 }
265 259
266 } // namespace ui 260 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/in_process_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698