0

cc: Chromify TextureLayerClient

R=danakj@chromium.org
BUG=none


Review URL: https://chromiumcodereview.appspot.com/12670009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189050 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
enne@chromium.org
2013-03-19 17:28:09 +00:00
parent f296411da3
commit 8b10406075
8 changed files with 31 additions and 32 deletions

@ -58,7 +58,7 @@ TextureLayer::~TextureLayer() {
if (texture_id_)
layer_tree_host()->AcquireLayerTextures();
if (rate_limit_context_ && client_)
layer_tree_host()->StopRateLimiter(client_->context());
layer_tree_host()->StopRateLimiter(client_->Context3d());
}
if (own_mailbox_)
texture_mailbox_.RunReleaseCallback(texture_mailbox_.sync_point());
@ -102,7 +102,7 @@ void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) {
void TextureLayer::SetRateLimitContext(bool rate_limit) {
if (!rate_limit && rate_limit_context_ && client_ && layer_tree_host())
layer_tree_host()->StopRateLimiter(client_->context());
layer_tree_host()->StopRateLimiter(client_->Context3d());
rate_limit_context_ = rate_limit;
}
@ -140,7 +140,7 @@ void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) {
Layer::SetNeedsDisplayRect(dirty_rect);
if (rate_limit_context_ && client_ && layer_tree_host() && DrawsContent())
layer_tree_host()->StartRateLimiter(client_->context());
layer_tree_host()->StartRateLimiter(client_->Context3d());
}
void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) {
@ -158,9 +158,9 @@ void TextureLayer::Update(ResourceUpdateQueue* queue,
const OcclusionTracker* occlusion,
RenderingStats* stats) {
if (client_) {
texture_id_ = client_->prepareTexture(*queue);
texture_id_ = client_->PrepareTexture(queue);
context_lost_ =
client_->context()->getGraphicsResetStatusARB() != GL_NO_ERROR;
client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR;
}
needs_display_ = false;

@ -5,27 +5,26 @@
#ifndef CC_LAYERS_TEXTURE_LAYER_CLIENT_H_
#define CC_LAYERS_TEXTURE_LAYER_CLIENT_H_
namespace WebKit {
class WebGraphicsContext3D;
}
namespace WebKit { class WebGraphicsContext3D; }
namespace cc {
class ResourceUpdateQueue;
class TextureLayerClient {
public:
// Called to prepare this layer's texture for compositing. The client may queue a texture
// upload or copy on the ResourceUpdateQueue.
// Returns the texture ID to be used for compositing.
virtual unsigned prepareTexture(ResourceUpdateQueue&) = 0;
public:
// Called to prepare this layer's texture for compositing. The client may
// queue a texture upload or copy on the ResourceUpdateQueue.
// Returns the texture ID to be used for compositing.
virtual unsigned PrepareTexture(ResourceUpdateQueue* queue) = 0;
// Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
virtual WebKit::WebGraphicsContext3D* context() = 0;
// Returns the context that is providing the texture. Used for rate limiting
// and detecting lost context.
virtual WebKit::WebGraphicsContext3D* Context3d() = 0;
protected:
virtual ~TextureLayerClient() { }
protected:
virtual ~TextureLayerClient() {}
};
}
} // namespace cc
#endif // CC_LAYERS_TEXTURE_LAYER_CLIENT_H_

@ -614,12 +614,12 @@ void Layer::PaintContents(SkCanvas* sk_canvas,
canvas->Restore();
}
unsigned Layer::prepareTexture(cc::ResourceUpdateQueue&) {
unsigned Layer::PrepareTexture(cc::ResourceUpdateQueue* queue) {
DCHECK(texture_layer_);
return texture_->PrepareTexture();
}
WebKit::WebGraphicsContext3D* Layer::context() {
WebKit::WebGraphicsContext3D* Layer::Context3d() {
DCHECK(texture_layer_);
return texture_->HostContext3D();
}

@ -298,8 +298,8 @@ class COMPOSITOR_EXPORT Layer
cc::Layer* cc_layer() { return cc_layer_; }
// TextureLayerClient
virtual unsigned prepareTexture(cc::ResourceUpdateQueue&) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
virtual unsigned PrepareTexture(cc::ResourceUpdateQueue* queue) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
float device_scale_factor() const { return device_scale_factor_; }

@ -82,14 +82,14 @@ class WebTextureUpdaterImpl : public WebKit::WebTextureUpdater {
ResourceUpdateQueue* queue_;
};
unsigned WebExternalTextureLayerImpl::prepareTexture(
ResourceUpdateQueue& queue) {
unsigned WebExternalTextureLayerImpl::PrepareTexture(
ResourceUpdateQueue* queue) {
DCHECK(client_);
WebTextureUpdaterImpl updater_impl(&queue);
WebTextureUpdaterImpl updater_impl(queue);
return client_->prepareTexture(updater_impl);
}
WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::context() {
WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::Context3d() {
DCHECK(client_);
return client_->context();
}

@ -34,8 +34,8 @@ class WebExternalTextureLayerImpl : public WebKit::WebExternalTextureLayer,
virtual void setRateLimitContext(bool rate_limit);
// TextureLayerClient implementation.
virtual unsigned prepareTexture(cc::ResourceUpdateQueue&) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
virtual unsigned PrepareTexture(cc::ResourceUpdateQueue*) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
private:
WebKit::WebExternalTextureLayerClient* client_;

@ -2089,11 +2089,11 @@ void PluginInstance::DeliverSamples(PP_Instance instance,
content_decryptor_delegate_->DeliverSamples(audio_frames, block_info);
}
unsigned PluginInstance::prepareTexture(cc::ResourceUpdateQueue&) {
unsigned PluginInstance::PrepareTexture(cc::ResourceUpdateQueue* queue) {
return GetBackingTextureId();
}
WebKit::WebGraphicsContext3D* PluginInstance::context() {
WebKit::WebGraphicsContext3D* PluginInstance::Context3d() {
DCHECK(bound_graphics_3d_.get());
DCHECK(bound_graphics_3d_->platform_context());
return bound_graphics_3d_->platform_context()->GetParentContext();

@ -463,8 +463,8 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
const PP_DecryptedBlockInfo* block_info) OVERRIDE;
// TextureLayerClient implementation.
virtual unsigned prepareTexture(cc::ResourceUpdateQueue&) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* context() OVERRIDE;
virtual unsigned PrepareTexture(cc::ResourceUpdateQueue* queue) OVERRIDE;
virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
// Reset this instance as proxied. Assigns the instance a new module, resets
// cached interfaces to point to the out-of-process proxy and re-sends