Loading native/jni/src/suggest/core/dicnode/dic_node.h +2 −20 Original line number Diff line number Diff line Loading @@ -83,14 +83,6 @@ class DicNode { #if DEBUG_DICT DicNodeProfiler mProfiler; #endif ////////////////// // Memory utils // ////////////////// AK_FORCE_INLINE static void managedDelete(DicNode *node) { node->remove(); } // end ///////////////// AK_FORCE_INLINE DicNode() : Loading Loading @@ -158,7 +150,7 @@ class DicNode { PROF_NODE_COPY(&dicNode->mProfiler, mProfiler); } AK_FORCE_INLINE void remove() { AK_FORCE_INLINE void finalize() { mIsUsed = false; if (mReleaseListener) { mReleaseListener->onReleased(this); Loading Loading @@ -478,17 +470,7 @@ class DicNode { mReleaseListener = releaseListener; } AK_FORCE_INLINE bool compare(const DicNode *right) { if (!isUsed() && !right->isUsed()) { // Compare pointer values here for stable comparison return this > right; } if (!isUsed()) { return true; } if (!right->isUsed()) { return false; } AK_FORCE_INLINE bool compare(const DicNode *right) const { // Promote exact matches to prevent them from being pruned. const bool leftExactMatch = ErrorTypeUtils::isExactMatch(getContainedErrorTypes()); const bool rightExactMatch = ErrorTypeUtils::isExactMatch(right->getContainedErrorTypes()); Loading native/jni/src/suggest/core/dicnode/dic_node_priority_queue.h +4 −4 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ class DicNodePriorityQueue : public DicNodeReleaseListener { } setMaxSize(maxSize); for (int i = 0; i < mCapacity + 1; ++i) { mDicNodesBuf[i].remove(); mDicNodesBuf[i].finalize(); mDicNodesBuf[i].setReleaseListener(this); mUnusedNodeIndices[i] = i == mCapacity ? NOT_A_NODE_ID : static_cast<int>(i) + 1; } Loading @@ -89,11 +89,11 @@ class DicNodePriorityQueue : public DicNodeReleaseListener { if (dest) { DicNodeUtils::initByCopy(node, dest); } node->remove(); node->finalize(); mDicNodesQueue.pop(); } void onReleased(DicNode *dicNode) { void onReleased(const DicNode *dicNode) { const int index = static_cast<int>(dicNode - &mDicNodesBuf[0]); if (mUnusedNodeIndices[index] != NOT_A_NODE_ID) { // it's already released Loading Loading @@ -190,7 +190,7 @@ class DicNodePriorityQueue : public DicNodeReleaseListener { mDicNodesQueue.push(dicNode); return dicNode; } dicNode->remove(); dicNode->finalize(); return 0; } Loading native/jni/src/suggest/core/dicnode/dic_node_release_listener.h +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class DicNodeReleaseListener { public: DicNodeReleaseListener() {} virtual ~DicNodeReleaseListener() {} virtual void onReleased(DicNode *dicNode) = 0; virtual void onReleased(const DicNode *dicNode) = 0; private: DISALLOW_COPY_AND_ASSIGN(DicNodeReleaseListener); }; Loading native/jni/src/suggest/core/dicnode/dic_nodes_cache.h +1 −8 Original line number Diff line number Diff line Loading @@ -100,14 +100,7 @@ class DicNodesCache { } AK_FORCE_INLINE void copyPushNextActive(DicNode *dicNode) { DicNode *pushedDicNode = mNextActiveDicNodes->copyPush(dicNode); if (!pushedDicNode) { if (dicNode->isCached()) { dicNode->remove(); } // We simply drop any dic node that was not cached, ignoring the slim chance // that one of its children represents what the user really wanted. } mNextActiveDicNodes->copyPush(dicNode); } void popTerminal(DicNode *dest) { Loading native/jni/src/suggest/core/result/suggestions_output_utils.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -131,7 +131,6 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16; true /* forceCommit */, boostExactMatches) : finalScore; outputShortcuts(&shortcutIt, shortcutBaseScore, sameAsTyped, outSuggestionResults); } DicNode::managedDelete(terminalDicNode); } scoringPolicy->getMostProbableString(traverseSession, languageWeight, outSuggestionResults); } Loading Loading
native/jni/src/suggest/core/dicnode/dic_node.h +2 −20 Original line number Diff line number Diff line Loading @@ -83,14 +83,6 @@ class DicNode { #if DEBUG_DICT DicNodeProfiler mProfiler; #endif ////////////////// // Memory utils // ////////////////// AK_FORCE_INLINE static void managedDelete(DicNode *node) { node->remove(); } // end ///////////////// AK_FORCE_INLINE DicNode() : Loading Loading @@ -158,7 +150,7 @@ class DicNode { PROF_NODE_COPY(&dicNode->mProfiler, mProfiler); } AK_FORCE_INLINE void remove() { AK_FORCE_INLINE void finalize() { mIsUsed = false; if (mReleaseListener) { mReleaseListener->onReleased(this); Loading Loading @@ -478,17 +470,7 @@ class DicNode { mReleaseListener = releaseListener; } AK_FORCE_INLINE bool compare(const DicNode *right) { if (!isUsed() && !right->isUsed()) { // Compare pointer values here for stable comparison return this > right; } if (!isUsed()) { return true; } if (!right->isUsed()) { return false; } AK_FORCE_INLINE bool compare(const DicNode *right) const { // Promote exact matches to prevent them from being pruned. const bool leftExactMatch = ErrorTypeUtils::isExactMatch(getContainedErrorTypes()); const bool rightExactMatch = ErrorTypeUtils::isExactMatch(right->getContainedErrorTypes()); Loading
native/jni/src/suggest/core/dicnode/dic_node_priority_queue.h +4 −4 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ class DicNodePriorityQueue : public DicNodeReleaseListener { } setMaxSize(maxSize); for (int i = 0; i < mCapacity + 1; ++i) { mDicNodesBuf[i].remove(); mDicNodesBuf[i].finalize(); mDicNodesBuf[i].setReleaseListener(this); mUnusedNodeIndices[i] = i == mCapacity ? NOT_A_NODE_ID : static_cast<int>(i) + 1; } Loading @@ -89,11 +89,11 @@ class DicNodePriorityQueue : public DicNodeReleaseListener { if (dest) { DicNodeUtils::initByCopy(node, dest); } node->remove(); node->finalize(); mDicNodesQueue.pop(); } void onReleased(DicNode *dicNode) { void onReleased(const DicNode *dicNode) { const int index = static_cast<int>(dicNode - &mDicNodesBuf[0]); if (mUnusedNodeIndices[index] != NOT_A_NODE_ID) { // it's already released Loading Loading @@ -190,7 +190,7 @@ class DicNodePriorityQueue : public DicNodeReleaseListener { mDicNodesQueue.push(dicNode); return dicNode; } dicNode->remove(); dicNode->finalize(); return 0; } Loading
native/jni/src/suggest/core/dicnode/dic_node_release_listener.h +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ class DicNodeReleaseListener { public: DicNodeReleaseListener() {} virtual ~DicNodeReleaseListener() {} virtual void onReleased(DicNode *dicNode) = 0; virtual void onReleased(const DicNode *dicNode) = 0; private: DISALLOW_COPY_AND_ASSIGN(DicNodeReleaseListener); }; Loading
native/jni/src/suggest/core/dicnode/dic_nodes_cache.h +1 −8 Original line number Diff line number Diff line Loading @@ -100,14 +100,7 @@ class DicNodesCache { } AK_FORCE_INLINE void copyPushNextActive(DicNode *dicNode) { DicNode *pushedDicNode = mNextActiveDicNodes->copyPush(dicNode); if (!pushedDicNode) { if (dicNode->isCached()) { dicNode->remove(); } // We simply drop any dic node that was not cached, ignoring the slim chance // that one of its children represents what the user really wanted. } mNextActiveDicNodes->copyPush(dicNode); } void popTerminal(DicNode *dest) { Loading
native/jni/src/suggest/core/result/suggestions_output_utils.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -131,7 +131,6 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16; true /* forceCommit */, boostExactMatches) : finalScore; outputShortcuts(&shortcutIt, shortcutBaseScore, sameAsTyped, outSuggestionResults); } DicNode::managedDelete(terminalDicNode); } scoringPolicy->getMostProbableString(traverseSession, languageWeight, outSuggestionResults); } Loading