Remove the dependency on NodeAllocatorInterface from dictionary module

Node structure is only relevant to lattice structure in converter module, so its dependency should be removed from dictionary module.  To this end, NodeAllocatorData is removed as it is used only in SystemDictionary for reverse lookup.  Having a general storage for it in NodeAllocatorInterface is overkill.  Also, method signatures of DictionaryInterface are changed accordingly.

node_test.cc is removed as it no longer contains useful tests due to the removal of NodeAllocatorData.

This is just an internal clean-up.  No user-visible behavior change is intended.

BUG=none
TEST=unittest

git-svn-id: https://mozc.googlecode.com/svn/trunk@547 a6090854-d499-a067-5803-1114d4e51264
diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc
index 3862ec7..7e39b59 100644
--- a/src/converter/immutable_converter.cc
+++ b/src/converter/immutable_converter.cc
@@ -776,8 +776,7 @@
     BaseNodeListBuilder builder(
         lattice->node_allocator(),
         lattice->node_allocator()->max_nodes_size());
-    dictionary_->LookupReverse(
-        StringPiece(begin, len), lattice->node_allocator(), &builder);
+    dictionary_->LookupReverse(StringPiece(begin, len), &builder);
     result_node = builder.result();
   } else {
     if (is_prediction && !FLAGS_disable_lattice_cache) {
@@ -1381,7 +1380,7 @@
   if (is_reverse) {
     // Reverse lookup for each prefix string in key is slow with current
     // implementation, so run it for them at once and cache the result.
-    dictionary_->PopulateReverseLookupCache(key, lattice->node_allocator());
+    dictionary_->PopulateReverseLookupCache(key);
   }
 
   bool is_valid_lattice = true;
@@ -1399,7 +1398,7 @@
 
   if (is_reverse) {
     // No reverse look up will happen afterwards.
-    dictionary_->ClearReverseLookupCache(lattice->node_allocator());
+    dictionary_->ClearReverseLookupCache();
   }
 
   // Predictive real time conversion
diff --git a/src/converter/immutable_converter_test.cc b/src/converter/immutable_converter_test.cc
index 1dd953e..e076e6f 100644
--- a/src/converter/immutable_converter_test.cc
+++ b/src/converter/immutable_converter_test.cc
@@ -268,8 +268,7 @@
     // No check
   }
 
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const {
+  virtual void LookupReverse(StringPiece str, Callback *callback) const {
     // No check
   }
 
diff --git a/src/converter/node.h b/src/converter/node.h
index 9b03448..c3221aa 100644
--- a/src/converter/node.h
+++ b/src/converter/node.h
@@ -30,7 +30,6 @@
 #ifndef MOZC_CONVERTER_NODE_H_
 #define MOZC_CONVERTER_NODE_H_
 
-#include <map>
 #include <string>
 
 #include "base/port.h"
@@ -38,8 +37,6 @@
 
 namespace mozc {
 
-class Segment;
-
 struct Node {
   enum NodeType {
     NOR_NODE,  // normal node
@@ -237,49 +234,6 @@
   }
 };
 
-// this class keep multiple types of data.
-// each type should inherit NodeAllocatorData::Data
-class NodeAllocatorData {
- public:
-  ~NodeAllocatorData() {
-    clear();
-  }
-
-  bool has(const char *name) const {
-    return (data_.find(name) != data_.end());
-  }
-
-  void erase(const char *name) {
-    if (has(name)) {
-      delete data_[name];
-      data_.erase(name);
-    }
-  }
-
-  void clear() {
-    for (map<const char *, Data *>::iterator it = data_.begin();
-         it != data_.end(); ++it) {
-      delete it->second;
-    }
-    data_.clear();
-  }
-
-  template<typename Type> Type *get(const char *name) {
-    if (!has(name)) {
-      data_[name] = new Type;
-    }
-    return reinterpret_cast<Type *>(data_[name]);
-  }
-
-  class Data {
-   public:
-    virtual ~Data() {}
-  };
-
- private:
-  map<const char *, Data *> data_;
-};
-
 class NodeAllocatorInterface {
  public:
   NodeAllocatorInterface() : max_nodes_size_(8192) {}
@@ -295,17 +249,8 @@
     max_nodes_size_ = max_nodes_size;
   }
 
-  // Backend specific data, like cache for look up.
-  NodeAllocatorData *mutable_data() {
-    return &data_;
-  }
-  const NodeAllocatorData &data() {
-    return data_;
-  }
-
  private:
   size_t max_nodes_size_;
-  NodeAllocatorData data_;
 };
 
 }  // namespace mozc
diff --git a/src/converter/node_test.cc b/src/converter/node_test.cc
deleted file mode 100644
index 6721d9c..0000000
--- a/src/converter/node_test.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2010-2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "converter/node.h"
-
-#include "testing/base/public/gunit.h"
-
-namespace mozc {
-namespace {
-const char *kTypeKey1 = "type1";
-const char *kTypeKey2 = "type2";
-class Type1 : public NodeAllocatorData::Data {
- public:
-  virtual ~Type1() {}
-  int x;
-};
-class Type2 : public NodeAllocatorData::Data {
- public:
-  virtual ~Type2() {}
-  int x;
-};
-}  // namespace
-
-TEST(NodeAllocatorDataTest, Basic) {
-  NodeAllocatorData data;
-  EXPECT_FALSE(data.has(kTypeKey1));
-  Type1 *t1;
-  Type2 *t2;
-  t2 = data.get<Type2>(kTypeKey2);
-  t2->x = 100;
-  EXPECT_FALSE(data.has(kTypeKey1));
-  EXPECT_TRUE(data.has(kTypeKey2));
-
-  t1 = data.get<Type1>(kTypeKey1);
-  t1->x = 10;
-  EXPECT_TRUE(data.has(kTypeKey1));
-  EXPECT_TRUE(data.has(kTypeKey2));
-
-  t2 = data.get<Type2>(kTypeKey2);
-  EXPECT_EQ(100, t2->x);
-
-  data.erase(kTypeKey1);
-  EXPECT_FALSE(data.has(kTypeKey1));
-  EXPECT_TRUE(data.has(kTypeKey2));
-
-  data.clear();
-  EXPECT_FALSE(data.has(kTypeKey1));
-  EXPECT_FALSE(data.has(kTypeKey2));
-}
-}  // mozc
diff --git a/src/dictionary/dictionary_impl.cc b/src/dictionary/dictionary_impl.cc
index 09fa9d3..bf1368e 100644
--- a/src/dictionary/dictionary_impl.cc
+++ b/src/dictionary/dictionary_impl.cc
@@ -194,7 +194,6 @@
 }
 
 void DictionaryImpl::LookupReverse(StringPiece str,
-                                   NodeAllocatorInterface *allocator,
                                    Callback *callback) const {
   CallbackWithFilter callback_with_filter(
       GET_CONFIG(use_spelling_correction),
@@ -204,7 +203,7 @@
       suppression_dictionary_,
       callback);
   for (size_t i = 0; i < dics_.size(); ++i) {
-    dics_[i]->LookupReverse(str, allocator, &callback_with_filter);
+    dics_[i]->LookupReverse(str, &callback_with_filter);
   }
 }
 
