| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/image_transport_factory.h" | 5 #include "content/browser/renderer_host/image_transport_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 16 #include "cc/output_surface.h" | 17 #include "cc/output_surface.h" |
| 17 #include "cc/output_surface_client.h" | 18 #include "cc/output_surface_client.h" |
| 18 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 19 #include "content/browser/gpu/gpu_data_manager_impl.h" | 20 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 20 #include "content/browser/gpu/gpu_process_host.h" | 21 #include "content/browser/gpu/gpu_process_host.h" |
| 21 #include "content/browser/gpu/gpu_surface_tracker.h" | 22 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 22 #include "content/common/gpu/client/context_provider_command_buffer.h" | 23 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 23 #include "content/common/gpu/client/gl_helper.h" | 24 #include "content/common/gpu/client/gl_helper.h" |
| 24 #include "content/common/gpu/client/gpu_channel_host.h" | 25 #include "content/common/gpu/client/gpu_channel_host.h" |
| 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 26 #include "content/common/gpu/gpu_messages.h" | 27 #include "content/common/gpu/gpu_messages.h" |
| 27 #include "content/common/gpu/gpu_process_launch_causes.h" | 28 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 28 #include "content/common/webkitplatformsupport_impl.h" | 29 #include "content/common/webkitplatformsupport_impl.h" |
| 29 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 30 #include "gpu/GLES2/gl2extchromium.h" | 31 #include "gpu/GLES2/gl2extchromium.h" |
| 31 #include "gpu/ipc/command_buffer_proxy.h" | 32 #include "gpu/ipc/command_buffer_proxy.h" |
| 32 #include "third_party/khronos/GLES2/gl2.h" | 33 #include "third_party/khronos/GLES2/gl2.h" |
| 33 #include "third_party/khronos/GLES2/gl2ext.h" | 34 #include "third_party/khronos/GLES2/gl2ext.h" |
| 34 #include "ui/compositor/compositor.h" | 35 #include "ui/compositor/compositor.h" |
| 35 #include "ui/compositor/compositor_setup.h" | 36 #include "ui/compositor/compositor_setup.h" |
| 37 #include "ui/compositor/compositor_switches.h" |
| 36 #include "ui/compositor/test_web_graphics_context_3d.h" | 38 #include "ui/compositor/test_web_graphics_context_3d.h" |
| 37 #include "ui/gfx/native_widget_types.h" | 39 #include "ui/gfx/native_widget_types.h" |
| 38 #include "ui/gfx/size.h" | 40 #include "ui/gfx/size.h" |
| 39 | 41 |
| 40 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 41 #include "ui/surface/accelerated_surface_win.h" | 43 #include "ui/surface/accelerated_surface_win.h" |
| 42 #endif | 44 #endif |
| 43 | 45 |
| 44 namespace content { | 46 namespace content { |
| 45 namespace { | 47 namespace { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 WebGraphicsContext3DCommandBufferImpl* context, | 300 WebGraphicsContext3DCommandBufferImpl* context, |
| 299 int surface_id, | 301 int surface_id, |
| 300 BrowserCompositorOutputSurfaceProxy* output_surface_proxy, | 302 BrowserCompositorOutputSurfaceProxy* output_surface_proxy, |
| 301 base::MessageLoopProxy* compositor_message_loop, | 303 base::MessageLoopProxy* compositor_message_loop, |
| 302 base::WeakPtr<ui::Compositor> compositor) | 304 base::WeakPtr<ui::Compositor> compositor) |
| 303 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context)), | 305 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context)), |
| 304 surface_id_(surface_id), | 306 surface_id_(surface_id), |
| 305 output_surface_proxy_(output_surface_proxy), | 307 output_surface_proxy_(output_surface_proxy), |
| 306 compositor_message_loop_(compositor_message_loop), | 308 compositor_message_loop_(compositor_message_loop), |
| 307 compositor_(compositor) { | 309 compositor_(compositor) { |
| 310 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 311 if (command_line->HasSwitch(switches::kUIMaxFramesPending)) { |
| 312 std::string string_value = command_line->GetSwitchValueASCII( |
| 313 switches::kUIMaxFramesPending); |
| 314 int int_value; |
| 315 if (base::StringToInt(string_value, &int_value)) |
| 316 capabilities_.max_frames_pending = int_value; |
| 317 else |
| 318 LOG(ERROR) << "Trouble parsing --" << switches::kUIMaxFramesPending; |
| 319 } |
| 308 DetachFromThread(); | 320 DetachFromThread(); |
| 309 } | 321 } |
| 310 | 322 |
| 311 virtual ~BrowserCompositorOutputSurface() { | 323 virtual ~BrowserCompositorOutputSurface() { |
| 312 DCHECK(CalledOnValidThread()); | 324 DCHECK(CalledOnValidThread()); |
| 313 if (!client_) | 325 if (!client_) |
| 314 return; | 326 return; |
| 315 output_surface_proxy_->RemoveSurface(surface_id_); | 327 output_surface_proxy_->RemoveSurface(surface_id_); |
| 316 } | 328 } |
| 317 | 329 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 delete g_factory; | 702 delete g_factory; |
| 691 g_factory = NULL; | 703 g_factory = NULL; |
| 692 } | 704 } |
| 693 | 705 |
| 694 // static | 706 // static |
| 695 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 707 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
| 696 return g_factory; | 708 return g_factory; |
| 697 } | 709 } |
| 698 | 710 |
| 699 } // namespace content | 711 } // namespace content |
| OLD | NEW |