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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 compositor_thread_task_runner.get()); | 174 compositor_thread_task_runner.get()); |
175 } | 175 } |
176 | 176 |
177 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 177 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
178 switches::kUseSurfaces)) { | 178 switches::kUseSurfaces)) { |
179 // This gets a bit confusing. Here we have a ContextProvider configured to | 179 // This gets a bit confusing. Here we have a ContextProvider configured to |
180 // render directly to this widget. We need to make an OnscreenDisplayClient | 180 // render directly to this widget. We need to make an OnscreenDisplayClient |
181 // associated with this context, then return a SurfaceDisplayOutputSurface | 181 // associated with this context, then return a SurfaceDisplayOutputSurface |
182 // set up to draw to the display's surface. | 182 // set up to draw to the display's surface. |
183 cc::SurfaceManager* manager = surface_manager_.get(); | 183 cc::SurfaceManager* manager = surface_manager_.get(); |
184 scoped_ptr<cc::OutputSurface> software_surface; | 184 scoped_ptr<cc::OutputSurface> display_surface; |
185 if (!context_provider.get()) { | 185 if (!context_provider.get()) { |
186 software_surface = | 186 display_surface = |
187 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 187 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
188 output_surface_proxy_, | 188 output_surface_proxy_, |
189 CreateSoftwareOutputDevice(compositor), | 189 CreateSoftwareOutputDevice(compositor), |
190 per_compositor_data_[compositor]->surface_id, | 190 per_compositor_data_[compositor]->surface_id, |
191 &output_surface_map_, | 191 &output_surface_map_, |
192 compositor->vsync_manager())); | 192 compositor->vsync_manager())); |
| 193 } else { |
| 194 display_surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
| 195 context_provider, |
| 196 per_compositor_data_[compositor]->surface_id, |
| 197 &output_surface_map_, |
| 198 compositor->vsync_manager(), |
| 199 CreateOverlayCandidateValidator(compositor->widget()))); |
193 } | 200 } |
194 scoped_ptr<OnscreenDisplayClient> display_client( | 201 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( |
195 new OnscreenDisplayClient(context_provider, | 202 display_surface.Pass(), manager, compositor->task_runner())); |
196 software_surface.Pass(), | |
197 manager, | |
198 compositor->task_runner())); | |
199 // TODO(jamesr): Need to set up filtering for the | |
200 // GpuHostMsg_UpdateVSyncParameters message. | |
201 | 203 |
202 scoped_refptr<cc::ContextProvider> offscreen_context_provider; | 204 scoped_refptr<cc::ContextProvider> offscreen_context_provider; |
203 if (context_provider.get()) { | 205 if (context_provider.get()) { |
204 offscreen_context_provider = ContextProviderCommandBuffer::Create( | 206 offscreen_context_provider = ContextProviderCommandBuffer::Create( |
205 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(), | 207 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(), |
206 "Offscreen-Compositor"); | 208 "Offscreen-Compositor"); |
207 } | 209 } |
208 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( | 210 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( |
209 new SurfaceDisplayOutputSurface(manager, | 211 new SurfaceDisplayOutputSurface(manager, |
210 next_surface_id_namespace_++, | 212 next_surface_id_namespace_++, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 460 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
459 observer_list_, | 461 observer_list_, |
460 OnLostResources()); | 462 OnLostResources()); |
461 | 463 |
462 // Kill things that use the shared context before killing the shared context. | 464 // Kill things that use the shared context before killing the shared context. |
463 lost_gl_helper.reset(); | 465 lost_gl_helper.reset(); |
464 lost_shared_main_thread_contexts = NULL; | 466 lost_shared_main_thread_contexts = NULL; |
465 } | 467 } |
466 | 468 |
467 } // namespace content | 469 } // namespace content |
OLD | NEW |