| 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/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 | 928 |
| 929 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( | 929 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( |
| 930 size_t* private_bytes, size_t* shared_bytes) { | 930 size_t* private_bytes, size_t* shared_bytes) { |
| 931 content::RenderThread::Get()->Send( | 931 content::RenderThread::Get()->Send( |
| 932 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); | 932 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); |
| 933 return true; | 933 return true; |
| 934 } | 934 } |
| 935 | 935 |
| 936 //------------------------------------------------------------------------------ | 936 //------------------------------------------------------------------------------ |
| 937 | 937 |
| 938 |
| 938 blink::WebGraphicsContext3D* | 939 blink::WebGraphicsContext3D* |
| 939 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( | 940 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( |
| 941 #ifdef ENABLE_EXPLICIT_GL_SHARE_GROUPS |
| 942 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 943 blink::WebGraphicsContext3D* share_context) { |
| 944 #else |
| 940 const blink::WebGraphicsContext3D::Attributes& attributes) { | 945 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 946 blink::WebGraphicsContext3D* share_context = NULL; |
| 947 #endif |
| 941 if (!RenderThreadImpl::current()) | 948 if (!RenderThreadImpl::current()) |
| 942 return NULL; | 949 return NULL; |
| 943 | 950 |
| 944 scoped_refptr<GpuChannelHost> gpu_channel_host( | 951 scoped_refptr<GpuChannelHost> gpu_channel_host( |
| 945 RenderThreadImpl::current()->EstablishGpuChannelSync( | 952 RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 946 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 953 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
| 947 | 954 |
| 948 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 955 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| 949 | 956 |
| 950 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 957 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 951 if (command_line->HasSwitch(switches::kWebGLCommandBufferSizeKb)) { | 958 if (command_line->HasSwitch(switches::kWebGLCommandBufferSizeKb)) { |
| 952 std::string size_string = command_line->GetSwitchValueASCII( | 959 std::string size_string = command_line->GetSwitchValueASCII( |
| 953 switches::kWebGLCommandBufferSizeKb); | 960 switches::kWebGLCommandBufferSizeKb); |
| 954 size_t buffer_size_kb; | 961 size_t buffer_size_kb; |
| 955 if (base::StringToSizeT(size_string, &buffer_size_kb)) { | 962 if (base::StringToSizeT(size_string, &buffer_size_kb)) { |
| 956 limits.command_buffer_size = buffer_size_kb * 1024; | 963 limits.command_buffer_size = buffer_size_kb * 1024; |
| 957 } | 964 } |
| 958 } | 965 } |
| 959 | 966 |
| 960 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 967 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 961 gpu_channel_host.get(), | 968 gpu_channel_host.get(), |
| 962 attributes, | 969 attributes, |
| 963 GURL(attributes.topDocumentURL), | 970 GURL(attributes.topDocumentURL), |
| 964 limits); | 971 limits, |
| 972 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)); |
| 965 } | 973 } |
| 966 | 974 |
| 967 //------------------------------------------------------------------------------ | 975 //------------------------------------------------------------------------------ |
| 968 | 976 |
| 969 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: | 977 blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl:: |
| 970 createSharedOffscreenGraphicsContext3DProvider() { | 978 createSharedOffscreenGraphicsContext3DProvider() { |
| 971 scoped_refptr<cc::ContextProvider> provider = | 979 scoped_refptr<cc::ContextProvider> provider = |
| 972 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | 980 RenderThreadImpl::current()->SharedMainThreadContextProvider(); |
| 973 if (!provider) | 981 if (!provider) |
| 974 return NULL; | 982 return NULL; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 return; | 1081 return; |
| 1074 QuotaDispatcher::ThreadSpecificInstance( | 1082 QuotaDispatcher::ThreadSpecificInstance( |
| 1075 thread_safe_sender_.get(), | 1083 thread_safe_sender_.get(), |
| 1076 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1084 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
| 1077 storage_partition, | 1085 storage_partition, |
| 1078 static_cast<quota::StorageType>(type), | 1086 static_cast<quota::StorageType>(type), |
| 1079 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 1087 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 1080 } | 1088 } |
| 1081 | 1089 |
| 1082 } // namespace content | 1090 } // namespace content |
| OLD | NEW |