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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 UpdateEnumeratorToTraverseSubdirectory();
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.
51 const std::vector<MtpFileEntry> file_entries_;
52
53 // Iterator to access the individual file entries.
54 std::vector<MtpFileEntry>::const_iterator file_entry_iter_;
55
56 // Enumerator to access current directory Id/path entries. 55 // Enumerator to access current directory Id/path entries.
57 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> 56 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
58 current_enumerator_; 57 current_enumerator_;
59 58
59 // Queue of untraversed directories.
60 std::queue<DirectoryEntryId> untraversed_directory_entry_ids_;
61
60 // |media_task_runner_| can wait on this event until the requested operation 62 // |media_task_runner_| can wait on this event until the requested operation
61 // is complete. 63 // is complete.
62 base::WaitableEvent* on_task_completed_event_; 64 base::WaitableEvent* on_task_completed_event_;
63 65
64 // Stores a reference to waitable event associated with the shut down message. 66 // Stores a reference to waitable event associated with the shut down message.
65 base::WaitableEvent* on_shutdown_event_; 67 base::WaitableEvent* on_shutdown_event_;
66 68
67 DISALLOW_COPY_AND_ASSIGN(MTPRecursiveDeviceObjectEnumerator); 69 DISALLOW_COPY_AND_ASSIGN(MTPRecursiveDeviceObjectEnumerator);
68 }; 70 };
69 71
70 } // namespace chrome 72 } // namespace chrome
71 73
72 #endif // CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMER ATOR_H_ 74 #endif // CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_RECURSIVE_DEVICE_OBJECT_ENUMER ATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698