Index: libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java |
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java |
index f3d72d8fcd5fb844e30ee7c6b77be9986f149884..4b50519825be40471c2064127a50eb4f146a3dee 100644 |
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java |
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java |
@@ -19,9 +19,8 @@ package org.adblockplus.libadblockplus; |
import java.util.List; |
-public final class FilterEngine implements Disposable |
+public final class FilterEngine |
{ |
- private final Disposer disposer; |
protected final long ptr; |
anton
2017/09/06 06:21:27
since now it's platform ptr, not filter engine ptr
|
static |
@@ -36,15 +35,9 @@ public final class FilterEngine implements Disposable |
OBJECT_SUBREQUEST, FONT, MEDIA |
} |
- public FilterEngine(final JsEngine jsEngine, final IsAllowedConnectionCallback isSubscriptionDownloadAllowedCallback) |
+ FilterEngine(/* JniPlatform */long ptr) |
anton
2017/09/06 06:21:27
if it's renamed to `platformPtr` there is no need
anton
2017/09/06 06:21:27
`public` here is required. Otherwise it's `package
sergei
2017/09/08 09:45:01
Totally agree with the constructor argument, renam
sergei
2017/09/08 09:45:01
I actually wanted it, so FilterEngine can be creat
anton
2017/09/08 10:19:19
Let's make it `public`.
We did not introduce `pack
sergei
2017/09/08 12:25:30
But in this case anyone can call a constructor of
diegocarloslima
2017/09/08 20:42:41
Since this project is meant to be distributed as a
|
{ |
- this.ptr = ctor(jsEngine.ptr, isSubscriptionDownloadAllowedCallback); |
- this.disposer = new Disposer(this, new DisposeWrapper(this.ptr)); |
- } |
- |
- public FilterEngine(final JsEngine jsEngine) |
- { |
- this(jsEngine, null); |
+ this.ptr = ptr; |
} |
public boolean isFirstRun() |
@@ -202,32 +195,8 @@ public final class FilterEngine implements Disposable |
updateFiltersAsync(this.ptr, subscriptionUrl); |
} |
- @Override |
- public void dispose() |
- { |
- this.disposer.dispose(); |
- } |
- |
- private final static class DisposeWrapper implements Disposable |
- { |
- private final long ptr; |
- |
- public DisposeWrapper(final long ptr) |
- { |
- this.ptr = ptr; |
- } |
- |
- @Override |
- public void dispose() |
- { |
- dtor(this.ptr); |
- } |
- } |
- |
private final static native void registerNatives(); |
- private final static native long ctor(long jsEnginePtr, IsAllowedConnectionCallback isSubscriptionDownloadAllowedCallback); |
- |
private final static native boolean isFirstRun(long ptr); |
anton
2017/09/06 06:21:27
i'd suggest to rename all `ptr` to `platformPtr` i
sergei
2017/09/08 09:45:01
see my thoughts about opaque pointer role, let's d
|
private final static native Filter getFilter(long ptr, String text); |
@@ -283,6 +252,4 @@ public final class FilterEngine implements Disposable |
private final static native String getAcceptableAdsSubscriptionURL(long ptr); |
private final static native void updateFiltersAsync(long ptr, String subscriptionUrl); |
- |
- private final static native void dtor(long ptr); |
} |