| 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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories; | 985 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories; |
| 986 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = | 986 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = |
| 987 GetMediaThreadMessageLoopProxy(); | 987 GetMediaThreadMessageLoopProxy(); |
| 988 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { | 988 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { |
| 989 if (!gpu_va_context_provider_ || | 989 if (!gpu_va_context_provider_ || |
| 990 gpu_va_context_provider_->DestroyedOnMainThread()) { | 990 gpu_va_context_provider_->DestroyedOnMainThread()) { |
| 991 if (!gpu_channel_host) { | 991 if (!gpu_channel_host) { |
| 992 gpu_channel_host = EstablishGpuChannelSync( | 992 gpu_channel_host = EstablishGpuChannelSync( |
| 993 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); | 993 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E); |
| 994 } | 994 } |
| 995 blink::WebGraphicsContext3D::Attributes attributes; | |
| 996 bool lose_context_when_out_of_memory = false; | |
| 997 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( | 995 gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( |
| 998 make_scoped_ptr( | 996 make_scoped_ptr( |
| 999 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 997 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 1000 gpu_channel_host.get(), | 998 gpu_channel_host.get(), |
| 1001 attributes, | 999 blink::WebGraphicsContext3D::Attributes(), |
| 1002 lose_context_when_out_of_memory, | |
| 1003 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), | 1000 GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"), |
| 1004 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | 1001 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 1005 NULL)), | 1002 NULL)), |
| 1006 "GPU-VideoAccelerator-Offscreen"); | 1003 "GPU-VideoAccelerator-Offscreen"); |
| 1007 } | 1004 } |
| 1008 } | 1005 } |
| 1009 if (gpu_va_context_provider_) { | 1006 if (gpu_va_context_provider_) { |
| 1010 gpu_factories = RendererGpuVideoAcceleratorFactories::Create( | 1007 gpu_factories = RendererGpuVideoAcceleratorFactories::Create( |
| 1011 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_); | 1008 gpu_channel_host, media_loop_proxy, gpu_va_context_provider_); |
| 1012 } | 1009 } |
| 1013 return gpu_factories; | 1010 return gpu_factories; |
| 1014 } | 1011 } |
| 1015 | 1012 |
| 1016 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 1013 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 1017 RenderThreadImpl::CreateOffscreenContext3d() { | 1014 RenderThreadImpl::CreateOffscreenContext3d() { |
| 1018 blink::WebGraphicsContext3D::Attributes attributes; | 1015 blink::WebGraphicsContext3D::Attributes attributes; |
| 1019 attributes.shareResources = true; | 1016 attributes.shareResources = true; |
| 1020 attributes.depth = false; | 1017 attributes.depth = false; |
| 1021 attributes.stencil = false; | 1018 attributes.stencil = false; |
| 1022 attributes.antialias = false; | 1019 attributes.antialias = false; |
| 1023 attributes.noAutomaticFlushes = true; | 1020 attributes.noAutomaticFlushes = true; |
| 1024 bool lose_context_when_out_of_memory = true; | |
| 1025 | 1021 |
| 1026 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1022 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 1027 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1023 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| 1028 return make_scoped_ptr( | 1024 return make_scoped_ptr( |
| 1029 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 1025 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 1030 gpu_channel_host.get(), | 1026 gpu_channel_host.get(), |
| 1031 attributes, | 1027 attributes, |
| 1032 lose_context_when_out_of_memory, | |
| 1033 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), | 1028 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), |
| 1034 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | 1029 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 1035 NULL)); | 1030 NULL)); |
| 1036 } | 1031 } |
| 1037 | 1032 |
| 1038 scoped_refptr<cc::ContextProvider> | 1033 scoped_refptr<cc::ContextProvider> |
| 1039 RenderThreadImpl::OffscreenCompositorContextProvider() { | 1034 RenderThreadImpl::OffscreenCompositorContextProvider() { |
| 1040 DCHECK(IsMainThread()); | 1035 DCHECK(IsMainThread()); |
| 1041 | 1036 |
| 1042 #if defined(OS_ANDROID) | 1037 #if defined(OS_ANDROID) |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 hidden_widget_count_--; | 1521 hidden_widget_count_--; |
| 1527 | 1522 |
| 1528 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1523 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1529 return; | 1524 return; |
| 1530 } | 1525 } |
| 1531 | 1526 |
| 1532 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1527 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1533 } | 1528 } |
| 1534 | 1529 |
| 1535 } // namespace content | 1530 } // namespace content |
| OLD | NEW |