OLD | NEW |
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 "content/browser/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( | 201 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( |
202 display_surface.Pass(), manager, compositor->task_runner())); | 202 display_surface.Pass(), manager, compositor->task_runner())); |
203 | 203 |
204 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( | 204 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( |
205 new SurfaceDisplayOutputSurface( | 205 new SurfaceDisplayOutputSurface( |
206 manager, compositor->surface_id_allocator(), context_provider)); | 206 manager, compositor->surface_id_allocator(), context_provider)); |
207 display_client->set_surface_output_surface(output_surface.get()); | 207 display_client->set_surface_output_surface(output_surface.get()); |
208 output_surface->set_display_client(display_client.get()); | 208 output_surface->set_display_client(display_client.get()); |
209 data->display_client = display_client.Pass(); | 209 data->display_client = display_client.Pass(); |
210 return output_surface.PassAs<cc::OutputSurface>(); | 210 return output_surface.Pass(); |
211 } | 211 } |
212 | 212 |
213 if (!context_provider.get()) { | 213 if (!context_provider.get()) { |
214 if (compositor_thread_.get()) { | 214 if (compositor_thread_.get()) { |
215 LOG(FATAL) << "Failed to create UI context, but can't use software" | 215 LOG(FATAL) << "Failed to create UI context, but can't use software" |
216 " compositing with browser threaded compositing. Aborting."; | 216 " compositing with browser threaded compositing. Aborting."; |
217 } | 217 } |
218 | 218 |
219 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( | 219 return make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
220 new SoftwareBrowserCompositorOutputSurface( | 220 output_surface_proxy_, |
221 output_surface_proxy_, | 221 CreateSoftwareOutputDevice(compositor), |
222 CreateSoftwareOutputDevice(compositor), | 222 per_compositor_data_[compositor]->surface_id, |
223 per_compositor_data_[compositor]->surface_id, | 223 &output_surface_map_, |
224 &output_surface_map_, | 224 compositor->vsync_manager())); |
225 compositor->vsync_manager())); | |
226 return surface.PassAs<cc::OutputSurface>(); | |
227 } | 225 } |
228 | 226 |
229 scoped_ptr<BrowserCompositorOutputSurface> surface; | 227 scoped_ptr<BrowserCompositorOutputSurface> surface; |
230 #if defined(USE_OZONE) | 228 #if defined(USE_OZONE) |
231 if (ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) { | 229 if (ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) { |
232 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( | 230 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( |
233 context_provider, | 231 context_provider, |
234 per_compositor_data_[compositor]->surface_id, | 232 per_compositor_data_[compositor]->surface_id, |
235 &output_surface_map_, | 233 &output_surface_map_, |
236 compositor->vsync_manager(), | 234 compositor->vsync_manager(), |
237 CreateOverlayCandidateValidator(compositor->widget()), | 235 CreateOverlayCandidateValidator(compositor->widget()), |
238 GL_RGB)); | 236 GL_RGB)); |
239 } | 237 } |
240 #endif | 238 #endif |
241 if (!surface) | 239 if (!surface) |
242 surface.reset(new GpuBrowserCompositorOutputSurface( | 240 surface.reset(new GpuBrowserCompositorOutputSurface( |
243 context_provider, | 241 context_provider, |
244 per_compositor_data_[compositor]->surface_id, | 242 per_compositor_data_[compositor]->surface_id, |
245 &output_surface_map_, | 243 &output_surface_map_, |
246 compositor->vsync_manager(), | 244 compositor->vsync_manager(), |
247 CreateOverlayCandidateValidator(compositor->widget()))); | 245 CreateOverlayCandidateValidator(compositor->widget()))); |
248 | 246 |
249 if (data->reflector.get()) | 247 if (data->reflector.get()) |
250 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); | 248 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); |
251 | 249 |
252 return surface.PassAs<cc::OutputSurface>(); | 250 return surface.Pass(); |
253 } | 251 } |
254 | 252 |
255 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 253 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
256 ui::Compositor* source, | 254 ui::Compositor* source, |
257 ui::Layer* target) { | 255 ui::Layer* target) { |
258 PerCompositorData* data = per_compositor_data_[source]; | 256 PerCompositorData* data = per_compositor_data_[source]; |
259 DCHECK(data); | 257 DCHECK(data); |
260 | 258 |
261 data->reflector = new ReflectorImpl(source, | 259 data->reflector = new ReflectorImpl(source, |
262 target, | 260 target, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 470 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
473 observer_list_, | 471 observer_list_, |
474 OnLostResources()); | 472 OnLostResources()); |
475 | 473 |
476 // Kill things that use the shared context before killing the shared context. | 474 // Kill things that use the shared context before killing the shared context. |
477 lost_gl_helper.reset(); | 475 lost_gl_helper.reset(); |
478 lost_shared_main_thread_contexts = NULL; | 476 lost_shared_main_thread_contexts = NULL; |
479 } | 477 } |
480 | 478 |
481 } // namespace content | 479 } // namespace content |
OLD | NEW |