OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FILEAPI_SAFE_PICASA_ALBUMS_INDEXER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUMS_INDEXER_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUMS_INDEXER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUMS_INDEXER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 void Start(const DoneCallback& callback); | 40 void Start(const DoneCallback& callback); |
41 | 41 |
42 private: | 42 private: |
43 enum ParserState { | 43 enum ParserState { |
44 INITIAL_STATE, | 44 INITIAL_STATE, |
45 STARTED_PARSING_STATE, | 45 STARTED_PARSING_STATE, |
46 FINISHED_PARSING_STATE, | 46 FINISHED_PARSING_STATE, |
47 }; | 47 }; |
48 | 48 |
49 // Private because content::UtilityProcessHostClient is ref-counted. | 49 // Private because content::UtilityProcessHostClient is ref-counted. |
50 virtual ~SafePicasaAlbumsIndexer(); | 50 ~SafePicasaAlbumsIndexer() override; |
51 | 51 |
52 // Processes a batch of folders. Reposts itself until done, then starts IPC. | 52 // Processes a batch of folders. Reposts itself until done, then starts IPC. |
53 void ProcessFoldersBatch(); | 53 void ProcessFoldersBatch(); |
54 | 54 |
55 // Launches the utility process. Must run on the IO thread. | 55 // Launches the utility process. Must run on the IO thread. |
56 void StartWorkOnIOThread(); | 56 void StartWorkOnIOThread(); |
57 | 57 |
58 // Notification from the utility process when it finshes indexing all the | 58 // Notification from the utility process when it finshes indexing all the |
59 // album contents. On error will return an empty map. | 59 // album contents. On error will return an empty map. |
60 // Runs on the IO thread. | 60 // Runs on the IO thread. |
61 void OnIndexPicasaAlbumsContentsFinished(const AlbumImagesMap& albums_images); | 61 void OnIndexPicasaAlbumsContentsFinished(const AlbumImagesMap& albums_images); |
62 | 62 |
63 // UtilityProcessHostClient implementation. | 63 // UtilityProcessHostClient implementation. |
64 // Runs on the IO thread. | 64 // Runs on the IO thread. |
65 virtual void OnProcessCrashed(int exit_code) override; | 65 void OnProcessCrashed(int exit_code) override; |
66 virtual bool OnMessageReceived(const IPC::Message& message) override; | 66 bool OnMessageReceived(const IPC::Message& message) override; |
67 | 67 |
68 AlbumUIDSet album_uids_; | 68 AlbumUIDSet album_uids_; |
69 | 69 |
70 // List of folders that still need their INI files read. | 70 // List of folders that still need their INI files read. |
71 std::queue<base::FilePath> folders_queue_; | 71 std::queue<base::FilePath> folders_queue_; |
72 | 72 |
73 std::vector<picasa::FolderINIContents> folders_inis_; | 73 std::vector<picasa::FolderINIContents> folders_inis_; |
74 | 74 |
75 // Only accessed on the Media Task Runner. | 75 // Only accessed on the Media Task Runner. |
76 DoneCallback callback_; | 76 DoneCallback callback_; |
77 | 77 |
78 // Verifies the messages from the utility process came at the right time. | 78 // Verifies the messages from the utility process came at the right time. |
79 // Initialized on the Media Task Runner, but only accessed on the IO thread. | 79 // Initialized on the Media Task Runner, but only accessed on the IO thread. |
80 ParserState parser_state_; | 80 ParserState parser_state_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(SafePicasaAlbumsIndexer); | 82 DISALLOW_COPY_AND_ASSIGN(SafePicasaAlbumsIndexer); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace picasa | 85 } // namespace picasa |
86 | 86 |
87 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUMS_INDEXER_H_ | 87 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUMS_INDEXER_H_ |
OLD | NEW |