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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 241 } |
241 | 242 |
242 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider); | 243 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", !!context_provider); |
243 | 244 |
244 if (!context_provider.get()) { | 245 if (!context_provider.get()) { |
245 if (ui::Compositor::WasInitializedWithThread()) { | 246 if (ui::Compositor::WasInitializedWithThread()) { |
246 LOG(FATAL) << "Failed to create UI context, but can't use software" | 247 LOG(FATAL) << "Failed to create UI context, but can't use software" |
247 " compositing with browser threaded compositing. Aborting."; | 248 " compositing with browser threaded compositing. Aborting."; |
248 } | 249 } |
249 | 250 |
250 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface = | 251 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( |
251 SoftwareBrowserCompositorOutputSurface::Create( | 252 new SoftwareBrowserCompositorOutputSurface( |
252 CreateSoftwareOutputDevice(compositor)); | 253 output_surface_proxy_, |
| 254 CreateSoftwareOutputDevice(compositor), |
| 255 per_compositor_data_[compositor]->surface_id, |
| 256 &output_surface_map_, |
| 257 base::MessageLoopProxy::current().get(), |
| 258 compositor->AsWeakPtr())); |
253 return surface.PassAs<cc::OutputSurface>(); | 259 return surface.PassAs<cc::OutputSurface>(); |
254 } | 260 } |
255 | 261 |
256 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = | 262 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = |
257 ui::Compositor::GetCompositorMessageLoop(); | 263 ui::Compositor::GetCompositorMessageLoop(); |
258 if (!compositor_thread_task_runner.get()) | 264 if (!compositor_thread_task_runner.get()) |
259 compositor_thread_task_runner = base::MessageLoopProxy::current(); | 265 compositor_thread_task_runner = base::MessageLoopProxy::current(); |
260 | 266 |
261 // Here we know the GpuProcessHost has been set up, because we created a | 267 // Here we know the GpuProcessHost has been set up, because we created a |
262 // context. | 268 // context. |
263 output_surface_proxy_->ConnectToGpuProcessHost( | 269 output_surface_proxy_->ConnectToGpuProcessHost( |
264 compositor_thread_task_runner.get()); | 270 compositor_thread_task_runner.get()); |
265 | 271 |
266 scoped_ptr<BrowserCompositorOutputSurface> surface( | 272 scoped_ptr<BrowserCompositorOutputSurface> surface( |
267 new BrowserCompositorOutputSurface( | 273 new GpuBrowserCompositorOutputSurface( |
268 context_provider, | 274 context_provider, |
269 per_compositor_data_[compositor]->surface_id, | 275 per_compositor_data_[compositor]->surface_id, |
270 &output_surface_map_, | 276 &output_surface_map_, |
271 base::MessageLoopProxy::current().get(), | 277 base::MessageLoopProxy::current().get(), |
272 compositor->AsWeakPtr())); | 278 compositor->AsWeakPtr())); |
273 if (data->reflector.get()) { | 279 if (data->reflector.get()) { |
274 data->reflector->CreateSharedTexture(); | 280 data->reflector->CreateSharedTexture(); |
275 data->reflector->AttachToOutputSurface(surface.get()); | 281 data->reflector->AttachToOutputSurface(surface.get()); |
276 } | 282 } |
277 | 283 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 observer_list_, | 552 observer_list_, |
547 OnLostResources()); | 553 OnLostResources()); |
548 | 554 |
549 // Kill things that use the shared context before killing the shared context. | 555 // Kill things that use the shared context before killing the shared context. |
550 lost_gl_helper.reset(); | 556 lost_gl_helper.reset(); |
551 lost_offscreen_compositor_contexts = NULL; | 557 lost_offscreen_compositor_contexts = NULL; |
552 lost_shared_main_thread_contexts = NULL; | 558 lost_shared_main_thread_contexts = NULL; |
553 } | 559 } |
554 | 560 |
555 } // namespace content | 561 } // namespace content |
OLD | NEW |