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

Unified Diff: cc/texture_layer.cc

Issue 11638028: Mailbox support for texture layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
Index: cc/texture_layer.cc
diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc
index 36c4220371d6f5653a7dedae16ed17b414504f96..f3bcf97ebc6facec9a952576c11db8e8c128f1f6 100644
--- a/cc/texture_layer.cc
+++ b/cc/texture_layer.cc
@@ -5,6 +5,7 @@
#include "cc/texture_layer.h"
#include "cc/layer_tree_host.h"
+#include "cc/mailbox_release_client.h"
#include "cc/texture_layer_client.h"
#include "cc/texture_layer_impl.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
@@ -14,12 +15,18 @@ namespace cc {
scoped_refptr<TextureLayer> TextureLayer::create(TextureLayerClient* client)
{
- return scoped_refptr<TextureLayer>(new TextureLayer(client));
+ return scoped_refptr<TextureLayer>(new TextureLayer(client, 0));
}
-TextureLayer::TextureLayer(TextureLayerClient* client)
+scoped_refptr<TextureLayer> TextureLayer::createWithMailboxClient(MailboxReleaseClient* client)
+{
+ return scoped_refptr<TextureLayer>(new TextureLayer(0, client));
+}
+
+TextureLayer::TextureLayer(TextureLayerClient* client, MailboxReleaseClient* mailboxClient)
: Layer()
, m_client(client)
+ , m_mailboxClient(mailboxClient)
, m_flipped(true)
, m_uvRect(0, 0, 1, 1)
, m_premultipliedAlpha(true)
@@ -46,7 +53,7 @@ TextureLayer::~TextureLayer()
scoped_ptr<LayerImpl> TextureLayer::createLayerImpl(LayerTreeImpl* treeImpl)
{
- return TextureLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>();
+ return TextureLayerImpl::create(treeImpl, m_layerId, m_mailboxClient).PassAs<LayerImpl>();
}
void TextureLayer::setFlipped(bool flipped)
@@ -100,6 +107,17 @@ void TextureLayer::setTextureId(unsigned id)
setNeedsCommit();
}
+void TextureLayer::setTextureMailbox(const std::string& mailboxName)
+{
+ if (m_mailboxName.compare(mailboxName) == 0)
+ return;
+ // If we never commited the mailbox, we need to release it here
+ if (!m_contentCommitted && m_mailboxName.size())
+ m_mailboxClient->mailboxReleased(m_mailboxName, 0);
+ m_mailboxName = mailboxName;
+ setNeedsCommit();
+}
+
void TextureLayer::willModifyTexture()
{
if (layerTreeHost() && (drawsContent() || m_contentCommitted)) {
@@ -125,7 +143,7 @@ void TextureLayer::setLayerTreeHost(LayerTreeHost* host)
bool TextureLayer::drawsContent() const
{
- return (m_client || m_textureId) && !m_contextLost && Layer::drawsContent();
+ return (m_client || m_textureId || m_mailboxName.size()) && !m_contextLost && Layer::drawsContent();
}
void TextureLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*, RenderingStats&)
@@ -147,7 +165,10 @@ void TextureLayer::pushPropertiesTo(LayerImpl* layer)
textureLayer->setUVRect(m_uvRect);
textureLayer->setVertexOpacity(m_vertexOpacity);
textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
- textureLayer->setTextureId(m_textureId);
+ if (m_mailboxClient)
+ textureLayer->setTextureMailbox(m_mailboxName);
+ else
+ textureLayer->setTextureId(m_textureId);
m_contentCommitted = drawsContent();
}

Powered by Google App Engine
This is Rietveld 408576698