summaryrefslogtreecommitdiffstats
path: root/webkit/gpu
diff options
context:
space:
mode:
authorsenorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-16 14:47:49 +0000
committersenorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-16 14:47:49 +0000
commit6535c52a387055cb4652ab8d3dcd1dc187e3a789 (patch)
tree16db767171a8f6246c7334197a7d1ef5ebe50609 /webkit/gpu
parent5229253b9eaa86b60e6d13c9a71321710614fb18 (diff)
downloadchromium_src-6535c52a387055cb4652ab8d3dcd1dc187e3a789.zip
chromium_src-6535c52a387055cb4652ab8d3dcd1dc187e3a789.tar.gz
chromium_src-6535c52a387055cb4652ab8d3dcd1dc187e3a789.tar.bz2
Allow GraphicsContext3D to be created with a NULL WebView for offscreen
contexts. This makes it easier to enable GPU acceleration from a lower level in WebKit. Also allow the in-process implementation of glTexImage2D() to take a NULL pixels ptr. It's semantically valid in GL, and the command buffer implementation already seems to handle it fine. Review URL: http://codereview.chromium.org/7633076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/gpu')
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc2
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_impl.cc11
2 files changed, 5 insertions, 8 deletions
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index 2ac1ded..0e3c77a9 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -652,7 +652,7 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::initialize(
GLInProcessContext* parent_context = NULL;
if (!render_directly_to_web_view) {
WebKit::WebGraphicsContext3D* view_context =
- web_view->graphicsContext3D();
+ web_view ? web_view->graphicsContext3D() : NULL;
if (view_context) {
WebGraphicsContext3DInProcessCommandBufferImpl* context_impl =
static_cast<WebGraphicsContext3DInProcessCommandBufferImpl*>(
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
index 23bcb2a..d27aa9a 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc
@@ -114,7 +114,8 @@ bool WebGraphicsContext3DInProcessImpl::initialize(
if (!render_directly_to_web_view) {
// Pick up the compositor's context to share resources with.
- WebGraphicsContext3D* view_context = webView->graphicsContext3D();
+ WebGraphicsContext3D* view_context = webView ?
+ webView->graphicsContext3D() : NULL;
if (view_context) {
WebGraphicsContext3DInProcessImpl* contextImpl =
static_cast<WebGraphicsContext3DInProcessImpl*>(view_context);
@@ -148,7 +149,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize(
// a page unload event, iterate down any live WebGraphicsContext3D instances
// and force them to drop their contexts, sending a context lost event if
// necessary.
- webView->mainFrame()->collectGarbage();
+ if (webView) webView->mainFrame()->collectGarbage();
gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false,
gfx::Size(1, 1));
@@ -169,7 +170,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize(
// a page unload event, iterate down any live WebGraphicsContext3D instances
// and force them to drop their contexts, sending a context lost event if
// necessary.
- webView->mainFrame()->collectGarbage();
+ if (webView) webView->mainFrame()->collectGarbage();
gl_context_ = gfx::GLContext::CreateGLContext(share_group,
gl_surface_.get());
@@ -1329,10 +1330,6 @@ void WebGraphicsContext3DInProcessImpl::texImage2D(
WGC3Denum target, WGC3Dint level, WGC3Denum internalFormat,
WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border,
WGC3Denum format, WGC3Denum type, const void* pixels) {
- if (width && height && !pixels) {
- synthesizeGLError(GL_INVALID_VALUE);
- return;
- }
makeContextCurrent();
glTexImage2D(target, level, internalFormat,
width, height, border, format, type, pixels);