Commit a22e15d4 authored by danakj@chromium.org's avatar danakj@chromium.org

Allow browser compositor to create an offscreen context3D.

This is needed for using compositor filters in Aura such as glass blur.

BUG=99528
TEST=


Review URL: http://codereview.chromium.org/9568042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124594 0039d316-1c4b-4281-b951-d872f2087c98
parent 86ccf5f8
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h"
#include "content/common/child_thread.h" #include "content/common/child_thread.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/socket_stream_dispatcher.h" #include "content/common/socket_stream_dispatcher.h"
#include "content/common/webkitplatformsupport_impl.h" #include "content/common/webkitplatformsupport_impl.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
namespace content { namespace content {
...@@ -46,4 +50,23 @@ WebKitPlatformSupportImpl::CreateWebSocketBridge( ...@@ -46,4 +50,23 @@ WebKitPlatformSupportImpl::CreateWebSocketBridge(
return dispatcher->CreateBridge(handle, delegate); return dispatcher->CreateBridge(handle, delegate);
} }
WebKit::WebGraphicsContext3D*
WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
const WebGraphicsContext3D::Attributes& attributes) {
// The WebGraphicsContext3DInProcessImpl code path is used for
// layout tests (though not through this code) as well as for
// debugging and bringing up new ports.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
attributes, false);
} else {
base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> null_client;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
new WebGraphicsContext3DCommandBufferImpl(0, GURL(), null_client));
if (!context->Initialize(attributes))
return NULL;
return context.release();
}
}
} // namespace content } // namespace content
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -30,6 +30,8 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl ...@@ -30,6 +30,8 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl
virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge( virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge(
WebKit::WebSocketStreamHandle* handle, WebKit::WebSocketStreamHandle* handle,
webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
const WebKit::WebGraphicsContext3D::Attributes& attributes);
}; };
} // namespace content } // namespace content
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "content/common/fileapi/webblobregistry_impl.h" #include "content/common/fileapi/webblobregistry_impl.h"
#include "content/common/fileapi/webfilesystem_impl.h" #include "content/common/fileapi/webfilesystem_impl.h"
#include "content/common/file_utilities_messages.h" #include "content/common/file_utilities_messages.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/indexed_db/proxy_webidbfactory_impl.h" #include "content/common/indexed_db/proxy_webidbfactory_impl.h"
#include "content/common/mime_registry_messages.h" #include "content/common/mime_registry_messages.h"
#include "content/common/npobject_util.h" #include "content/common/npobject_util.h"
...@@ -50,7 +49,6 @@ ...@@ -50,7 +49,6 @@
#include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webclipboard_impl.h"
#include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webfileutilities_impl.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "content/common/child_process_messages.h" #include "content/common/child_process_messages.h"
...@@ -581,25 +579,6 @@ RendererWebKitPlatformSupportImpl::sharedWorkerRepository() { ...@@ -581,25 +579,6 @@ RendererWebKitPlatformSupportImpl::sharedWorkerRepository() {
} }
} }
WebKit::WebGraphicsContext3D*
RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
const WebGraphicsContext3D::Attributes& attributes) {
// The WebGraphicsContext3DInProcessImpl code path is used for
// layout tests (though not through this code) as well as for
// debugging and bringing up new ports.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
attributes, false);
} else {
base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> null_client;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
new WebGraphicsContext3DCommandBufferImpl(0, GURL(), null_client));
if (!context->Initialize(attributes))
return NULL;
return context.release();
}
}
double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() {
return audio_hardware::GetOutputSampleRate(); return audio_hardware::GetOutputSampleRate();
} }
......
...@@ -82,8 +82,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl ...@@ -82,8 +82,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
const WebKit::WebString& keyPath) OVERRIDE; const WebKit::WebString& keyPath) OVERRIDE;
virtual WebKit::WebFileSystem* fileSystem() OVERRIDE; virtual WebKit::WebFileSystem* fileSystem() OVERRIDE;
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository() OVERRIDE; virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository() OVERRIDE;
virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
const WebKit::WebGraphicsContext3D::Attributes& attributes);
virtual double audioHardwareSampleRate() OVERRIDE; virtual double audioHardwareSampleRate() OVERRIDE;
virtual size_t audioHardwareBufferSize() OVERRIDE; virtual size_t audioHardwareBufferSize() OVERRIDE;
virtual WebKit::WebAudioDevice* createAudioDevice( virtual WebKit::WebAudioDevice* createAudioDevice(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment