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

Unified Diff: content/browser/indexed_db/indexed_db_database.h

Issue 2472213003: [IndexedDB] Refactoring to remove ref ptrs and host transaction ids. (Closed)
Patch Set: updated unittests Created 4 years, 1 month 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
Index: content/browser/indexed_db/indexed_db_database.h
diff --git a/content/browser/indexed_db/indexed_db_database.h b/content/browser/indexed_db/indexed_db_database.h
index 8427563aba4fcc944770c8e6e5363e18384e8188..ba14b32612c982486c74e865fcdddfb3b3fb0577 100644
--- a/content/browser/indexed_db/indexed_db_database.h
+++ b/content/browser/indexed_db/indexed_db_database.h
@@ -87,13 +87,14 @@ class CONTENT_EXPORT IndexedDBDatabase
void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks);
const IndexedDBDatabaseMetadata& metadata() const { return metadata_; }
- void CreateObjectStore(int64_t transaction_id,
+ void CreateObjectStore(IndexedDBTransaction* transaction,
int64_t object_store_id,
const base::string16& name,
const IndexedDBKeyPath& key_path,
bool auto_increment);
- void DeleteObjectStore(int64_t transaction_id, int64_t object_store_id);
- void RenameObjectStore(int64_t transaction_id,
+ void DeleteObjectStore(IndexedDBTransaction* transaction,
+ int64_t object_store_id);
+ void RenameObjectStore(IndexedDBTransaction* transaction,
int64_t object_store_id,
const base::string16& new_name);
@@ -112,21 +113,22 @@ class CONTENT_EXPORT IndexedDBDatabase
// pending connection.
void VersionChangeIgnored();
- void Commit(int64_t transaction_id);
- void Abort(int64_t transaction_id);
- void Abort(int64_t transaction_id, const IndexedDBDatabaseError& error);
+ void Commit(IndexedDBTransaction* transaction);
+ void Abort(IndexedDBTransaction* transaction);
+ void Abort(IndexedDBTransaction* transaction,
+ const IndexedDBDatabaseError& error);
- void CreateIndex(int64_t transaction_id,
+ void CreateIndex(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id,
const base::string16& name,
const IndexedDBKeyPath& key_path,
bool unique,
bool multi_entry);
- void DeleteIndex(int64_t transaction_id,
+ void DeleteIndex(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id);
- void RenameIndex(int64_t transaction_id,
+ void RenameIndex(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id,
const base::string16& new_name);
@@ -144,11 +146,9 @@ class CONTENT_EXPORT IndexedDBDatabase
// Called by transactions to report failure committing to the backing store.
void TransactionCommitFailed(const leveldb::Status& status);
- void AddPendingObserver(int64_t transaction_id,
+ void AddPendingObserver(IndexedDBTransaction* transaction,
int32_t observer_id,
const IndexedDBObserver::Options& options);
- void RemovePendingObservers(IndexedDBConnection* connection,
- const std::vector<int32_t>& pending_observer_ids);
void FilterObservation(IndexedDBTransaction*,
int64_t object_store_id,
@@ -157,20 +157,20 @@ class CONTENT_EXPORT IndexedDBDatabase
void SendObservations(
std::map<int32_t, std::unique_ptr<IndexedDBObserverChanges>> change_map);
- void Get(int64_t transaction_id,
+ void Get(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id,
std::unique_ptr<IndexedDBKeyRange> key_range,
bool key_only,
scoped_refptr<IndexedDBCallbacks> callbacks);
- void GetAll(int64_t transaction_id,
+ void GetAll(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id,
std::unique_ptr<IndexedDBKeyRange> key_range,
bool key_only,
int64_t max_count,
scoped_refptr<IndexedDBCallbacks> callbacks);
- void Put(int64_t transaction_id,
+ void Put(IndexedDBTransaction* transaction,
int64_t object_store_id,
IndexedDBValue* value,
std::vector<std::unique_ptr<storage::BlobDataHandle>>* handles,
@@ -178,14 +178,14 @@ class CONTENT_EXPORT IndexedDBDatabase
blink::WebIDBPutMode mode,
scoped_refptr<IndexedDBCallbacks> callbacks,
const std::vector<IndexKeys>& index_keys);
- void SetIndexKeys(int64_t transaction_id,
+ void SetIndexKeys(IndexedDBTransaction* transaction,
int64_t object_store_id,
std::unique_ptr<IndexedDBKey> primary_key,
const std::vector<IndexKeys>& index_keys);
- void SetIndexesReady(int64_t transaction_id,
+ void SetIndexesReady(IndexedDBTransaction* transaction,
int64_t object_store_id,
const std::vector<int64_t>& index_ids);
- void OpenCursor(int64_t transaction_id,
+ void OpenCursor(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id,
std::unique_ptr<IndexedDBKeyRange> key_range,
@@ -193,16 +193,16 @@ class CONTENT_EXPORT IndexedDBDatabase
bool key_only,
blink::WebIDBTaskType task_type,
scoped_refptr<IndexedDBCallbacks> callbacks);
- void Count(int64_t transaction_id,
+ void Count(IndexedDBTransaction* transaction,
int64_t object_store_id,
int64_t index_id,
std::unique_ptr<IndexedDBKeyRange> key_range,
scoped_refptr<IndexedDBCallbacks> callbacks);
- void DeleteRange(int64_t transaction_id,
+ void DeleteRange(IndexedDBTransaction* transaction,
int64_t object_store_id,
std::unique_ptr<IndexedDBKeyRange> key_range,
scoped_refptr<IndexedDBCallbacks> callbacks);
- void Clear(int64_t transaction_id,
+ void Clear(IndexedDBTransaction* transaction,
int64_t object_store_id,
scoped_refptr<IndexedDBCallbacks> callbacks);
@@ -315,8 +315,6 @@ class CONTENT_EXPORT IndexedDBDatabase
scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
int child_process_id);
- IndexedDBTransaction* GetTransaction(int64_t transaction_id) const;
-
bool ValidateObjectStoreId(int64_t object_store_id) const;
bool ValidateObjectStoreIdAndIndexId(int64_t object_store_id,
int64_t index_id) const;
@@ -332,8 +330,7 @@ class CONTENT_EXPORT IndexedDBDatabase
scoped_refptr<IndexedDBFactory> factory_;
IndexedDBTransactionCoordinator transaction_coordinator_;
-
- std::map<int64_t, IndexedDBTransaction*> transactions_;
+ int64_t transaction_count_ = 0;
list_set<IndexedDBConnection*> connections_;

Powered by Google App Engine
This is Rietveld 408576698