Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.h

Issue 2035313008: [Cronet] Make StartNetLog and StopNetLog synchronous in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/cronet/android/cronet_url_request_context_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Posts a task that might depend on the context being initialized 70 // Posts a task that might depend on the context being initialized
71 // to the network thread. 71 // to the network thread.
72 void PostTaskToNetworkThread(const tracked_objects::Location& posted_from, 72 void PostTaskToNetworkThread(const tracked_objects::Location& posted_from,
73 const base::Closure& callback); 73 const base::Closure& callback);
74 74
75 bool IsOnNetworkThread() const; 75 bool IsOnNetworkThread() const;
76 76
77 net::URLRequestContext* GetURLRequestContext(); 77 net::URLRequestContext* GetURLRequestContext();
78 78
79 // Starts NetLog logging to file. This can be called on any thread.
79 void StartNetLogToFile(JNIEnv* env, 80 void StartNetLogToFile(JNIEnv* env,
80 const base::android::JavaParamRef<jobject>& jcaller, 81 const base::android::JavaParamRef<jobject>& jcaller,
81 const base::android::JavaParamRef<jstring>& jfile_name, 82 const base::android::JavaParamRef<jstring>& jfile_name,
82 jboolean jlog_all); 83 jboolean jlog_all);
83 84
85 // Stops NetLog logging to file. This can be called on any thread. This will
86 // flush any remaining writes to disk.
84 void StopNetLog(JNIEnv* env, 87 void StopNetLog(JNIEnv* env,
85 const base::android::JavaParamRef<jobject>& jcaller); 88 const base::android::JavaParamRef<jobject>& jcaller);
86 89
87 // Default net::LOAD flags used to create requests. 90 // Default net::LOAD flags used to create requests.
88 int default_load_flags() const { return default_load_flags_; } 91 int default_load_flags() const { return default_load_flags_; }
89 92
90 // Called on main Java thread to initialize URLRequestContext. 93 // Called on main Java thread to initialize URLRequestContext.
91 void InitRequestContextOnMainThread(); 94 void InitRequestContextOnMainThread();
92 95
93 // Enables the network quality estimator and optionally configures it to 96 // Enables the network quality estimator and optionally configures it to
(...skipping 23 matching lines...) Expand all
117 const base::android::ScopedJavaGlobalRef<jobject>& 120 const base::android::ScopedJavaGlobalRef<jobject>&
118 jcronet_url_request_context); 121 jcronet_url_request_context);
119 122
120 // Runs a task that might depend on the context being initialized. 123 // Runs a task that might depend on the context being initialized.
121 // This method should only be run on the network thread. 124 // This method should only be run on the network thread.
122 void RunTaskAfterContextInitOnNetworkThread( 125 void RunTaskAfterContextInitOnNetworkThread(
123 const base::Closure& task_to_run_after_context_init); 126 const base::Closure& task_to_run_after_context_init);
124 127
125 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; 128 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const;
126 129
127 void StartNetLogToFileOnNetworkThread(const std::string& file_name,
128 bool log_all);
129
130 void StopNetLogOnNetworkThread();
131
132 // Gets the file thread. Create one if there is none. 130 // Gets the file thread. Create one if there is none.
133 base::Thread* GetFileThread(); 131 base::Thread* GetFileThread();
134 132
135 // Instantiate and configure the network quality estimator. For default 133 // Instantiate and configure the network quality estimator. For default
136 // behavior, parameters should be set to false; otherwise the estimator 134 // behavior, parameters should be set to false; otherwise the estimator
137 // can be configured to observe requests to localhost, as well as to use 135 // can be configured to observe requests to localhost, as well as to use
138 // observe smaller responses when estimating throughput. 136 // observe smaller responses when estimating throughput.
139 void EnableNetworkQualityEstimatorOnNetworkThread( 137 void EnableNetworkQualityEstimatorOnNetworkThread(
140 bool use_local_host_requests, 138 bool use_local_host_requests,
141 bool use_smaller_responses); 139 bool use_smaller_responses);
(...skipping 11 matching lines...) Expand all
153 int32_t throughput_kbps, 151 int32_t throughput_kbps,
154 const base::TimeTicks& timestamp, 152 const base::TimeTicks& timestamp,
155 net::NetworkQualityObservationSource source) override; 153 net::NetworkQualityObservationSource source) override;
156 154
157 // Network thread is owned by |this|, but is destroyed from java thread. 155 // Network thread is owned by |this|, but is destroyed from java thread.
158 base::Thread* network_thread_; 156 base::Thread* network_thread_;
159 157
160 // File thread should be destroyed last. 158 // File thread should be destroyed last.
161 std::unique_ptr<base::Thread> file_thread_; 159 std::unique_ptr<base::Thread> file_thread_;
162 160
163 // |write_to_file_observer_| and |context_| should only be accessed on 161 // |write_to_file_observer_| should only be accessed with
164 // network thread. 162 // |write_to_file_observer_lock_|.
165 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; 163 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_;
164 base::Lock write_to_file_observer_lock_;
166 165
167 // |pref_service_| should outlive the HttpServerPropertiesManager owned by 166 // |pref_service_| should outlive the HttpServerPropertiesManager owned by
168 // |context_|. 167 // |context_|.
169 std::unique_ptr<PrefService> pref_service_; 168 std::unique_ptr<PrefService> pref_service_;
170 std::unique_ptr<net::URLRequestContext> context_; 169 std::unique_ptr<net::URLRequestContext> context_;
171 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; 170 std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
172 scoped_refptr<JsonPrefStore> json_pref_store_; 171 scoped_refptr<JsonPrefStore> json_pref_store_;
173 net::HttpServerPropertiesManager* http_server_properties_manager_; 172 net::HttpServerPropertiesManager* http_server_properties_manager_;
174 173
175 // |sdch_owner_| should be destroyed before |json_pref_store_|, because 174 // |sdch_owner_| should be destroyed before |json_pref_store_|, because
(...skipping 18 matching lines...) Expand all
194 #if defined(DATA_REDUCTION_PROXY_SUPPORT) 193 #if defined(DATA_REDUCTION_PROXY_SUPPORT)
195 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; 194 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_;
196 #endif 195 #endif
197 196
198 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); 197 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
199 }; 198 };
200 199
201 } // namespace cronet 200 } // namespace cronet
202 201
203 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 202 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/cronet_url_request_context_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698