Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: webkit/fileapi/media/mtp_device_map_service.cc

Issue 11358243: Redesigned and refactored ScopedMTPDeviceMapEntry, MTPDeviceMapService & MTPDeviceDelegate classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..05f2410d73f041e8c3e9cf0528e72452f845636b 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,11 +35,12 @@ 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);
}
-MTPDeviceDelegate* MTPDeviceMapService::GetMTPDeviceDelegate(
- const std::string& filesystem_id) {
+MTPDeviceDelegate* MTPDeviceMapService::
+ GetMTPDeviceDelegate(const std::string& filesystem_id) {
kinuko 2012/11/15 10:23:39 nit: this new indentation looks a bit unusual...?
kmadhusu 2012/11/15 17:52:24 Fixed.
DCHECK(thread_checker_.CalledOnValidThread());
FilePath device_path;
if (!IsolatedContext::GetInstance()->GetRegisteredPath(filesystem_id,
@@ -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() {
« webkit/fileapi/media/mtp_device_delegate.h ('K') | « webkit/fileapi/media/mtp_device_map_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698