diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-09 21:56:01 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-09 21:56:01 +0000 |
commit | ea2ac588744f3ac413f822a1bd507488d73739a2 (patch) | |
tree | d43c880f285454163c9649f34a843421a5f39cd4 /ui | |
parent | d9c7427af6a3915a4484ad9b0d6c9051bd04aefe (diff) | |
download | chromium_src-ea2ac588744f3ac413f822a1bd507488d73739a2.zip chromium_src-ea2ac588744f3ac413f822a1bd507488d73739a2.tar.gz chromium_src-ea2ac588744f3ac413f822a1bd507488d73739a2.tar.bz2 |
Add GLHelper::AsyncCopyTextureTo and make thumbnail generation asynchronous.
BUG=118547
TEST=Manually checked that UI thread is not blocked by the thumbnailer
Review URL: http://codereview.chromium.org/9791031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/compositor/compositor.cc | 20 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor.h | 11 |
2 files changed, 28 insertions, 3 deletions
diff --git a/ui/gfx/compositor/compositor.cc b/ui/gfx/compositor/compositor.cc index 965d1cb..0a94054 100644 --- a/ui/gfx/compositor/compositor.cc +++ b/ui/gfx/compositor/compositor.cc @@ -77,9 +77,26 @@ bool DefaultContextFactory::Initialize() { WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContext( Compositor* compositor) { + return CreateContextCommon(compositor, false); +} + +WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateOffscreenContext( + Compositor* compositor) { + return CreateContextCommon(compositor, true); +} + +void DefaultContextFactory::RemoveCompositor(Compositor* compositor) { +} + +WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon( + Compositor* compositor, + bool offscreen) { WebKit::WebGraphicsContext3D::Attributes attrs; attrs.shareResources = true; WebKit::WebGraphicsContext3D* context = + offscreen ? + webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( + attrs, false) : webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWindow( attrs, compositor->widget(), share_group_.get()); CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -92,9 +109,6 @@ WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContext( return context; } -void DefaultContextFactory::RemoveCompositor(Compositor* compositor) { -} - Texture::Texture(bool flipped, const gfx::Size& size) : texture_id_(0), flipped_(flipped), diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h index 1a2422a..d8d75dc 100644 --- a/ui/gfx/compositor/compositor.h +++ b/ui/gfx/compositor/compositor.h @@ -54,6 +54,11 @@ class COMPOSITOR_EXPORT ContextFactory { virtual WebKit::WebGraphicsContext3D* CreateContext( Compositor* compositor) = 0; + // Creates a context for given compositor used for offscreen rendering. See + // the comments of CreateContext to know how per-compositor data is handled. + virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext( + Compositor* compositor) = 0; + // Destroys per-compositor data. virtual void RemoveCompositor(Compositor* compositor) = 0; }; @@ -67,6 +72,8 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { // ContextFactory implementation virtual WebKit::WebGraphicsContext3D* CreateContext( Compositor* compositor) OVERRIDE; + virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext( + Compositor* compositor) OVERRIDE; virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; bool Initialize(); @@ -76,6 +83,10 @@ class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { } private: + WebKit::WebGraphicsContext3D* CreateContextCommon( + Compositor* compositor, + bool offscreen); + scoped_refptr<gfx::GLShareGroup> share_group_; DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); |