OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const content::BrowserThread::ID thread_id; | 53 const content::BrowserThread::ID thread_id; |
54 const tracked_objects::Location location; | 54 const tracked_objects::Location location; |
55 const base::Closure task; | 55 const base::Closure task; |
56 }; | 56 }; |
57 | 57 |
58 class MTPFileNode; | 58 class MTPFileNode; |
59 | 59 |
60 // Maps file ids to file nodes. | 60 // Maps file ids to file nodes. |
61 typedef std::map<uint32, MTPFileNode*> FileIdToMTPFileNodeMap; | 61 typedef std::map<uint32, MTPFileNode*> FileIdToMTPFileNodeMap; |
62 | 62 |
| 63 // Maps file paths to file info. |
| 64 typedef std::map<base::FilePath, fileapi::DirectoryEntry> FileInfoCache; |
| 65 |
63 // Should only be called by CreateMTPDeviceAsyncDelegate() factory call. | 66 // Should only be called by CreateMTPDeviceAsyncDelegate() factory call. |
64 // Defer the device initializations until the first file operation request. | 67 // Defer the device initializations until the first file operation request. |
65 // Do all the initializations in EnsureInitAndRunTask() function. | 68 // Do all the initializations in EnsureInitAndRunTask() function. |
66 explicit MTPDeviceDelegateImplLinux(const std::string& device_location); | 69 explicit MTPDeviceDelegateImplLinux(const std::string& device_location); |
67 | 70 |
68 // Destructed via CancelPendingTasksAndDeleteDelegate(). | 71 // Destructed via CancelPendingTasksAndDeleteDelegate(). |
69 virtual ~MTPDeviceDelegateImplLinux(); | 72 virtual ~MTPDeviceDelegateImplLinux(); |
70 | 73 |
71 // MTPDeviceAsyncDelegate: | 74 // MTPDeviceAsyncDelegate: |
72 virtual void GetFileInfo(const base::FilePath& file_path, | 75 virtual void GetFileInfo(const base::FilePath& file_path, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 FileIdToMTPFileNodeMap file_id_to_node_map_; | 274 FileIdToMTPFileNodeMap file_id_to_node_map_; |
272 | 275 |
273 // The root node of a tree-structure that caches the directory structure of | 276 // The root node of a tree-structure that caches the directory structure of |
274 // the MTP device. | 277 // the MTP device. |
275 scoped_ptr<MTPFileNode> root_node_; | 278 scoped_ptr<MTPFileNode> root_node_; |
276 | 279 |
277 // A list of child nodes encountered while a ReadDirectory operation, which | 280 // A list of child nodes encountered while a ReadDirectory operation, which |
278 // can return results over multiple callbacks, is in progress. | 281 // can return results over multiple callbacks, is in progress. |
279 std::set<std::string> child_nodes_seen_; | 282 std::set<std::string> child_nodes_seen_; |
280 | 283 |
| 284 // A cache to store file metadata for file entries read during a ReadDirectory |
| 285 // operation. Used to service incoming GetFileInfo calls for the duration of |
| 286 // the ReadDirectory operation. |
| 287 FileInfoCache file_info_cache_; |
| 288 |
281 // For callbacks that may run after destruction. | 289 // For callbacks that may run after destruction. |
282 base::WeakPtrFactory<MTPDeviceDelegateImplLinux> weak_ptr_factory_; | 290 base::WeakPtrFactory<MTPDeviceDelegateImplLinux> weak_ptr_factory_; |
283 | 291 |
284 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplLinux); | 292 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplLinux); |
285 }; | 293 }; |
286 | 294 |
287 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H
_ | 295 #endif // CHROME_BROWSER_MEDIA_GALLERIES_LINUX_MTP_DEVICE_DELEGATE_IMPL_LINUX_H
_ |
OLD | NEW |