Chromium Code Reviews| 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/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 22 } // namespace base | 23 } // namespace base |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 class WriteToFileNetLogObserver; | 26 class WriteToFileNetLogObserver; |
| 26 class URLRequestContext; | 27 class URLRequestContext; |
| 27 class ProxyConfigService; | 28 class ProxyConfigService; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 87 |
| 87 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; | 88 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; |
| 88 | 89 |
| 89 void StartNetLogToFileOnNetworkThread(const std::string& file_name, | 90 void StartNetLogToFileOnNetworkThread(const std::string& file_name, |
| 90 bool log_all); | 91 bool log_all); |
| 91 | 92 |
| 92 void StopNetLogOnNetworkThread(); | 93 void StopNetLogOnNetworkThread(); |
| 93 | 94 |
| 94 // Network thread is owned by |this|, but is destroyed from java thread. | 95 // Network thread is owned by |this|, but is destroyed from java thread. |
| 95 base::Thread* network_thread_; | 96 base::Thread* network_thread_; |
| 97 scoped_ptr<base::Thread> file_thread_; | |
|
mmenke
2015/05/20 18:33:41
Should probably mention this should be destroyed l
xunjieli
2015/05/20 21:06:12
Done.
| |
| 96 // |write_to_file_observer_| and |context_| should only be accessed on | 98 // |write_to_file_observer_| and |context_| should only be accessed on |
| 97 // network thread. | 99 // network thread. |
| 98 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 100 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
| 99 scoped_ptr<net::URLRequestContext> context_; | 101 scoped_ptr<net::URLRequestContext> context_; |
| 100 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 102 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 103 // |sdch_owner_| should be destroyed before |json_pref_store_|, because | |
| 104 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending | |
| 105 // writes to the disk. | |
| 106 scoped_refptr<JsonPrefStore> json_pref_store_; | |
| 101 scoped_ptr<net::SdchOwner> sdch_owner_; | 107 scoped_ptr<net::SdchOwner> sdch_owner_; |
| 102 | 108 |
| 103 // Context config is only valid untng context is initialized. | 109 // Context config is only valid untng context is initialized. |
| 104 scoped_ptr<URLRequestContextConfig> context_config_; | 110 scoped_ptr<URLRequestContextConfig> context_config_; |
| 105 | 111 |
| 106 // A queue of tasks that need to be run after context has been initialized. | 112 // A queue of tasks that need to be run after context has been initialized. |
| 107 std::queue<base::Closure> tasks_waiting_for_context_; | 113 std::queue<base::Closure> tasks_waiting_for_context_; |
| 108 bool is_context_initialized_; | 114 bool is_context_initialized_; |
| 109 int default_load_flags_; | 115 int default_load_flags_; |
| 110 | 116 |
| 111 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 117 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 112 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 118 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
| 113 #endif | 119 #endif |
| 114 | 120 |
| 115 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 121 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
| 116 }; | 122 }; |
| 117 | 123 |
| 118 } // namespace cronet | 124 } // namespace cronet |
| 119 | 125 |
| 120 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 126 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| OLD | NEW |