| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // pending requests can be torn down safely. Right before calling this method, | 61 // pending requests can be torn down safely. Right before calling this method, |
| 62 // subclasses must ensure GetURLRequestContext returns nullptr, to protect | 62 // subclasses must ensure GetURLRequestContext returns nullptr, to protect |
| 63 // against reentrancy. | 63 // against reentrancy. |
| 64 void NotifyContextShuttingDown(); | 64 void NotifyContextShuttingDown(); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 // OnDestruct is used to ensure deletion on the thread on which the request | 67 // OnDestruct is used to ensure deletion on the thread on which the request |
| 68 // IO happens. | 68 // IO happens. |
| 69 void OnDestruct() const; | 69 void OnDestruct() const; |
| 70 | 70 |
| 71 ObserverList<URLRequestContextGetterObserver> observer_list_; | 71 base::ObserverList<URLRequestContextGetterObserver> observer_list_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); | 73 DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 struct URLRequestContextGetterTraits { | 76 struct URLRequestContextGetterTraits { |
| 77 static void Destruct(const URLRequestContextGetter* context_getter) { | 77 static void Destruct(const URLRequestContextGetter* context_getter) { |
| 78 context_getter->OnDestruct(); | 78 context_getter->OnDestruct(); |
| 79 } | 79 } |
| 80 }; | 80 }; |
| 81 | 81 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 98 | 98 |
| 99 URLRequestContext* context_; | 99 URLRequestContext* context_; |
| 100 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 100 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter); | 102 DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace net | 105 } // namespace net |
| 106 | 106 |
| 107 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ | 107 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_H_ |
| OLD | NEW |