Index: chrome/browser/in_process_webkit/indexed_db_key_utility_client.h |
diff --git a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h |
index 3a79c282be520b8bfa973c23b68d6a2eb96b9e04..20887ead277dc12d6346ba7ef22965988a7bc037 100644 |
--- a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h |
+++ b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h |
@@ -7,6 +7,7 @@ |
#pragma once |
#include "base/ref_counted.h" |
+#include "base/synchronization/lock.h" |
#include "base/synchronization/waitable_event.h" |
#include "chrome/browser/utility_process_host.h" |
@@ -21,17 +22,12 @@ class SerializedScriptValue; |
class IndexedDBKeyUtilityClient |
: public base::RefCountedThreadSafe<IndexedDBKeyUtilityClient> { |
public: |
- IndexedDBKeyUtilityClient(); |
- // Starts the UtilityProcess. Must be called before any other method. |
- void StartUtilityProcess(); |
+ // Get a pointer to the IndexedDBKeyUtilityClient instance. |
+ static IndexedDBKeyUtilityClient* Get(); |
- // Ends the UtilityProcess. Must be called after StartUtilityProcess() and |
- // before destruction. |
- // TODO(bulach): figure out an appropriate hook so that we can keep the |
- // UtilityProcess running for a longer period of time and avoid spinning it |
- // on every IDBObjectStore::Put call. |
- void EndUtilityProcess(); |
+ // Shut down the IndexedDBKeyUtilityClient if it was ever started. |
+ static void Shutdown(); |
// Synchronously obtain the |keys| from |values| for the given |key_path|. |
void CreateIDBKeysFromSerializedValuesAndKeyPath( |
@@ -57,8 +53,16 @@ class IndexedDBKeyUtilityClient |
}; |
friend class base::RefCountedThreadSafe<IndexedDBKeyUtilityClient>; |
+ IndexedDBKeyUtilityClient(); |
~IndexedDBKeyUtilityClient(); |
+ // Lock to protect the instance_ member. |
+ static base::Lock instantiation_lock_; |
+ static scoped_refptr<IndexedDBKeyUtilityClient> instance_; |
bulach
2011/01/14 17:55:08
iirc, it's not safe / advisable to have non-POD st
|
+ |
+ // Starts the UtilityProcess. Must be called before any other method. |
+ void StartUtilityProcess(); |
+ |
void GetRDHAndStartUtilityProcess(); |
void StartUtilityProcessInternal(ResourceDispatcherHost* rdh); |
void EndUtilityProcessInternal(); |