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 #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 net::AlternativeService alternative_service( |
| 201 quic_hint_host_port_pair, | 201 net::AlternateProtocol::QUIC, "", |
|
Bence
2015/03/20 13:46:06
Note: empty host string means default host, that i
| |
| 202 static_cast<uint16>(quic_hint.alternate_port), | 202 static_cast<uint16>(quic_hint.alternate_port)); |
| 203 net::AlternateProtocol::QUIC, | 203 context_->http_server_properties()->SetAlternativeService( |
| 204 1.0f); | 204 quic_hint_host_port_pair, alternative_service, 1.0f); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 JNIEnv* env = base::android::AttachCurrentThread(); | 208 JNIEnv* env = base::android::AttachCurrentThread(); |
| 209 Java_CronetUrlRequestContext_initNetworkThread( | 209 Java_CronetUrlRequestContext_initNetworkThread( |
| 210 env, jcronet_url_request_context.obj()); | 210 env, jcronet_url_request_context.obj()); |
| 211 | 211 |
| 212 is_context_initialized_ = true; | 212 is_context_initialized_ = true; |
| 213 while (!tasks_waiting_for_context_.empty()) { | 213 while (!tasks_waiting_for_context_.empty()) { |
| 214 tasks_waiting_for_context_.front().Run(); | 214 tasks_waiting_for_context_.front().Run(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 } | 322 } |
| 323 | 323 |
| 324 static jint SetMinLogLevel(JNIEnv* env, jclass jcaller, jint jlog_level) { | 324 static jint SetMinLogLevel(JNIEnv* env, jclass jcaller, jint jlog_level) { |
| 325 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); | 325 jint old_log_level = static_cast<jint>(logging::GetMinLogLevel()); |
| 326 // MinLogLevel is global, shared by all URLRequestContexts. | 326 // MinLogLevel is global, shared by all URLRequestContexts. |
| 327 logging::SetMinLogLevel(static_cast<int>(jlog_level)); | 327 logging::SetMinLogLevel(static_cast<int>(jlog_level)); |
| 328 return old_log_level; | 328 return old_log_level; |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace cronet | 331 } // namespace cronet |
| OLD | NEW |