Index: content/browser/loader/loader_globals.h |
diff --git a/content/browser/loader/loader_globals.h b/content/browser/loader/loader_globals.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4ec520b2fbb19bd2bebf1a57a73486787dc279bd |
--- /dev/null |
+++ b/content/browser/loader/loader_globals.h |
@@ -0,0 +1,45 @@ |
+// Copyright (c) 2017 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. |
+ |
+#ifndef CONTENT_BROWSER_LOADER_LOADER_GLOBALS_H_ |
+#define CONTENT_BROWSER_LOADER_LOADER_GLOBALS_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/single_thread_task_runner.h" |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+ |
+// Contains global state for the network loader sources. Only one instance of |
+// this class is active at any given point. |
+class CONTENT_EXPORT LoaderGlobals { |
+ public: |
+ // Returns a pointer to the global instance. |
+ static LoaderGlobals* Get(); |
+ |
+ LoaderGlobals( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_runner, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner); |
+ |
+ ~LoaderGlobals(); |
+ |
+ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner() const { |
+ return io_thread_task_runner_; |
+ } |
+ |
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner() const { |
+ return main_thread_task_runner_; |
+ } |
+ |
+ private: |
+ // Task runner to be used for posting tasks to the main thread. |
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
+ |
+ // Task runner to be used for posting tasks to the IO thread. |
+ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_LOADER_LOADER_GLOBALS_H_ |