| 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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 idle_notifications_to_skip_ = 2; | 864 idle_notifications_to_skip_ = 2; |
| 865 } | 865 } |
| 866 | 866 |
| 867 scoped_refptr<RendererGpuVideoAcceleratorFactories> | 867 scoped_refptr<RendererGpuVideoAcceleratorFactories> |
| 868 RenderThreadImpl::GetGpuFactories() { | 868 RenderThreadImpl::GetGpuFactories() { |
| 869 DCHECK(IsMainThread()); | 869 DCHECK(IsMainThread()); |
| 870 | 870 |
| 871 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); | 871 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); |
| 872 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 872 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 873 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories; | 873 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories; |
| 874 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = |
| 875 GetMediaThreadMessageLoopProxy(); |
| 874 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { | 876 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { |
| 875 if (!gpu_va_context_provider_ || | 877 if (!gpu_va_context_provider_ || |
| 876 gpu_va_context_provider_->DestroyedOnMainThread()) { | 878 gpu_va_context_provider_->DestroyedOnMainThread()) { |
| 877 if (!gpu_channel_host) { | 879 if (!gpu_channel_host) { |
| 878 gpu_channel_host = EstablishGpuChannelSync( | 880 gpu_channel_host = EstablishGpuChannelSync( |
| 879 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); | 881 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); |
| 880 } | 882 } |
| 881 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( | 883 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( |
| 882 make_scoped_ptr( | 884 make_scoped_ptr( |
| 883 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 885 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 884 gpu_channel_host.get(), | 886 gpu_channel_host.get(), |
| 885 WebKit::WebGraphicsContext3D::Attributes(), | 887 WebKit::WebGraphicsContext3D::Attributes(), |
| 886 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))), | 888 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"))), |
| 887 "GPU-VideoAccelerator-Offscreen"); | 889 "GPU-VideoAccelerator-Offscreen"); |
| 890 media_loop_proxy->PostTask( |
| 891 FROM_HERE, |
| 892 base::Bind( |
| 893 base::IgnoreResult(&cc::ContextProvider::BindToCurrentThread), |
| 894 gpu_va_context_provider_)); |
| 888 } | 895 } |
| 889 } | 896 } |
| 890 if (gpu_channel_host) { | 897 if (gpu_channel_host) { |
| 891 gpu_factories = new RendererGpuVideoAcceleratorFactories( | 898 gpu_factories = new RendererGpuVideoAcceleratorFactories( |
| 892 gpu_channel_host.get(), gpu_va_context_provider_); | 899 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_); |
| 893 } | 900 } |
| 894 return gpu_factories; | 901 return gpu_factories; |
| 895 } | 902 } |
| 896 | 903 |
| 897 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 904 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 898 RenderThreadImpl::CreateOffscreenContext3d() { | 905 RenderThreadImpl::CreateOffscreenContext3d() { |
| 899 WebKit::WebGraphicsContext3D::Attributes attributes; | 906 WebKit::WebGraphicsContext3D::Attributes attributes; |
| 900 attributes.shareResources = true; | 907 attributes.shareResources = true; |
| 901 attributes.depth = false; | 908 attributes.depth = false; |
| 902 attributes.stencil = false; | 909 attributes.stencil = false; |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 if (!gamepad_shared_memory_reader_) | 1348 if (!gamepad_shared_memory_reader_) |
| 1342 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1349 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
| 1343 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1350 gamepad_shared_memory_reader_->SampleGamepads(*data); |
| 1344 } | 1351 } |
| 1345 | 1352 |
| 1346 base::ProcessId RenderThreadImpl::renderer_process_id() const { | 1353 base::ProcessId RenderThreadImpl::renderer_process_id() const { |
| 1347 return renderer_process_id_; | 1354 return renderer_process_id_; |
| 1348 } | 1355 } |
| 1349 | 1356 |
| 1350 } // namespace content | 1357 } // namespace content |
| OLD | NEW |