Index: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java |
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..75134081f192c57d265fff7b29ca5ad76af2bf4e |
--- /dev/null |
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java |
@@ -0,0 +1,54 @@ |
+/* |
+ * This file is part of Adblock Plus <https://adblockplus.org/>, |
+ * Copyright (C) 2006-present eyeo GmbH |
+ * |
+ * Adblock Plus is free software: you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 3 as |
+ * published by the Free Software Foundation. |
+ * |
+ * Adblock Plus is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ */ |
+ |
+package org.adblockplus.libadblockplus.android; |
+ |
+public interface AdblockEngineProvider |
+{ |
+ /** |
+ * Register AdblockEngine client |
+ * @param asynchronous If `true` engines will be created in background thread without locking of |
+ * current thread. Use waitForReady() before getEngine() later. |
+ * If `false` locks current thread. |
+ * @return if a new instance is allocated |
+ */ |
+ boolean retain(boolean asynchronous); |
+ |
+ /** |
+ * Wait until everything is ready (used for `retain(true)`) |
+ * Warning: locks current thread |
+ */ |
+ void waitForReady(); |
+ |
+ /** |
+ * Return AdblockEngine instance |
+ * @return AdblockEngine instance. Can be `null` if not yet retained or already released |
+ */ |
+ AdblockEngine getEngine(); |
+ |
+ /** |
+ * Unregister AdblockEngine client |
+ * @return `true` if the last instance is destroyed |
+ */ |
+ boolean release(); |
+ |
+ /** |
+ * Get registered clients count |
+ * @return registered clients count |
+ */ |
+ int getCounter(); |
+} |