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

Unified Diff: chrome/browser/utility_process_host.h

Issue 3043037: Adds IDBKeyPath parser / extractor, and provides a mechanism to call it sandboxed. (Closed)
Patch Set: Makes MSVC happy. Created 10 years, 4 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
« no previous file with comments | « chrome/browser/idbbindingutilities_browsertest.cc ('k') | chrome/browser/utility_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/utility_process_host.h
diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h
index 8dfee5e1fedac34bf134233f64d98235863ad746..8aadf35cdbf4caf2f161a020cf07e253665b1bc3 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);
};
« no previous file with comments | « chrome/browser/idbbindingutilities_browsertest.cc ('k') | chrome/browser/utility_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698