| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // associated with this context, then return a SurfaceDisplayOutputSurface | 180 // associated with this context, then return a SurfaceDisplayOutputSurface |
| 181 // set up to draw to the display's surface. | 181 // set up to draw to the display's surface. |
| 182 cc::SurfaceManager* manager = surface_manager_.get(); | 182 cc::SurfaceManager* manager = surface_manager_.get(); |
| 183 scoped_ptr<cc::OutputSurface> display_surface; | 183 scoped_ptr<cc::OutputSurface> display_surface; |
| 184 if (!context_provider.get()) { | 184 if (!context_provider.get()) { |
| 185 display_surface = | 185 display_surface = |
| 186 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 186 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
| 187 output_surface_proxy_, | 187 output_surface_proxy_, |
| 188 CreateSoftwareOutputDevice(compositor), | 188 CreateSoftwareOutputDevice(compositor), |
| 189 per_compositor_data_[compositor]->surface_id, | 189 per_compositor_data_[compositor]->surface_id, |
| 190 &output_surface_map_, | 190 &output_surface_map_)); |
| 191 compositor->vsync_manager())); | |
| 192 } else { | |
| 193 display_surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | |
| 194 context_provider, | |
| 195 per_compositor_data_[compositor]->surface_id, | |
| 196 &output_surface_map_, | |
| 197 compositor->vsync_manager(), | |
| 198 CreateOverlayCandidateValidator(compositor->widget()))); | |
| 199 } | 191 } |
| 200 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( | 192 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( |
| 201 display_surface.Pass(), manager, compositor->task_runner())); | 193 display_surface.Pass(), manager, compositor->task_runner())); |
| 202 | 194 |
| 203 scoped_refptr<cc::ContextProvider> offscreen_context_provider; | 195 scoped_refptr<cc::ContextProvider> offscreen_context_provider; |
| 204 if (context_provider.get()) { | 196 if (context_provider.get()) { |
| 205 offscreen_context_provider = ContextProviderCommandBuffer::Create( | 197 offscreen_context_provider = ContextProviderCommandBuffer::Create( |
| 206 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(), | 198 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(), |
| 207 "Offscreen-Compositor"); | 199 "Offscreen-Compositor"); |
| 208 } | 200 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 220 if (compositor_thread_.get()) { | 212 if (compositor_thread_.get()) { |
| 221 LOG(FATAL) << "Failed to create UI context, but can't use software" | 213 LOG(FATAL) << "Failed to create UI context, but can't use software" |
| 222 " compositing with browser threaded compositing. Aborting."; | 214 " compositing with browser threaded compositing. Aborting."; |
| 223 } | 215 } |
| 224 | 216 |
| 225 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( | 217 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( |
| 226 new SoftwareBrowserCompositorOutputSurface( | 218 new SoftwareBrowserCompositorOutputSurface( |
| 227 output_surface_proxy_, | 219 output_surface_proxy_, |
| 228 CreateSoftwareOutputDevice(compositor), | 220 CreateSoftwareOutputDevice(compositor), |
| 229 per_compositor_data_[compositor]->surface_id, | 221 per_compositor_data_[compositor]->surface_id, |
| 230 &output_surface_map_, | 222 &output_surface_map_)); |
| 231 compositor->vsync_manager())); | |
| 232 return surface.PassAs<cc::OutputSurface>(); | 223 return surface.PassAs<cc::OutputSurface>(); |
| 233 } | 224 } |
| 234 | 225 |
| 235 scoped_ptr<BrowserCompositorOutputSurface> surface; | 226 scoped_ptr<BrowserCompositorOutputSurface> surface; |
| 236 #if defined(USE_OZONE) | 227 #if defined(USE_OZONE) |
| 237 if (ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) { | 228 if (ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) { |
| 238 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( | 229 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( |
| 239 context_provider, | 230 context_provider, |
| 240 per_compositor_data_[compositor]->surface_id, | 231 per_compositor_data_[compositor]->surface_id, |
| 241 &output_surface_map_, | 232 &output_surface_map_, |
| 242 compositor->vsync_manager(), | |
| 243 CreateOverlayCandidateValidator(compositor->widget()), | 233 CreateOverlayCandidateValidator(compositor->widget()), |
| 244 GL_RGB8_OES)); | 234 GL_RGB8_OES)); |
| 245 } | 235 } |
| 246 #endif | 236 #endif |
| 247 if (!surface) | 237 if (!surface) |
| 248 surface.reset(new GpuBrowserCompositorOutputSurface( | 238 surface.reset(new GpuBrowserCompositorOutputSurface( |
| 249 context_provider, | 239 context_provider, |
| 250 per_compositor_data_[compositor]->surface_id, | 240 per_compositor_data_[compositor]->surface_id, |
| 251 &output_surface_map_, | 241 &output_surface_map_, |
| 252 compositor->vsync_manager(), | |
| 253 CreateOverlayCandidateValidator(compositor->widget()))); | 242 CreateOverlayCandidateValidator(compositor->widget()))); |
| 254 | 243 |
| 255 if (data->reflector.get()) | 244 if (data->reflector.get()) |
| 256 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); | 245 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); |
| 257 | 246 |
| 258 return surface.PassAs<cc::OutputSurface>(); | 247 return surface.PassAs<cc::OutputSurface>(); |
| 259 } | 248 } |
| 260 | 249 |
| 261 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 250 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
| 262 ui::Compositor* source, | 251 ui::Compositor* source, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 462 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 474 observer_list_, | 463 observer_list_, |
| 475 OnLostResources()); | 464 OnLostResources()); |
| 476 | 465 |
| 477 // Kill things that use the shared context before killing the shared context. | 466 // Kill things that use the shared context before killing the shared context. |
| 478 lost_gl_helper.reset(); | 467 lost_gl_helper.reset(); |
| 479 lost_shared_main_thread_contexts = NULL; | 468 lost_shared_main_thread_contexts = NULL; |
| 480 } | 469 } |
| 481 | 470 |
| 482 } // namespace content | 471 } // namespace content |
| OLD | NEW |