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

Unified Diff: chrome/browser/extensions/sandboxed_extension_unpacker.cc

Issue 160501: Try again to land: http://codereview.chromium.org/160483 (Closed)
Patch Set: Created 11 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/extensions/sandboxed_extension_unpacker.cc
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
index 8048ff27de7d4552843195ea7e2428167a5cc500..46a838291d45d4962a0dd083a319c08482581fb6 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
@@ -28,11 +28,15 @@ const char SandboxedExtensionUnpacker::kExtensionHeaderMagic[] = "Cr24";
SandboxedExtensionUnpacker::SandboxedExtensionUnpacker(
const FilePath& crx_path, ResourceDispatcherHost* rdh,
SandboxedExtensionUnpackerClient* client)
- : crx_path_(crx_path), client_loop_(MessageLoop::current()), rdh_(rdh),
- client_(client), got_response_(false) {
+ : crx_path_(crx_path), file_loop_(NULL), rdh_(rdh), client_(client),
+ got_response_(false) {
}
void SandboxedExtensionUnpacker::Start() {
+ // We assume that we are started on the thread that the client wants us to do
+ // file IO on.
+ file_loop_ = MessageLoop::current();
+
// Create a temporary directory to work in.
if (!temp_dir_.CreateUniqueTempDir()) {
ReportFailure("Could not create temporary directory.");
@@ -72,13 +76,13 @@ void SandboxedExtensionUnpacker::Start() {
void SandboxedExtensionUnpacker::StartProcessOnIOThread(
const FilePath& temp_crx_path) {
- UtilityProcessHost* host = new UtilityProcessHost(rdh_, this,
- MessageLoop::current());
+ UtilityProcessHost* host = new UtilityProcessHost(rdh_, this, file_loop_);
host->StartExtensionUnpacker(temp_crx_path);
}
void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
const DictionaryValue& manifest) {
+ DCHECK(file_loop_ == MessageLoop::current());
got_response_ = true;
ExtensionUnpacker::DecodedImages images;
@@ -164,6 +168,7 @@ void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
void SandboxedExtensionUnpacker::OnUnpackExtensionFailed(
const std::string& error) {
+ DCHECK(file_loop_ == MessageLoop::current());
got_response_ = true;
ReportFailure(error);
}
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.h ('k') | chrome/browser/extensions/theme_preview_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698