summaryrefslogtreecommitdiffstats
path: root/chrome/browser/utility_process_host.cc
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 13:54:59 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 13:54:59 +0000
commit67a7851692243892bb2d7253d2f1974833e57432 (patch)
tree98bdc05f9af985cbcc8b9cc6ea0ccf472a85b588 /chrome/browser/utility_process_host.cc
parente40cc399bd7e438579d6fcfa208103c12caf9052 (diff)
downloadchromium_src-67a7851692243892bb2d7253d2f1974833e57432.zip
chromium_src-67a7851692243892bb2d7253d2f1974833e57432.tar.gz
chromium_src-67a7851692243892bb2d7253d2f1974833e57432.tar.bz2
Adds IDBKeyPath parser / extractor, and provides a mechanism to call it sandboxed.
TEST=idbkeypathextractor_browsertests.cc Review URL: http://codereview.chromium.org/3043037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/utility_process_host.cc')
-rw-r--r--chrome/browser/utility_process_host.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc
index e49df71..6014f22 100644
--- a/chrome/browser/utility_process_host.cc
+++ b/chrome/browser/utility_process_host.cc
@@ -18,10 +18,12 @@ UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh,
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) {
@@ -59,11 +61,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");
@@ -159,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()
}