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