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

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: Rebase 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
« no previous file with comments | « cc/texture_layer.h ('k') | cc/texture_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/texture_layer.cc
diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc
index dd12abd5a8bf4b0111c6c8780d0adb379c72cffc..7f2bb0870f5bd3e4aef09f1b244aa60c393865df 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));
}
@@ -59,8 +59,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)
@@ -121,17 +121,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();
}
@@ -161,7 +159,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&)
@@ -186,7 +184,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);
}
« no previous file with comments | « 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