Add a SafeMap equivalent to std::map but without the error-prone operator[].

Change-Id: Iae5ba2091c55a34dbd1005cf3d25fce2a8d5c1f9
diff --git a/src/hprof/hprof.cc b/src/hprof/hprof.cc
index b118b5c..d6771d0 100644
--- a/src/hprof/hprof.cc
+++ b/src/hprof/hprof.cc
@@ -649,10 +649,13 @@
 }
 
 HprofStringId Hprof::LookupStringId(std::string string) {
-  if (strings_.find(string) == strings_.end()) {
-    strings_[string] = next_string_id_++;
+  StringMapIterator it = strings_.find(string);
+  if (it != strings_.end()) {
+    return it->second;
   }
-  return strings_[string];
+  HprofStringId id = next_string_id_++;
+  strings_.Put(string, id);
+  return id;
 }
 
 int Hprof::DumpStrings() {