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: addressed Diego's comments Created Jan. 19, 2018, 12:23 p.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
index a48f06e478904d861e20debb9a7d3fad12c90814..c5a80d945df434cb51209e706b5b97c26b57500b 100644
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngineProvider.java
@@ -19,8 +19,36 @@ 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();
- AdblockEngine getAdblockEngine();
+
+ /**
+ * Return AdblockEngine instance
+ * @return AdblockEngine instance. Can be `null` is 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();
}

Powered by Google App Engine
This is Rietveld