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

Unified Diff: chrome/browser/media_gallery/linux/mtp_recursive_device_object_enumerator.h

Issue 11855005: [Linux, Media Gallery] Fix MTPRecursiveDeviceObjectEnumerator to recursively enumerate all the medi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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: chrome/browser/media_gallery/linux/mtp_recursive_device_object_enumerator.h
diff --git a/chrome/browser/media_gallery/linux/mtp_recursive_device_object_enumerator.h b/chrome/browser/media_gallery/linux/mtp_recursive_device_object_enumerator.h
index 13b5910198f9f5cddf465f0a9115c28648760a59..a6a67c40843bd88c1d7eb5966706a9d93f0a5ddf 100644
--- a/chrome/browser/media_gallery/linux/mtp_recursive_device_object_enumerator.h
+++ b/chrome/browser/media_gallery/linux/mtp_recursive_device_object_enumerator.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMERATOR_H_
#define CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMERATOR_H_
+#include <queue>
#include <string>
#include <vector>
@@ -40,6 +41,10 @@ class MTPRecursiveDeviceObjectEnumerator
virtual base::Time LastModifiedTime() OVERRIDE;
private:
+ typedef uint32_t DirectoryEntryId;
+
+ void MaybeUpdateCurrentFileEntryList();
+
// Stores the device handle that was used to open the device.
const std::string device_handle_;
@@ -47,8 +52,8 @@ class MTPRecursiveDeviceObjectEnumerator
// ReadMTPDirectoryWorker object on the correct thread.
scoped_refptr<base::SequencedTaskRunner> media_task_runner_;
- // List of top-level directory file entries.
- const std::vector<MtpFileEntry> file_entries_;
+ // List of current directory file entries.
+ std::vector<MtpFileEntry> file_entries_;
// Iterator to access the individual file entries.
std::vector<MtpFileEntry>::const_iterator file_entry_iter_;
@@ -57,6 +62,9 @@ class MTPRecursiveDeviceObjectEnumerator
scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
current_enumerator_;
+ // 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.
+ std::queue<DirectoryEntryId> unparsed_directory_entry_ids_;
+
// |media_task_runner_| can wait on this event until the requested operation
// is complete.
base::WaitableEvent* on_task_completed_event_;

Powered by Google App Engine
This is Rietveld 408576698