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 webkit::gpu::WebGraphicsContext3DImpl* context = NULL; | |
danakj
2014/08/15 15:28:44
use scoped_ptr
dshwang
2014/08/15 16:02:32
yes, I'll update soon.
| |
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 = 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 = 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()) { |
dshwang
2014/08/15 14:54:01
This method is used by WebGL. Now we return the co
| |
963 | 980 delete context; |
964 scoped_refptr<GpuChannelHost> gpu_channel_host( | 981 return NULL; |
965 RenderThreadImpl::current()->EstablishGpuChannelSync( | 982 } |
966 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ); | 983 return context; |
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 } | 984 } |
978 | 985 |
979 //------------------------------------------------------------------------------ | 986 //------------------------------------------------------------------------------ |
980 | 987 |
981 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: | 988 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: |
982 createSharedOffscreenGraphicsContext3DProvider() { | 989 createSharedOffscreenGraphicsContext3DProvider() { |
983 scoped_refptr<webkit::gpu::ContextProviderWebContext> provider = | 990 scoped_refptr<webkit::gpu::ContextProviderWebContext> provider = |
984 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | 991 RenderThreadImpl::current()->SharedMainThreadContextProvider(); |
985 if (!provider) | 992 if (!provider) |
986 return NULL; | 993 return NULL; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1200 | 1207 |
1201 //------------------------------------------------------------------------------ | 1208 //------------------------------------------------------------------------------ |
1202 | 1209 |
1203 // static | 1210 // static |
1204 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( | 1211 void RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting( |
1205 const blink::WebBatteryStatus& status) { | 1212 const blink::WebBatteryStatus& status) { |
1206 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); | 1213 g_test_battery_status_dispatcher.Get().PostBatteryStatusChange(status); |
1207 } | 1214 } |
1208 | 1215 |
1209 } // namespace content | 1216 } // namespace content |
OLD | NEW |