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(); |
898 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { | 900 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { |
899 if (!gpu_va_context_provider_ || | 901 if (!gpu_va_context_provider_ || |
900 gpu_va_context_provider_->DestroyedOnMainThread()) { | 902 gpu_va_context_provider_->DestroyedOnMainThread()) { |
901 if (!gpu_channel_host) { | 903 if (!gpu_channel_host) { |
902 gpu_channel_host = EstablishGpuChannelSync( | 904 gpu_channel_host = EstablishGpuChannelSync( |
903 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); | 905 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); |
904 } | 906 } |
905 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( | 907 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( |
906 make_scoped_ptr( | 908 make_scoped_ptr( |
907 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 909 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
908 gpu_channel_host.get(), | 910 gpu_channel_host.get(), |
909 blink::WebGraphicsContext3D::Attributes(), | 911 blink::WebGraphicsContext3D::Attributes(), |
910 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), | 912 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), |
911 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())), | 913 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())), |
912 "GPU-VideoAccelerator-Offscreen"); | 914 "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_)); |
913 } | 920 } |
914 } | 921 } |
915 if (gpu_channel_host) { | 922 if (gpu_channel_host) { |
916 gpu_factories = new RendererGpuVideoAcceleratorFactories( | 923 gpu_factories = new RendererGpuVideoAcceleratorFactories( |
917 gpu_channel_host.get(), gpu_va_context_provider_); | 924 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_); |
918 } | 925 } |
919 return gpu_factories; | 926 return gpu_factories; |
920 } | 927 } |
921 | 928 |
922 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 929 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
923 RenderThreadImpl::CreateOffscreenContext3d() { | 930 RenderThreadImpl::CreateOffscreenContext3d() { |
924 blink::WebGraphicsContext3D::Attributes attributes; | 931 blink::WebGraphicsContext3D::Attributes attributes; |
925 attributes.shareResources = true; | 932 attributes.shareResources = true; |
926 attributes.depth = false; | 933 attributes.depth = false; |
927 attributes.stencil = false; | 934 attributes.stencil = false; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 hidden_widget_count_--; | 1415 hidden_widget_count_--; |
1409 | 1416 |
1410 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1417 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1411 return; | 1418 return; |
1412 } | 1419 } |
1413 | 1420 |
1414 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1421 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1415 } | 1422 } |
1416 | 1423 |
1417 } // namespace content | 1424 } // namespace content |
OLD | NEW |