diff options
Diffstat (limited to 'chrome/browser/utility_process_host.cc')
-rw-r--r-- | chrome/browser/utility_process_host.cc | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 6a4a7fd..5091169 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -5,24 +5,28 @@ #include "chrome/browser/utility_process_host.h" #include "app/app_switches.h" -#include "app/l10n_util.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/message_loop.h" +#include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/indexed_db_key.h" #include "chrome/common/utility_messages.h" #include "ipc/ipc_switches.h" +#include "third_party/skia/include/core/SkBitmap.h" UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh, Client* client, ChromeThread::ID client_thread_id) : BrowserChildProcessHost(UTILITY_PROCESS, rdh), client_(client), - client_thread_id_(client_thread_id) { + client_thread_id_(client_thread_id), + is_batch_mode_(false) { } UtilityProcessHost::~UtilityProcessHost() { + DCHECK(!is_batch_mode_); } bool UtilityProcessHost::StartExtensionUnpacker(const FilePath& extension) { @@ -60,11 +64,37 @@ bool UtilityProcessHost::StartImageDecoding( return true; } +bool UtilityProcessHost::StartIDBKeysFromValuesAndKeyPath( + int id, const std::vector<SerializedScriptValue>& serialized_values, + const string16& key_path) { + if (!StartProcess(FilePath())) + return false; + + Send(new UtilityMsg_IDBKeysFromValuesAndKeyPath( + id, serialized_values, key_path)); + return true; +} + +bool UtilityProcessHost::StartBatchMode() { + CHECK(!is_batch_mode_); + is_batch_mode_ = StartProcess(FilePath()); + Send(new UtilityMsg_BatchMode_Started()); + return is_batch_mode_; +} + +void UtilityProcessHost::EndBatchMode() { + CHECK(is_batch_mode_); + is_batch_mode_ = false; + Send(new UtilityMsg_BatchMode_Finished()); +} + FilePath UtilityProcessHost::GetUtilityProcessCmd() { return GetChildPath(true); } bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { + if (is_batch_mode_) + return true; // Name must be set or metrics_service will crash in any test which // launches a UtilityProcessHost. set_name(L"utility process"); @@ -79,12 +109,11 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { } CommandLine* cmd_line = new CommandLine(exe_path); - cmd_line->AppendSwitchWithValue(switches::kProcessType, - switches::kUtilityProcess); - cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, - ASCIIToWide(channel_id())); + cmd_line->AppendSwitchASCII(switches::kProcessType, + switches::kUtilityProcess); + cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); std::string locale = g_browser_process->GetApplicationLocale(); - cmd_line->AppendSwitchWithValue(switches::kLang, locale); + cmd_line->AppendSwitchASCII(switches::kLang, locale); SetCrashReporterCommandLine(cmd_line); @@ -92,17 +121,14 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { if (browser_command_line.HasSwitch(switches::kChromeFrame)) cmd_line->AppendSwitch(switches::kChromeFrame); - if (browser_command_line.HasSwitch(switches::kEnableApps)) - cmd_line->AppendSwitch(switches::kEnableApps); + if (browser_command_line.HasSwitch(switches::kDisableApps)) + cmd_line->AppendSwitch(switches::kDisableApps); if (browser_command_line.HasSwitch( switches::kEnableExperimentalExtensionApis)) { cmd_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); } - if (browser_command_line.HasSwitch(switches::kIssue35198ExtraLogging)) - cmd_line->AppendSwitch(switches::kIssue35198ExtraLogging); - #if defined(OS_POSIX) // TODO(port): Sandbox this on Linux. Also, zygote this to work with // Linux updating. @@ -111,12 +137,11 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { if (has_cmd_prefix) { // launch the utility child process with some prefix (usually "xterm -e gdb // --args"). - cmd_line->PrependWrapper(browser_command_line.GetSwitchValue( + cmd_line->PrependWrapper(browser_command_line.GetSwitchValueNative( switches::kUtilityCmdPrefix)); } - cmd_line->AppendSwitchWithValue(switches::kUtilityProcessAllowedDir, - exposed_dir.value().c_str()); + cmd_line->AppendSwitchPath(switches::kUtilityProcessAllowedDir, exposed_dir); #endif Launch( @@ -162,5 +187,9 @@ void UtilityProcessHost::Client::OnMessageReceived( Client::OnDecodeImageSucceeded) IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed, Client::OnDecodeImageFailed) + IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded, + Client::OnIDBKeysFromValuesAndKeyPathSucceeded) + IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, + Client::OnIDBKeysFromValuesAndKeyPathFailed) IPC_END_MESSAGE_MAP_EX() } |