summaryrefslogtreecommitdiffstats
path: root/cc/layers/texture_layer.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-30 06:29:27 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-30 06:29:27 +0000
commit74b43cce8bf2f7d13fc1576d96088d2ac584e69d (patch)
tree0d86665c1f56e21696e862189e500d4fb2cc828c /cc/layers/texture_layer.cc
parentaaa60babeabcbb8d4b3ba0e587a85398b5fbd099 (diff)
downloadchromium_src-74b43cce8bf2f7d13fc1576d96088d2ac584e69d.zip
chromium_src-74b43cce8bf2f7d13fc1576d96088d2ac584e69d.tar.gz
chromium_src-74b43cce8bf2f7d13fc1576d96088d2ac584e69d.tar.bz2
cc: Block commit on activate by setting a flag on LayerTreeHost.
Currently the ThreadProxy recursively asks all layers in the tree if they should block the commit. This is problematic as when you remove a layer from a the tree, it may want to block the commit to get back resources from its active-tree impl-layer. Instead, have layers call SetNextCommitWaitsForActivation() when they want the next commit to block on activate. This way we only block commits that matter, not every commit when there's a texture layer present. And we can allow a layer to block the commit when it is leaving the tree. Tests: TextureLayerNoMailboxIsActivatedDuringCommit TextureLayerMailboxIsActivatedDuringCommit DelegatedFrameIsActivatedDuringCommit R=enne, piman BUG=277953 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=220418 Review URL: https://chromiumcodereview.appspot.com/23530003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/texture_layer.cc')
-rw-r--r--cc/layers/texture_layer.cc28
1 files changed, 19 insertions, 9 deletions
diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc
index 4d6df14..d0ab7d9 100644
--- a/cc/layers/texture_layer.cc
+++ b/cc/layers/texture_layer.cc
@@ -125,6 +125,9 @@ void TextureLayer::SetTextureId(unsigned id) {
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::SetTextureMailbox(const TextureMailbox& mailbox) {
@@ -138,6 +141,9 @@ void TextureLayer::SetTextureMailbox(const TextureMailbox& mailbox) {
holder_ref_.reset();
needs_set_mailbox_ = true;
SetNeedsCommit();
+ // The active frame needs to be replaced and the mailbox returned before the
+ // commit is called complete.
+ SetNextCommitWaitsForActivation();
}
void TextureLayer::WillModifyTexture() {
@@ -161,16 +167,24 @@ void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) {
}
if (layer_tree_host()) {
- if (texture_id_)
+ if (texture_id_) {
layer_tree_host()->AcquireLayerTextures();
+ // The texture id needs to be removed from the active tree before the
+ // commit is called complete.
+ SetNextCommitWaitsForActivation();
+ }
if (rate_limit_context_ && client_)
layer_tree_host()->StopRateLimiter(client_->Context3d());
}
// If we're removed from the tree, the TextureLayerImpl will be destroyed, and
// we will need to set the mailbox again on a new TextureLayerImpl the next
// time we push.
- if (!host && uses_mailbox_ && holder_ref_)
+ if (!host && uses_mailbox_ && holder_ref_) {
needs_set_mailbox_ = true;
+ // The active frame needs to be replaced and the mailbox returned before the
+ // commit is called complete.
+ SetNextCommitWaitsForActivation();
+ }
Layer::SetLayerTreeHost(host);
}
@@ -196,6 +210,9 @@ bool TextureLayer::Update(ResourceUpdateQueue* queue,
client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR)
texture_id_ = 0;
updated = true;
+ // The texture id needs to be removed from the active tree before the
+ // commit is called complete.
+ SetNextCommitWaitsForActivation();
}
}
@@ -241,13 +258,6 @@ Region TextureLayer::VisibleContentOpaqueRegion() const {
return Region();
}
-bool TextureLayer::BlocksPendingCommit() const {
- // Double-buffered texture layers need to be blocked until they can be made
- // triple-buffered. Single-buffered layers already prevent draws, so
- // can block too for simplicity.
- return DrawsContent();
-}
-
bool TextureLayer::CanClipSelf() const {
return true;
}