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

Unified Diff: content/browser/indexed_db/cursor_impl.cc

Issue 2472213003: [IndexedDB] Refactoring to remove ref ptrs and host transaction ids. (Closed)
Patch Set: rebase Created 4 years 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/cursor_impl.cc
diff --git a/content/browser/indexed_db/cursor_impl.cc b/content/browser/indexed_db/cursor_impl.cc
index 6e4d2198180248a3431960ce935652a6cb1d79a1..e711d8dd76724422d9afe18bd2a45ac2215dc15d 100644
--- a/content/browser/indexed_db/cursor_impl.cc
+++ b/content/browser/indexed_db/cursor_impl.cc
@@ -12,7 +12,7 @@ namespace content {
class CursorImpl::IDBThreadHelper {
public:
- explicit IDBThreadHelper(scoped_refptr<IndexedDBCursor> cursor);
+ explicit IDBThreadHelper(std::unique_ptr<IndexedDBCursor> cursor);
~IDBThreadHelper();
void Advance(uint32_t count, scoped_refptr<IndexedDBCallbacks> callbacks);
@@ -24,13 +24,13 @@ class CursorImpl::IDBThreadHelper {
private:
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
- scoped_refptr<IndexedDBCursor> cursor_;
+ std::unique_ptr<IndexedDBCursor> cursor_;
const url::Origin origin_;
DISALLOW_COPY_AND_ASSIGN(IDBThreadHelper);
};
-CursorImpl::CursorImpl(scoped_refptr<IndexedDBCursor> cursor,
+CursorImpl::CursorImpl(std::unique_ptr<IndexedDBCursor> cursor,
const url::Origin& origin,
scoped_refptr<IndexedDBDispatcherHost> dispatcher_host)
: helper_(new IDBThreadHelper(std::move(cursor))),
@@ -88,10 +88,12 @@ void CursorImpl::PrefetchReset(
}
CursorImpl::IDBThreadHelper::IDBThreadHelper(
- scoped_refptr<IndexedDBCursor> cursor)
+ std::unique_ptr<IndexedDBCursor> cursor)
: cursor_(std::move(cursor)) {}
-CursorImpl::IDBThreadHelper::~IDBThreadHelper() {}
+CursorImpl::IDBThreadHelper::~IDBThreadHelper() {
+ cursor_->RemoveCursorFromTransaction();
+}
void CursorImpl::IDBThreadHelper::Advance(
uint32_t count,

Powered by Google App Engine
This is Rietveld 408576698