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

Unified Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java

Issue 29671734: Issue 6265 - Create shared AdblockEngine instance in AdblockWebView in background (Closed)
Patch Set: Sergey's comments Created Jan. 22, 2018, 6:19 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+}
« no previous file with comments | « libadblockplus-android/pom.xml ('k') | libadblockplus-android/src/org/adblockplus/libadblockplus/android/ConnectionType.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld