Remove clearAndFlushDictionary() and use clear().

clearAndFlushDictionary() was needed when dictionaries are constructed
in java side. All expandable dictionaries now use native code; thus,
this method is same to clear() and no longer needed.

Bug: 13755213
Change-Id: Ifd836e64f8ff807930f7cd2319b103b65e8fce70
main
Keisuke Kuroyanagi 2014-04-24 11:25:47 -07:00
parent 7de3d0eed7
commit 2dcb5c1b4d
5 changed files with 6 additions and 14 deletions

View File

@ -542,7 +542,7 @@ public class DictionaryFacilitatorForSuggest {
if (userHistoryDict == null) {
return;
}
userHistoryDict.clearAndFlushDictionary();
userHistoryDict.clear();
}
// This method gets called only when the IME receives a notification to remove the
@ -553,7 +553,7 @@ public class DictionaryFacilitatorForSuggest {
if (personalizationDict == null) {
return;
}
personalizationDict.clearAndFlushDictionary();
personalizationDict.clear();
}
public void addMultipleDictionaryEntriesToPersonalizationDictionary(

View File

@ -244,7 +244,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
true /* useFullEditDistance */, mLocale, mDictType, true /* isUpdatable */);
}
protected void clear() {
public void clear() {
ExecutorUtils.getExecutor(mDictName).execute(new Runnable() {
@Override
public void run() {

View File

@ -135,19 +135,11 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
// No initial contents.
}
@UsedForTesting
public void clearAndFlushDictionary() {
// Clear the node structure on memory
clear();
// Then flush the cleared state of the dictionary on disk.
asyncFlushBinaryDictionary();
}
@UsedForTesting
public void clearAndFlushDictionaryWithAdditionalAttributes(
final Map<String, String> attributeMap) {
mAdditionalAttributeMap = attributeMap;
clearAndFlushDictionary();
clear();
}
/* package */ void runGCIfRequired() {

View File

@ -135,7 +135,7 @@ public class PersonalizationHelper {
if (entry.getValue() != null) {
final DecayingExpandableBinaryDictionaryBase dict = entry.getValue().get();
if (dict != null) {
dict.clearAndFlushDictionary();
dict.clear();
}
}
}

View File

@ -147,7 +147,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
final UserHistoryDictionary dict = PersonalizationHelper.getUserHistoryDictionary(
mContext, locale);
dict.waitAllTasksForTests();
dict.clearAndFlushDictionary();
dict.clear();
dict.close();
dict.waitAllTasksForTests();
}