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

Side by Side Diff: chrome/browser/extensions/sandboxed_extension_unpacker.cc

Issue 306032: Simplify threading in browser thread by making only ChromeThread deal with di... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: a few more simplifications Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extensions/sandboxed_extension_unpacker.h" 5 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "app/gfx/codec/png_codec.h" 9 #include "app/gfx/codec/png_codec.h"
10 #include "base/crypto/signature_verifier.h" 10 #include "base/crypto/signature_verifier.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 bool use_utility_process = rdh_ && 66 bool use_utility_process = rdh_ &&
67 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); 67 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
68 68
69 #if defined(OS_POSIX) 69 #if defined(OS_POSIX)
70 // TODO(port): Don't use a utility process on linux (crbug.com/22703) or 70 // TODO(port): Don't use a utility process on linux (crbug.com/22703) or
71 // MacOS (crbug.com/8102) until problems related to autoupdate are fixed. 71 // MacOS (crbug.com/8102) until problems related to autoupdate are fixed.
72 use_utility_process = false; 72 use_utility_process = false;
73 #endif 73 #endif
74 74
75 if (use_utility_process) { 75 if (use_utility_process) {
76 ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(FROM_HERE, 76 ChromeThread::PostTask(
77 NewRunnableMethod(this, 77 ChromeThread::IO, FROM_HERE,
78 NewRunnableMethod(
79 this,
78 &SandboxedExtensionUnpacker::StartProcessOnIOThread, 80 &SandboxedExtensionUnpacker::StartProcessOnIOThread,
79 temp_crx_path)); 81 temp_crx_path));
80 } else { 82 } else {
81 // Otherwise, unpack the extension in this process. 83 // Otherwise, unpack the extension in this process.
82 ExtensionUnpacker unpacker(temp_crx_path); 84 ExtensionUnpacker unpacker(temp_crx_path);
83 if (unpacker.Run() && unpacker.DumpImagesToFile()) 85 if (unpacker.Run() && unpacker.DumpImagesToFile())
84 OnUnpackExtensionSucceeded(*unpacker.parsed_manifest()); 86 OnUnpackExtensionSucceeded(*unpacker.parsed_manifest());
85 else 87 else
86 OnUnpackExtensionFailed(unpacker.error_message()); 88 OnUnpackExtensionFailed(unpacker.error_message());
87 } 89 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 302
301 void SandboxedExtensionUnpacker::ReportFailure(const std::string& error) { 303 void SandboxedExtensionUnpacker::ReportFailure(const std::string& error) {
302 client_->OnUnpackFailure(error); 304 client_->OnUnpackFailure(error);
303 } 305 }
304 306
305 void SandboxedExtensionUnpacker::ReportSuccess() { 307 void SandboxedExtensionUnpacker::ReportSuccess() {
306 // Client takes ownership of temporary directory and extension. 308 // Client takes ownership of temporary directory and extension.
307 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, 309 client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_,
308 extension_.release()); 310 extension_.release());
309 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698