OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 11 matching lines...) Expand all Loading... |
22 class IndexedDBTransaction; | 22 class IndexedDBTransaction; |
23 | 23 |
24 class CONTENT_EXPORT IndexedDBCursor | 24 class CONTENT_EXPORT IndexedDBCursor |
25 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBCursor>) { | 25 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBCursor>) { |
26 public: | 26 public: |
27 IndexedDBCursor(std::unique_ptr<IndexedDBBackingStore::Cursor> cursor, | 27 IndexedDBCursor(std::unique_ptr<IndexedDBBackingStore::Cursor> cursor, |
28 indexed_db::CursorType cursor_type, | 28 indexed_db::CursorType cursor_type, |
29 blink::WebIDBTaskType task_type, | 29 blink::WebIDBTaskType task_type, |
30 IndexedDBTransaction* transaction); | 30 IndexedDBTransaction* transaction); |
31 | 31 |
32 void Advance(uint32_t count, scoped_refptr<IndexedDBCallbacks> callbacks); | 32 void Advance(uint32_t count); |
33 void Continue(std::unique_ptr<IndexedDBKey> key, | 33 void Continue(std::unique_ptr<IndexedDBKey> key, |
34 std::unique_ptr<IndexedDBKey> primary_key, | 34 std::unique_ptr<IndexedDBKey> primary_key); |
35 scoped_refptr<IndexedDBCallbacks> callbacks); | 35 void PrefetchContinue(int number_to_fetch); |
36 void PrefetchContinue(int number_to_fetch, | |
37 scoped_refptr<IndexedDBCallbacks> callbacks); | |
38 leveldb::Status PrefetchReset(int used_prefetches, int unused_prefetches); | 36 leveldb::Status PrefetchReset(int used_prefetches, int unused_prefetches); |
39 | 37 |
40 const IndexedDBKey& key() const { return cursor_->key(); } | 38 const IndexedDBKey& key() const { return cursor_->key(); } |
41 const IndexedDBKey& primary_key() const { return cursor_->primary_key(); } | 39 const IndexedDBKey& primary_key() const { return cursor_->primary_key(); } |
42 IndexedDBValue* Value() const { | 40 IndexedDBValue* Value() const { |
43 return (cursor_type_ == indexed_db::CURSOR_KEY_ONLY) ? NULL | 41 return (cursor_type_ == indexed_db::CURSOR_KEY_ONLY) ? NULL |
44 : cursor_->value(); | 42 : cursor_->value(); |
45 } | 43 } |
46 void Close(); | 44 void Close(); |
47 | 45 |
48 void CursorIterationOperation(std::unique_ptr<IndexedDBKey> key, | 46 void CursorIterationOperation(std::unique_ptr<IndexedDBKey> key, |
49 std::unique_ptr<IndexedDBKey> primary_key, | 47 std::unique_ptr<IndexedDBKey> primary_key, |
50 scoped_refptr<IndexedDBCallbacks> callbacks, | |
51 IndexedDBTransaction* transaction); | 48 IndexedDBTransaction* transaction); |
52 void CursorAdvanceOperation(uint32_t count, | 49 void CursorAdvanceOperation(uint32_t count, |
53 scoped_refptr<IndexedDBCallbacks> callbacks, | |
54 IndexedDBTransaction* transaction); | 50 IndexedDBTransaction* transaction); |
55 void CursorPrefetchIterationOperation( | 51 void CursorPrefetchIterationOperation( |
56 int number_to_fetch, | 52 int number_to_fetch, |
57 scoped_refptr<IndexedDBCallbacks> callbacks, | |
58 IndexedDBTransaction* transaction); | 53 IndexedDBTransaction* transaction); |
59 | 54 |
60 private: | 55 private: |
61 friend class base::RefCounted<IndexedDBCursor>; | 56 friend class base::RefCounted<IndexedDBCursor>; |
62 | 57 |
63 ~IndexedDBCursor(); | 58 ~IndexedDBCursor(); |
64 | 59 |
65 blink::WebIDBTaskType task_type_; | 60 blink::WebIDBTaskType task_type_; |
66 indexed_db::CursorType cursor_type_; | 61 indexed_db::CursorType cursor_type_; |
67 const scoped_refptr<IndexedDBTransaction> transaction_; | 62 const scoped_refptr<IndexedDBTransaction> transaction_; |
68 | 63 |
69 // Must be destroyed before transaction_. | 64 // Must be destroyed before transaction_. |
70 std::unique_ptr<IndexedDBBackingStore::Cursor> cursor_; | 65 std::unique_ptr<IndexedDBBackingStore::Cursor> cursor_; |
71 // Must be destroyed before transaction_. | 66 // Must be destroyed before transaction_. |
72 std::unique_ptr<IndexedDBBackingStore::Cursor> saved_cursor_; | 67 std::unique_ptr<IndexedDBBackingStore::Cursor> saved_cursor_; |
73 | 68 |
74 bool closed_; | 69 bool closed_; |
75 | 70 |
76 DISALLOW_COPY_AND_ASSIGN(IndexedDBCursor); | 71 DISALLOW_COPY_AND_ASSIGN(IndexedDBCursor); |
77 }; | 72 }; |
78 | 73 |
79 } // namespace content | 74 } // namespace content |
80 | 75 |
81 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_ | 76 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_ |
OLD | NEW |