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