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 "cronet_url_request_adapter.h" | 5 #include "cronet_url_request_adapter.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 using base::android::ConvertUTF8ToJavaString; | 26 using base::android::ConvertUTF8ToJavaString; |
27 | 27 |
28 namespace cronet { | 28 namespace cronet { |
29 | 29 |
30 // Explicitly register static JNI functions. | 30 // Explicitly register static JNI functions. |
31 bool CronetUrlRequestAdapterRegisterJni(JNIEnv* env) { | 31 bool CronetUrlRequestAdapterRegisterJni(JNIEnv* env) { |
32 return RegisterNativesImpl(env); | 32 return RegisterNativesImpl(env); |
33 } | 33 } |
34 | 34 |
35 static jlong CreateRequestAdapter(JNIEnv* env, | 35 static jlong CreateRequestAdapter(JNIEnv* env, |
36 jobject jurl_request, | 36 const JavaParamRef<jobject>& jurl_request, |
37 jlong jurl_request_context_adapter, | 37 jlong jurl_request_context_adapter, |
38 jstring jurl_string, | 38 const JavaParamRef<jstring>& jurl_string, |
39 jint jpriority) { | 39 jint jpriority) { |
40 CronetURLRequestContextAdapter* context_adapter = | 40 CronetURLRequestContextAdapter* context_adapter = |
41 reinterpret_cast<CronetURLRequestContextAdapter*>( | 41 reinterpret_cast<CronetURLRequestContextAdapter*>( |
42 jurl_request_context_adapter); | 42 jurl_request_context_adapter); |
43 DCHECK(context_adapter); | 43 DCHECK(context_adapter); |
44 | 44 |
45 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl_string)); | 45 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl_string)); |
46 | 46 |
47 VLOG(1) << "New chromium network request_adapter: " | 47 VLOG(1) << "New chromium network request_adapter: " |
48 << url.possibly_invalid_spec(); | 48 << url.possibly_invalid_spec(); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 VLOG(1) << "Error " << net::ErrorToString(net_error) | 378 VLOG(1) << "Error " << net::ErrorToString(net_error) |
379 << " on chromium request: " << initial_url_.possibly_invalid_spec(); | 379 << " on chromium request: " << initial_url_.possibly_invalid_spec(); |
380 JNIEnv* env = base::android::AttachCurrentThread(); | 380 JNIEnv* env = base::android::AttachCurrentThread(); |
381 cronet::Java_CronetUrlRequest_onError( | 381 cronet::Java_CronetUrlRequest_onError( |
382 env, owner_.obj(), net_error, | 382 env, owner_.obj(), net_error, |
383 ConvertUTF8ToJavaString(env, net::ErrorToString(net_error)).obj()); | 383 ConvertUTF8ToJavaString(env, net::ErrorToString(net_error)).obj()); |
384 return true; | 384 return true; |
385 } | 385 } |
386 | 386 |
387 } // namespace cronet | 387 } // namespace cronet |
OLD | NEW |