Merge "Remove clearAndFlushDictionary() and use clear()."

main
Keisuke Kuroyanagi 2014-04-24 18:29:05 +00:00 committed by Android (Google) Code Review
commit 3d658a63ca
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();
}