am 3acbf7d0: Merge "Add BinaryDictionary.flushWithGCIfHasUpdated()."
* commit '3acbf7d00c8bf67487b3fc575df675262e5c4ede': Add BinaryDictionary.flushWithGCIfHasUpdated().main
commit
db9db4620f
|
@ -460,6 +460,7 @@ public final class BinaryDictionary extends Dictionary {
|
|||
dictFile.length(), mIsUpdatable);
|
||||
}
|
||||
|
||||
// Flush to dict file if the dictionary has been updated.
|
||||
public void flush() {
|
||||
if (!isValidDictionary()) return;
|
||||
if (mHasUpdated) {
|
||||
|
@ -468,6 +469,14 @@ public final class BinaryDictionary extends Dictionary {
|
|||
}
|
||||
}
|
||||
|
||||
// Run GC and flush to dict file if the dictionary has been updated.
|
||||
public void flushWithGCIfHasUpdated() {
|
||||
if (mHasUpdated) {
|
||||
flushWithGC();
|
||||
}
|
||||
}
|
||||
|
||||
// Run GC and flush to dict file.
|
||||
public void flushWithGC() {
|
||||
if (!isValidDictionary()) return;
|
||||
flushWithGCNative(mNativeDict, mDictFilePath);
|
||||
|
|
|
@ -515,7 +515,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||
createBinaryDictionaryLocked();
|
||||
openBinaryDictionaryLocked();
|
||||
loadInitialContentsLocked();
|
||||
mBinaryDictionary.flushWithGC();
|
||||
// Run GC and flush to file when initial contents have been loaded.
|
||||
mBinaryDictionary.flushWithGCIfHasUpdated();
|
||||
}
|
||||
|
||||
private void flushDictionaryLocked() {
|
||||
|
|
Loading…
Reference in New Issue