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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
13 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "cc/context_provider.h" |
15 #include "content/common/database_util.h" | 16 #include "content/common/database_util.h" |
16 #include "content/common/file_utilities_messages.h" | 17 #include "content/common/file_utilities_messages.h" |
17 #include "content/common/fileapi/webblobregistry_impl.h" | 18 #include "content/common/fileapi/webblobregistry_impl.h" |
18 #include "content/common/fileapi/webfilesystem_impl.h" | 19 #include "content/common/fileapi/webfilesystem_impl.h" |
| 20 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
19 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" | 21 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" |
20 #include "content/common/mime_registry_messages.h" | 22 #include "content/common/mime_registry_messages.h" |
21 #include "content/common/npobject_util.h" | 23 #include "content/common/npobject_util.h" |
22 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
23 #include "content/common/webmessageportchannel_impl.h" | 25 #include "content/common/webmessageportchannel_impl.h" |
24 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/gpu_info.h" | 27 #include "content/public/common/gpu_info.h" |
26 #include "content/public/renderer/content_renderer_client.h" | 28 #include "content/public/renderer/content_renderer_client.h" |
27 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 29 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
28 #include "content/renderer/gamepad_shared_memory_reader.h" | 30 #include "content/renderer/gamepad_shared_memory_reader.h" |
(...skipping 15 matching lines...) Expand all Loading... |
44 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente
rClient.h" | 46 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente
rClient.h" |
45 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 47 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
46 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 48 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
49 #include "webkit/base/file_path_string_conversions.h" | 51 #include "webkit/base/file_path_string_conversions.h" |
50 #include "webkit/glue/simple_webmimeregistry_impl.h" | 52 #include "webkit/glue/simple_webmimeregistry_impl.h" |
51 #include "webkit/glue/webclipboard_impl.h" | 53 #include "webkit/glue/webclipboard_impl.h" |
52 #include "webkit/glue/webfileutilities_impl.h" | 54 #include "webkit/glue/webfileutilities_impl.h" |
53 #include "webkit/glue/webkit_glue.h" | 55 #include "webkit/glue/webkit_glue.h" |
| 56 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
54 | 57 |
55 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
56 #include "content/common/child_process_messages.h" | 59 #include "content/common/child_process_messages.h" |
57 #include "third_party/WebKit/Source/Platform/chromium/public/win/WebSandboxSuppo
rt.h" | 60 #include "third_party/WebKit/Source/Platform/chromium/public/win/WebSandboxSuppo
rt.h" |
58 #endif | 61 #endif |
59 | 62 |
60 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
61 #include "content/common/mac/font_descriptor.h" | 64 #include "content/common/mac/font_descriptor.h" |
62 #include "content/common/mac/font_loader.h" | 65 #include "content/common/mac/font_loader.h" |
63 #include "third_party/WebKit/Source/Platform/chromium/public/mac/WebSandboxSuppo
rt.h" | 66 #include "third_party/WebKit/Source/Platform/chromium/public/mac/WebSandboxSuppo
rt.h" |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 g_sandbox_enabled = enable; | 827 g_sandbox_enabled = enable; |
825 return was_enabled; | 828 return was_enabled; |
826 } | 829 } |
827 | 830 |
828 // static | 831 // static |
829 void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting( | 832 void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting( |
830 const WebGamepads& pads) { | 833 const WebGamepads& pads) { |
831 g_test_gamepads.Get() = pads; | 834 g_test_gamepads.Get() = pads; |
832 } | 835 } |
833 | 836 |
834 GpuChannelHostFactory* | |
835 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | |
836 return RenderThreadImpl::current(); | |
837 } | |
838 | |
839 //------------------------------------------------------------------------------ | 837 //------------------------------------------------------------------------------ |
840 | 838 |
841 WebKit::WebHyphenator* RendererWebKitPlatformSupportImpl::hyphenator() { | 839 WebKit::WebHyphenator* RendererWebKitPlatformSupportImpl::hyphenator() { |
842 WebKit::WebHyphenator* hyphenator = | 840 WebKit::WebHyphenator* hyphenator = |
843 GetContentClient()->renderer()->OverrideWebHyphenator(); | 841 GetContentClient()->renderer()->OverrideWebHyphenator(); |
844 if (hyphenator) | 842 if (hyphenator) |
845 return hyphenator; | 843 return hyphenator; |
846 return hyphenator_.get(); | 844 return hyphenator_.get(); |
847 } | 845 } |
848 | 846 |
849 //------------------------------------------------------------------------------ | 847 //------------------------------------------------------------------------------ |
850 | 848 |
851 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( | 849 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( |
852 size_t* private_bytes, size_t* shared_bytes) { | 850 size_t* private_bytes, size_t* shared_bytes) { |
853 content::RenderThread::Get()->Send( | 851 content::RenderThread::Get()->Send( |
854 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); | 852 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); |
855 return true; | 853 return true; |
856 } | 854 } |
857 | 855 |
| 856 //------------------------------------------------------------------------------ |
| 857 |
| 858 WebKit::WebGraphicsContext3D* |
| 859 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( |
| 860 const WebKit::WebGraphicsContext3D::Attributes& attributes) { |
| 861 // The WebGraphicsContext3DInProcessImpl code path is used for |
| 862 // layout tests (though not through this code) as well as for |
| 863 // debugging and bringing up new ports. |
| 864 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { |
| 865 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( |
| 866 attributes, false); |
| 867 } else { |
| 868 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 869 RenderThreadImpl::current(), |
| 870 attributes, |
| 871 GURL(attributes.topDocumentURL)); |
| 872 } |
| 873 } |
| 874 |
| 875 //------------------------------------------------------------------------------ |
| 876 |
| 877 WebKit::WebGraphicsContext3D* RendererWebKitPlatformSupportImpl:: |
| 878 sharedOffscreenGraphicsContext3D() { |
| 879 if (!shared_offscreen_context_ || |
| 880 shared_offscreen_context_->DestroyedOnMainThread()) { |
| 881 shared_offscreen_context_ = |
| 882 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 883 } |
| 884 if (!shared_offscreen_context_->InitializeOnMainThread()) |
| 885 return NULL; |
| 886 if (!shared_offscreen_context_->BindToCurrentThread()) |
| 887 return NULL; |
| 888 return shared_offscreen_context_->Context3d(); |
| 889 } |
| 890 |
| 891 //------------------------------------------------------------------------------ |
| 892 |
| 893 GrContext* RendererWebKitPlatformSupportImpl::sharedOffscreenGrContext() { |
| 894 if (!shared_offscreen_context_) |
| 895 return NULL; |
| 896 return shared_offscreen_context_->GrContext(); |
| 897 } |
| 898 |
| 899 |
858 } // namespace content | 900 } // namespace content |
OLD | NEW |