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

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: Addressed review comments 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..97ba2d300c761fc58cb39f8ad3ad978d4615e8fa 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>
@@ -21,6 +22,8 @@ class WaitableEvent;
namespace chrome {
+class MTPDeviceObjectEnumerator;
+
// Recursively enumerate each file entry from a given media file entry set.
class MTPRecursiveDeviceObjectEnumerator
: public fileapi::FileSystemFileUtil::AbstractFileEnumerator {
@@ -40,6 +43,13 @@ class MTPRecursiveDeviceObjectEnumerator
virtual base::Time LastModifiedTime() OVERRIDE;
private:
+ typedef uint32_t DirectoryEntryId;
+
+ // Returns an enumerator to traverse the subdirectory objects. If there
+ // is no subdirectory, returns NULL. The caller owns the returned
+ // MTPDeviceObjectEnumerator.
+ scoped_ptr<MTPDeviceObjectEnumerator> GetSubdirectoryEnumerator();
+
// Stores the device handle that was used to open the device.
const std::string device_handle_;
@@ -47,15 +57,14 @@ 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_;
-
- // Iterator to access the individual file entries.
- std::vector<MtpFileEntry>::const_iterator file_entry_iter_;
-
// Enumerator to access current directory Id/path entries.
+ scoped_ptr<MTPDeviceObjectEnumerator> current_enumerator_;
+
scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
- current_enumerator_;
+ empty_enumerator_;
+
+ // Queue of untraversed directories.
+ std::queue<DirectoryEntryId> untraversed_directory_entry_ids_;
// |media_task_runner_| can wait on this event until the requested operation
// is complete.

Powered by Google App Engine
This is Rietveld 408576698