Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: jni/JniWebRequest.cpp

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Adressed first batch of review issues. Created April 16, 2014, 5:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « jni/JniLogSystem.cpp ('k') | jni/Utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « jni/JniLogSystem.cpp ('k') | jni/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld