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

Unified Diff: content/browser/after_startup_task_poster_impl.cc

Issue 949293002: Implement a poor man's PostAfterStartupTask() function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: content/browser/after_startup_task_poster_impl.cc
diff --git a/content/browser/after_startup_task_poster_impl.cc b/content/browser/after_startup_task_poster_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a19fe2ef6ddf5e766f373f757bddb1a3eef50318
--- /dev/null
+++ b/content/browser/after_startup_task_poster_impl.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/after_startup_task_poster_impl.h"
+#include "base/task_runner.h"
+
+namespace content {
+
+namespace {
+
+AfterStartupTaskPoster* g_task_poster = nullptr;
+
+}
+
+void DefaultAfterStartupTaskPoster::PostAfterStartup(
+ const tracked_objects::Location& from_here,
+ const scoped_refptr<base::TaskRunner>& task_runner,
+ const base::Closure& task) {
+ task_runner->PostTask(from_here, task);
+}
+
+void DefaultAfterStartupTaskPoster::PostAfterStartupAndReply(
+ const tracked_objects::Location& from_here,
+ const scoped_refptr<base::TaskRunner>& task_runner,
+ const base::Closure& task,
+ const base::Closure& reply) {
+ task_runner->PostTaskAndReply(from_here, task, reply);
+}
+
+AfterStartupTaskPoster& GetAfterStartupTaskPoster() {
+ DCHECK(g_task_poster) ;
+ return *g_task_poster;
+}
+
+void SetAfterStartupTaskPoster(AfterStartupTaskPoster* task_poster) {
+ DCHECK(task_poster);
+ DCHECK(!g_task_poster);
+ g_task_poster = task_poster;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698