aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionary.java
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2013-09-30 13:57:54 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2013-09-30 13:57:54 +0900
commitc18510049a3422c88ed3ab3bbc64944c94a611fd (patch)
tree41f1ff63b0a00aeb5afc722e6bd19df52f3adcdb /java/src/com/android/inputmethod/latin/BinaryDictionary.java
parent1cf4789ba6abb5855392d542bb075c12d2d9b6a0 (diff)
downloadlatinime-c18510049a3422c88ed3ab3bbc64944c94a611fd.tar.gz
latinime-c18510049a3422c88ed3ab3bbc64944c94a611fd.tar.xz
latinime-c18510049a3422c88ed3ab3bbc64944c94a611fd.zip
Prepare dictionary decay.
Bug: 6669677 Change-Id: I8fbae190dd44a6bdbee7e9b6d3a16208322727f7
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index 6ec7aeec3..29c6c0451 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -115,7 +115,7 @@ public final class BinaryDictionary extends Dictionary {
private static native long openNative(String sourceDir, long dictOffset, long dictSize,
boolean isUpdatable);
private static native void flushNative(long dict, String filePath);
- private static native boolean needsToRunGCNative(long dict);
+ private static native boolean needsToRunGCNative(long dict, boolean mindsBlockByGC);
private static native void flushWithGCNative(long dict, String filePath);
private static native void closeNative(long dict);
private static native int getProbabilityNative(long dict, int[] word);
@@ -270,7 +270,7 @@ public final class BinaryDictionary extends Dictionary {
}
private void runGCIfRequired() {
- if (needsToRunGCNative(mNativeDict)) {
+ if (needsToRunGC(true /* mindsBlockByGC */)) {
flushWithGC();
}
}
@@ -326,9 +326,15 @@ public final class BinaryDictionary extends Dictionary {
reopen();
}
- public boolean needsToRunGC() {
+ /**
+ * Checks whether GC is needed to run or not.
+ * @param mindsBlockByGC Whether to mind operations blocked by GC. We don't need to care about
+ * the blocking in some situations such as in idle time or just before closing.
+ * @return whether GC is needed to run or not.
+ */
+ public boolean needsToRunGC(final boolean mindsBlockByGC) {
if (!isValidDictionary()) return false;
- return needsToRunGCNative(mNativeDict);
+ return needsToRunGCNative(mNativeDict, mindsBlockByGC);
}
@UsedForTesting