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

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: cleanup idle wait. 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
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..178185f64feae1cef29a514ff2270b2d01ebda15 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,25 @@ bool MessageLoopProxyImpl::PostTaskHelper(
return ret;
}
+bool MessageLoopProxyImpl::PostTaskHelper(
+ const tracked_objects::Location& from_here, const base::Closure& task,
+ int64 delay_ms, bool nestable) {
+ bool ret = false;
+ {
darin (slow to review) 2011/07/07 21:54:01 the extra nesting here can be removed. it only ex
awong 2011/07/08 00:38:40 Done.
+ 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);
+ }
+ ret = true;
+ }
+ }
+ return ret;
+}
+
scoped_refptr<MessageLoopProxy>
MessageLoopProxy::CreateForCurrentThread() {
scoped_refptr<MessageLoopProxy> ret(new MessageLoopProxyImpl());

Powered by Google App Engine
This is Rietveld 408576698