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

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: Post dmurph review 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_connection.h
diff --git a/content/browser/indexed_db/indexed_db_connection.h b/content/browser/indexed_db/indexed_db_connection.h
index 4d828e5e6ff5e28a138f19c79959f5a928ab165e..5e588efa89697553e13b114f60cd09e25b1711ee 100644
--- a/content/browser/indexed_db/indexed_db_connection.h
+++ b/content/browser/indexed_db/indexed_db_connection.h
@@ -10,6 +10,7 @@
#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;
@@ -27,9 +28,19 @@ class CONTENT_EXPORT IndexedDBConnection {
virtual bool IsConnected();
void VersionChangeIgnored();
+ void ActivatePendingObservers(
+ std::vector<std::unique_ptr<IndexedDBObserver>>* pending_observers);
+ 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>>& activeObservers()
Marijn Kruisselbrink 2016/06/24 00:48:08 the "activeObservers" name does not match our nami
palakj1 2016/06/27 20:19:22 Done.
+ const {
+ return active_observers_;
+ }
+ base::WeakPtr<IndexedDBConnection> weakPtr() {
Marijn Kruisselbrink 2016/06/24 00:48:08 similarly this should be called GetWeakPtr()
palakj1 2016/06/27 20:19:22 Changed. I should read the style guide carefully.
+ return weak_factory_.GetWeakPtr();
+ }
private:
// NULL in some unit tests, and after the connection is closed.
@@ -38,7 +49,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);

Powered by Google App Engine
This is Rietveld 408576698