OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/prefs/json_pref_store.h" | 18 #include "base/prefs/json_pref_store.h" |
19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
20 | 20 |
21 class PrefService; | 21 class PrefService; |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
25 } // namespace base | 25 } // namespace base |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 class HttpServerPropertiesManager; | 28 class HttpServerPropertiesManager; |
| 29 class NetLog; |
29 class ProxyConfigService; | 30 class ProxyConfigService; |
30 class SdchOwner; | 31 class SdchOwner; |
31 class URLRequestContext; | 32 class URLRequestContext; |
32 class WriteToFileNetLogObserver; | 33 class WriteToFileNetLogObserver; |
33 } // namespace net | 34 } // namespace net |
34 | 35 |
35 namespace cronet { | 36 namespace cronet { |
36 | 37 |
37 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 38 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
38 class CronetDataReductionProxy; | 39 class CronetDataReductionProxy; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // File thread should be destroyed last. | 105 // File thread should be destroyed last. |
105 scoped_ptr<base::Thread> file_thread_; | 106 scoped_ptr<base::Thread> file_thread_; |
106 | 107 |
107 // |write_to_file_observer_| and |context_| should only be accessed on | 108 // |write_to_file_observer_| and |context_| should only be accessed on |
108 // network thread. | 109 // network thread. |
109 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 110 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
110 | 111 |
111 // |pref_service_| should outlive the HttpServerPropertiesManager owned by | 112 // |pref_service_| should outlive the HttpServerPropertiesManager owned by |
112 // |context_|. | 113 // |context_|. |
113 scoped_ptr<PrefService> pref_service_; | 114 scoped_ptr<PrefService> pref_service_; |
| 115 scoped_ptr<net::NetLog> net_log_; |
114 scoped_ptr<net::URLRequestContext> context_; | 116 scoped_ptr<net::URLRequestContext> context_; |
115 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 117 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
116 scoped_refptr<JsonPrefStore> json_pref_store_; | 118 scoped_refptr<JsonPrefStore> json_pref_store_; |
117 net::HttpServerPropertiesManager* http_server_properties_manager_; | 119 net::HttpServerPropertiesManager* http_server_properties_manager_; |
118 | 120 |
119 // |sdch_owner_| should be destroyed before |json_pref_store_|, because | 121 // |sdch_owner_| should be destroyed before |json_pref_store_|, because |
120 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending | 122 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending |
121 // writes to the disk. | 123 // writes to the disk. |
122 scoped_ptr<net::SdchOwner> sdch_owner_; | 124 scoped_ptr<net::SdchOwner> sdch_owner_; |
123 | 125 |
124 // Context config is only valid until context is initialized. | 126 // Context config is only valid until context is initialized. |
125 scoped_ptr<URLRequestContextConfig> context_config_; | 127 scoped_ptr<URLRequestContextConfig> context_config_; |
126 | 128 |
127 // A queue of tasks that need to be run after context has been initialized. | 129 // A queue of tasks that need to be run after context has been initialized. |
128 std::queue<base::Closure> tasks_waiting_for_context_; | 130 std::queue<base::Closure> tasks_waiting_for_context_; |
129 bool is_context_initialized_; | 131 bool is_context_initialized_; |
130 int default_load_flags_; | 132 int default_load_flags_; |
131 | 133 |
132 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 134 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
133 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 135 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
134 #endif | 136 #endif |
135 | 137 |
136 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 138 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
137 }; | 139 }; |
138 | 140 |
139 } // namespace cronet | 141 } // namespace cronet |
140 | 142 |
141 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 143 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |