Index: webkit/fileapi/media/mtp_device_map_service.cc |
diff --git a/webkit/fileapi/media/mtp_device_map_service.cc b/webkit/fileapi/media/mtp_device_map_service.cc |
index 68bf3d47b3e144bf9c866c6ae5561c2d3e609cfe..e4284e14b95322c19f7f0015ad90350a3173f051 100644 |
--- a/webkit/fileapi/media/mtp_device_map_service.cc |
+++ b/webkit/fileapi/media/mtp_device_map_service.cc |
@@ -20,11 +20,10 @@ MTPDeviceMapService* MTPDeviceMapService::GetInstance() { |
void MTPDeviceMapService::AddDelegate( |
const FilePath::StringType& device_location, |
- scoped_refptr<MTPDeviceDelegate> delegate) { |
+ MTPDeviceDelegate* delegate) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- DCHECK(delegate.get()); |
+ DCHECK(delegate); |
DCHECK(!device_location.empty()); |
- |
if (ContainsKey(delegate_map_, device_location)) |
return; |
@@ -36,6 +35,7 @@ void MTPDeviceMapService::RemoveDelegate( |
DCHECK(thread_checker_.CalledOnValidThread()); |
DelegateMap::iterator it = delegate_map_.find(device_location); |
DCHECK(it != delegate_map_.end()); |
+ it->second->CancelPendingTasksAndDeleteDelegate(); |
delegate_map_.erase(it); |
} |
@@ -53,7 +53,7 @@ MTPDeviceDelegate* MTPDeviceMapService::GetMTPDeviceDelegate( |
DelegateMap::const_iterator it = delegate_map_.find(device_location); |
DCHECK(it != delegate_map_.end()); |
- return it->second.get(); |
+ return it->second; |
} |
MTPDeviceMapService::MTPDeviceMapService() { |