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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 idle_notifications_to_skip_ = 2; | 888 idle_notifications_to_skip_ = 2; |
889 } | 889 } |
890 | 890 |
891 scoped_refptr<RendererGpuVideoAcceleratorFactories> | 891 scoped_refptr<RendererGpuVideoAcceleratorFactories> |
892 RenderThreadImpl::GetGpuFactories() { | 892 RenderThreadImpl::GetGpuFactories() { |
893 DCHECK(IsMainThread()); | 893 DCHECK(IsMainThread()); |
894 | 894 |
895 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); | 895 scoped_refptr<GpuChannelHost> gpu_channel_host = GetGpuChannel(); |
896 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 896 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
897 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories; | 897 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories; |
898 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = | |
899 GetMediaThreadMessageLoopProxy(); | |
900 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { | 898 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { |
901 if (!gpu_va_context_provider_ || | 899 if (!gpu_va_context_provider_ || |
902 gpu_va_context_provider_->DestroyedOnMainThread()) { | 900 gpu_va_context_provider_->DestroyedOnMainThread()) { |
903 if (!gpu_channel_host) { | 901 if (!gpu_channel_host) { |
904 gpu_channel_host = EstablishGpuChannelSync( | 902 gpu_channel_host = EstablishGpuChannelSync( |
905 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); | 903 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); |
906 } | 904 } |
907 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( | 905 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( |
908 make_scoped_ptr( | 906 make_scoped_ptr( |
909 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 907 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
910 gpu_channel_host.get(), | 908 gpu_channel_host.get(), |
911 blink::WebGraphicsContext3D::Attributes(), | 909 blink::WebGraphicsContext3D::Attributes(), |
912 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), | 910 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), |
913 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())), | 911 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())), |
914 "GPU-VideoAccelerator-Offscreen"); | 912 "GPU-VideoAccelerator-Offscreen"); |
915 media_loop_proxy->PostTask( | |
916 FROM_HERE, | |
917 base::Bind( | |
918 base::IgnoreResult(&cc::ContextProvider::BindToCurrentThread), | |
919 gpu_va_context_provider_)); | |
920 } | 913 } |
921 } | 914 } |
922 if (gpu_channel_host) { | 915 if (gpu_channel_host) { |
923 gpu_factories = new RendererGpuVideoAcceleratorFactories( | 916 gpu_factories = new RendererGpuVideoAcceleratorFactories( |
924 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_); | 917 gpu_channel_host.get(), gpu_va_context_provider_); |
925 } | 918 } |
926 return gpu_factories; | 919 return gpu_factories; |
927 } | 920 } |
928 | 921 |
929 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 922 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
930 RenderThreadImpl::CreateOffscreenContext3d() { | 923 RenderThreadImpl::CreateOffscreenContext3d() { |
931 blink::WebGraphicsContext3D::Attributes attributes; | 924 blink::WebGraphicsContext3D::Attributes attributes; |
932 attributes.shareResources = true; | 925 attributes.shareResources = true; |
933 attributes.depth = false; | 926 attributes.depth = false; |
934 attributes.stencil = false; | 927 attributes.stencil = false; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 hidden_widget_count_--; | 1408 hidden_widget_count_--; |
1416 | 1409 |
1417 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1410 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1418 return; | 1411 return; |
1419 } | 1412 } |
1420 | 1413 |
1421 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1414 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1422 } | 1415 } |
1423 | 1416 |
1424 } // namespace content | 1417 } // namespace content |
OLD | NEW |