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

Delta Between Two Patch Sets: jni/JniWebRequest.cpp

Issue 4761138508070912: Issue 1848 - Clean up local reference handling (Closed)
Left Patch Set: Removed member variable prefixes Created Jan. 23, 2015, 1:16 p.m.
Right Patch Set: Stupid auto-formatter^^ Created Feb. 4, 2015, 12:04 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « jni/JniUpdateCheckDoneCallback.cpp ('k') | jni/Utils.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 27 matching lines...) Expand all
38 { 38 {
39 } 39 }
40 40
41 AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url, 41 AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url,
42 const AdblockPlus::HeaderList& requestHeaders) const 42 const AdblockPlus::HeaderList& requestHeaders) const
43 { 43 {
44 JNIEnvAcquire env(GetJavaVM()); 44 JNIEnvAcquire env(GetJavaVM());
45 45
46 jmethodID method = env->GetMethodID( 46 jmethodID method = env->GetMethodID(
47 *JniLocalReference<jclass>(*env, 47 *JniLocalReference<jclass>(*env,
48 env->GetObjectClass(GetCallbackObject())), "httpGET", 48 env->GetObjectClass(GetCallbackObject())),
49 "httpGET",
49 "(Ljava/lang/String;Ljava/util/List;)" TYP("ServerResponse")); 50 "(Ljava/lang/String;Ljava/util/List;)" TYP("ServerResponse"));
50 51
51 AdblockPlus::ServerResponse sResponse; 52 AdblockPlus::ServerResponse sResponse;
52 sResponse.status = AdblockPlus::WebRequest::NS_ERROR_FAILURE; 53 sResponse.status = AdblockPlus::WebRequest::NS_ERROR_FAILURE;
53 54
54 if (method) 55 if (method)
55 { 56 {
56 JniLocalReference<jobject> arrayList(*env, NewJniArrayList(*env)); 57 JniLocalReference<jobject> arrayList(*env, NewJniArrayList(*env));
57 58
58 for (AdblockPlus::HeaderList::const_iterator it = requestHeaders.begin(), 59 for (AdblockPlus::HeaderList::const_iterator it = requestHeaders.begin(),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 static JNINativeMethod methods[] = 101 static JNINativeMethod methods[] =
101 { 102 {
102 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, 103 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor },
103 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } 104 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
104 }; 105 };
105 106
106 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest _registerNatives(JNIEnv *env, jclass clazz) 107 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest _registerNatives(JNIEnv *env, jclass clazz)
107 { 108 {
108 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 109 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
109 } 110 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld