summaryrefslogtreecommitdiffstats
path: root/chrome/browser/utility_process_host.h
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.h
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.h')
-rw-r--r--chrome/browser/utility_process_host.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h
index 8dfee5e..8aadf35 100644
--- a/chrome/browser/utility_process_host.h
+++ b/chrome/browser/utility_process_host.h
@@ -18,11 +18,17 @@
#include "ipc/ipc_channel.h"
class DictionaryValue;
+class IndexedDBKey;
+class SerializedScriptValue;
class SkBitmap;
// This class acts as the browser-side host to a utility child process. A
// utility process is a short-lived sandboxed process that is created to run
// a specific task. This class lives solely on the IO thread.
+// If you need a single method call in the sandbox, use StartFooBar(p).
+// If you need multiple batches of work to be done in the sandboxed process,
+// use StartBatchMode(), then multiple calls to StartFooBar(p),
+// then finish with EndBatchMode().
class UtilityProcessHost : public BrowserChildProcessHost {
public:
// An interface to be implemented by consumers of the utility process to
@@ -72,6 +78,18 @@ class UtilityProcessHost : public BrowserChildProcessHost {
// Called when image data decoding failed.
virtual void OnDecodeImageFailed() {}
+ // Called when we have successfully obtained the IndexedDBKey after
+ // a call to StartIDBKeysFromValuesAndKeyPath.
+ // |id| is the corresponding identifier.
+ // |keys| the corresponding IndexedDBKey.
+ virtual void OnIDBKeysFromValuesAndKeyPathSucceeded(
+ int id, const std::vector<IndexedDBKey>& keys) {}
+
+ // Called when IDBKeyPath has failed.
+ // |id| is the corresponding identifier passed on
+ // StartIDBKeysFromValuesAndKeyPath.
+ virtual void OnIDBKeysFromValuesAndKeyPathFailed(int id) {}
+
protected:
friend class base::RefCountedThreadSafe<Client>;
@@ -109,12 +127,26 @@ class UtilityProcessHost : public BrowserChildProcessHost {
// Start image decoding.
bool StartImageDecoding(const std::vector<unsigned char>& encoded_data);
+ // Starts extracting |key_path| from |serialized_values|, and replies with the
+ // corresponding IndexedDBKeys via OnIDBKeysFromValuesAndKeyPathSucceeded.
+ bool StartIDBKeysFromValuesAndKeyPath(
+ int id, const std::vector<SerializedScriptValue>& serialized_values,
+ const string16& key_path);
+
+ // Starts utility process in batch mode. Caller must call EndBatchMode()
+ // to finish the utility process.
+ bool StartBatchMode();
+
+ // Ends the utility process. Must be called after StartBatchMode().
+ void EndBatchMode();
+
protected:
// Allow these methods to be overridden for tests.
virtual FilePath GetUtilityProcessCmd();
private:
- // Starts a process. Returns true iff it succeeded.
+ // Starts a process if necessary. Returns true if it succeeded or a process
+ // has already been started via StartBatchMode().
bool StartProcess(const FilePath& exposed_dir);
// IPC messages:
@@ -132,6 +164,9 @@ class UtilityProcessHost : public BrowserChildProcessHost {
// A pointer to our client interface, who will be informed of progress.
scoped_refptr<Client> client_;
ChromeThread::ID client_thread_id_;
+ // True when running in batch mode, i.e., StartBatchMode() has been called
+ // and the utility process will run until EndBatchMode().
+ bool is_batch_mode_;
DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost);
};