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

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

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final architechture Created 4 years, 5 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_connection.h
diff --git a/content/browser/indexed_db/indexed_db_connection.h b/content/browser/indexed_db/indexed_db_connection.h
index 4d828e5e6ff5e28a138f19c79959f5a928ab165e..3c305f39d057147c8a8feb12654a0f826404b09a 100644
--- a/content/browser/indexed_db/indexed_db_connection.h
+++ b/content/browser/indexed_db/indexed_db_connection.h
@@ -10,9 +10,9 @@
#include "base/memory/weak_ptr.h"
#include "content/browser/indexed_db/indexed_db_database.h"
#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
+#include "content/browser/indexed_db/indexed_db_observer.h"
namespace content {
-class IndexedDBCallbacks;
class IndexedDBDatabaseError;
class CONTENT_EXPORT IndexedDBConnection {
@@ -28,8 +28,22 @@ class CONTENT_EXPORT IndexedDBConnection {
void VersionChangeIgnored();
+ virtual void ActivatePendingObservers(
+ std::vector<std::unique_ptr<IndexedDBObserver>> pending_observers);
+ // Removes observer listed in |remove_observer_ids| from active_observer of
+ // connection or pending_observer of transactions associated with this
+ // connection.
+ virtual void RemoveObservers(const std::vector<int32_t>& remove_observer_ids);
+
IndexedDBDatabase* database() const { return database_.get(); }
IndexedDBDatabaseCallbacks* callbacks() const { return callbacks_.get(); }
+ const std::vector<std::unique_ptr<IndexedDBObserver>>& active_observers()
+ const {
+ return active_observers_;
+ }
+ base::WeakPtr<IndexedDBConnection> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
private:
// NULL in some unit tests, and after the connection is closed.
@@ -38,7 +52,7 @@ class CONTENT_EXPORT IndexedDBConnection {
// The callbacks_ member is cleared when the connection is closed.
// May be NULL in unit tests.
scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_;
-
+ std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_;
base::WeakPtrFactory<IndexedDBConnection> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection);
« no previous file with comments | « content/browser/indexed_db/indexed_db_class_factory.cc ('k') | content/browser/indexed_db/indexed_db_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698