Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 12212100: Provide shared context to Platform API in renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseforreals Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.h ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/thread_safe_sender.h" 24 #include "content/common/thread_safe_sender.h"
23 #include "content/common/view_messages.h" 25 #include "content/common/view_messages.h"
24 #include "content/common/webmessageportchannel_impl.h" 26 #include "content/common/webmessageportchannel_impl.h"
25 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
26 #include "content/public/common/gpu_info.h" 28 #include "content/public/common/gpu_info.h"
27 #include "content/public/renderer/content_renderer_client.h" 29 #include "content/public/renderer/content_renderer_client.h"
28 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 30 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
(...skipping 16 matching lines...) Expand all
45 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente rClient.h" 47 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCente rClient.h"
46 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 48 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
47 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" 49 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
50 #include "webkit/base/file_path_string_conversions.h" 52 #include "webkit/base/file_path_string_conversions.h"
51 #include "webkit/glue/simple_webmimeregistry_impl.h" 53 #include "webkit/glue/simple_webmimeregistry_impl.h"
52 #include "webkit/glue/webclipboard_impl.h" 54 #include "webkit/glue/webclipboard_impl.h"
53 #include "webkit/glue/webfileutilities_impl.h" 55 #include "webkit/glue/webfileutilities_impl.h"
54 #include "webkit/glue/webkit_glue.h" 56 #include "webkit/glue/webkit_glue.h"
57 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
55 58
56 #if defined(OS_WIN) 59 #if defined(OS_WIN)
57 #include "content/common/child_process_messages.h" 60 #include "content/common/child_process_messages.h"
58 #include "third_party/WebKit/Source/Platform/chromium/public/win/WebSandboxSuppo rt.h" 61 #include "third_party/WebKit/Source/Platform/chromium/public/win/WebSandboxSuppo rt.h"
59 #endif 62 #endif
60 63
61 #if defined(OS_MACOSX) 64 #if defined(OS_MACOSX)
62 #include "content/common/mac/font_descriptor.h" 65 #include "content/common/mac/font_descriptor.h"
63 #include "content/common/mac/font_loader.h" 66 #include "content/common/mac/font_loader.h"
64 #include "third_party/WebKit/Source/Platform/chromium/public/mac/WebSandboxSuppo rt.h" 67 #include "third_party/WebKit/Source/Platform/chromium/public/mac/WebSandboxSuppo rt.h"
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 g_sandbox_enabled = enable; 824 g_sandbox_enabled = enable;
822 return was_enabled; 825 return was_enabled;
823 } 826 }
824 827
825 // static 828 // static
826 void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting( 829 void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(
827 const WebGamepads& pads) { 830 const WebGamepads& pads) {
828 g_test_gamepads.Get() = pads; 831 g_test_gamepads.Get() = pads;
829 } 832 }
830 833
831 GpuChannelHostFactory*
832 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() {
833 return RenderThreadImpl::current();
834 }
835
836 //------------------------------------------------------------------------------ 834 //------------------------------------------------------------------------------
837 835
838 WebKit::WebHyphenator* RendererWebKitPlatformSupportImpl::hyphenator() { 836 WebKit::WebHyphenator* RendererWebKitPlatformSupportImpl::hyphenator() {
839 WebKit::WebHyphenator* hyphenator = 837 WebKit::WebHyphenator* hyphenator =
840 GetContentClient()->renderer()->OverrideWebHyphenator(); 838 GetContentClient()->renderer()->OverrideWebHyphenator();
841 if (hyphenator) 839 if (hyphenator)
842 return hyphenator; 840 return hyphenator;
843 return hyphenator_.get(); 841 return hyphenator_.get();
844 } 842 }
845 843
846 //------------------------------------------------------------------------------ 844 //------------------------------------------------------------------------------
847 845
848 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( 846 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes(
849 size_t* private_bytes, size_t* shared_bytes) { 847 size_t* private_bytes, size_t* shared_bytes) {
850 content::RenderThread::Get()->Send( 848 content::RenderThread::Get()->Send(
851 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); 849 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes));
852 return true; 850 return true;
853 } 851 }
854 852
853 //------------------------------------------------------------------------------
854
855 WebKit::WebGraphicsContext3D*
856 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
857 const WebKit::WebGraphicsContext3D::Attributes& attributes) {
858 // The WebGraphicsContext3DInProcessImpl code path is used for
859 // layout tests (though not through this code) as well as for
860 // debugging and bringing up new ports.
861 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
862 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
863 attributes, false);
864 } else {
865 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
866 RenderThreadImpl::current(),
867 attributes,
868 GURL(attributes.topDocumentURL));
869 }
870 }
871
872 //------------------------------------------------------------------------------
873
874 WebKit::WebGraphicsContext3D* RendererWebKitPlatformSupportImpl::
875 sharedOffscreenGraphicsContext3D() {
876 if (!shared_offscreen_context_ ||
877 shared_offscreen_context_->DestroyedOnMainThread()) {
878 shared_offscreen_context_ =
879 RenderThreadImpl::current()->OffscreenContextProviderForMainThread();
880 }
881 if (!shared_offscreen_context_->InitializeOnMainThread())
882 return NULL;
883 if (!shared_offscreen_context_->BindToCurrentThread())
884 return NULL;
885 return shared_offscreen_context_->Context3d();
886 }
887
888 //------------------------------------------------------------------------------
889
890 GrContext* RendererWebKitPlatformSupportImpl::sharedOffscreenGrContext() {
891 if (!shared_offscreen_context_)
892 return NULL;
893 return shared_offscreen_context_->GrContext();
894 }
895
896
855 } // namespace content 897 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.h ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698