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

Unified Diff: cc/texture_layer.cc

Issue 11888010: Cosmetic cleanup to texture_layer mailboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 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
Index: cc/texture_layer.cc
diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc
index 575fd5f50e1493e8785216ab295236b0fee57c6b..f5bd63c3a92dbdf3dd1d3c2d019927f1d5b941b1 100644
--- a/cc/texture_layer.cc
+++ b/cc/texture_layer.cc
@@ -12,12 +12,12 @@
namespace cc {
-static void runCallbackOnMainThread(const TextureLayer::MailboxCallback& callback, unsigned syncPoint)
+static void runCallbackOnMainThread(const TextureMailbox::ReleaseCallback& callback, unsigned syncPoint)
{
callback.Run(syncPoint);
}
-static void postCallbackToMainThread(Thread *mainThread, const TextureLayer::MailboxCallback& callback, unsigned syncPoint)
+static void postCallbackToMainThread(Thread *mainThread, const TextureMailbox::ReleaseCallback& callback, unsigned syncPoint)
{
mainThread->postTask(base::Bind(&runCallbackOnMainThread, callback, syncPoint));
}
@@ -58,8 +58,8 @@ TextureLayer::~TextureLayer()
if (m_rateLimitContext && m_client)
layerTreeHost()->stopRateLimiter(m_client->context());
}
- if (!m_contentCommitted && !m_mailboxName.empty())
- m_mailboxReleaseCallback.Run(0);
+ if (!m_contentCommitted)
+ m_textureMailbox.RunReleaseCallback(0);
}
scoped_ptr<LayerImpl> TextureLayer::createLayerImpl(LayerTreeImpl* treeImpl)
@@ -119,17 +119,15 @@ void TextureLayer::setTextureId(unsigned id)
setNeedsCommit();
}
-void TextureLayer::setTextureMailbox(const std::string& mailboxName, const MailboxCallback& callback)
+void TextureLayer::setTextureMailbox(const TextureMailbox& mailbox)
{
DCHECK(m_usesMailbox);
- DCHECK(mailboxName.empty() == callback.is_null());
- if (m_mailboxName.compare(mailboxName) == 0)
+ if (m_textureMailbox.Equals(mailbox))
return;
// If we never commited the mailbox, we need to release it here
- if (!m_contentCommitted && !m_mailboxName.empty())
- m_mailboxReleaseCallback.Run(0);
- m_mailboxReleaseCallback = callback;
- m_mailboxName = mailboxName;
+ if (!m_contentCommitted)
+ m_textureMailbox.RunReleaseCallback(0);
+ m_textureMailbox = mailbox;
setNeedsCommit();
}
@@ -159,7 +157,7 @@ void TextureLayer::setLayerTreeHost(LayerTreeHost* host)
bool TextureLayer::drawsContent() const
{
- return (m_client || m_textureId || !m_mailboxName.empty()) && !m_contextLost && Layer::drawsContent();
+ return (m_client || m_textureId || !m_textureMailbox.IsEmpty()) && !m_contextLost && Layer::drawsContent();
}
void TextureLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*, RenderingStats&)
@@ -183,7 +181,10 @@ void TextureLayer::pushPropertiesTo(LayerImpl* layer)
textureLayer->setPremultipliedAlpha(m_premultipliedAlpha);
if (m_usesMailbox) {
Thread* mainThread = layerTreeHost()->proxy()->mainThread();
- textureLayer->setTextureMailbox(m_mailboxName, base::Bind(&postCallbackToMainThread, mainThread, m_mailboxReleaseCallback));
+ TextureMailbox::ReleaseCallback callback;
+ if (!m_textureMailbox.IsEmpty())
+ callback = base::Bind(&postCallbackToMainThread, mainThread, m_textureMailbox.callback());
+ textureLayer->setTextureMailbox(TextureMailbox(m_textureMailbox.name(), callback));
} else {
textureLayer->setTextureId(m_textureId);
}
« cc/resource_provider.cc ('K') | « cc/texture_layer.h ('k') | cc/texture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698