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

Side by Side Diff: chrome/browser/media_galleries/fileapi/safe_picasa_album_table_reader.h

Issue 18986012: Media Galleries API Picasa: Make PicasaDataProvider handle async PMP and INI parsing robustly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0039-picasa-import-sandbox-ini-parsing
Patch Set: Created 7 years, 5 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
OLDNEW
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 13 matching lines...) Expand all
24 24
25 namespace picasa { 25 namespace picasa {
26 26
27 // SafePicasaAlbumTableReader parses the given Picasa PMP Album Table safely 27 // SafePicasaAlbumTableReader parses the given Picasa PMP Album Table safely
28 // via a utility process. The SafePicasaAlbumTableReader object is ref-counted 28 // via a utility process. The SafePicasaAlbumTableReader object is ref-counted
29 // and kept alive after Start() is called until the ParserCallback is called. 29 // and kept alive after Start() is called until the ParserCallback is called.
30 // The ParserCallback is guaranteed to be called eventually either when the 30 // The ParserCallback is guaranteed to be called eventually either when the
31 // utility process replies or when it dies. 31 // utility process replies or when it dies.
32 class SafePicasaAlbumTableReader : public content::UtilityProcessHostClient { 32 class SafePicasaAlbumTableReader : public content::UtilityProcessHostClient {
33 public: 33 public:
34 typedef base::Callback<void(bool, 34 // Callback includes a refptr to itself to guarantee that this object
35 // survives past the execution of its last posted callback.
36 typedef base::Callback<void(scoped_refptr<SafePicasaAlbumTableReader>,
37 bool,
35 const std::vector<AlbumInfo>&, 38 const std::vector<AlbumInfo>&,
36 const std::vector<AlbumInfo>&)> ParserCallback; 39 const std::vector<AlbumInfo>&)> ParserCallback;
37 40
38 SafePicasaAlbumTableReader(const AlbumTableFiles& album_table_files, 41 SafePicasaAlbumTableReader(const AlbumTableFiles& album_table_files,
39 const ParserCallback& callback); 42 const ParserCallback& callback);
40 43
41 void Start(); 44 void Start();
42 45
43 private: 46 private:
44 enum ParserState { 47 enum ParserState {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Verifies the messages from the utility process came at the right time. 85 // Verifies the messages from the utility process came at the right time.
83 // Initialized on the Media Task Runner, but only accessed on the IO thread. 86 // Initialized on the Media Task Runner, but only accessed on the IO thread.
84 ParserState parser_state_; 87 ParserState parser_state_;
85 88
86 DISALLOW_COPY_AND_ASSIGN(SafePicasaAlbumTableReader); 89 DISALLOW_COPY_AND_ASSIGN(SafePicasaAlbumTableReader);
87 }; 90 };
88 91
89 } // namespace picasa 92 } // namespace picasa
90 93
91 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER _H_ 94 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SAFE_PICASA_ALBUM_TABLE_READER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698