OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 struct URLRequestContextGetterTraits; | 23 struct URLRequestContextGetterTraits; |
24 | 24 |
25 // Interface for retrieving an URLRequestContext. | 25 // Interface for retrieving an URLRequestContext. |
26 class NET_EXPORT URLRequestContextGetter | 26 class NET_EXPORT URLRequestContextGetter |
27 : public base::RefCountedThreadSafe<URLRequestContextGetter, | 27 : public base::RefCountedThreadSafe<URLRequestContextGetter, |
28 URLRequestContextGetterTraits> { | 28 URLRequestContextGetterTraits> { |
29 public: | 29 public: |
30 // Returns the URLRequestContextGetter's URLRequestContext. Must only be | 30 // Returns the URLRequestContextGetter's URLRequestContext. Must only be |
31 // called on the network task runner. Once NotifyContextShuttingDown() is | 31 // called on the network task runner. Once NotifyContextShuttingDown() is |
32 // invoked, must always return nullptr. | 32 // invoked, must always return nullptr. Does not transfer ownership of |
| 33 // the URLRequestContext. |
33 virtual URLRequestContext* GetURLRequestContext() = 0; | 34 virtual URLRequestContext* GetURLRequestContext() = 0; |
34 | 35 |
35 // Returns a SingleThreadTaskRunner corresponding to the thread on | 36 // Returns a SingleThreadTaskRunner corresponding to the thread on |
36 // which the network IO happens (the thread on which the returned | 37 // which the network IO happens (the thread on which the returned |
37 // URLRequestContext may be used). | 38 // URLRequestContext may be used). |
38 virtual scoped_refptr<base::SingleThreadTaskRunner> | 39 virtual scoped_refptr<base::SingleThreadTaskRunner> |
39 GetNetworkTaskRunner() const = 0; | 40 GetNetworkTaskRunner() const = 0; |
40 | 41 |
41 // Adds / removes an observer to watch for shutdown of |this|'s context. Must | 42 // Adds / removes an observer to watch for shutdown of |this|'s context. Must |
42 // only be called on network thread. May not be called once | 43 // only be called on network thread. May not be called once |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 99 |
99 URLRequestContext* context_; | 100 URLRequestContext* context_; |
100 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 101 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter); | 103 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace net | 106 } // namespace net |
106 | 107 |
107 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ | 108 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |