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

Unified Diff: chrome/browser/after_startup_task_utils.cc

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 | « chrome/browser/after_startup_task_utils.h ('k') | chrome/browser/after_startup_task_utils_unittest.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.cc
diff --git a/chrome/browser/after_startup_task_utils.cc b/chrome/browser/after_startup_task_utils.cc
index 0d0eab653c4381260cd7a7291e3dfc8927f07c68..c5c29e8b8cb599f7305a2df9b0a82abce8dd1e7c 100644
--- a/chrome/browser/after_startup_task_utils.cc
+++ b/chrome/browser/after_startup_task_utils.cc
@@ -192,6 +192,27 @@ void StartupObserver::Start() {
} // namespace
+AfterStartupTaskUtils::Runner::Runner(
+ scoped_refptr<base::TaskRunner> destination_runner)
+ : destination_runner_(std::move(destination_runner)) {
+ DCHECK(destination_runner_);
+}
+
+AfterStartupTaskUtils::Runner::~Runner() = default;
+
+bool AfterStartupTaskUtils::Runner::PostDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ base::TimeDelta delay) {
+ DCHECK(delay.is_zero());
+ AfterStartupTaskUtils::PostTask(from_here, destination_runner_, task);
+ return true;
+}
+
+bool AfterStartupTaskUtils::Runner::RunsTasksOnCurrentThread() const {
+ return destination_runner_->RunsTasksOnCurrentThread();
+}
+
void AfterStartupTaskUtils::StartMonitoringStartup() {
// The observer is self-deleting.
(new StartupObserver)->Start();
@@ -199,15 +220,15 @@ void AfterStartupTaskUtils::StartMonitoringStartup() {
void AfterStartupTaskUtils::PostTask(
const tracked_objects::Location& from_here,
- const scoped_refptr<base::TaskRunner>& task_runner,
+ const scoped_refptr<base::TaskRunner>& destination_runner,
const base::Closure& task) {
if (IsBrowserStartupComplete()) {
- task_runner->PostTask(from_here, task);
+ destination_runner->PostTask(from_here, task);
return;
}
std::unique_ptr<AfterStartupTask> queued_task(
- new AfterStartupTask(from_here, task_runner, task));
+ new AfterStartupTask(from_here, destination_runner, task));
QueueTask(std::move(queued_task));
}
« no previous file with comments | « chrome/browser/after_startup_task_utils.h ('k') | chrome/browser/after_startup_task_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698