| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // associated with this context, then return a SurfaceDisplayOutputSurface | 179 // associated with this context, then return a SurfaceDisplayOutputSurface |
| 180 // set up to draw to the display's surface. | 180 // set up to draw to the display's surface. |
| 181 cc::SurfaceManager* manager = surface_manager_.get(); | 181 cc::SurfaceManager* manager = surface_manager_.get(); |
| 182 scoped_ptr<cc::OutputSurface> software_surface; | 182 scoped_ptr<cc::OutputSurface> software_surface; |
| 183 if (!context_provider) { | 183 if (!context_provider) { |
| 184 software_surface = | 184 software_surface = |
| 185 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 185 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
| 186 output_surface_proxy_, | 186 output_surface_proxy_, |
| 187 CreateSoftwareOutputDevice(compositor), | 187 CreateSoftwareOutputDevice(compositor), |
| 188 per_compositor_data_[compositor]->surface_id, | 188 per_compositor_data_[compositor]->surface_id, |
| 189 &output_surface_map_, | 189 &output_surface_map_)); |
| 190 compositor->vsync_manager())); | |
| 191 } | 190 } |
| 192 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( | 191 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( |
| 193 context_provider, software_surface.Pass(), manager)); | 192 context_provider, software_surface.Pass(), manager)); |
| 194 // TODO(jamesr): Need to set up filtering for the | 193 // TODO(jamesr): Need to set up filtering for the |
| 195 // GpuHostMsg_UpdateVSyncParameters message. | 194 // GpuHostMsg_UpdateVSyncParameters message. |
| 196 | 195 |
| 197 scoped_refptr<cc::ContextProvider> offscreen_context_provider; | 196 scoped_refptr<cc::ContextProvider> offscreen_context_provider; |
| 198 if (context_provider) { | 197 if (context_provider) { |
| 199 offscreen_context_provider = ContextProviderCommandBuffer::Create( | 198 offscreen_context_provider = ContextProviderCommandBuffer::Create( |
| 200 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(), | 199 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext(), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 213 if (compositor_thread_.get()) { | 212 if (compositor_thread_.get()) { |
| 214 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" |
| 215 " compositing with browser threaded compositing. Aborting."; | 214 " compositing with browser threaded compositing. Aborting."; |
| 216 } | 215 } |
| 217 | 216 |
| 218 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( | 217 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( |
| 219 new SoftwareBrowserCompositorOutputSurface( | 218 new SoftwareBrowserCompositorOutputSurface( |
| 220 output_surface_proxy_, | 219 output_surface_proxy_, |
| 221 CreateSoftwareOutputDevice(compositor), | 220 CreateSoftwareOutputDevice(compositor), |
| 222 per_compositor_data_[compositor]->surface_id, | 221 per_compositor_data_[compositor]->surface_id, |
| 223 &output_surface_map_, | 222 &output_surface_map_)); |
| 224 compositor->vsync_manager())); | |
| 225 return surface.PassAs<cc::OutputSurface>(); | 223 return surface.PassAs<cc::OutputSurface>(); |
| 226 } | 224 } |
| 227 | 225 |
| 228 scoped_ptr<BrowserCompositorOutputSurface> surface( | 226 scoped_ptr<BrowserCompositorOutputSurface> surface( |
| 229 new GpuBrowserCompositorOutputSurface( | 227 new GpuBrowserCompositorOutputSurface( |
| 230 context_provider, | 228 context_provider, |
| 231 per_compositor_data_[compositor]->surface_id, | 229 per_compositor_data_[compositor]->surface_id, |
| 232 &output_surface_map_, | 230 &output_surface_map_, |
| 233 compositor->vsync_manager(), | |
| 234 CreateOverlayCandidateValidator(compositor->widget()))); | 231 CreateOverlayCandidateValidator(compositor->widget()))); |
| 235 if (data->reflector.get()) | 232 if (data->reflector.get()) |
| 236 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); | 233 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); |
| 237 | 234 |
| 238 return surface.PassAs<cc::OutputSurface>(); | 235 return surface.PassAs<cc::OutputSurface>(); |
| 239 } | 236 } |
| 240 | 237 |
| 241 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 238 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
| 242 ui::Compositor* source, | 239 ui::Compositor* source, |
| 243 ui::Layer* target) { | 240 ui::Layer* target) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 450 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 454 observer_list_, | 451 observer_list_, |
| 455 OnLostResources()); | 452 OnLostResources()); |
| 456 | 453 |
| 457 // Kill things that use the shared context before killing the shared context. | 454 // Kill things that use the shared context before killing the shared context. |
| 458 lost_gl_helper.reset(); | 455 lost_gl_helper.reset(); |
| 459 lost_shared_main_thread_contexts = NULL; | 456 lost_shared_main_thread_contexts = NULL; |
| 460 } | 457 } |
| 461 | 458 |
| 462 } // namespace content | 459 } // namespace content |
| OLD | NEW |