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 | |
pauljensen
2015/07/06 16:31:46
Can we remove this new line? and the one on line 1
xunjieli
2015/07/06 19:40:03
Partially done. I still left a new line before var
| |
111 // |pref_service_| should outlive the HttpServerPropertiesManager owned by | |
112 // |context_|. | |
113 scoped_ptr<PrefService> pref_service_; | |
114 | |
107 scoped_ptr<net::URLRequestContext> context_; | 115 scoped_ptr<net::URLRequestContext> context_; |
116 | |
108 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 117 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
109 | 118 |
119 scoped_refptr<JsonPrefStore> json_pref_store_; | |
pauljensen
2015/07/06 16:31:46
why is this line moved up?
xunjieli
2015/07/06 19:40:03
Before this CL, only sdch_owner uses json_pref_sto
| |
120 | |
110 // |sdch_owner_| should be destroyed before |json_pref_store_|, because | 121 // |sdch_owner_| should be destroyed before |json_pref_store_|, because |
111 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending | 122 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending |
112 // writes to the disk. | 123 // writes to the disk. |
113 scoped_refptr<JsonPrefStore> json_pref_store_; | |
114 scoped_ptr<net::SdchOwner> sdch_owner_; | 124 scoped_ptr<net::SdchOwner> sdch_owner_; |
115 | 125 |
116 // Context config is only valid untng context is initialized. | 126 // Context config is only valid untng context is initialized. |
pauljensen
2015/07/06 16:31:46
untng->until
xunjieli
2015/07/06 19:40:03
Done.
| |
117 scoped_ptr<URLRequestContextConfig> context_config_; | 127 scoped_ptr<URLRequestContextConfig> context_config_; |
118 | 128 |
119 // 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. |
120 std::queue<base::Closure> tasks_waiting_for_context_; | 130 std::queue<base::Closure> tasks_waiting_for_context_; |
131 | |
121 bool is_context_initialized_; | 132 bool is_context_initialized_; |
133 | |
122 int default_load_flags_; | 134 int default_load_flags_; |
123 | 135 |
124 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 136 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
125 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 137 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
126 #endif | 138 #endif |
127 | 139 |
128 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 140 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
129 }; | 141 }; |
130 | 142 |
131 } // namespace cronet | 143 } // namespace cronet |
132 | 144 |
133 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 145 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |