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

Side by Side Diff: libadblockplus-android/jni/JniSubscription.cpp

Issue 29361445: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Patch Set: renamings, updated README Created Dec. 19, 2016, 3:04 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
OLDNEW
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 10 matching lines...) Expand all
21 21
22 static AdblockPlus::Subscription* GetSubscriptionPtr(jlong ptr) 22 static AdblockPlus::Subscription* GetSubscriptionPtr(jlong ptr)
23 { 23 {
24 return JniLongToTypePtr<AdblockPlus::SubscriptionPtr>(ptr)->get(); 24 return JniLongToTypePtr<AdblockPlus::SubscriptionPtr>(ptr)->get();
25 } 25 }
26 26
27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue) 27 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong jsValue)
28 { 28 {
29 try 29 try
30 { 30 {
31 return JniPtrToLong(new AdblockPlus::SubscriptionPtr(new AdblockPlus::Subscr iption(JniGetJsValuePtr(jsValue)))); 31 AdblockPlus::JsValue *jsValuePtr = JniGetJsValue(jsValue);
32 return JniPtrToLong(new AdblockPlus::SubscriptionPtr(new AdblockPlus::Subscr iption(
33 std::move(*jsValuePtr))));
32 } 34 }
33 CATCH_THROW_AND_RETURN(env, 0) 35 CATCH_THROW_AND_RETURN(env, 0)
34 } 36 }
35 37
36 static jboolean JNICALL JniIsListed(JNIEnv* env, jclass clazz, jlong ptr) 38 static jboolean JNICALL JniIsListed(JNIEnv* env, jclass clazz, jlong ptr)
37 { 39 {
38 try 40 try
39 { 41 {
40 return GetSubscriptionPtr(ptr)->IsListed() ? JNI_TRUE : JNI_FALSE; 42 return GetSubscriptionPtr(ptr)->IsListed() ? JNI_TRUE : JNI_FALSE;
41 } 43 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList }, 100 { (char*)"removeFromList", (char*)"(J)V", (void*)JniRemoveFromList },
99 { (char*)"updateFilters", (char*)"(J)V", (void*)JniUpdateFilters }, 101 { (char*)"updateFilters", (char*)"(J)V", (void*)JniUpdateFilters },
100 { (char*)"isUpdating", (char*)"(J)Z", (void*)JniIsUpdating }, 102 { (char*)"isUpdating", (char*)"(J)Z", (void*)JniIsUpdating },
101 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals } 103 { (char*)"operatorEquals", (char*)"(JJ)Z", (void*)JniOperatorEquals }
102 }; 104 };
103 105
104 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Subscripti on_registerNatives(JNIEnv *env, jclass clazz) 106 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_Subscripti on_registerNatives(JNIEnv *env, jclass clazz)
105 { 107 {
106 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 108 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
107 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld