diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 07:19:14 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 07:19:14 +0000 |
commit | a76f1d23e1ba09f1b3206bacc0a8b43f6e8be204 (patch) | |
tree | 0a9fa1b17f93eb666b1b8fb7fa7b2a6973ed2d5d /content | |
parent | 2084cd0ddce0dccb9c7c868aeb5a3301fa2160d3 (diff) | |
download | chromium_src-a76f1d23e1ba09f1b3206bacc0a8b43f6e8be204.zip chromium_src-a76f1d23e1ba09f1b3206bacc0a8b43f6e8be204.tar.gz chromium_src-a76f1d23e1ba09f1b3206bacc0a8b43f6e8be204.tar.bz2 |
ui: Add PrepareTexture() function to ui::Texture.
Replace the texture_id()/set_texture_id() interface of ui::Texture
with virtual PrepareTexture() function. This prevents use of the
texture without a subclassed instance of ui::Texture being aware
of it.
BUG=132342
TEST=manual
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11192070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/image_transport_factory.cc | 24 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 4 |
2 files changed, 19 insertions, 9 deletions
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc index 81955e2..a167152 100644 --- a/content/browser/renderer_host/image_transport_factory.cc +++ b/content/browser/renderer_host/image_transport_factory.cc @@ -102,8 +102,12 @@ class ImageTransportClientTexture : public ui::Texture { float device_scale_factor, uint64 surface_id) : ui::Texture(true, size, device_scale_factor), - host_context_(host_context) { - set_texture_id(surface_id); + host_context_(host_context), + texture_id_(surface_id) { + } + + virtual unsigned PrepareTexture() { + return texture_id_; } virtual WebKit::WebGraphicsContext3D* HostContext3D() { @@ -118,6 +122,7 @@ class ImageTransportClientTexture : public ui::Texture { // before the |host_context_| via // |ImageTransportFactoryObserver::OnLostContext()| handlers. WebKit::WebGraphicsContext3D* host_context_; + unsigned texture_id_; DISALLOW_COPY_AND_ASSIGN(ImageTransportClientTexture); }; @@ -129,12 +134,16 @@ class OwnedTexture : public ui::Texture, ImageTransportFactoryObserver { float device_scale_factor, unsigned int texture_id) : ui::Texture(true, size, device_scale_factor), - host_context_(host_context) { + host_context_(host_context), + texture_id_(texture_id) { ImageTransportFactory::GetInstance()->AddObserver(this); - set_texture_id(texture_id); } // ui::Texture overrides: + virtual unsigned PrepareTexture() { + return texture_id_; + } + virtual WebKit::WebGraphicsContext3D* HostContext3D() OVERRIDE { return host_context_; } @@ -152,9 +161,9 @@ class OwnedTexture : public ui::Texture, ImageTransportFactoryObserver { private: void DeleteTexture() { - if (texture_id()) { - host_context_->deleteTexture(texture_id()); - set_texture_id(0); + if (texture_id_) { + host_context_->deleteTexture(texture_id_); + texture_id_ = 0; } } @@ -162,6 +171,7 @@ class OwnedTexture : public ui::Texture, ImageTransportFactoryObserver { // before the |host_context_| via // |ImageTransportFactoryObserver::OnLostContext()| handlers. WebKit::WebGraphicsContext3D* host_context_; + unsigned texture_id_; DISALLOW_COPY_AND_ASSIGN(OwnedTexture); }; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 869bba3..dec21505a 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -674,7 +674,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface( src_subrect_in_gl.set_y(GetViewBounds().height() - src_subrect.bottom()); gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect_in_gl); - gl_helper->CopyTextureTo(container->texture_id(), + gl_helper->CopyTextureTo(container->PrepareTexture(), container->size(), src_subrect_in_pixel, dst_size_in_pixel, @@ -1409,7 +1409,7 @@ scoped_refptr<ui::Texture> RenderWidgetHostViewAura::CopyTexture() { ui::Texture* container = it->second; DCHECK(container); WebKit::WebGLId texture_id = - gl_helper->CopyTexture(container->texture_id(), container->size()); + gl_helper->CopyTexture(container->PrepareTexture(), container->size()); if (!texture_id) return scoped_refptr<ui::Texture>(); |