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

Unified Diff: content/browser/browser_thread_impl.cc

Issue 9427023: Add functions to expand PostDelayedTask interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add fix to RunOnPluginThread() in host_plugin.cc Created 8 years, 10 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 | « content/browser/browser_thread_impl.h ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_thread_impl.cc
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index f0aab01f562a5739f13fd9d5f02b04897ce83980..22a2e71dcfd0cc3845c235a09fc888ef917e9891 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -141,7 +141,7 @@ bool BrowserThreadImpl::PostTaskHelper(
BrowserThread::ID identifier,
const tracked_objects::Location& from_here,
const base::Closure& task,
- int64 delay_ms,
+ base::TimeDelta delay,
bool nestable) {
DCHECK(identifier >= 0 && identifier < ID_COUNT);
// Optimization: to avoid unnecessary locks, we listed the ID enumeration in
@@ -162,7 +162,6 @@ bool BrowserThreadImpl::PostTaskHelper(
MessageLoop* message_loop = globals.threads[identifier] ?
globals.threads[identifier]->message_loop() : NULL;
if (message_loop) {
- base::TimeDelta delay = base::TimeDelta::FromMilliseconds(delay_ms);
if (nestable) {
message_loop->PostDelayedTask(from_here, task, delay);
} else {
@@ -187,9 +186,14 @@ class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy {
// MessageLoopProxy implementation.
virtual bool PostDelayedTask(
const tracked_objects::Location& from_here,
- const base::Closure& task, int64 delay_ms) OVERRIDE{
+ const base::Closure& task, int64 delay_ms) OVERRIDE {
return BrowserThread::PostDelayedTask(id_, from_here, task, delay_ms);
}
+ virtual bool PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task, base::TimeDelta delay) OVERRIDE {
+ return BrowserThread::PostDelayedTask(id_, from_here, task, delay);
+ }
virtual bool PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
@@ -198,6 +202,13 @@ class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy {
return BrowserThread::PostNonNestableDelayedTask(id_, from_here, task,
delay_ms);
}
+ virtual bool PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) OVERRIDE {
+ return BrowserThread::PostNonNestableDelayedTask(id_, from_here, task,
+ delay);
+ }
virtual bool RunsTasksOnCurrentThread() const OVERRIDE {
return BrowserThread::CurrentlyOn(id_);
@@ -266,7 +277,7 @@ bool BrowserThread::PostTask(ID identifier,
const tracked_objects::Location& from_here,
const base::Closure& task) {
return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, 0, true);
+ identifier, from_here, task, base::TimeDelta(), true);
}
// static
@@ -275,7 +286,20 @@ bool BrowserThread::PostDelayedTask(ID identifier,
const base::Closure& task,
int64 delay_ms) {
return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, delay_ms, true);
+ identifier,
+ from_here,
+ task,
+ base::TimeDelta::FromMilliseconds(delay_ms),
+ true);
+}
+
+// static
+bool BrowserThread::PostDelayedTask(ID identifier,
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ return BrowserThreadImpl::PostTaskHelper(
+ identifier, from_here, task, delay, true);
}
// static
@@ -284,7 +308,7 @@ bool BrowserThread::PostNonNestableTask(
const tracked_objects::Location& from_here,
const base::Closure& task) {
return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, 0, false);
+ identifier, from_here, task, base::TimeDelta(), false);
}
// static
@@ -294,7 +318,21 @@ bool BrowserThread::PostNonNestableDelayedTask(
const base::Closure& task,
int64 delay_ms) {
return BrowserThreadImpl::PostTaskHelper(
- identifier, from_here, task, delay_ms, false);
+ identifier,
+ from_here,
+ task,
+ base::TimeDelta::FromMilliseconds(delay_ms),
+ false);
+}
+
+// static
+bool BrowserThread::PostNonNestableDelayedTask(
+ ID identifier,
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ return BrowserThreadImpl::PostTaskHelper(
+ identifier, from_here, task, delay, false);
}
// static
« no previous file with comments | « content/browser/browser_thread_impl.h ('k') | content/public/browser/browser_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698