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

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

Issue 16337010: Remove IDBCursorBackendInterface::deleteFunction (part 2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 #include "content/browser/indexed_db/indexed_db_cursor_impl.h" 5 #include "content/browser/indexed_db/indexed_db_cursor_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/indexed_db/indexed_db_backing_store.h" 8 #include "content/browser/indexed_db/indexed_db_backing_store.h"
9 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" 9 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h"
10 #include "content/browser/indexed_db/indexed_db_database_error.h" 10 #include "content/browser/indexed_db/indexed_db_database_error.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 private: 60 private:
61 scoped_refptr<IndexedDBCursorImpl> cursor_; 61 scoped_refptr<IndexedDBCursorImpl> cursor_;
62 int number_to_fetch_; 62 int number_to_fetch_;
63 scoped_refptr<IndexedDBCallbacksWrapper> callbacks_; 63 scoped_refptr<IndexedDBCallbacksWrapper> callbacks_;
64 }; 64 };
65 65
66 IndexedDBCursorImpl::IndexedDBCursorImpl( 66 IndexedDBCursorImpl::IndexedDBCursorImpl(
67 scoped_ptr<IndexedDBBackingStore::Cursor> cursor, 67 scoped_ptr<IndexedDBBackingStore::Cursor> cursor,
68 indexed_db::CursorType cursor_type, 68 indexed_db::CursorType cursor_type,
69 IndexedDBDatabase::TaskType task_type, 69 IndexedDBDatabase::TaskType task_type,
70 IndexedDBTransaction* transaction, 70 IndexedDBTransaction* transaction)
71 int64 object_store_id)
72 : task_type_(task_type), 71 : task_type_(task_type),
73 cursor_type_(cursor_type), 72 cursor_type_(cursor_type),
74 transaction_(transaction), 73 transaction_(transaction),
75 object_store_id_(object_store_id),
76 cursor_(cursor.Pass()), 74 cursor_(cursor.Pass()),
77 closed_(false) { 75 closed_(false) {
78 transaction_->RegisterOpenCursor(this); 76 transaction_->RegisterOpenCursor(this);
79 } 77 }
80 78
81 IndexedDBCursorImpl::~IndexedDBCursorImpl() { 79 IndexedDBCursorImpl::~IndexedDBCursorImpl() {
82 transaction_->UnregisterOpenCursor(this); 80 transaction_->UnregisterOpenCursor(this);
83 } 81 }
84 82
85 void IndexedDBCursorImpl::ContinueFunction( 83 void IndexedDBCursorImpl::ContinueFunction(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!cursor_->cursor_ || !cursor_->cursor_->ContinueFunction(key_.get())) { 117 if (!cursor_->cursor_ || !cursor_->cursor_->ContinueFunction(key_.get())) {
120 cursor_->cursor_.reset(); 118 cursor_->cursor_.reset();
121 callbacks_->OnSuccess(static_cast<std::vector<char>*>(NULL)); 119 callbacks_->OnSuccess(static_cast<std::vector<char>*>(NULL));
122 return; 120 return;
123 } 121 }
124 122
125 callbacks_->OnSuccess( 123 callbacks_->OnSuccess(
126 cursor_->key(), cursor_->primary_key(), cursor_->Value()); 124 cursor_->key(), cursor_->primary_key(), cursor_->Value());
127 } 125 }
128 126
129 void IndexedDBCursorImpl::DeleteFunction(
130 scoped_refptr<IndexedDBCallbacksWrapper> callbacks) {
131 IDB_TRACE("IndexedDBCursorImpl::delete");
132 DCHECK_NE(transaction_->mode(), indexed_db::TRANSACTION_READ_ONLY);
133 scoped_ptr<IndexedDBKeyRange> key_range =
134 make_scoped_ptr(new IndexedDBKeyRange(cursor_->primary_key()));
135 transaction_->database()->DeleteRange(
136 transaction_->id(), object_store_id_, key_range.Pass(), callbacks);
137 }
138
139 void IndexedDBCursorImpl::PrefetchContinue( 127 void IndexedDBCursorImpl::PrefetchContinue(
140 int number_to_fetch, 128 int number_to_fetch,
141 scoped_refptr<IndexedDBCallbacksWrapper> callbacks) { 129 scoped_refptr<IndexedDBCallbacksWrapper> callbacks) {
142 IDB_TRACE("IndexedDBCursorImpl::prefetch_continue"); 130 IDB_TRACE("IndexedDBCursorImpl::prefetch_continue");
143 131
144 transaction_->ScheduleTask( 132 transaction_->ScheduleTask(
145 task_type_, 133 task_type_,
146 new CursorPrefetchIterationOperation(this, number_to_fetch, callbacks)); 134 new CursorPrefetchIterationOperation(this, number_to_fetch, callbacks));
147 } 135 }
148 136
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 202 }
215 203
216 void IndexedDBCursorImpl::Close() { 204 void IndexedDBCursorImpl::Close() {
217 IDB_TRACE("IndexedDBCursorImpl::close"); 205 IDB_TRACE("IndexedDBCursorImpl::close");
218 closed_ = true; 206 closed_ = true;
219 cursor_.reset(); 207 cursor_.reset();
220 saved_cursor_.reset(); 208 saved_cursor_.reset();
221 } 209 }
222 210
223 } // namespace content 211 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698