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/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
947 return createOffscreenGraphicsContext3D(attributes, NULL); | 947 return createOffscreenGraphicsContext3D(attributes, NULL); |
948 } | 948 } |
949 | 949 |
950 blink::WebGraphicsContext3D* | 950 blink::WebGraphicsContext3D* |
951 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( | 951 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( |
952 const blink::WebGraphicsContext3D::Attributes& attributes, | 952 const blink::WebGraphicsContext3D::Attributes& attributes, |
953 blink::WebGraphicsContext3D* share_context) { | 953 blink::WebGraphicsContext3D* share_context) { |
954 if (!RenderThreadImpl::current()) | 954 if (!RenderThreadImpl::current()) |
955 return NULL; | 955 return NULL; |
956 | 956 |
957 scoped_ptr<webkit::gpu::WebGraphicsContext3DImpl> context; | |
957 #if defined(OS_ANDROID) | 958 #if defined(OS_ANDROID) |
958 if (SynchronousCompositorFactory* factory = | 959 if (SynchronousCompositorFactory* factory = |
959 SynchronousCompositorFactory::GetInstance()) { | 960 SynchronousCompositorFactory::GetInstance()) { |
960 return factory->CreateOffscreenGraphicsContext3D(attributes); | 961 context.reset(factory->CreateOffscreenGraphicsContext3D(attributes)); |
962 } else | |
963 #endif | |
964 { | |
965 scoped_refptr<GpuChannelHost> gpu_channel_host( | |
966 RenderThreadImpl::current()->EstablishGpuChannelSync( | |
967 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E)); | |
968 | |
969 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | |
970 bool lose_context_when_out_of_memory = false; | |
971 context.reset(WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | |
972 gpu_channel_host.get(), | |
973 attributes, | |
974 lose_context_when_out_of_memory, | |
975 GURL(attributes.topDocumentURL), | |
976 limits, | |
977 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); | |
961 } | 978 } |
962 #endif | 979 if (context && !context->BindToCurrentThread()) { |
piman
2014/08/15 17:47:34
Are contexts created by this API exclusively used
| |
963 | 980 return NULL; |
964 scoped_refptr<GpuChannelHost> gpu_channel_host( | 981 } |
965 RenderThreadImpl::current()->EstablishGpuChannelSync( | 982 return context.release(); |
966 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ); | |
967 | |
968 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | |
969 bool lose_context_when_out_of_memory = false; | |
970 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | |
971 gpu_channel_host.get(), | |
972 attributes, | |
973 lose_context_when_out_of_memory, | |
974 GURL(attributes.topDocumentURL), | |
975 limits, | |
976 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)); | |
977 } | 983 } |
978 | 984 |
979 //------------------------------------------------------------------------------ | 985 //------------------------------------------------------------------------------ |
980 | 986 |
981 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: | 987 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: |
982 createSharedOffscreenGraphicsContext3DProvider() { | 988 createSharedOffscreenGraphicsContext3DProvider() { |
983 scoped_refptr<webkit::gpu::ContextProviderWebContext> provider = | 989 scoped_refptr<webkit::gpu::ContextProviderWebContext> provider = |
984 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | 990 RenderThreadImpl::current()->SharedMainThreadContextProvider(); |
985 if (!provider) | 991 if (!provider) |
986 return NULL; | 992 return NULL; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1200 | 1206 |
1201 //------------------------------------------------------------------------------ | 1207 //------------------------------------------------------------------------------ |
1202 | 1208 |
1203 // static | 1209 // static |
1204 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1210 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1205 const blink::WebBatteryStatus& status) { | 1211 const blink::WebBatteryStatus& status) { |
1206 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1212 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1207 } | 1213 } |
1208 | 1214 |
1209 } // namespace content | 1215 } // namespace content |
OLD | NEW |