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

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

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Observer moved to connection Created 4 years, 6 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
Index: content/browser/indexed_db/indexed_db_transaction.h
diff --git a/content/browser/indexed_db/indexed_db_transaction.h b/content/browser/indexed_db/indexed_db_transaction.h
index ae1863b151f161ab6fc82e3ca1b575171d784568..9e2910a73cc18814a0e152deb599933b805009b9 100644
--- a/content/browser/indexed_db/indexed_db_transaction.h
+++ b/content/browser/indexed_db/indexed_db_transaction.h
@@ -18,6 +18,7 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "content/browser/indexed_db/indexed_db_backing_store.h"
+#include "content/browser/indexed_db/indexed_db_connection.h"
#include "content/browser/indexed_db/indexed_db_database.h"
#include "content/browser/indexed_db/indexed_db_database_error.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
@@ -27,6 +28,7 @@ namespace content {
class BlobWriteCallbackImpl;
class IndexedDBCursor;
class IndexedDBDatabaseCallbacks;
+class IndexedDBObserver;
class CONTENT_EXPORT IndexedDBTransaction
: public NON_EXPORTED_BASE(base::RefCounted<IndexedDBTransaction>) {
@@ -63,6 +65,8 @@ class CONTENT_EXPORT IndexedDBTransaction
pending_preemptive_events_--;
DCHECK_GE(pending_preemptive_events_, 0);
}
+ void AddPendingObserver(std::unique_ptr<IndexedDBObserver> observer);
+
IndexedDBBackingStore::Transaction* BackingStoreTransaction() {
return transaction_.get();
}
@@ -70,6 +74,7 @@ class CONTENT_EXPORT IndexedDBTransaction
IndexedDBDatabase* database() const { return database_.get(); }
IndexedDBDatabaseCallbacks* connection() const { return callbacks_.get(); }
+ IndexedDBConnection* getConnection() const { return connection_; }
dmurph 2016/06/22 01:09:49 connection_.get();
palakj1 2016/06/23 20:56:30 Done.
State state() const { return state_; }
bool IsTimeoutTimerRunning() const { return timeout_timer_.IsRunning(); }
@@ -82,12 +87,15 @@ class CONTENT_EXPORT IndexedDBTransaction
};
const Diagnostics& diagnostics() const { return diagnostics_; }
+ std::vector<std::unique_ptr<IndexedDBObserver>> pending_observers_;
protected:
// Test classes may derive, but most creation should be done via
// IndexedDBClassFactory.
IndexedDBTransaction(
int64_t id,
+ // TODO(palakj): Eliminate callbacks and db.
dmurph 2016/06/22 01:09:49 I'm not sure what you mean by 'eliminate callbacks
palakj1 2016/06/23 20:56:30 the connection object includes a reference to both
+ IndexedDBConnection* connection,
dmurph 2016/06/22 01:09:49 base::WeakPtr<IndexedDBConnection> connection
palakj1 2016/06/23 20:56:30 Dome.
scoped_refptr<IndexedDBDatabaseCallbacks> callbacks,
const std::set<int64_t>& object_store_ids,
blink::WebIDBTransactionMode mode,
@@ -123,6 +131,8 @@ class CONTENT_EXPORT IndexedDBTransaction
leveldb::Status CommitPhaseTwo();
void Timeout();
+ void ActivatePendingObserver();
+
const int64_t id_;
const std::set<int64_t> object_store_ids_;
const blink::WebIDBTransactionMode mode_;
@@ -130,6 +140,8 @@ class CONTENT_EXPORT IndexedDBTransaction
bool used_;
State state_;
bool commit_pending_;
+ // TODO(palakj): wrap it with something?
+ IndexedDBConnection* connection_;
dmurph 2016/06/22 01:09:49 Please use a base::WeakPtr<IndexedDBConnection>
palakj1 2016/06/23 20:56:30 Done.
scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_;
scoped_refptr<IndexedDBDatabase> database_;

Powered by Google App Engine
This is Rietveld 408576698