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_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMERATO R_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMERATO R_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMERATO R_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMERATO R_H_ |
7 | 7 |
8 #include <queue> | |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/time.h" | 14 #include "base/time.h" |
14 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" | 15 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" |
15 #include "webkit/fileapi/file_system_file_util.h" | 16 #include "webkit/fileapi/file_system_file_util.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
(...skipping 15 matching lines...) Expand all Loading... | |
33 | 34 |
34 virtual ~MTPRecursiveDeviceObjectEnumerator(); | 35 virtual ~MTPRecursiveDeviceObjectEnumerator(); |
35 | 36 |
36 // AbstractFileEnumerator: | 37 // AbstractFileEnumerator: |
37 virtual FilePath Next() OVERRIDE; | 38 virtual FilePath Next() OVERRIDE; |
38 virtual int64 Size() OVERRIDE; | 39 virtual int64 Size() OVERRIDE; |
39 virtual bool IsDirectory() OVERRIDE; | 40 virtual bool IsDirectory() OVERRIDE; |
40 virtual base::Time LastModifiedTime() OVERRIDE; | 41 virtual base::Time LastModifiedTime() OVERRIDE; |
41 | 42 |
42 private: | 43 private: |
44 typedef uint32_t DirectoryEntryId; | |
45 | |
46 void MaybeUpdateCurrentFileEntryList(); | |
47 | |
43 // Stores the device handle that was used to open the device. | 48 // Stores the device handle that was used to open the device. |
44 const std::string device_handle_; | 49 const std::string device_handle_; |
45 | 50 |
46 // Stores a reference to |media_task_runner_| to construct and destruct | 51 // Stores a reference to |media_task_runner_| to construct and destruct |
47 // ReadMTPDirectoryWorker object on the correct thread. | 52 // ReadMTPDirectoryWorker object on the correct thread. |
48 scoped_refptr<base::SequencedTaskRunner> media_task_runner_; | 53 scoped_refptr<base::SequencedTaskRunner> media_task_runner_; |
49 | 54 |
50 // List of top-level directory file entries. | 55 // List of current directory file entries. |
51 const std::vector<MtpFileEntry> file_entries_; | 56 std::vector<MtpFileEntry> file_entries_; |
52 | 57 |
53 // Iterator to access the individual file entries. | 58 // Iterator to access the individual file entries. |
54 std::vector<MtpFileEntry>::const_iterator file_entry_iter_; | 59 std::vector<MtpFileEntry>::const_iterator file_entry_iter_; |
55 | 60 |
56 // Enumerator to access current directory Id/path entries. | 61 // Enumerator to access current directory Id/path entries. |
57 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> | 62 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> |
58 current_enumerator_; | 63 current_enumerator_; |
59 | 64 |
65 // Used to recursively enumerate the sub-directory objects. | |
Lei Zhang
2013/01/11 06:35:44
Just say "Queue of untraversed directories."
kmadhusu
2013/01/11 22:34:22
Done.
| |
66 std::queue<DirectoryEntryId> unparsed_directory_entry_ids_; | |
67 | |
60 // |media_task_runner_| can wait on this event until the requested operation | 68 // |media_task_runner_| can wait on this event until the requested operation |
61 // is complete. | 69 // is complete. |
62 base::WaitableEvent* on_task_completed_event_; | 70 base::WaitableEvent* on_task_completed_event_; |
63 | 71 |
64 // Stores a reference to waitable event associated with the shut down message. | 72 // Stores a reference to waitable event associated with the shut down message. |
65 base::WaitableEvent* on_shutdown_event_; | 73 base::WaitableEvent* on_shutdown_event_; |
66 | 74 |
67 DISALLOW_COPY_AND_ASSIGN(MTPRecursiveDeviceObjectEnumerator); | 75 DISALLOW_COPY_AND_ASSIGN(MTPRecursiveDeviceObjectEnumerator); |
68 }; | 76 }; |
69 | 77 |
70 } // namespace chrome | 78 } // namespace chrome |
71 | 79 |
72 #endif // CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMER ATOR_H_ | 80 #endif // CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMER ATOR_H_ |
OLD | NEW |