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

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: Coding style fixes 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 indexed_db::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::NORMAL_TASK,
33 transaction,
34 object_store_id));
35 }
36 static scoped_refptr<IndexedDBCursorImpl> Create(
37 scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
38 indexed_db::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_ == indexed_db::CURSOR_KEY_ONLY) ? NULL
65 : cursor_->Value();
66 }
67 void Close();
68
69 private:
70 IndexedDBCursorImpl(scoped_ptr<IndexedDBBackingStore::Cursor>,
71 indexed_db::CursorType,
72 IndexedDBDatabase::TaskType,
73 IndexedDBTransaction*,
74 int64_t object_store_id);
75 virtual ~IndexedDBCursorImpl();
76
77 class CursorIterationOperation;
78 class CursorAdvanceOperation;
79 class CursorPrefetchIterationOperation;
80
81 IndexedDBDatabase::TaskType task_type_;
82 indexed_db::CursorType cursor_type_;
83 const scoped_refptr<IndexedDBTransaction> transaction_;
84 const int64_t object_store_id_;
85
86 // Must be destroyed before transaction_.
87 scoped_ptr<IndexedDBBackingStore::Cursor> cursor_;
88 // Must be destroyed before transaction_.
89 scoped_ptr<IndexedDBBackingStore::Cursor> saved_cursor_;
90
91 bool closed_;
92 };
93
94 } // namespace content
95
96 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698