| 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_ALBUM_TABLE_READER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 ParserCallback; | 38 ParserCallback; |
| 39 | 39 |
| 40 // This class takes ownership of |album_table_files| and will close them. | 40 // This class takes ownership of |album_table_files| and will close them. |
| 41 explicit SafePicasaAlbumTableReader(AlbumTableFiles album_table_files); | 41 explicit SafePicasaAlbumTableReader(AlbumTableFiles album_table_files); |
| 42 | 42 |
| 43 void Start(const ParserCallback& callback); | 43 void Start(const ParserCallback& callback); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 enum ParserState { | 46 enum ParserState { |
| 47 INITIAL_STATE, | 47 INITIAL_STATE, |
| 48 PINGED_UTILITY_PROCESS_STATE, | |
| 49 STARTED_PARSING_STATE, | 48 STARTED_PARSING_STATE, |
| 50 FINISHED_PARSING_STATE, | 49 FINISHED_PARSING_STATE, |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 // Private because content::UtilityProcessHostClient is ref-counted. | 52 // Private because content::UtilityProcessHostClient is ref-counted. |
| 54 ~SafePicasaAlbumTableReader() override; | 53 ~SafePicasaAlbumTableReader() override; |
| 55 | 54 |
| 56 // Launches the utility process. Must run on the IO thread. | 55 // Launches the utility process. Must run on the IO thread. |
| 57 void StartWorkOnIOThread(); | 56 void StartWorkOnIOThread(); |
| 58 | 57 |
| 59 // Notification that the utility process is running, and we can now get its | |
| 60 // process handle. | |
| 61 // Runs on the IO thread. | |
| 62 void OnProcessStarted(); | |
| 63 | |
| 64 // Notification from the utility process when it finshes parsing the PMP | 58 // Notification from the utility process when it finshes parsing the PMP |
| 65 // database. This is received even if PMP parsing fails. | 59 // database. This is received even if PMP parsing fails. |
| 66 // Runs on the IO thread. | 60 // Runs on the IO thread. |
| 67 void OnParsePicasaPMPDatabaseFinished(bool parse_success, | 61 void OnParsePicasaPMPDatabaseFinished(bool parse_success, |
| 68 const std::vector<AlbumInfo>& albums, | 62 const std::vector<AlbumInfo>& albums, |
| 69 const std::vector<AlbumInfo>& folders); | 63 const std::vector<AlbumInfo>& folders); |
| 70 | 64 |
| 71 // UtilityProcessHostClient implementation. | 65 // UtilityProcessHostClient implementation. |
| 72 // Runs on the IO thread. | 66 // Runs on the IO thread. |
| 73 void OnProcessCrashed(int exit_code) override; | 67 void OnProcessCrashed(int exit_code) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 84 // 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. |
| 85 // 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. |
| 86 ParserState parser_state_; | 80 ParserState parser_state_; |
| 87 | 81 |
| 88 DISALLOW_COPY_AND_ASSIGN(SafePicasaAlbumTableReader); | 82 DISALLOW_COPY_AND_ASSIGN(SafePicasaAlbumTableReader); |
| 89 }; | 83 }; |
| 90 | 84 |
| 91 } // namespace picasa | 85 } // namespace picasa |
| 92 | 86 |
| 93 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER
_H_ | 87 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER
_H_ |
| OLD | NEW |