| Index: cc/layers/texture_layer.cc
|
| diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc
|
| index 90c48c89c8d37b1642ebf6ac3905e8b79098dfd0..4285ee0eb54caa4127ddbceb8f0e185c57a3c1b1 100644
|
| --- a/cc/layers/texture_layer.cc
|
| +++ b/cc/layers/texture_layer.cc
|
| @@ -35,7 +35,7 @@ TextureLayer::TextureLayer(TextureLayerClient* client, bool uses_mailbox)
|
| premultiplied_alpha_(true),
|
| blend_background_color_(false),
|
| rate_limit_context_(false),
|
| - content_committed_(false),
|
| + impl_may_draw_client_data_(false),
|
| texture_id_(0),
|
| needs_set_mailbox_(false) {
|
| vertex_opacity_[0] = 1.0f;
|
| @@ -51,10 +51,24 @@ void TextureLayer::ClearClient() {
|
| if (rate_limit_context_ && client_ && layer_tree_host())
|
| layer_tree_host()->StopRateLimiter();
|
| client_ = NULL;
|
| - if (uses_mailbox_)
|
| + ClearTexture();
|
| +}
|
| +
|
| +void TextureLayer::ClearTexture() {
|
| + if (uses_mailbox_) {
|
| SetTextureMailbox(TextureMailbox(), scoped_ptr<SingleReleaseCallback>());
|
| - else
|
| - SetTextureId(0);
|
| + } else if (texture_id_) {
|
| + if (impl_may_draw_client_data_) {
|
| + DCHECK(layer_tree_host());
|
| + layer_tree_host()->AcquireLayerTextures();
|
| + impl_may_draw_client_data_ = false;
|
| + }
|
| + texture_id_ = 0;
|
| + SetNeedsCommit();
|
| + // The texture id needs to be removed from the active tree before the
|
| + // commit is called complete.
|
| + SetNextCommitWaitsForActivation();
|
| + }
|
| }
|
|
|
| scoped_ptr<LayerImpl> TextureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
|
| @@ -119,19 +133,6 @@ void TextureLayer::SetRateLimitContext(bool rate_limit) {
|
| rate_limit_context_ = rate_limit;
|
| }
|
|
|
| -void TextureLayer::SetTextureId(unsigned id) {
|
| - DCHECK(!uses_mailbox_);
|
| - if (texture_id_ == id)
|
| - return;
|
| - if (texture_id_ && layer_tree_host())
|
| - layer_tree_host()->AcquireLayerTextures();
|
| - texture_id_ = id;
|
| - SetNeedsCommit();
|
| - // The texture id needs to be removed from the active tree before the
|
| - // commit is called complete.
|
| - SetNextCommitWaitsForActivation();
|
| -}
|
| -
|
| void TextureLayer::SetTextureMailboxInternal(
|
| const TextureMailbox& mailbox,
|
| scoped_ptr<SingleReleaseCallback> release_callback,
|
| @@ -190,14 +191,6 @@ void TextureLayer::SetTextureMailboxWithoutReleaseCallback(
|
| mailbox, release.Pass(), requires_commit, allow_mailbox_reuse);
|
| }
|
|
|
| -void TextureLayer::WillModifyTexture() {
|
| - if (!uses_mailbox_ && layer_tree_host() && (DrawsContent() ||
|
| - content_committed_)) {
|
| - layer_tree_host()->AcquireLayerTextures();
|
| - content_committed_ = false;
|
| - }
|
| -}
|
| -
|
| void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) {
|
| Layer::SetNeedsDisplayRect(dirty_rect);
|
|
|
| @@ -212,11 +205,12 @@ void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) {
|
| }
|
|
|
| if (layer_tree_host()) {
|
| - if (texture_id_) {
|
| + if (impl_may_draw_client_data_) {
|
| layer_tree_host()->AcquireLayerTextures();
|
| // The texture id needs to be removed from the active tree before the
|
| // commit is called complete.
|
| SetNextCommitWaitsForActivation();
|
| + impl_may_draw_client_data_ = false;
|
| }
|
| if (rate_limit_context_ && client_)
|
| layer_tree_host()->StopRateLimiter();
|
| @@ -295,7 +289,7 @@ void TextureLayer::PushPropertiesTo(LayerImpl* layer) {
|
| needs_set_mailbox_ = false;
|
| } else {
|
| texture_layer->SetTextureId(texture_id_);
|
| - content_committed_ = DrawsContent();
|
| + impl_may_draw_client_data_ = texture_id_ && Layer::DrawsContent();
|
| }
|
| }
|
|
|
|
|