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 #include "components/cronet/android/cronet_url_request_context_adapter.h" | 5 #include "components/cronet/android/cronet_url_request_context_adapter.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 if (quic_hint.alternate_port <= std::numeric_limits<uint16>::min() || | 191 if (quic_hint.alternate_port <= std::numeric_limits<uint16>::min() || |
192 quic_hint.alternate_port > std::numeric_limits<uint16>::max()) { | 192 quic_hint.alternate_port > std::numeric_limits<uint16>::max()) { |
193 LOG(ERROR) << "Invalid QUIC hint alternate port: " | 193 LOG(ERROR) << "Invalid QUIC hint alternate port: " |
194 << quic_hint.alternate_port; | 194 << quic_hint.alternate_port; |
195 continue; | 195 continue; |
196 } | 196 } |
197 | 197 |
198 net::HostPortPair quic_hint_host_port_pair(canon_host, | 198 net::HostPortPair quic_hint_host_port_pair(canon_host, |
199 quic_hint.port); | 199 quic_hint.port); |
200 context_->http_server_properties()->SetAlternateProtocol( | 200 context_->http_server_properties()->AddAlternateProtocol( |
201 quic_hint_host_port_pair, | 201 quic_hint_host_port_pair, |
202 static_cast<uint16>(quic_hint.alternate_port), | 202 static_cast<uint16>(quic_hint.alternate_port), |
203 net::AlternateProtocol::QUIC, | 203 net::AlternateProtocol::QUIC, 1.0f); |
204 1.0f); | |
205 } | 204 } |
206 } | 205 } |
207 | 206 |
208 JNIEnv* env = base::android::AttachCurrentThread(); | 207 JNIEnv* env = base::android::AttachCurrentThread(); |
209 Java_CronetUrlRequestContext_initNetworkThread( | 208 Java_CronetUrlRequestContext_initNetworkThread( |
210 env, jcronet_url_request_context.obj()); | 209 env, jcronet_url_request_context.obj()); |
211 | 210 |
212 is_context_initialized_ = true; | 211 is_context_initialized_ = true; |
213 while (!tasks_waiting_for_context_.empty()) { | 212 while (!tasks_waiting_for_context_.empty()) { |
214 tasks_waiting_for_context_.front().Run(); | 213 tasks_waiting_for_context_.front().Run(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 323 } |
325 | 324 |
326 static jint SetMinLogLevel(JNIEnv* env, jclass jcaller, jint jlog_level) { | 325 static jint SetMinLogLevel(JNIEnv* env, jclass jcaller, jint jlog_level) { |
327 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); | 326 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); |
328 // MinLogLevel is global, shared by all URLRequestContexts. | 327 // MinLogLevel is global, shared by all URLRequestContexts. |
329 logging::SetMinLogLevel(static_cast<int>(jlog_level)); | 328 logging::SetMinLogLevel(static_cast<int>(jlog_level)); |
330 return old_log_level; | 329 return old_log_level; |
331 } | 330 } |
332 | 331 |
333 } // namespace cronet | 332 } // namespace cronet |
OLD | NEW |