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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 LOG(FATAL) << "Failed to create UI context, but can't use software" | 210 LOG(FATAL) << "Failed to create UI context, but can't use software" |
211 " compositing with browser threaded compositing. Aborting."; | 211 " compositing with browser threaded compositing. Aborting."; |
212 } | 212 } |
213 | 213 |
214 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( | 214 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( |
215 new SoftwareBrowserCompositorOutputSurface( | 215 new SoftwareBrowserCompositorOutputSurface( |
216 output_surface_proxy_, | 216 output_surface_proxy_, |
217 CreateSoftwareOutputDevice(compositor), | 217 CreateSoftwareOutputDevice(compositor), |
218 per_compositor_data_[compositor]->surface_id, | 218 per_compositor_data_[compositor]->surface_id, |
219 &output_surface_map_, | 219 &output_surface_map_, |
220 compositor->vsync_manager())); | 220 base::MessageLoopProxy::current().get(), |
| 221 compositor->AsWeakPtr())); |
221 return surface.PassAs<cc::OutputSurface>(); | 222 return surface.PassAs<cc::OutputSurface>(); |
222 } | 223 } |
223 | 224 |
224 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = | 225 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = |
225 ui::Compositor::GetCompositorMessageLoop(); | 226 ui::Compositor::GetCompositorMessageLoop(); |
226 if (!compositor_thread_task_runner.get()) | 227 if (!compositor_thread_task_runner.get()) |
227 compositor_thread_task_runner = base::MessageLoopProxy::current(); | 228 compositor_thread_task_runner = base::MessageLoopProxy::current(); |
228 | 229 |
229 // Here we know the GpuProcessHost has been set up, because we created a | 230 // Here we know the GpuProcessHost has been set up, because we created a |
230 // context. | 231 // context. |
231 output_surface_proxy_->ConnectToGpuProcessHost( | 232 output_surface_proxy_->ConnectToGpuProcessHost( |
232 compositor_thread_task_runner.get()); | 233 compositor_thread_task_runner.get()); |
233 | 234 |
234 scoped_ptr<BrowserCompositorOutputSurface> surface( | 235 scoped_ptr<BrowserCompositorOutputSurface> surface( |
235 new GpuBrowserCompositorOutputSurface( | 236 new GpuBrowserCompositorOutputSurface( |
236 context_provider, | 237 context_provider, |
237 per_compositor_data_[compositor]->surface_id, | 238 per_compositor_data_[compositor]->surface_id, |
238 &output_surface_map_, | 239 &output_surface_map_, |
239 compositor->vsync_manager())); | 240 base::MessageLoopProxy::current().get(), |
| 241 compositor->AsWeakPtr())); |
240 if (data->reflector.get()) { | 242 if (data->reflector.get()) { |
241 data->reflector->CreateSharedTexture(); | 243 data->reflector->CreateSharedTexture(); |
242 data->reflector->AttachToOutputSurface(surface.get()); | 244 data->reflector->AttachToOutputSurface(surface.get()); |
243 } | 245 } |
244 | 246 |
245 return surface.PassAs<cc::OutputSurface>(); | 247 return surface.PassAs<cc::OutputSurface>(); |
246 } | 248 } |
247 | 249 |
248 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 250 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
249 ui::Compositor* source, | 251 ui::Compositor* source, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 observer_list_, | 481 observer_list_, |
480 OnLostResources()); | 482 OnLostResources()); |
481 | 483 |
482 // Kill things that use the shared context before killing the shared context. | 484 // Kill things that use the shared context before killing the shared context. |
483 lost_gl_helper.reset(); | 485 lost_gl_helper.reset(); |
484 lost_offscreen_compositor_contexts = NULL; | 486 lost_offscreen_compositor_contexts = NULL; |
485 lost_shared_main_thread_contexts = NULL; | 487 lost_shared_main_thread_contexts = NULL; |
486 } | 488 } |
487 | 489 |
488 } // namespace content | 490 } // namespace content |
OLD | NEW |