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; | |
22 | |
21 namespace base { | 23 namespace base { |
22 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
23 } // namespace base | 25 } // namespace base |
24 | 26 |
25 namespace net { | 27 namespace net { |
26 class WriteToFileNetLogObserver; | 28 class HttpServerPropertiesManager; |
27 class URLRequestContext; | |
28 class ProxyConfigService; | 29 class ProxyConfigService; |
29 class SdchOwner; | 30 class SdchOwner; |
31 class URLRequestContext; | |
32 class WriteToFileNetLogObserver; | |
30 } // namespace net | 33 } // namespace net |
31 | 34 |
32 namespace cronet { | 35 namespace cronet { |
33 | 36 |
34 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 37 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
35 class CronetDataReductionProxy; | 38 class CronetDataReductionProxy; |
36 #endif | 39 #endif |
37 | 40 |
38 struct URLRequestContextConfig; | 41 struct URLRequestContextConfig; |
39 | 42 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 | 100 |
98 // Network thread is owned by |this|, but is destroyed from java thread. | 101 // Network thread is owned by |this|, but is destroyed from java thread. |
99 base::Thread* network_thread_; | 102 base::Thread* network_thread_; |
100 | 103 |
101 // File thread should be destroyed last. | 104 // File thread should be destroyed last. |
102 scoped_ptr<base::Thread> file_thread_; | 105 scoped_ptr<base::Thread> file_thread_; |
103 | 106 |
104 // |write_to_file_observer_| and |context_| should only be accessed on | 107 // |write_to_file_observer_| and |context_| should only be accessed on |
105 // network thread. | 108 // network thread. |
106 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 109 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
110 // |pref_service_| should outlive |http_server_properties_manager_|. | |
pauljensen
2015/07/01 18:42:22
change |http_server_properties_manager_| to refer
xunjieli
2015/07/06 14:58:02
Done.
| |
111 scoped_ptr<PrefService> pref_service_; | |
107 scoped_ptr<net::URLRequestContext> context_; | 112 scoped_ptr<net::URLRequestContext> context_; |
108 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 113 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
109 | 114 |
115 scoped_refptr<JsonPrefStore> json_pref_store_; | |
116 scoped_ptr<net::HttpServerPropertiesManager> http_server_properties_manager_; | |
pauljensen
2015/07/01 18:42:22
this doesn't need to be a class member anymore as
xunjieli
2015/07/06 14:58:02
Done.
| |
110 // |sdch_owner_| should be destroyed before |json_pref_store_|, because | 117 // |sdch_owner_| should be destroyed before |json_pref_store_|, because |
111 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending | 118 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending |
112 // writes to the disk. | 119 // writes to the disk. |
113 scoped_refptr<JsonPrefStore> json_pref_store_; | |
114 scoped_ptr<net::SdchOwner> sdch_owner_; | 120 scoped_ptr<net::SdchOwner> sdch_owner_; |
115 | 121 |
116 // Context config is only valid untng context is initialized. | 122 // Context config is only valid untng context is initialized. |
117 scoped_ptr<URLRequestContextConfig> context_config_; | 123 scoped_ptr<URLRequestContextConfig> context_config_; |
118 | 124 |
119 // A queue of tasks that need to be run after context has been initialized. | 125 // A queue of tasks that need to be run after context has been initialized. |
120 std::queue<base::Closure> tasks_waiting_for_context_; | 126 std::queue<base::Closure> tasks_waiting_for_context_; |
121 bool is_context_initialized_; | 127 bool is_context_initialized_; |
122 int default_load_flags_; | 128 int default_load_flags_; |
123 | 129 |
124 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 130 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
125 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 131 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
126 #endif | 132 #endif |
127 | 133 |
128 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 134 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
129 }; | 135 }; |
130 | 136 |
131 } // namespace cronet | 137 } // namespace cronet |
132 | 138 |
133 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 139 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |