Add function support for Sleep with TimeDelta input.
This is the first step of fixing issue 108171 (converting calls of Sleep() to
use TimeDelta instead of ints in milliseconds). I checked
platform_thread_unittests.cc for any tests explicitly for Sleep but found none,
so I didn't add any for this interface.
There will be a bit more implementation juggling here once the Sleep(int ms)
interface is removed, but that's coming in a later CL.
BUG=108171
TEST=
Review URL: http://codereview.chromium.org/8965072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116012 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 76784292d9ca82be8da21583d1e323dff2e513bc
diff --git a/base/message_loop.cc b/base/message_loop.cc
index f272a83..32b4061 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -272,6 +272,13 @@
AddToIncomingQueue(&pending_task);
}
+void MessageLoop::PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ Task* task,
+ base::TimeDelta delay) {
+ PostDelayedTask(from_here, task, delay.InMillisecondsRoundedUp());
+}
+
void MessageLoop::PostNonNestableTask(
const tracked_objects::Location& from_here, Task* task) {
DCHECK(task);
@@ -296,6 +303,13 @@
AddToIncomingQueue(&pending_task);
}
+void MessageLoop::PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ Task* task,
+ base::TimeDelta delay) {
+ PostNonNestableDelayedTask(from_here, task, delay.InMillisecondsRoundedUp());
+}
+
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, const base::Closure& task) {
DCHECK(!task.is_null()) << from_here.ToString();
@@ -304,7 +318,8 @@
}
void MessageLoop::PostDelayedTask(
- const tracked_objects::Location& from_here, const base::Closure& task,
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
int64 delay_ms) {
DCHECK(!task.is_null()) << from_here.ToString();
PendingTask pending_task(from_here, task,
@@ -312,6 +327,13 @@
AddToIncomingQueue(&pending_task);
}
+void MessageLoop::PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ PostDelayedTask(from_here, task, delay.InMillisecondsRoundedUp());
+}
+
void MessageLoop::PostNonNestableTask(
const tracked_objects::Location& from_here, const base::Closure& task) {
DCHECK(!task.is_null()) << from_here.ToString();
@@ -328,6 +350,13 @@
AddToIncomingQueue(&pending_task);
}
+void MessageLoop::PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ PostNonNestableDelayedTask(from_here, task, delay.InMillisecondsRoundedUp());
+}
+
void MessageLoop::Run() {
AutoRunState save_state(this);
RunHandler();