OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/aura/gpu_process_transport_factory.h" | 5 #include "content/browser/aura/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" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "cc/output/compositor_frame.h" | 14 #include "cc/output/compositor_frame.h" |
15 #include "cc/output/output_surface.h" | 15 #include "cc/output/output_surface.h" |
16 #include "content/browser/aura/browser_compositor_output_surface.h" | 16 #include "content/browser/aura/browser_compositor_output_surface.h" |
17 #include "content/browser/aura/browser_compositor_output_surface_proxy.h" | 17 #include "content/browser/aura/browser_compositor_output_surface_proxy.h" |
| 18 #include "content/browser/aura/gpu_browser_compositor_output_surface.h" |
18 #include "content/browser/aura/reflector_impl.h" | 19 #include "content/browser/aura/reflector_impl.h" |
19 #include "content/browser/aura/software_browser_compositor_output_surface.h" | 20 #include "content/browser/aura/software_browser_compositor_output_surface.h" |
20 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 21 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
21 #include "content/browser/gpu/gpu_data_manager_impl.h" | 22 #include "content/browser/gpu/gpu_data_manager_impl.h" |
22 #include "content/browser/gpu/gpu_surface_tracker.h" | 23 #include "content/browser/gpu/gpu_surface_tracker.h" |
23 #include "content/browser/renderer_host/render_widget_host_impl.h" | 24 #include "content/browser/renderer_host/render_widget_host_impl.h" |
24 #include "content/common/gpu/client/context_provider_command_buffer.h" | 25 #include "content/common/gpu/client/context_provider_command_buffer.h" |
25 #include "content/common/gpu/client/gl_helper.h" | 26 #include "content/common/gpu/client/gl_helper.h" |
26 #include "content/common/gpu/client/gpu_channel_host.h" | 27 #include "content/common/gpu/client/gpu_channel_host.h" |
27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 28 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 243 } |
243 | 244 |
244 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider); | 245 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider); |
245 | 246 |
246 if (!context_provider.get()) { | 247 if (!context_provider.get()) { |
247 if (ui::Compositor::WasInitializedWithThread()) { | 248 if (ui::Compositor::WasInitializedWithThread()) { |
248 LOG(FATAL) << "Failed to create UI context, but can't use software" | 249 LOG(FATAL) << "Failed to create UI context, but can't use software" |
249 " compositing with browser threaded compositing. Aborting."; | 250 " compositing with browser threaded compositing. Aborting."; |
250 } | 251 } |
251 | 252 |
252 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface = | 253 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( |
253 SoftwareBrowserCompositorOutputSurface::Create( | 254 new SoftwareBrowserCompositorOutputSurface( |
254 CreateSoftwareOutputDevice(compositor)); | 255 output_surface_proxy_, |
| 256 CreateSoftwareOutputDevice(compositor), |
| 257 per_compositor_data_[compositor]->surface_id, |
| 258 &output_surface_map_, |
| 259 base::MessageLoopProxy::current().get(), |
| 260 compositor->AsWeakPtr())); |
255 return surface.PassAs<cc::OutputSurface>(); | 261 return surface.PassAs<cc::OutputSurface>(); |
256 } | 262 } |
257 | 263 |
258 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = | 264 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = |
259 ui::Compositor::GetCompositorMessageLoop(); | 265 ui::Compositor::GetCompositorMessageLoop(); |
260 if (!compositor_thread_task_runner.get()) | 266 if (!compositor_thread_task_runner.get()) |
261 compositor_thread_task_runner = base::MessageLoopProxy::current(); | 267 compositor_thread_task_runner = base::MessageLoopProxy::current(); |
262 | 268 |
263 // Here we know the GpuProcessHost has been set up, because we created a | 269 // Here we know the GpuProcessHost has been set up, because we created a |
264 // context. | 270 // context. |
265 output_surface_proxy_->ConnectToGpuProcessHost( | 271 output_surface_proxy_->ConnectToGpuProcessHost( |
266 compositor_thread_task_runner.get()); | 272 compositor_thread_task_runner.get()); |
267 | 273 |
268 scoped_ptr<BrowserCompositorOutputSurface> surface( | 274 scoped_ptr<BrowserCompositorOutputSurface> surface( |
269 new BrowserCompositorOutputSurface( | 275 new GpuBrowserCompositorOutputSurface( |
270 context_provider, | 276 context_provider, |
271 per_compositor_data_[compositor]->surface_id, | 277 per_compositor_data_[compositor]->surface_id, |
272 &output_surface_map_, | 278 &output_surface_map_, |
273 base::MessageLoopProxy::current().get(), | 279 base::MessageLoopProxy::current().get(), |
274 compositor->AsWeakPtr())); | 280 compositor->AsWeakPtr())); |
275 if (data->reflector.get()) { | 281 if (data->reflector.get()) { |
276 data->reflector->CreateSharedTexture(); | 282 data->reflector->CreateSharedTexture(); |
277 data->reflector->AttachToOutputSurface(surface.get()); | 283 data->reflector->AttachToOutputSurface(surface.get()); |
278 } | 284 } |
279 | 285 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 observer_list_, | 556 observer_list_, |
551 OnLostResources()); | 557 OnLostResources()); |
552 | 558 |
553 // Kill things that use the shared context before killing the shared context. | 559 // Kill things that use the shared context before killing the shared context. |
554 lost_gl_helper.reset(); | 560 lost_gl_helper.reset(); |
555 lost_offscreen_compositor_contexts = NULL; | 561 lost_offscreen_compositor_contexts = NULL; |
556 lost_shared_main_thread_contexts = NULL; | 562 lost_shared_main_thread_contexts = NULL; |
557 } | 563 } |
558 | 564 |
559 } // namespace content | 565 } // namespace content |
OLD | NEW |