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