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