| 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_URL_REQUEST_CONTEXT_ADAPTER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/prefs/json_pref_store.h" |
| 17 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 18 #include "net/log/net_log.h" | 19 #include "net/log/net_log.h" |
| 19 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
| 20 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 class WriteToFileNetLogObserver; | 24 class WriteToFileNetLogObserver; |
| 24 class ProxyConfigService; | 25 class ProxyConfigService; |
| 25 class SdchOwner; | 26 class SdchOwner; |
| 26 } // namespace net | 27 } // namespace net |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Initializes |context_| on the Network thread. | 93 // Initializes |context_| on the Network thread. |
| 93 void InitRequestContextOnNetworkThread(); | 94 void InitRequestContextOnNetworkThread(); |
| 94 | 95 |
| 95 // Helper function to start writing NetLog data to file. This should only be | 96 // Helper function to start writing NetLog data to file. This should only be |
| 96 // run after context is initialized. | 97 // run after context is initialized. |
| 97 void StartNetLogToFileHelper(const std::string& file_name, bool log_all); | 98 void StartNetLogToFileHelper(const std::string& file_name, bool log_all); |
| 98 // Helper function to stop writing NetLog data to file. This should only be | 99 // Helper function to stop writing NetLog data to file. This should only be |
| 99 // run after context is initialized. | 100 // run after context is initialized. |
| 100 void StopNetLogHelper(); | 101 void StopNetLogHelper(); |
| 101 | 102 |
| 103 base::Thread* network_thread_; |
| 104 scoped_ptr<base::Thread> file_thread_; |
| 105 |
| 102 scoped_refptr<URLRequestContextAdapterDelegate> delegate_; | 106 scoped_refptr<URLRequestContextAdapterDelegate> delegate_; |
| 103 scoped_ptr<net::URLRequestContext> context_; | 107 scoped_ptr<net::URLRequestContext> context_; |
| 104 std::string user_agent_; | 108 std::string user_agent_; |
| 105 bool load_disable_cache_; | 109 bool load_disable_cache_; |
| 106 base::Thread* network_thread_; | |
| 107 scoped_ptr<NetLogObserver> net_log_observer_; | 110 scoped_ptr<NetLogObserver> net_log_observer_; |
| 108 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 111 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
| 109 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 112 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 113 // |sdch_owner_| should be destroyed before |json_pref_store_|, because |
| 114 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending |
| 115 // writes to the disk. |
| 116 scoped_refptr<JsonPrefStore> json_pref_store_; |
| 110 scoped_ptr<net::SdchOwner> sdch_owner_; | 117 scoped_ptr<net::SdchOwner> sdch_owner_; |
| 111 scoped_ptr<URLRequestContextConfig> config_; | 118 scoped_ptr<URLRequestContextConfig> config_; |
| 112 | 119 |
| 113 // A queue of tasks that need to be run after context has been initialized. | 120 // A queue of tasks that need to be run after context has been initialized. |
| 114 std::queue<RunAfterContextInitTask> tasks_waiting_for_context_; | 121 std::queue<RunAfterContextInitTask> tasks_waiting_for_context_; |
| 115 bool is_context_initialized_; | 122 bool is_context_initialized_; |
| 116 | 123 |
| 117 DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter); | 124 DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter); |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 } // namespace cronet | 127 } // namespace cronet |
| 121 | 128 |
| 122 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ | 129 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| OLD | NEW |