diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 23:39:51 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 23:39:51 +0000 |
commit | 7e8b4d1d6608a5cbf4ab3c4ac129c85c888f11d8 (patch) | |
tree | 8cc75ce7621bfb7785c1dd817c2b911cf363ed4a | |
parent | b17aae95e9bcf2378b6c29f8bb0c6f39fdd15bcd (diff) | |
download | chromium_src-7e8b4d1d6608a5cbf4ab3c4ac129c85c888f11d8.zip chromium_src-7e8b4d1d6608a5cbf4ab3c4ac129c85c888f11d8.tar.gz chromium_src-7e8b4d1d6608a5cbf4ab3c4ac129c85c888f11d8.tar.bz2 |
Implement WebViewClient::createGraphicsContext3D (and support for DRT)
This is chrome side of https://bugs.webkit.org/show_bug.cgi?id=76593
This also reverts r118249
BUG=99516
TEST=manually ran Chrome w/accelerated content, DRT, test_shell_tests.
Review URL: http://codereview.chromium.org/9254035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118543 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/renderer/render_view_impl.cc | 26 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 4 | ||||
-rw-r--r-- | webkit/glue/webkitplatformsupport_impl.cc | 18 | ||||
-rw-r--r-- | webkit/glue/webkitplatformsupport_impl.h | 6 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 22 | ||||
-rw-r--r-- | webkit/support/webkit_support.h | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 15 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 4 |
8 files changed, 77 insertions, 24 deletions
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 59fb8de..54dd53e 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -157,6 +157,7 @@ #include "webkit/glue/webkit_constants.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/weburlloader_impl.h" +#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" #include "webkit/media/webmediaplayer_impl.h" #include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/webplugin_delegate.h" @@ -202,6 +203,7 @@ using WebKit::WebFindOptions; using WebKit::WebFormControlElement; using WebKit::WebFormElement; using WebKit::WebFrame; +using WebKit::WebGraphicsContext3D; using WebKit::WebHistoryItem; using WebKit::WebIconURL; using WebKit::WebImage; @@ -1432,6 +1434,30 @@ WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace( session_storage_namespace_id_); } +WebGraphicsContext3D* RenderViewImpl::createGraphicsContext3D( + WebGraphicsContext3D::Attributes attributes, + bool direct) { + if (!webview()) + return NULL; + // The WebGraphicsContext3DInProcessImpl code path is used for + // layout tests (though not through this code) as well as for + // debugging and bringing up new ports. + scoped_ptr<WebGraphicsContext3D> context; + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { + context.reset(new webkit::gpu::WebGraphicsContext3DInProcessImpl( + gfx::kNullPluginWindow, NULL)); + } else { +#if defined(ENABLE_GPU) + context.reset(new WebGraphicsContext3DCommandBufferImpl()); +#else + return NULL; +#endif + } + if (!context->initialize(attributes, webview(), direct)) + return NULL; + return context.release(); +} + void RenderViewImpl::didAddMessageToConsole( const WebConsoleMessage& message, const WebString& source_name, unsigned source_line) { diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 99d3f10..3add4d7 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -44,6 +44,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "ui/base/javascript_message_type.h" #include "ui/gfx/surface/transport_dib.h" #include "webkit/glue/webpreferences.h" @@ -332,6 +333,9 @@ class RenderViewImpl : public RenderWidget, WebKit::WebExternalPopupMenuClient* popup_menu_client); virtual WebKit::WebStorageNamespace* createSessionStorageNamespace( unsigned quota); + virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D( + WebKit::WebGraphicsContext3D::Attributes attributes, + bool direct); virtual void didAddMessageToConsole( const WebKit::WebConsoleMessage& message, const WebKit::WebString& source_name, diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc index abd0a0a..0605652 100644 --- a/webkit/glue/webkitplatformsupport_impl.cc +++ b/webkit/glue/webkitplatformsupport_impl.cc @@ -569,24 +569,6 @@ WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() { return thread; } -WebKit::WebGraphicsContext3D* -WebKitPlatformSupportImpl::createGraphicsContext3D() { - return WebKitPlatformSupport::createGraphicsContext3D(); -} - -WebKit::WebGraphicsContext3D* -WebKitPlatformSupportImpl::createGraphicsContext3D( - WebKit::WebGraphicsContext3D::Attributes attributes, - WebKit::WebView* web_view, - bool render_to_web_view) { - scoped_ptr<WebKit::WebGraphicsContext3D> context(createGraphicsContext3D()); - if (!context.get() || - !context->initialize(attributes, web_view, render_to_web_view)) { - return NULL; - } - return context.release(); -} - base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile( const WebKit::WebString& vfs_file_name, int desired_flags) { return base::kInvalidPlatformFileValue; diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h index b9996c7..7604600 100644 --- a/webkit/glue/webkitplatformsupport_impl.h +++ b/webkit/glue/webkitplatformsupport_impl.h @@ -9,7 +9,6 @@ #include "base/platform_file.h" #include "base/threading/thread_local_storage.h" #include "base/timer.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webkit_glue_export.h" @@ -98,11 +97,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : virtual void callOnMainThread(void (*func)(void*), void* context); virtual WebKit::WebThread* createThread(const char* name); virtual WebKit::WebThread* currentThread(); - virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D(); - virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D( - WebKit::WebGraphicsContext3D::Attributes attributes, - WebKit::WebView* web_view, - bool render_to_web_view); // Embedder functions. The following are not implemented by the glue layer and diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 1b39cb2..7fd6678 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -50,6 +50,8 @@ #include "webkit/glue/webkit_constants.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitplatformsupport_impl.h" +#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" +#include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" #include "webkit/media/webmediaplayer_impl.h" #include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/webplugin_impl.h" @@ -366,6 +368,26 @@ GraphicsContext3DImplementation GetGraphicsContext3DImplementation() { return g_graphics_context_3d_implementation; } +WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( + WebKit::WebGraphicsContext3D::Attributes attributes, + WebKit::WebView* web_view, + bool direct) { + scoped_ptr<WebKit::WebGraphicsContext3D> context; + switch (webkit_support::GetGraphicsContext3DImplementation()) { + case webkit_support::IN_PROCESS: + context.reset(new webkit::gpu::WebGraphicsContext3DInProcessImpl( + gfx::kNullPluginWindow, NULL)); + break; + case webkit_support::IN_PROCESS_COMMAND_BUFFER: + context.reset( + new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl()); + break; + } + if (!context->initialize(attributes, web_view, direct)) + return NULL; + return context.release(); +} + void RegisterMockedURL(const WebKit::WebURL& url, const WebKit::WebURLResponse& response, const WebKit::WebString& file_path) { diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index 71de1e0..c8ed97c 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -11,6 +11,7 @@ #include "base/string16.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "ui/base/keycodes/keyboard_codes.h" namespace WebKit { @@ -98,6 +99,11 @@ enum GraphicsContext3DImplementation { void SetGraphicsContext3DImplementation(GraphicsContext3DImplementation); GraphicsContext3DImplementation GetGraphicsContext3DImplementation(); +WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( + WebKit::WebGraphicsContext3D::Attributes attributes, + WebKit::WebView* web_view, + bool direct); + // ------- URL load mocking. // Registers the file at |file_path| to be served when |url| is requested. // |response| is the response provided with the contents. diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 5c4f652..29c7f97 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -65,6 +65,7 @@ #include "webkit/glue/webpreferences.h" #include "webkit/glue/weburlrequest_extradata_impl.h" #include "webkit/glue/window_open_disposition.h" +#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" #include "webkit/media/webmediaplayer_impl.h" #include "webkit/plugins/npapi/webplugin_impl.h" #include "webkit/plugins/npapi/plugin_list.h" @@ -97,6 +98,7 @@ using WebKit::WebFileSystem; using WebKit::WebFileSystemCallbacks; using WebKit::WebFormElement; using WebKit::WebFrame; +using WebKit::WebGraphicsContext3D; using WebKit::WebHistoryItem; using WebKit::WebImage; using WebKit::WebMediaPlayer; @@ -336,6 +338,19 @@ WebStorageNamespace* TestWebViewDelegate::createSessionStorageNamespace( WebStorageNamespace::m_sessionStorageQuota); } +WebGraphicsContext3D* TestWebViewDelegate::createGraphicsContext3D( + WebGraphicsContext3D::Attributes attributes, + bool direct) { + if (!shell_->webView()) + return NULL; + scoped_ptr<WebGraphicsContext3D> context( + new webkit::gpu::WebGraphicsContext3DInProcessImpl( + gfx::kNullPluginWindow, NULL)); + if (!context->initialize(attributes, shell_->webView(), direct)) + return NULL; + return context.release(); +} + void TestWebViewDelegate::didAddMessageToConsole( const WebConsoleMessage& message, const WebString& source_name, unsigned source_line) { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index ef5bd4e..d168f94 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -25,6 +25,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/webplugin_page_delegate.h" #include "webkit/tools/test_shell/mock_spellcheck.h" @@ -89,6 +90,9 @@ class TestWebViewDelegate : public WebKit::WebViewClient, const WebKit::WebPopupMenuInfo& info); virtual WebKit::WebStorageNamespace* createSessionStorageNamespace( unsigned quota); + virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D( + WebKit::WebGraphicsContext3D::Attributes attributes, + bool direct); virtual void didAddMessageToConsole( const WebKit::WebConsoleMessage& message, const WebKit::WebString& source_name, unsigned source_line); |