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

Unified Diff: chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc
diff --git a/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc b/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc
index 21205e0cddeaf3eb1eec271c48423fb0125e081c..b6234138f37e17e7549acf19f7dafa6ac5691d57 100644
--- a/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc
+++ b/chrome/browser/media_galleries/fileapi/safe_picasa_albums_indexer.cc
@@ -9,7 +9,6 @@
#include "chrome/common/chrome_utility_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
-#include "content/public/browser/utility_process_host.h"
using chrome::MediaFileSystemBackend;
using content::BrowserThread;
@@ -105,11 +104,14 @@ void SafePicasaAlbumsIndexer::StartWorkOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(FINISHED_READING_INI_FILES_STATE, parser_state_);
- UtilityProcessHost* host =
- UtilityProcessHost::Create(this, base::MessageLoopProxy::current());
- host->EnableZygote();
- host->Send(new ChromeUtilityMsg_IndexPicasaAlbumsContents(album_uids_,
- folders_inis_));
+ utility_process_host_ = content::UtilityProcessHost::Create(
+ this,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())
vandebo (ex-Chrome) 2013/07/12 18:29:59 make a local temp variable to get nicer indenting.
vandebo (ex-Chrome) 2013/07/12 18:29:59 Why not use the current() method, you've already a
tommycli 2013/07/12 21:37:19 Done.
tommycli 2013/07/12 21:37:19 Done.
+ ->AsWeakPtr();
+
+ utility_process_host_->EnableZygote();
+ utility_process_host_->Send(new ChromeUtilityMsg_IndexPicasaAlbumsContents(
+ album_uids_, folders_inis_));
parser_state_ = STARTED_PARSING_STATE;
}
@@ -121,7 +123,10 @@ void SafePicasaAlbumsIndexer::OnIndexPicasaAlbumsContentsFinished(
MediaFileSystemBackend::MediaTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(callback_, true, albums_images));
+ base::Bind(callback_,
+ make_scoped_refptr(this),
+ true,
+ albums_images));
parser_state_ = FINISHED_PARSING_STATE;
}
@@ -130,7 +135,10 @@ void SafePicasaAlbumsIndexer::OnProcessCrashed(int exit_code) {
MediaFileSystemBackend::MediaTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(callback_, false, AlbumImagesMap()));
+ base::Bind(callback_,
+ make_scoped_refptr(this),
+ false,
+ AlbumImagesMap()));
}
bool SafePicasaAlbumsIndexer::OnMessageReceived(

Powered by Google App Engine
This is Rietveld 408576698