@@ -225,17 +224,15 @@
   return user_dictionary_->Reload();
 }
 
-void DictionaryImpl::PopulateReverseLookupCache(
-    StringPiece str, NodeAllocatorInterface *allocator) const {
+void DictionaryImpl::PopulateReverseLookupCache(StringPiece str) const {
   for (size_t i = 0; i < dics_.size(); ++i) {
-    dics_[i]->PopulateReverseLookupCache(str, allocator);
+    dics_[i]->PopulateReverseLookupCache(str);
   }
 }
 
-void DictionaryImpl::ClearReverseLookupCache(
-    NodeAllocatorInterface *allocator) const {
+void DictionaryImpl::ClearReverseLookupCache() const {
   for (size_t i = 0; i < dics_.size(); ++i) {
-    dics_[i]->ClearReverseLookupCache(allocator);
+    dics_[i]->ClearReverseLookupCache();
   }
 }
 
diff --git a/src/dictionary/dictionary_impl.h b/src/dictionary/dictionary_impl.h
index 37b2cf1..01ab9ba 100644
--- a/src/dictionary/dictionary_impl.h
+++ b/src/dictionary/dictionary_impl.h
@@ -63,30 +63,20 @@
   virtual ~DictionaryImpl();
 
   virtual bool HasKey(StringPiece key) const;
-
   virtual bool HasValue(StringPiece value) const;
-
   virtual void LookupPredictive(
       StringPiece key, bool use_kana_modifier_insensitive_lookup,
       Callback *callback) const;
   virtual void LookupPrefix(
       StringPiece key, bool use_kana_modifier_insensitive_lookup,
       Callback *callback) const;
-
   virtual void LookupExact(StringPiece key, Callback *callback) const;
-
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const;
-
+  virtual void LookupReverse(StringPiece str, Callback *callback) const;
   virtual bool LookupComment(StringPiece key, StringPiece value,
                              string *comment) const;
-
   virtual bool Reload();
-
-  virtual void PopulateReverseLookupCache(
-      StringPiece str, NodeAllocatorInterface *allocator) const;
-
-  virtual void ClearReverseLookupCache(NodeAllocatorInterface *allocator) const;
+  virtual void PopulateReverseLookupCache(StringPiece str) const;
+  virtual void ClearReverseLookupCache() const;
 
  private:
   enum LookupType {
diff --git a/src/dictionary/dictionary_interface.h b/src/dictionary/dictionary_interface.h
index d5793a6..acf8163 100644
--- a/src/dictionary/dictionary_interface.h
+++ b/src/dictionary/dictionary_interface.h
@@ -36,12 +36,10 @@
 #include "base/port.h"
 #include "base/string_piece.h"
 #include "base/trie.h"
+#include "dictionary/dictionary_token.h"
 
 namespace mozc {
 
-class NodeAllocatorInterface;  // converter/node.h
-struct Token;                  // dictionary/dictionary_token.h
-
 // TODO(noriyukit): Move this interface into dictionary namespace.
 class DictionaryInterface {
  public:
@@ -130,9 +128,7 @@
 
   // For reverse lookup, the reading is stored in Token::value and the word
   // is stored in Token::key.
-  // TODO(hsumita): Remove a dependency on NodeAllocatorInterface.
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const = 0;
+  virtual void LookupReverse(StringPiece str, Callback *callback) const = 0;
 
   // Looks up a user comment from a pair of key and value.  When (key, value)
   // doesn't exist in this dictionary or user comment is empty, bool is
@@ -141,11 +137,10 @@
                              string *comment) const { return false; }
 
   // Populates cache for LookupReverse().
-  // TODO(hsumita): Remove a dependency on NodeAllocatorInterface.
-  virtual void PopulateReverseLookupCache(
-      StringPiece str, NodeAllocatorInterface *allocator) const {}
-  virtual void ClearReverseLookupCache(
-      NodeAllocatorInterface *allocator) const {}
+  // TODO(noriyukit): These cache initialize/finalize mechanism shouldn't be a
+  // part of the interface.
+  virtual void PopulateReverseLookupCache(StringPiece str) const {}
+  virtual void ClearReverseLookupCache() const {}
 
   // Sync mutable dictionary data into local disk.
   virtual bool Sync() { return true; }
diff --git a/src/dictionary/dictionary_mock.cc b/src/dictionary/dictionary_mock.cc
index b19201a..020eb7a 100644
--- a/src/dictionary/dictionary_mock.cc
+++ b/src/dictionary/dictionary_mock.cc
@@ -205,9 +205,7 @@
   }
 }
 
-void DictionaryMock::LookupReverse(StringPiece str,
-                                   NodeAllocatorInterface *allocator,
-                                   Callback *callback) const {
+void DictionaryMock::LookupReverse(StringPiece str, Callback *callback) const {
   CHECK(!str.empty());
 
   for (int i = 1; i <= str.size(); ++i) {
diff --git a/src/dictionary/dictionary_mock.h b/src/dictionary/dictionary_mock.h
index 38dd6c0..af30841 100644
--- a/src/dictionary/dictionary_mock.h
+++ b/src/dictionary/dictionary_mock.h
@@ -89,9 +89,8 @@
   virtual void LookupExact(StringPiece key, Callback *callback) const;
 
   // For reverse lookup, the reading is stored in Token::value and the word
-  // is stored in Token::key. This mock method doesn't use |*allocator|.
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const;
+  // is stored in Token::key.
+  virtual void LookupReverse(StringPiece str, Callback *callback) const;
 
   // Adds a string-result pair to the predictive search result.
   // LookupPrefix will return the result only when the search key exactly
diff --git a/src/dictionary/dictionary_mock_test.cc b/src/dictionary/dictionary_mock_test.cc
index 4b38860..ba254fa 100644
--- a/src/dictionary/dictionary_mock_test.cc
+++ b/src/dictionary/dictionary_mock_test.cc
@@ -174,7 +174,7 @@
   }
 
   CollectTokenCallback callback;
-  dic->LookupReverse(k1, NULL, &callback);
+  dic->LookupReverse(k1, &callback);
   const vector<Token> &result_tokens = callback.tokens();
   EXPECT_TRUE(SearchMatchingToken(t0->key, t0->value, 0, result_tokens))
       << "Failed to find: " << t0->key;
diff --git a/src/dictionary/suffix_dictionary.cc b/src/dictionary/suffix_dictionary.cc
index 3869c25..53ab416 100644
--- a/src/dictionary/suffix_dictionary.cc
+++ b/src/dictionary/suffix_dictionary.cc
@@ -134,7 +134,6 @@
 }
 
 void SuffixDictionary::LookupReverse(StringPiece str,
-                                     NodeAllocatorInterface *allocator,
                                      Callback *callback) const {
 }
 
diff --git a/src/dictionary/suffix_dictionary.h b/src/dictionary/suffix_dictionary.h
index ea2195a..63b579b 100644
--- a/src/dictionary/suffix_dictionary.h
+++ b/src/dictionary/suffix_dictionary.h
@@ -67,8 +67,7 @@
   virtual void LookupPrefix(
       StringPiece key, bool use_kana_modifier_insensitive_lookup,
       Callback *callback) const;
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const;
+  virtual void LookupReverse(StringPiece str, Callback *callback) const;
   virtual void LookupExact(StringPiece key, Callback *callback) const;
 
  private:
diff --git a/src/dictionary/system/system_dictionary.cc b/src/dictionary/system/system_dictionary.cc
index c6301e1..35d7f2e 100644
--- a/src/dictionary/system/system_dictionary.cc
+++ b/src/dictionary/system/system_dictionary.cc
@@ -60,7 +60,6 @@
 #include "base/string_piece.h"
 #include "base/system_util.h"
 #include "base/util.h"
-#include "converter/node_allocator.h"
 #include "dictionary/dictionary_token.h"
 #include "dictionary/file/dictionary_file.h"
 #include "dictionary/system/codec_interface.h"
@@ -77,7 +76,6 @@
 namespace {
 
 const int kMinTokenArrayBlobSize = 4;
-const char *kReverseLookupCache = "reverse_lookup_cache";
 
 // Expansion table format:
 // "<Character to expand>[<Expanded character 1><Expanded character 2>...]"
@@ -410,7 +408,7 @@
 
 }  // namespace
 
-class SystemDictionary::ReverseLookupCache : public NodeAllocatorData::Data {
+class SystemDictionary::ReverseLookupCache {
  public:
   ReverseLookupCache() {}
 
@@ -1151,14 +1149,13 @@
   }
 }
 
-void SystemDictionary::LookupReverse(
-    StringPiece str, NodeAllocatorInterface *allocator,
-    Callback *callback) const {
+void SystemDictionary::LookupReverse(StringPiece str,
+                                     Callback *callback) const {
   // 1st step: Hiragana/Katakana are not in the value trie
   // 2nd step: Reverse lookup in value trie
   ReverseLookupCallbackWrapper callback_wrapper(callback);
   RegisterReverseLookupTokensForT13N(str, &callback_wrapper);
-  RegisterReverseLookupTokensForValue(str, allocator, &callback_wrapper);
+  RegisterReverseLookupTokensForValue(str, &callback_wrapper);
 }
 
 namespace {
@@ -1183,19 +1180,14 @@
 
 }  // namespace
 
-void SystemDictionary::PopulateReverseLookupCache(
-    StringPiece str, NodeAllocatorInterface *allocator) const {
-  if (allocator == NULL) {
-    return;
-  }
+void SystemDictionary::PopulateReverseLookupCache(StringPiece str) const {
   if (reverse_lookup_index_ != NULL) {
     // We don't need to prepare cache for the current reverse conversion,
     // as we have already built the index for reverse lookup.
     return;
   }
-  ReverseLookupCache *cache =
-      allocator->mutable_data()->get<ReverseLookupCache>(kReverseLookupCache);
-  DCHECK(cache) << "can't get cache data.";
+  reverse_lookup_cache_.reset(new ReverseLookupCache);
+  DCHECK(reverse_lookup_cache_.get());
 
   // Iterate each suffix and collect IDs of all substrings.
   set<int> id_set;
@@ -1210,12 +1202,11 @@
     pos += Util::OneCharLen(suffix.data());
   }
   // Collect tokens for all IDs.
-  ScanTokens(id_set, cache);
+  ScanTokens(id_set, reverse_lookup_cache_.get());
 }
 
-void SystemDictionary::ClearReverseLookupCache(
-    NodeAllocatorInterface *allocator) const {
-  allocator->mutable_data()->erase(kReverseLookupCache);
+void SystemDictionary::ClearReverseLookupCache() const {
+  reverse_lookup_cache_.reset(NULL);
 }
 
 namespace {
@@ -1261,28 +1252,21 @@
 }
 
 void SystemDictionary::RegisterReverseLookupTokensForValue(
-    StringPiece value, NodeAllocatorInterface *allocator,
-    Callback *callback) const {
+    StringPiece value, Callback *callback) const {
   string lookup_key;
   codec_->EncodeValue(value, &lookup_key);
 
   set<int> id_set;
   AddKeyIdsOfAllPrefixes(value_trie_, lookup_key, &id_set);
 
-  const bool has_cache = (allocator != NULL &&
-                          allocator->data().has(kReverseLookupCache));
-  ReverseLookupCache *cache =
-      has_cache
-      ? allocator->mutable_data()->get<ReverseLookupCache>(kReverseLookupCache)
-      : NULL;
-
   ReverseLookupCache *results = NULL;
   ReverseLookupCache non_cached_results;
   if (reverse_lookup_index_ != NULL) {
     reverse_lookup_index_->FillResultMap(id_set, &non_cached_results.results);
     results = &non_cached_results;
-  } else if (cache != NULL && cache->IsAvailable(id_set)) {
-    results = cache;
+  } else if (reverse_lookup_cache_.get() != NULL &&
+             reverse_lookup_cache_->IsAvailable(id_set)) {
+    results = reverse_lookup_cache_.get();
   } else {
     // Cache is not available. Get token for each ID.
     ScanTokens(id_set, &non_cached_results);
diff --git a/src/dictionary/system/system_dictionary.h b/src/dictionary/system/system_dictionary.h
index 6f661bc..29bf908 100644
--- a/src/dictionary/system/system_dictionary.h
+++ b/src/dictionary/system/system_dictionary.h
@@ -108,12 +108,9 @@
       StringPiece key, bool use_kana_modifier_insensitive_lookup,
       Callback *callback) const;
   virtual void LookupExact(StringPiece key, Callback *callback) const;
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const;
-  virtual void PopulateReverseLookupCache(
-      StringPiece str, NodeAllocatorInterface *allocator) const;
-  virtual void ClearReverseLookupCache(
-      NodeAllocatorInterface *allocator) const;
+  virtual void LookupReverse(StringPiece str, Callback *callback) const;
+  virtual void PopulateReverseLookupCache(StringPiece str) const;
+  virtual void ClearReverseLookupCache() const;
 
  private:
   class ReverseLookupCache;
@@ -126,7 +123,6 @@
   void RegisterReverseLookupTokensForT13N(StringPiece value,
                                           Callback *callback) const;
   void RegisterReverseLookupTokensForValue(StringPiece value,
-                                           NodeAllocatorInterface *allocator,
                                            Callback *callback) const;
   void ScanTokens(const set<int> &id_set, ReverseLookupCache *cache) const;
   void RegisterReverseLookupResults(const set<int> &id_set,
@@ -158,6 +154,7 @@
   const SystemDictionaryCodecInterface *codec_;
   KeyExpansionTable hiragana_expansion_table_;
   scoped_ptr<DictionaryFile> dictionary_file_;
+  mutable scoped_ptr<ReverseLookupCache> reverse_lookup_cache_;
   scoped_ptr<ReverseLookupIndex> reverse_lookup_index_;
 
   DISALLOW_COPY_AND_ASSIGN(SystemDictionary);
diff --git a/src/dictionary/system/system_dictionary_test.cc b/src/dictionary/system/system_dictionary_test.cc
index 48645e7..c3e19f7 100644
--- a/src/dictionary/system/system_dictionary_test.cc
+++ b/src/dictionary/system/system_dictionary_test.cc
@@ -40,7 +40,6 @@
 #include "base/stl_util.h"
 #include "base/system_util.h"
 #include "base/util.h"
-#include "converter/node_allocator.h"
 #include "data_manager/user_pos_manager.h"
 #include "dictionary/dictionary_test_util.h"
 #include "dictionary/dictionary_token.h"
@@ -845,7 +844,7 @@
   for (size_t source_index = 0; source_index < test_size; ++source_index) {
     const Token &source_token = *source_tokens[source_index];
     CollectTokenCallback callback;
-    system_dic->LookupReverse(source_token.value, NULL, &callback);
+    system_dic->LookupReverse(source_token.value, &callback);
     const vector<Token> &tokens = callback.tokens();
 
     bool found = false;
@@ -884,7 +883,7 @@
     // append "が"
     const string key = t7->value + "\xe3\x81\x8c";
     CollectTokenCallback callback;
-    system_dic->LookupReverse(key, NULL, &callback);
+    system_dic->LookupReverse(key, &callback);
     const vector<Token> &tokens = callback.tokens();
     bool found = false;
     for (size_t i = 0; i < tokens.size(); ++i) {
@@ -920,8 +919,8 @@
        size > 0 && it != source_tokens.end(); ++it, --size) {
     const Token &t = **it;
     CollectTokenCallback callback1, callback2;
-    system_dic_without_index->LookupReverse(t.value, NULL, &callback1);
-    system_dic_with_index->LookupReverse(t.value, NULL, &callback2);
+    system_dic_without_index->LookupReverse(t.value, &callback1);
+    system_dic_with_index->LookupReverse(t.value, &callback2);
 
     const vector<Token> &tokens1 = callback1.tokens();
     const vector<Token> &tokens2 = callback2.tokens();
@@ -957,13 +956,12 @@
       SystemDictionary::Builder(dic_fn_).Build());
   ASSERT_TRUE(system_dic.get() != NULL)
       << "Failed to open dictionary source:" << dic_fn_;
-  NodeAllocator allocator;
-  system_dic->PopulateReverseLookupCache(kDoraemon, &allocator);
+  system_dic->PopulateReverseLookupCache(kDoraemon);
   CheckTokenExistenceCallback callback(&target_token);
-  system_dic->LookupReverse(kDoraemon, &allocator, &callback);
+  system_dic->LookupReverse(kDoraemon, &callback);
   EXPECT_TRUE(callback.found())
       << "Could not find " << PrintToken(source_token);
-  system_dic->ClearReverseLookupCache(&allocator);
+  system_dic->ClearReverseLookupCache();
 }
 
 TEST_F(SystemDictionaryTest, SpellingCorrectionTokens) {
diff --git a/src/dictionary/system/value_dictionary.cc b/src/dictionary/system/value_dictionary.cc
index b9ea3ab..eed18f9 100644
--- a/src/dictionary/system/value_dictionary.cc
+++ b/src/dictionary/system/value_dictionary.cc
@@ -239,7 +239,6 @@
 }
 
 void ValueDictionary::LookupReverse(StringPiece str,
-                                    NodeAllocatorInterface *allocator,
                                     Callback *callback) const {
 }
 
diff --git a/src/dictionary/system/value_dictionary.h b/src/dictionary/system/value_dictionary.h
index f7e7c49..1783351 100644
--- a/src/dictionary/system/value_dictionary.h
+++ b/src/dictionary/system/value_dictionary.h
@@ -78,9 +78,7 @@
       StringPiece key, bool use_kana_modifier_insensitive_lookup,
       Callback *callback) const;
   virtual void LookupExact(StringPiece key, Callback *callback) const;
-  virtual void LookupReverse(
-      StringPiece str, NodeAllocatorInterface *allocator,
-      Callback *callback) const;
+  virtual void LookupReverse(StringPiece str, Callback *callback) const;
 
  private:
   explicit ValueDictionary(const POSMatcher& pos_matcher);
diff --git a/src/dictionary/user_dictionary.cc b/src/dictionary/user_dictionary.cc
index fc9c9dd..bb87009 100644
--- a/src/dictionary/user_dictionary.cc
+++ b/src/dictionary/user_dictionary.cc
@@ -444,7 +444,6 @@
 }
 
 void UserDictionary::LookupReverse(StringPiece str,
-                                   NodeAllocatorInterface *allocator,
                                    Callback *callback) const {
   if (GET_CONFIG(incognito_mode)) {
     return;
diff --git a/src/dictionary/user_dictionary.h b/src/dictionary/user_dictionary.h
index 7bebfa7..f7d1b77 100644
--- a/src/dictionary/user_dictionary.h
+++ b/src/dictionary/user_dictionary.h
@@ -66,8 +66,7 @@
       StringPiece key, bool use_kana_modifier_insensitive_lookup,
       Callback *callback) const;
   virtual void LookupExact(StringPiece key, Callback *callback) const;
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const;
+  virtual void LookupReverse(StringPiece str, Callback *callback) const;
 
   // Looks up a user comment from a pair of key and value.  When (key, value)
   // doesn't exist in this dictionary or user comment is empty, bool is
diff --git a/src/dictionary/user_dictionary_stub.h b/src/dictionary/user_dictionary_stub.h
index 6db59dd..cb99ac1 100644
--- a/src/dictionary/user_dictionary_stub.h
+++ b/src/dictionary/user_dictionary_stub.h
@@ -54,8 +54,7 @@
 
   virtual void LookupExact(StringPiece key, Callback *callback) const {}
 
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const {}
+  virtual void LookupReverse(StringPiece str, Callback *callback) const {}
 
   virtual bool LookupComment(StringPiece key, StringPiece value,
                              string *comment) const {
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index 5d80494..573db73 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
 MAJOR=2
 MINOR=16
-BUILD=2063
+BUILD=2064
 REVISION=102
 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
 # downloaded by NaCl Mozc.
diff --git a/src/prediction/dictionary_predictor_test.cc b/src/prediction/dictionary_predictor_test.cc
index 04a1318..6e349b1 100644
--- a/src/prediction/dictionary_predictor_test.cc
+++ b/src/prediction/dictionary_predictor_test.cc
@@ -297,9 +297,8 @@
                           Callback *callback));
   MOCK_CONST_METHOD2(LookupExact,
                      void(StringPiece key, Callback *callback));
-  MOCK_CONST_METHOD3(LookupReverse,
-                     void(StringPiece str, NodeAllocatorInterface *allocator,
-                          Callback *callback));
+  MOCK_CONST_METHOD2(LookupReverse,
+                     void(StringPiece str, Callback *callback));
 };
 
 // Action to call the third argument of LookupPrefix with the token
@@ -1738,8 +1737,7 @@
 
   virtual void LookupExact(StringPiece key, Callback *callback) const {}
 
-  virtual void LookupReverse(StringPiece str, NodeAllocatorInterface *allocator,
-                             Callback *callback) const {}
+  virtual void LookupReverse(StringPiece str, Callback *callback) const {}
 };
 
 }  // namespace