| 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 #include "content/browser/indexed_db/indexed_db_cursor.h" | 5 #include "content/browser/indexed_db/indexed_db_cursor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // will be ignored. | 133 // will be ignored. |
| 134 for (int i = 0; i < number_to_fetch; ++i) { | 134 for (int i = 0; i < number_to_fetch; ++i) { |
| 135 if (!cursor_ || !cursor_->Continue(&s)) { | 135 if (!cursor_ || !cursor_->Continue(&s)) { |
| 136 cursor_.reset(); | 136 cursor_.reset(); |
| 137 break; | 137 break; |
| 138 } | 138 } |
| 139 | 139 |
| 140 if (i == 0) { | 140 if (i == 0) { |
| 141 // First prefetched result is always used, so that's the position | 141 // First prefetched result is always used, so that's the position |
| 142 // a cursor should be reset to if the prefetch is invalidated. | 142 // a cursor should be reset to if the prefetch is invalidated. |
| 143 saved_cursor_.reset(cursor_->Clone()); | 143 saved_cursor_ = cursor_->Clone(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 found_keys.push_back(cursor_->key()); | 146 found_keys.push_back(cursor_->key()); |
| 147 found_primary_keys.push_back(cursor_->primary_key()); | 147 found_primary_keys.push_back(cursor_->primary_key()); |
| 148 | 148 |
| 149 switch (cursor_type_) { | 149 switch (cursor_type_) { |
| 150 case indexed_db::CURSOR_KEY_ONLY: | 150 case indexed_db::CURSOR_KEY_ONLY: |
| 151 found_values.push_back(IndexedDBValue()); | 151 found_values.push_back(IndexedDBValue()); |
| 152 break; | 152 break; |
| 153 case indexed_db::CURSOR_KEY_AND_VALUE: { | 153 case indexed_db::CURSOR_KEY_AND_VALUE: { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void IndexedDBCursor::Close() { | 200 void IndexedDBCursor::Close() { |
| 201 IDB_TRACE("IndexedDBCursor::Close"); | 201 IDB_TRACE("IndexedDBCursor::Close"); |
| 202 closed_ = true; | 202 closed_ = true; |
| 203 cursor_.reset(); | 203 cursor_.reset(); |
| 204 saved_cursor_.reset(); | 204 saved_cursor_.reset(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace content | 207 } // namespace content |
| OLD | NEW |