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

Unified Diff: chrome/browser/after_startup_task_utils.h

Issue 2238603002: Introduce AfterStartupTaskUtils::Runner for callsites that want to use AfterStartupTaskUtils but ne… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b9_sequenced_worker_pool_redirection
Patch Set: merge up to r411308 Created 4 years, 4 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 | « no previous file | chrome/browser/after_startup_task_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/after_startup_task_utils.h
diff --git a/chrome/browser/after_startup_task_utils.h b/chrome/browser/after_startup_task_utils.h
index 77388dd543f735127d927ba4884c6ffd8b751606..19751300b3abf48445d6dd419d82925bec56e030 100644
--- a/chrome/browser/after_startup_task_utils.h
+++ b/chrome/browser/after_startup_task_utils.h
@@ -8,29 +8,45 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/task_runner.h"
namespace android {
class AfterStartupTaskUtilsJNI;
}
-namespace base {
-class TaskRunner;
-}
-namespace tracked_objects {
-class Location;
-};
-
class AfterStartupTaskUtils {
public:
+ // A helper TaskRunner which merely forwards to
+ // AfterStartupTaskUtils::PostTask(). Doesn't support tasks with a non-zero
+ // delay.
+ class Runner : public base::TaskRunner {
+ public:
+ explicit Runner(scoped_refptr<base::TaskRunner> destination_runner);
+
+ // Overrides from base::TaskRunner:
+ bool PostDelayedTask(const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) override;
+ bool RunsTasksOnCurrentThread() const override;
+
+ private:
+ ~Runner() override;
+
+ const scoped_refptr<base::TaskRunner> destination_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(Runner);
+ };
+
// Observes startup and when complete runs tasks that have accrued.
static void StartMonitoringStartup();
// Used to augment the behavior of BrowserThread::PostAfterStartupTask
// for chrome. Tasks are queued until startup is complete.
// Note: see browser_thread.h
- static void PostTask(const tracked_objects::Location& from_here,
- const scoped_refptr<base::TaskRunner>& task_runner,
- const base::Closure& task);
+ static void PostTask(
+ const tracked_objects::Location& from_here,
+ const scoped_refptr<base::TaskRunner>& destination_runner,
+ const base::Closure& task);
// Returns true if browser startup is complete. Only use this on a one-off
// basis; If you need to poll this function constantly, use the above
« no previous file with comments | « no previous file | chrome/browser/after_startup_task_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698