From 66cc9dec55bcfff9a92acb9a4b40a041d130185b Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Thu, 6 Mar 2014 20:12:47 +0900 Subject: [PATCH] Stop new BigramDictionary. BigramDictionary is allocated inside of Dictionary. Change-Id: If224b4c408403f43eb3d2e292c0e0ecb86429290 --- native/jni/src/suggest/core/dictionary/dictionary.cpp | 6 +++--- native/jni/src/suggest/core/dictionary/dictionary.h | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/native/jni/src/suggest/core/dictionary/dictionary.cpp b/native/jni/src/suggest/core/dictionary/dictionary.cpp index ffa96e167..c26e3aad6 100644 --- a/native/jni/src/suggest/core/dictionary/dictionary.cpp +++ b/native/jni/src/suggest/core/dictionary/dictionary.cpp @@ -37,7 +37,7 @@ const int Dictionary::HEADER_ATTRIBUTE_BUFFER_SIZE = 32; Dictionary::Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::StructurePolicyPtr dictionaryStructureWithBufferPolicy) : mDictionaryStructureWithBufferPolicy(std::move(dictionaryStructureWithBufferPolicy)), - mBigramDictionary(new BigramDictionary(mDictionaryStructureWithBufferPolicy.get())), + mBigramDictionary(mDictionaryStructureWithBufferPolicy.get()), mGestureSuggest(new Suggest(GestureSuggestPolicyFactory::getGestureSuggestPolicy())), mTypingSuggest(new Suggest(TypingSuggestPolicyFactory::getTypingSuggestPolicy())) { logDictionaryInfo(env); @@ -78,7 +78,7 @@ void Dictionary::getPredictions(const int *word, int length, SuggestionResults *const outSuggestionResults) const { TimeKeeper::setCurrentTime(); if (length <= 0) return; - mBigramDictionary->getPredictions(word, length, outSuggestionResults); + mBigramDictionary.getPredictions(word, length, outSuggestionResults); } int Dictionary::getProbability(const int *word, int length) const { @@ -94,7 +94,7 @@ int Dictionary::getProbability(const int *word, int length) const { int Dictionary::getBigramProbability(const int *word0, int length0, const int *word1, int length1) const { TimeKeeper::setCurrentTime(); - return mBigramDictionary->getBigramProbability(word0, length0, word1, length1); + return mBigramDictionary.getBigramProbability(word0, length0, word1, length1); } void Dictionary::addUnigramWord(const int *const word, const int length, const int probability, diff --git a/native/jni/src/suggest/core/dictionary/dictionary.h b/native/jni/src/suggest/core/dictionary/dictionary.h index 2dea9fff8..ce032fceb 100644 --- a/native/jni/src/suggest/core/dictionary/dictionary.h +++ b/native/jni/src/suggest/core/dictionary/dictionary.h @@ -109,14 +109,13 @@ class Dictionary { private: DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary); - typedef std::unique_ptr BigramDictionaryPtr; typedef std::unique_ptr SuggestInterfacePtr; static const int HEADER_ATTRIBUTE_BUFFER_SIZE; const DictionaryStructureWithBufferPolicy::StructurePolicyPtr mDictionaryStructureWithBufferPolicy; - const BigramDictionaryPtr mBigramDictionary; + const BigramDictionary mBigramDictionary; const SuggestInterfacePtr mGestureSuggest; const SuggestInterfacePtr mTypingSuggest;