OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_LOADER_LOADER_GLOBALS_H_ |
| 6 #define CONTENT_BROWSER_LOADER_LOADER_GLOBALS_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "content/common/content_export.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // Contains global state for the network loader sources. Only one instance of |
| 15 // this class is active at any given point. |
| 16 class CONTENT_EXPORT LoaderGlobals { |
| 17 public: |
| 18 // Returns a pointer to the global instance. |
| 19 static LoaderGlobals* Get(); |
| 20 |
| 21 LoaderGlobals( |
| 22 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_runner, |
| 23 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner); |
| 24 |
| 25 ~LoaderGlobals(); |
| 26 |
| 27 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner() const { |
| 28 return io_thread_task_runner_; |
| 29 } |
| 30 |
| 31 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner() const { |
| 32 return main_thread_task_runner_; |
| 33 } |
| 34 |
| 35 private: |
| 36 // Task runner to be used for posting tasks to the main thread. |
| 37 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 38 |
| 39 // Task runner to be used for posting tasks to the IO thread. |
| 40 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
| 41 }; |
| 42 |
| 43 } // namespace content |
| 44 |
| 45 #endif // CONTENT_BROWSER_LOADER_LOADER_GLOBALS_H_ |
OLD | NEW |