Remove legacy base/hash_tables.h in favor of C++11

With this CL all the uses of base/hash_tables.h are replaced with std::unordered_set and std::unordered_map in favor of C++11.

No user-visible behavior change is intended.

BUG=none
TEST=unittest

git-svn-id: https://mozc.googlecode.com/svn/trunk@521 a6090854-d499-a067-5803-1114d4e51264
diff --git a/src/base/base_test.gyp b/src/base/base_test.gyp
index a43b8e6..008c2a1 100644
--- a/src/base/base_test.gyp
+++ b/src/base/base_test.gyp
@@ -126,7 +126,6 @@
       'sources': [
         'bitarray_test.cc',
         'flags_test.cc',
-        'hash_tables_test.cc',
         'iterator_adapter_test.cc',
         'logging_test.cc',
         'mmap_test.cc',
diff --git a/src/base/hash_tables.h b/src/base/hash_tables.h
deleted file mode 100644
index d62af39..0000000
--- a/src/base/hash_tables.h
+++ /dev/null
@@ -1,70 +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.
-
-// Provides hash_map, hash_set, and the basic hash functions.
-// Eventually we'll be switching to unorderd_map and unorderd_set.
-
-#ifndef MOZC_BASE_HASH_TABLES_H_
-#define MOZC_BASE_HASH_TABLES_H_
-
-
-#ifdef OS_WIN
-#include <hash_map>
-#include <hash_set>
-#if _MSC_VER < 1310 || _MSC_VER >= 1600
-using std::hash_map;
-using std::hash_set;
-#else
-using stdext::hash_map;
-using stdext::hash_set;
-#endif
-#else  // not OS_WIN
-
-#include <ext/hash_map>
-#include <ext/hash_set>
-using __gnu_cxx::hash_map;
-using __gnu_cxx::hash_set;
-
-#include <string>
-namespace __gnu_cxx {
-// FNV-1a hash similar to tr1/functional_hash.h.
-template <>
-struct hash<std::string> {
-  std::size_t operator()(const std::string& s) const {
-    std::size_t result = 0;
-    for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) {
-      result = (result * 131) + *i;
-    }
-    return result;
-  }
-};
-}
-#endif  // not OS_WIN
-
-#endif  // MOZC_BASE_HASH_TABLES_H_
diff --git a/src/base/hash_tables_test.cc b/src/base/hash_tables_test.cc
deleted file mode 100644
index 02ede26..0000000
--- a/src/base/hash_tables_test.cc
+++ /dev/null
@@ -1,43 +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 "base/hash_tables.h"
-#include "testing/base/public/gunit.h"
-
-TEST(HashTables, HashMap) {
-  hash_map<string, int> test_map;
-  test_map["test"] = 1;
-  EXPECT_EQ(1, test_map["test"]);
-}
-
-TEST(HashTables, HashSet) {
-  hash_set<string> test_set;
-  test_set.insert("test");
-  EXPECT_EQ(1, test_set.count("test"));
-}
diff --git a/src/data_manager/data_manager_test_base.cc b/src/data_manager/data_manager_test_base.cc
index 1b856d3..0324fd6 100644
--- a/src/data_manager/data_manager_test_base.cc
+++ b/src/data_manager/data_manager_test_base.cc
@@ -31,11 +31,11 @@
 
 #include <cstring>
 #include <string>
+#include <unordered_set>
 #include <vector>
 
 #include "base/file_stream.h"
 #include "base/file_util.h"
-#include "base/hash_tables.h"
 #include "base/logging.h"
 #include "base/util.h"
 #include "converter/connector_base.h"
@@ -210,7 +210,7 @@
   }
 
   // Load the original suggestion filter from file.
-  hash_set<string> suggestion_filter_set;
+  std::unordered_set<string> suggestion_filter_set;
 
   vector<string> files;
   Util::SplitStringUsing(suggestion_filter_files_, ",", &files);
diff --git a/src/dictionary/system/system_dictionary_builder.cc b/src/dictionary/system/system_dictionary_builder.cc
index e0bdb21..f33abf6 100644
--- a/src/dictionary/system/system_dictionary_builder.cc
+++ b/src/dictionary/system/system_dictionary_builder.cc
@@ -33,10 +33,10 @@
 #include <climits>
 #include <cstring>
 #include <sstream>
