Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: trunk/src/cc/layers/texture_layer.cc

Issue 224363003: Re-land "cc: Remove TextureLayer::SetTextureId and TextureLayer::WillModifyTexture" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/cc/layers/texture_layer.h ('k') | trunk/src/cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
}
« no previous file with comments | « trunk/src/cc/layers/texture_layer.h ('k') | trunk/src/cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698