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 26 matching lines...) Expand all Loading... |
37 // URLRequestContext may be used). | 37 // URLRequestContext may be used). |
38 virtual scoped_refptr<base::SingleThreadTaskRunner> | 38 virtual scoped_refptr<base::SingleThreadTaskRunner> |
39 GetNetworkTaskRunner() const = 0; | 39 GetNetworkTaskRunner() const = 0; |
40 | 40 |
41 // Adds / removes an observer to watch for shutdown of |this|'s context. Must | 41 // 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 | 42 // only be called on network thread. May not be called once |
43 // GetURLRequestContext() starts returning nullptr. | 43 // GetURLRequestContext() starts returning nullptr. |
44 void AddObserver(URLRequestContextGetterObserver* observer); | 44 void AddObserver(URLRequestContextGetterObserver* observer); |
45 void RemoveObserver(URLRequestContextGetterObserver* observer); | 45 void RemoveObserver(URLRequestContextGetterObserver* observer); |
46 | 46 |
| 47 void AddRef() const; |
| 48 void Release() const; |
| 49 |
47 protected: | 50 protected: |
48 friend class base::RefCountedThreadSafe<URLRequestContextGetter, | 51 friend class base::RefCountedThreadSafe<URLRequestContextGetter, |
49 URLRequestContextGetterTraits>; | 52 URLRequestContextGetterTraits>; |
50 friend class base::DeleteHelper<URLRequestContextGetter>; | 53 friend class base::DeleteHelper<URLRequestContextGetter>; |
51 friend struct URLRequestContextGetterTraits; | 54 friend struct URLRequestContextGetterTraits; |
52 | 55 |
53 URLRequestContextGetter(); | 56 URLRequestContextGetter(); |
54 virtual ~URLRequestContextGetter(); | 57 virtual ~URLRequestContextGetter(); |
55 | 58 |
56 // Called to indicate the URLRequestContext is about to be shutdown, so | 59 // Called to indicate the URLRequestContext is about to be shutdown, so |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 101 |
99 URLRequestContext* context_; | 102 URLRequestContext* context_; |
100 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 103 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
101 | 104 |
102 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter); | 105 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter); |
103 }; | 106 }; |
104 | 107 |
105 } // namespace net | 108 } // namespace net |
106 | 109 |
107 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ | 110 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |