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

Unified Diff: base/message_loop_proxy_impl.cc

Issue 7316015: Support Closure in ALL the loops! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed nit and rebased. Created 9 years, 5 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 | « base/message_loop_proxy_impl.h ('k') | base/message_loop_proxy_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop_proxy_impl.cc
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc
index b47c934be21e547038259c9e2aa22f3c331a76ba..5ffba1a738feea011a8eb122d387b416ac9237a2 100644
--- a/base/message_loop_proxy_impl.cc
+++ b/base/message_loop_proxy_impl.cc
@@ -40,6 +40,30 @@ bool MessageLoopProxyImpl::PostNonNestableDelayedTask(
return PostTaskHelper(from_here, task, delay_ms, false);
}
+bool MessageLoopProxyImpl::PostTask(const tracked_objects::Location& from_here,
+ const base::Closure& task) {
+ return PostTaskHelper(from_here, task, 0, true);
+}
+
+bool MessageLoopProxyImpl::PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ int64 delay_ms) {
+ return PostTaskHelper(from_here, task, delay_ms, true);
+}
+
+bool MessageLoopProxyImpl::PostNonNestableTask(
+ const tracked_objects::Location& from_here, const base::Closure& task) {
+ return PostTaskHelper(from_here, task, 0, false);
+}
+
+bool MessageLoopProxyImpl::PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ int64 delay_ms) {
+ return PostTaskHelper(from_here, task, delay_ms, false);
+}
+
bool MessageLoopProxyImpl::BelongsToCurrentThread() {
// We shouldn't use MessageLoop::current() since it uses LazyInstance which
// may be deleted by ~AtExitManager when a WorkerPool thread calls this
@@ -102,6 +126,22 @@ bool MessageLoopProxyImpl::PostTaskHelper(
return ret;
}
+bool MessageLoopProxyImpl::PostTaskHelper(
+ const tracked_objects::Location& from_here, const base::Closure& task,
+ int64 delay_ms, bool nestable) {
+ AutoLock lock(message_loop_lock_);
+ if (target_message_loop_) {
+ if (nestable) {
+ target_message_loop_->PostDelayedTask(from_here, task, delay_ms);
+ } else {
+ target_message_loop_->PostNonNestableDelayedTask(from_here, task,
+ delay_ms);
+ }
+ return true;
+ }
+ return false;
+}
+
scoped_refptr<MessageLoopProxy>
MessageLoopProxy::CreateForCurrentThread() {
scoped_refptr<MessageLoopProxy> ret(new MessageLoopProxyImpl());
« no previous file with comments | « base/message_loop_proxy_impl.h ('k') | base/message_loop_proxy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698