Index: trunk/src/cc/layers/texture_layer.cc |
=================================================================== |
--- trunk/src/cc/layers/texture_layer.cc (revision 261488) |
+++ trunk/src/cc/layers/texture_layer.cc (working copy) |
@@ -35,7 +35,7 @@ |
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 @@ |
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 @@ |
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 @@ |
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 @@ |
} |
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 @@ |
needs_set_mailbox_ = false; |
} else { |
texture_layer->SetTextureId(texture_id_); |
- content_committed_ = DrawsContent(); |
+ impl_may_draw_client_data_ = texture_id_ && Layer::DrawsContent(); |
} |
} |