am 3d658a63: Merge "Remove clearAndFlushDictionary() and use clear()."

* commit '3d658a63ca5a65940dacec8b9fb0c2849ebce11b':
  Remove clearAndFlushDictionary() and use clear().
main
Keisuke Kuroyanagi 2014-04-24 18:33:31 +00:00 committed by Android Git Automerger
commit 6b224a5779
5 changed files with 6 additions and 14 deletions

View File

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

View File

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

View File

@ -135,19 +135,11 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
// No initial contents. // 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 @UsedForTesting
public void clearAndFlushDictionaryWithAdditionalAttributes( public void clearAndFlushDictionaryWithAdditionalAttributes(
final Map<String, String> attributeMap) { final Map<String, String> attributeMap) {
mAdditionalAttributeMap = attributeMap; mAdditionalAttributeMap = attributeMap;
clearAndFlushDictionary(); clear();
} }
/* package */ void runGCIfRequired() { /* package */ void runGCIfRequired() {

View File

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

View File

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