| Index: webkit/fileapi/media/mtp_device_map_service.h
|
| diff --git a/webkit/fileapi/media/mtp_device_map_service.h b/webkit/fileapi/media/mtp_device_map_service.h
|
| index 3002097ad7963f4361317e850148ba163c46d64f..6849976a82f2f280aa3dca7ce5d3e06f28c61834 100644
|
| --- a/webkit/fileapi/media/mtp_device_map_service.h
|
| +++ b/webkit/fileapi/media/mtp_device_map_service.h
|
| @@ -8,8 +8,8 @@
|
| #include <map>
|
|
|
| #include "base/file_path.h"
|
| -#include "base/memory/ref_counted.h"
|
| #include "base/memory/singleton.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/threading/thread_checker.h"
|
| #include "webkit/storage/webkit_storage_export.h"
|
|
|
| @@ -17,43 +17,45 @@ namespace fileapi {
|
|
|
| class MTPDeviceDelegate;
|
|
|
| -// Helper class to manage media device delegates which can communicate with mtp
|
| -// devices to complete media file system operations.
|
| +// This class provides media transfer protocol (MTP) device delegate to
|
| +// complete media file system operations. ScopedMTPDeviceMapEntry class
|
| +// manages the device map entries. This class operates on the IO thread.
|
| class WEBKIT_STORAGE_EXPORT MTPDeviceMapService {
|
| public:
|
| static MTPDeviceMapService* GetInstance();
|
|
|
| - // Adds the media device delegate for the given |device_location|. Called on
|
| - // IO thread.
|
| + // Adds the MTP device delegate to the map service. |device_location|
|
| + // specifies the mount location of the MTP device.
|
| + // Called on the IO thread.
|
| void AddDelegate(const FilePath::StringType& device_location,
|
| - scoped_refptr<MTPDeviceDelegate> delegate);
|
| + MTPDeviceDelegate* delegate);
|
|
|
| - // Removes the media device delegate for the given |device_location| if
|
| - // exists. Called on IO thread.
|
| + // Removes the MTP device delegate from the map service. |device_location|
|
| + // specifies the mount location of the MTP device.
|
| + // Called on the IO thread.
|
| void RemoveDelegate(const FilePath::StringType& device_location);
|
|
|
| // Gets the media device delegate associated with |filesystem_id|.
|
| // Return NULL if the |filesystem_id| is no longer valid (e.g. because the
|
| - // corresponding device is detached etc). Called on IO thread.
|
| + // corresponding device is detached etc).
|
| + // Called on the IO thread.
|
| MTPDeviceDelegate* GetMTPDeviceDelegate(const std::string& filesystem_id);
|
|
|
| private:
|
| friend struct DefaultSingletonTraits<MTPDeviceMapService>;
|
|
|
| - typedef scoped_refptr<MTPDeviceDelegate> MTPDeviceDelegateObj;
|
| -
|
| - // Mapping of device_location and MTPDeviceDelegate object.
|
| - typedef std::map<FilePath::StringType, MTPDeviceDelegateObj> DelegateMap;
|
| + // Mapping of device_location and MTPDeviceDelegate* object. It is safe to
|
| + // store and access the raw pointer. This class operates on the IO thread.
|
| + typedef std::map<FilePath::StringType, MTPDeviceDelegate*> DelegateMap;
|
|
|
| // Get access to this class using GetInstance() method.
|
| MTPDeviceMapService();
|
| ~MTPDeviceMapService();
|
|
|
| - // Stores a map of attached mtp device delegates.
|
| + // Map of attached mtp device delegates.
|
| DelegateMap delegate_map_;
|
|
|
| - // Stores a |thread_checker_| object to verify all methods of this class are
|
| - // called on same thread.
|
| + // Object to verify all methods of this class are called on the same thread.
|
| base::ThreadChecker thread_checker_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(MTPDeviceMapService);
|
|
|