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

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

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: Add invalidate call. 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 #include "chrome/browser/media_galleries/fileapi/safe_picasa_album_table_reader. h" 5 #include "chrome/browser/media_galleries/fileapi/safe_picasa_album_table_reader. h"
6 6
7 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 7 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
8 #include "chrome/common/chrome_utility_messages.h" 8 #include "chrome/common/chrome_utility_messages.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/child_process_data.h" 10 #include "content/public/browser/child_process_data.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void SafePicasaAlbumTableReader::OnParsePicasaPMPDatabaseFinished( 96 void SafePicasaAlbumTableReader::OnParsePicasaPMPDatabaseFinished(
97 bool parse_success, 97 bool parse_success,
98 const std::vector<AlbumInfo>& albums, 98 const std::vector<AlbumInfo>& albums,
99 const std::vector<AlbumInfo>& folders) { 99 const std::vector<AlbumInfo>& folders) {
100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
101 if (parser_state_ != STARTED_PARSING_STATE) 101 if (parser_state_ != STARTED_PARSING_STATE)
102 return; 102 return;
103 103
104 MediaFileSystemBackend::MediaTaskRunner()->PostTask( 104 MediaFileSystemBackend::MediaTaskRunner()->PostTask(
105 FROM_HERE, 105 FROM_HERE,
106 base::Bind(callback_, parse_success, albums, folders)); 106 base::Bind(callback_,
107 scoped_refptr<SafePicasaAlbumTableReader>(this),
vandebo (ex-Chrome) 2013/07/11 16:56:27 make_scoped_refptr might be easier here.
tommycli 2013/07/11 21:19:17 Done.
108 parse_success,
109 albums,
110 folders));
107 parser_state_ = FINISHED_PARSING_STATE; 111 parser_state_ = FINISHED_PARSING_STATE;
108 } 112 }
109 113
110 void SafePicasaAlbumTableReader::OnProcessCrashed(int exit_code) { 114 void SafePicasaAlbumTableReader::OnProcessCrashed(int exit_code) {
111 OnParsePicasaPMPDatabaseFinished(false, std::vector<AlbumInfo>(), 115 OnParsePicasaPMPDatabaseFinished(false, std::vector<AlbumInfo>(),
112 std::vector<AlbumInfo>()); 116 std::vector<AlbumInfo>());
113 } 117 }
114 118
115 bool SafePicasaAlbumTableReader::OnMessageReceived( 119 bool SafePicasaAlbumTableReader::OnMessageReceived(
116 const IPC::Message& message) { 120 const IPC::Message& message) {
117 bool handled = true; 121 bool handled = true;
118 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumTableReader, message) 122 IPC_BEGIN_MESSAGE_MAP(SafePicasaAlbumTableReader, message)
119 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted, 123 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted,
120 OnProcessStarted) 124 OnProcessStarted)
121 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, 125 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished,
122 OnParsePicasaPMPDatabaseFinished) 126 OnParsePicasaPMPDatabaseFinished)
123 IPC_MESSAGE_UNHANDLED(handled = false) 127 IPC_MESSAGE_UNHANDLED(handled = false)
124 IPC_END_MESSAGE_MAP() 128 IPC_END_MESSAGE_MAP()
125 return handled; 129 return handled;
126 } 130 }
127 131
128 } // namespace picasa 132 } // namespace picasa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698