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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 83 |
| 83 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; | 84 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; |
| 84 | 85 |
| 85 void StartNetLogToFileOnNetworkThread(const std::string& file_name, | 86 void StartNetLogToFileOnNetworkThread(const std::string& file_name, |
| 86 bool log_all); | 87 bool log_all); |
| 87 | 88 |
| 88 void StopNetLogOnNetworkThread(); | 89 void StopNetLogOnNetworkThread(); |
| 89 | 90 |
| 90 // Network thread is owned by |this|, but is destroyed from java thread. | 91 // Network thread is owned by |this|, but is destroyed from java thread. |
| 91 base::Thread* network_thread_; | 92 base::Thread* network_thread_; |
| 93 scoped_ptr<base::Thread> file_thread_; | |
| 92 // |write_to_file_observer_| and |context_| should only be accessed on | 94 // |write_to_file_observer_| and |context_| should only be accessed on |
| 93 // network thread. | 95 // network thread. |
| 94 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 96 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
| 95 scoped_ptr<net::URLRequestContext> context_; | 97 scoped_ptr<net::URLRequestContext> context_; |
| 96 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 98 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 99 scoped_refptr<JsonPrefStore> network_json_store_; | |
| 97 scoped_ptr<net::SdchOwner> sdch_owner_; | 100 scoped_ptr<net::SdchOwner> sdch_owner_; |
|
mef
2015/05/13 15:15:22
Should we add a comment that sdch_owner_ must be d
mmenke
2015/05/13 15:34:41
PrefStore is refcounted (shudder), so that's actua
mef
2015/05/13 15:50:09
Umm, but as long as we hold the ref to PrefStore w
xunjieli
2015/05/13 16:57:44
Done. Added comment about the order.
| |
| 98 | 101 |
| 99 // Context config is only valid untng context is initialized. | 102 // Context config is only valid untng context is initialized. |
| 100 scoped_ptr<URLRequestContextConfig> context_config_; | 103 scoped_ptr<URLRequestContextConfig> context_config_; |
| 101 | 104 |
| 102 // A queue of tasks that need to be run after context has been initialized. | 105 // A queue of tasks that need to be run after context has been initialized. |
| 103 std::queue<base::Closure> tasks_waiting_for_context_; | 106 std::queue<base::Closure> tasks_waiting_for_context_; |
| 104 bool is_context_initialized_; | 107 bool is_context_initialized_; |
| 105 int default_load_flags_; | 108 int default_load_flags_; |
| 106 | 109 |
| 107 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 110 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 } // namespace cronet | 113 } // namespace cronet |
| 111 | 114 |
| 112 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 115 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| OLD | NEW |