Index: cc/resources/texture_mailbox_deleter.cc |
diff --git a/cc/resources/texture_mailbox_deleter.cc b/cc/resources/texture_mailbox_deleter.cc |
index ed611e464fa756703a16a90224b6b55e60854729..5ace26557560217ee57223155331f537050f7c14 100644 |
--- a/cc/resources/texture_mailbox_deleter.cc |
+++ b/cc/resources/texture_mailbox_deleter.cc |
@@ -25,7 +25,7 @@ static void DeleteTextureOnImplThread( |
static void PostTaskFromMainToImplThread( |
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
- TextureMailbox::ReleaseCallback run_impl_callback, |
+ ReleaseCallback run_impl_callback, |
unsigned sync_point, |
bool is_lost) { |
// This posts the task to RunDeleteTextureOnImplThread(). |
@@ -37,46 +37,47 @@ TextureMailboxDeleter::TextureMailboxDeleter() : weak_ptr_factory_(this) {} |
TextureMailboxDeleter::~TextureMailboxDeleter() { |
for (size_t i = 0; i < impl_callbacks_.size(); ++i) |
- impl_callbacks_.at(i)->Run(0, true); |
+ impl_callbacks_.at(i)->RunAndReset(0, true); |
} |
-TextureMailbox::ReleaseCallback TextureMailboxDeleter::GetReleaseCallback( |
+ScopedReleaseCallback TextureMailboxDeleter::GetReleaseCallback( |
const scoped_refptr<ContextProvider>& context_provider, |
unsigned texture_id) { |
// This callback owns a reference on the |context_provider|. It must be |
// destroyed on the impl thread. Upon destruction of this class, the |
// callback must immediately be destroyed. |
- scoped_ptr<TextureMailbox::ReleaseCallback> impl_callback( |
- new TextureMailbox::ReleaseCallback(base::Bind( |
- &DeleteTextureOnImplThread, context_provider, texture_id))); |
+ scoped_ptr<ScopedReleaseCallback> impl_callback( |
+ new ScopedReleaseCallback(base::Bind(&DeleteTextureOnImplThread, |
+ context_provider, |
+ texture_id))); |
impl_callbacks_.push_back(impl_callback.Pass()); |
// The raw pointer to the impl-side callback is valid as long as this |
// class is alive. So we guard it with a WeakPtr. |
- TextureMailbox::ReleaseCallback run_impl_callback = |
+ ReleaseCallback run_impl_callback( |
base::Bind(&TextureMailboxDeleter::RunDeleteTextureOnImplThread, |
weak_ptr_factory_.GetWeakPtr(), |
- impl_callbacks_.back()); |
+ impl_callbacks_.back())); |
// Provide a callback for the main thread that posts back to the impl |
// thread. |
- TextureMailbox::ReleaseCallback main_callback = |
+ ScopedReleaseCallback main_callback( |
base::Bind(&PostTaskFromMainToImplThread, |
base::MessageLoopProxy::current(), |
- run_impl_callback); |
+ run_impl_callback)); |
- return main_callback; |
+ return main_callback.Pass(); |
} |
void TextureMailboxDeleter::RunDeleteTextureOnImplThread( |
- TextureMailbox::ReleaseCallback* impl_callback, |
+ ScopedReleaseCallback* impl_callback, |
unsigned sync_point, |
bool is_lost) { |
for (size_t i = 0; i < impl_callbacks_.size(); ++i) { |
if (impl_callbacks_.at(i)->Equals(*impl_callback)) { |
// Run the callback, then destroy it here on the impl thread. |
- impl_callback->Run(sync_point, is_lost); |
+ impl_callback->RunAndReset(sync_point, is_lost); |
impl_callbacks_.erase(impl_callbacks_.begin() + i); |
return; |
} |