Index: components/gcm_driver/instance_id/instance_id_driver.cc |
diff --git a/components/gcm_driver/instance_id/instance_id_driver.cc b/components/gcm_driver/instance_id/instance_id_driver.cc |
index e671fef8c07ebcd70dff9b8225bd73ae5b0e6e84..140d5019efd1c92e9fb09fbf444aafea74a283cc 100644 |
--- a/components/gcm_driver/instance_id/instance_id_driver.cc |
+++ b/components/gcm_driver/instance_id/instance_id_driver.cc |
@@ -29,8 +29,7 @@ bool InstanceIDDriver::IsInstanceIDEnabled() { |
} |
InstanceIDDriver::InstanceIDDriver(gcm::GCMDriver* gcm_driver) |
- : gcm_driver_(gcm_driver), |
- instance_id_map_deleter_(&instance_id_map_) { |
+ : gcm_driver_(gcm_driver) { |
} |
InstanceIDDriver::~InstanceIDDriver() { |
@@ -41,17 +40,14 @@ InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { |
if (iter != instance_id_map_.end()) |
return iter->second; |
- InstanceID* instance_id = InstanceID::Create(app_id, gcm_driver_); |
- instance_id_map_[app_id] = instance_id; |
- return instance_id; |
+ scoped_ptr<InstanceID> instance_id = InstanceID::Create(app_id, gcm_driver_); |
+ InstanceID* instance_id_ptr = instance_id.get(); |
+ instance_id_map_.insert(app_id, instance_id.Pass()); |
+ return instance_id_ptr; |
} |
void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { |
- auto iter = instance_id_map_.find(app_id); |
- if (iter == instance_id_map_.end()) |
- return; |
- delete iter->second; |
- instance_id_map_.erase(iter); |
+ instance_id_map_.erase(app_id); |
} |
bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { |