Index: content/browser/indexed_db/indexed_db_cursor.h |
diff --git a/content/browser/indexed_db/indexed_db_cursor.h b/content/browser/indexed_db/indexed_db_cursor.h |
index 72852f6651babe842faa4c26666725afe74b65b2..591f9f890502ab3b5be1299ee4c761b54560bebb 100644 |
--- a/content/browser/indexed_db/indexed_db_cursor.h |
+++ b/content/browser/indexed_db/indexed_db_cursor.h |
@@ -12,6 +12,7 @@ |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "content/browser/indexed_db/indexed_db_backing_store.h" |
#include "content/browser/indexed_db/indexed_db_database.h" |
#include "content/browser/indexed_db/indexed_db_transaction.h" |
@@ -20,13 +21,13 @@ |
namespace content { |
-class CONTENT_EXPORT IndexedDBCursor |
- : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBCursor>) { |
+class CONTENT_EXPORT IndexedDBCursor { |
public: |
IndexedDBCursor(std::unique_ptr<IndexedDBBackingStore::Cursor> cursor, |
indexed_db::CursorType cursor_type, |
blink::WebIDBTaskType task_type, |
IndexedDBTransaction* transaction); |
+ ~IndexedDBCursor(); |
void Advance(uint32_t count, scoped_refptr<IndexedDBCallbacks> callbacks); |
void Continue(std::unique_ptr<IndexedDBKey> key, |
@@ -42,6 +43,8 @@ class CONTENT_EXPORT IndexedDBCursor |
return (cursor_type_ == indexed_db::CURSOR_KEY_ONLY) ? NULL |
: cursor_->value(); |
} |
+ |
+ void RemoveCursorFromTransaction(); |
void Close(); |
leveldb::Status CursorIterationOperation( |
@@ -59,13 +62,11 @@ class CONTENT_EXPORT IndexedDBCursor |
IndexedDBTransaction* transaction); |
private: |
- friend class base::RefCounted<IndexedDBCursor>; |
- |
- ~IndexedDBCursor(); |
- |
blink::WebIDBTaskType task_type_; |
indexed_db::CursorType cursor_type_; |
- const scoped_refptr<IndexedDBTransaction> transaction_; |
+ |
+ // We rely on the transaction calling Close() to clear this. |
+ IndexedDBTransaction* transaction_; |
// Must be destroyed before transaction_. |
cmumford
2016/12/01 19:14:51
Should Close() assert that cursor_ is null?
dmurph
2016/12/01 21:12:23
No, as the IndexedDBTransaction calls it in CloseA
|
std::unique_ptr<IndexedDBBackingStore::Cursor> cursor_; |
@@ -74,6 +75,8 @@ class CONTENT_EXPORT IndexedDBCursor |
bool closed_; |
+ base::WeakPtrFactory<IndexedDBCursor> ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(IndexedDBCursor); |
}; |