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

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

Issue 16581002: IndexedDB: Eliminate interfaces for IndexedDB{Factory,Database,Cursor} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 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/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/browser/indexed_db/indexed_db_backing_store.h"
14 #include "content/browser/indexed_db/indexed_db_cursor.h"
15 #include "content/browser/indexed_db/indexed_db_database.h"
16 #include "content/common/indexed_db/indexed_db_key_range.h"
17
18 namespace content {
19
20 class IndexedDBDatabaseImpl;
21 class IndexedDBTransaction;
22
23 class IndexedDBCursorImpl : public IndexedDBCursor {
24 public:
25 static scoped_refptr<IndexedDBCursorImpl> Create(
26 scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
27 indexed_db::CursorType cursor_type,
28 IndexedDBTransaction* transaction) {
29 return make_scoped_refptr(
30 new IndexedDBCursorImpl(cursor.Pass(),
31 cursor_type,
32 IndexedDBDatabase::NORMAL_TASK,
33 transaction));
34 }
35 static scoped_refptr<IndexedDBCursorImpl> Create(
36 scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
37 indexed_db::CursorType cursor_type,
38 IndexedDBDatabase::TaskType task_type,
39 IndexedDBTransaction* transaction) {
40 return make_scoped_refptr(new IndexedDBCursorImpl(
41 cursor.Pass(), cursor_type, task_type, transaction));
42 }
43
44 // IndexedDBCursor
45 virtual void Advance(uint32 count,
46 scoped_refptr<IndexedDBCallbacksWrapper> callbacks)
47 OVERRIDE;
48 virtual void ContinueFunction(
49 scoped_ptr<IndexedDBKey> key,
50 scoped_refptr<IndexedDBCallbacksWrapper> callbacks) OVERRIDE;
51 virtual void PrefetchContinue(
52 int number_to_fetch,
53 scoped_refptr<IndexedDBCallbacksWrapper> callbacks) OVERRIDE;
54 virtual void PrefetchReset(int used_prefetches, int unused_prefetches)
55 OVERRIDE;
56 virtual void PostSuccessHandlerCallback() OVERRIDE {}
57
58 const IndexedDBKey& key() const { return cursor_->key(); }
59 const IndexedDBKey& primary_key() const { return cursor_->primary_key(); }
60 std::vector<char>* Value() const {
61 return (cursor_type_ == indexed_db::CURSOR_KEY_ONLY) ? NULL
62 : cursor_->Value();
63 }
64 void Close();
65
66 private:
67 IndexedDBCursorImpl(scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
68 indexed_db::CursorType cursor_type,
69 IndexedDBDatabase::TaskType task_type,
70 IndexedDBTransaction* transaction);
71 virtual ~IndexedDBCursorImpl();
72
73 class CursorIterationOperation;
74 class CursorAdvanceOperation;
75 class CursorPrefetchIterationOperation;
76
77 IndexedDBDatabase::TaskType task_type_;
78 indexed_db::CursorType cursor_type_;
79 const scoped_refptr<IndexedDBTransaction> transaction_;
80
81 // Must be destroyed before transaction_.
82 scoped_ptr<IndexedDBBackingStore::Cursor> cursor_;
83 // Must be destroyed before transaction_.
84 scoped_ptr<IndexedDBBackingStore::Cursor> saved_cursor_;
85
86 bool closed_;
87 };
88
89 } // namespace content
90
91 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_cursor.cc ('k') | content/browser/indexed_db/indexed_db_cursor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698