OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 CATCH_THROW_AND_RETURN(env, 0) | 26 CATCH_THROW_AND_RETURN(env, 0) |
27 } | 27 } |
28 | 28 |
29 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) | 29 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
30 { | 30 { |
31 delete JniLongToTypePtr<AdblockPlus::WebRequestPtr>(ptr); | 31 delete JniLongToTypePtr<AdblockPlus::WebRequestPtr>(ptr); |
32 } | 32 } |
33 | 33 |
34 JniWebRequest::JniWebRequest(JNIEnv* env, jobject callbackObject) | 34 JniWebRequest::JniWebRequest(JNIEnv* env, jobject callbackObject) |
35 : JniCallbackBase(env, callbackObject), AdblockPlus::WebRequest() | 35 : JniCallbackBase(env, callbackObject), AdblockPlus::WebRequest(), |
| 36 tupleClass(new JniGlobalReference<jclass>(env, env->FindClass("com/github/rj
eschke/neetutils/collections/Tuple"))), |
| 37 serverResponseClass(new JniGlobalReference<jclass>(env, env->FindClass(PKG("
ServerResponse")))) |
36 { | 38 { |
37 tupleClass.reset(new JniGlobalReference<jclass>(env, env->FindClass("com/githu
b/rjeschke/neetutils/collections/Tuple"))); | |
38 serverResponseClass.reset(new JniGlobalReference<jclass>(env, env->FindClass(P
KG("ServerResponse")))); | |
39 } | 39 } |
40 | 40 |
41 AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url, const Adb
lockPlus::HeaderList& requestHeaders) const | 41 AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url, const Adb
lockPlus::HeaderList& requestHeaders) const |
42 { | 42 { |
43 JNIEnvAcquire env(GetJavaVM()); | 43 JNIEnvAcquire env(GetJavaVM()); |
44 | 44 |
45 jclass clazz = env->GetObjectClass(GetCallbackObject()); | 45 jclass clazz = env->GetObjectClass(GetCallbackObject()); |
46 jmethodID method = env->GetMethodID(clazz, "httpGET", "(Ljava/lang/String;Ljav
a/util/List;)" TYP("ServerResponse")); | 46 jmethodID method = env->GetMethodID(clazz, "httpGET", "(Ljava/lang/String;Ljav
a/util/List;)" TYP("ServerResponse")); |
47 | 47 |
48 AdblockPlus::ServerResponse sResponse; | 48 AdblockPlus::ServerResponse sResponse; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 static JNINativeMethod methods[] = | 82 static JNINativeMethod methods[] = |
83 { | 83 { |
84 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, | 84 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, |
85 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 85 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
86 }; | 86 }; |
87 | 87 |
88 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest
_registerNatives(JNIEnv *env, jclass clazz) | 88 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest
_registerNatives(JNIEnv *env, jclass clazz) |
89 { | 89 { |
90 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 90 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
91 } | 91 } |
OLD | NEW |