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

Side by Side Diff: content/browser/indexed_db/indexed_db_cursor_impl.h

Issue 15564008: Migrate the IndexedDB backend from Blink to Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Accessor naming, use LevelDBSlice ctor explicitly Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_IMPL_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_IMPL_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/indexed_db/indexed_db_backing_store.h"
13 #include "content/browser/indexed_db/indexed_db_cursor.h"
14 #include "content/browser/indexed_db/indexed_db_database.h"
15 #include "content/common/indexed_db/indexed_db_key_range.h"
16
17 namespace content {
18
19 class IndexedDBDatabaseImpl;
20 class IndexedDBTransaction;
21
22 class IndexedDBCursorImpl : public IndexedDBCursor {
23 public:
24 static scoped_refptr<IndexedDBCursorImpl> Create(
25 scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
26 IndexedDB::CursorType cursor_type,
27 IndexedDBTransaction* transaction,
28 int64_t object_store_id) {
29 return make_scoped_refptr(
30 new IndexedDBCursorImpl(cursor.Pass(),
31 cursor_type,
32 IndexedDBDatabase::NormalTask,
33 transaction,
34 object_store_id));
35 }
36 static scoped_refptr<IndexedDBCursorImpl> Create(
37 scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
38 IndexedDB::CursorType cursor_type,
39 IndexedDBDatabase::TaskType task_type,
40 IndexedDBTransaction* transaction,
41 int64_t object_store_id) {
42 return make_scoped_refptr(new IndexedDBCursorImpl(
43 cursor.Pass(), cursor_type, task_type, transaction, object_store_id));
44 }
45
46 // IndexedDBCursor
47 virtual void Advance(unsigned long, scoped_refptr<IndexedDBCallbacksWrapper>)
48 OVERRIDE;
49 virtual void ContinueFunction(scoped_ptr<IndexedDBKey>,
50 scoped_refptr<IndexedDBCallbacksWrapper>)
51 OVERRIDE;
52 virtual void DeleteFunction(scoped_refptr<IndexedDBCallbacksWrapper>)
53 OVERRIDE;
54 virtual void PrefetchContinue(int number_to_fetch,
55 scoped_refptr<IndexedDBCallbacksWrapper>)
56 OVERRIDE;
57 virtual void PrefetchReset(int used_prefetches, int unused_prefetches)
58 OVERRIDE;
59 virtual void PostSuccessHandlerCallback() OVERRIDE {}
60
61 const IndexedDBKey& key() const { return cursor_->key(); }
62 const IndexedDBKey& primary_key() const { return cursor_->primary_key(); }
63 std::vector<char>* Value() const {
64 return (cursor_type_ == IndexedDB::CursorKeyOnly) ? NULL : cursor_->Value();
65 }
66 void Close();
67
68 private:
69 IndexedDBCursorImpl(scoped_ptr<IndexedDBBackingStore::Cursor>,
70 IndexedDB::CursorType,
71 IndexedDBDatabase::TaskType,
72 IndexedDBTransaction*,
73 int64_t object_store_id);
74 virtual ~IndexedDBCursorImpl();
75
76 class CursorIterationOperation;
77 class CursorAdvanceOperation;
78 class CursorPrefetchIterationOperation;
79
80 IndexedDBDatabase::TaskType task_type_;
81 IndexedDB::CursorType cursor_type_;
82 const scoped_refptr<IndexedDBTransaction> transaction_;
83 const int64_t object_store_id_;
84
85 // Must be destroyed before transaction_.
86 scoped_ptr<IndexedDBBackingStore::Cursor> cursor_;
87 // Must be destroyed before transaction_.
88 scoped_ptr<IndexedDBBackingStore::Cursor> saved_cursor_;
89
90 bool closed_;
91 };
92
93 } // namespace content
94
95 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698