+#include <unordered_set>
 
 #include "base/file_stream.h"
 #include "base/flags.h"
-#include "base/hash_tables.h"
 #include "base/logging.h"
 #include "base/util.h"
 #include "dictionary/dictionary_token.h"
@@ -202,7 +202,7 @@
     return false;
   }
 
-  hash_set<uint32> seen;
+  std::unordered_set<uint32> seen;
   for (size_t i = 0; i < key_info.tokens.size(); ++i) {
     const Token *token = key_info.tokens[i].token;
     const uint32 pos = GetCombinedPos(token->lid, token->rid);
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index 2b1ea14..1644008 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
 MAJOR=2
 MINOR=16
-BUILD=2037
+BUILD=2038
 REVISION=102
 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
 # downloaded by NaCl Mozc.
diff --git a/src/prediction/suggestion_filter_test.cc b/src/prediction/suggestion_filter_test.cc
index 4da49b2..f8fca07 100644
--- a/src/prediction/suggestion_filter_test.cc
+++ b/src/prediction/suggestion_filter_test.cc
@@ -30,13 +30,13 @@
 #include "prediction/suggestion_filter.h"
 
 #include <set>
-#include <vector>
 #include <string>
+#include <unordered_set>
+#include <vector>
 
 #include "base/file_stream.h"
 #include "base/file_util.h"
 #include "base/flags.h"
-#include "base/hash_tables.h"
 #include "base/logging.h"
 #include "base/util.h"
 #include "testing/base/public/googletest.h"
@@ -69,7 +69,7 @@
 
 TEST(SuggestionFilter, IsBadSuggestionTest) {
   // Load suggestion_filter
-  hash_set<string> suggestion_filter_set;
+  std::unordered_set<string> suggestion_filter_set;
 
   vector<string> files;
   Util::SplitStringUsing(FLAGS_suggestion_filter_files, ",", &files);
diff --git a/src/win32/tip/tip_text_service.cc b/src/win32/tip/tip_text_service.cc
index bfa7959..7010fad 100644
--- a/src/win32/tip/tip_text_service.cc
+++ b/src/win32/tip/tip_text_service.cc
@@ -38,9 +38,9 @@
 
 #include <memory>
 #include <string>
+#include <unordered_map>
 
 #include "base/const.h"
-#include "base/hash_tables.h"
 #include "base/logging.h"
 #include "base/port.h"
 #include "base/process.h"
@@ -239,7 +239,7 @@
 
 // Custom hash function for ATL::CComPtr.
 template <typename T>
-struct CComPtrHashCompare : public hash_compare<CComPtr<T>> {
+struct CComPtrHash {
   size_t operator()(const CComPtr<T> &value) const {
     // Caveats: On x86 environment, both _M_X64 and _M_IX86 are defined. So we
     //     need to check _M_X64 first.
@@ -253,20 +253,14 @@
     // Compress the data by shifting unused bits.
     return reinterpret_cast<size_t>(value.p) >> kUnusedBits;
   }
-  bool operator()(const CComPtr<T> &value1, const CComPtr<T> &value2) const {
-      return value1 != value2;
-  }
 };
 
 // Custom hash function for GUID.
-struct GuidHashCompare : public hash_compare<GUID> {
+struct GuidHash {
   size_t operator()(const GUID &value) const {
     // Compress the data by shifting unused bits.
     return value.Data1;
   }
-  bool operator()(const GUID &value1, const GUID &value2) const {
-    return !::IsEqualGUID(value1, value2);
-  }
 };
 
 // An observer that binds ITfCompositionSink::OnCompositionTerminated callback
@@ -1785,10 +1779,10 @@
   // Used for LangBar integration.
   TipLangBar langbar_;
 
-  typedef hash_map<GUID, UINT, GuidHashCompare> PreservedKeyMap;
-  typedef hash_map<CComPtr<ITfContext>,
-                   TipPrivateContext *,
-                   CComPtrHashCompare<ITfContext>> PrivateContextMap;
+  using PreservedKeyMap = std::unordered_map<GUID, UINT, GuidHash>;
+  using PrivateContextMap = std::unordered_map<CComPtr<ITfContext>,
+                                               TipPrivateContext *,
+                                               CComPtrHash<ITfContext>>;
   PrivateContextMap private_context_map_;
   PreservedKeyMap preserved_key_map_;
   unique_ptr<TipThreadContext> thread_context_;
diff --git a/src/win32/tip/tip_ui_element_immersive.cc b/src/win32/tip/tip_ui_element_immersive.cc
index 3dfce55..bd76ba3 100644
--- a/src/win32/tip/tip_ui_element_immersive.cc
+++ b/src/win32/tip/tip_ui_element_immersive.cc
@@ -40,8 +40,8 @@
 #include <msctf.h>
 
 #include <memory>
+#include <unordered_map>
 
-#include "base/hash_tables.h"
 #include "base/util.h"
 #include "renderer/table_layout.h"
 #include "renderer/win32/text_renderer.h"
@@ -607,9 +607,7 @@
   return window_handle;
 }
 
-class WindowMap
-    : public hash_map<HWND, TipImmersiveUiElementImpl *> {
-};
+using WindowMap = std::unordered_map<HWND, TipImmersiveUiElementImpl *>;
 
 class ThreadLocalInfo {
  public:
diff --git a/src/win32/tip/tip_ui_element_manager.cc b/src/win32/tip/tip_ui_element_manager.cc
index fda21ea..5294194 100644
--- a/src/win32/tip/tip_ui_element_manager.cc
+++ b/src/win32/tip/tip_ui_element_manager.cc
@@ -36,7 +36,8 @@
 #include <atlstr.h>
 #include <msctf.h>
 
-#include "base/hash_tables.h"
+#include <unordered_map>
+
 #include "renderer/renderer_command.pb.h"
 #include "session/commands.pb.h"
 #include "win32/base/input_state.h"
@@ -93,7 +94,8 @@
 }  // namespace
 
 class TipUiElementManager::UiElementMap
-    : public hash_map<TipUiElementManager::UIElementFlags, UIElementInfo> {
+    : public std::unordered_map<TipUiElementManager::UIElementFlags,
+                                UIElementInfo> {
 };
 
 TipUiElementManager::TipUiElementManager()
diff --git a/src/win32/tip/tip_ui_handler_immersive.cc b/src/win32/tip/tip_ui_handler_immersive.cc
index 594923d..1a74bf6 100644
--- a/src/win32/tip/tip_ui_handler_immersive.cc
+++ b/src/win32/tip/tip_ui_handler_immersive.cc
@@ -38,7 +38,8 @@
 #include <atlwin.h>
 #include <msctf.h>
 
-#include "base/hash_tables.h"
+#include <unordered_map>
+
 #include "base/util.h"
 #include "session/commands.pb.h"
 #include "win32/tip/tip_composition_util.h"
@@ -74,37 +75,7 @@
 // value, the current thread is initialized.
 volatile DWORD g_tls_index = TLS_OUT_OF_INDEXES;
 
-// Visual C++ 2008 requires this.
-#if 1310 <= _MSC_VER || _MSC_VER < 1600
-using stdext::hash_compare;
-#endif  // 1310 <= _MSC_VER < 1600
-
-// Custom hash function for ATL::CComPtr.
-template <typename T>
-struct PtrHashCompare : public hash_compare<T> {
-  std::size_t operator()(const T &value) const {
-    // Caveats: On x86 environment, both _M_X64 and _M_IX86 are defined. So we
-    //     need to check _M_X64 first.
-#if defined(_M_X64)
-    const size_t kUnusedBits = 3;  // assuming 8-byte aligned
-#elif defined(_M_IX86)
-    const size_t kUnusedBits = 2;  // assuming 4-byte aligned
-#else
-#error "unsupported platform"
-#endif
-    // Compress the data by shifting unused bits.
-    return reinterpret_cast<size_t>(value) >> kUnusedBits;
-  }
-  bool operator()(const T &value1, const T &value2) const {
-    return value1 != value2;
-  }
-};
-
-class UiElementMap
-    : public hash_map<ITfUIElement *,
-                      HWND,
-                      PtrHashCompare<IUnknown *> > {
-};
+using UiElementMap = std::unordered_map<ITfUIElement *, HWND>;
 
 class ThreadLocalInfo {
  public: