| 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> |
| 8 |
| 7 #include <vector> | 9 #include <vector> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 13 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 12 #include "content/browser/indexed_db/indexed_db_database_error.h" | 14 #include "content/browser/indexed_db/indexed_db_database_error.h" |
| 13 #include "content/browser/indexed_db/indexed_db_tracing.h" | 15 #include "content/browser/indexed_db/indexed_db_tracing.h" |
| 14 #include "content/browser/indexed_db/indexed_db_transaction.h" | 16 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 15 #include "content/browser/indexed_db/indexed_db_value.h" | 17 #include "content/browser/indexed_db/indexed_db_value.h" |
| 16 | 18 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 40 | 42 |
| 41 transaction_->ScheduleTask( | 43 transaction_->ScheduleTask( |
| 42 task_type_, | 44 task_type_, |
| 43 base::Bind(&IndexedDBCursor::CursorIterationOperation, | 45 base::Bind(&IndexedDBCursor::CursorIterationOperation, |
| 44 this, | 46 this, |
| 45 base::Passed(&key), | 47 base::Passed(&key), |
| 46 base::Passed(&primary_key), | 48 base::Passed(&primary_key), |
| 47 callbacks)); | 49 callbacks)); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void IndexedDBCursor::Advance(uint32 count, | 52 void IndexedDBCursor::Advance(uint32_t count, |
| 51 scoped_refptr<IndexedDBCallbacks> callbacks) { | 53 scoped_refptr<IndexedDBCallbacks> callbacks) { |
| 52 IDB_TRACE("IndexedDBCursor::Advance"); | 54 IDB_TRACE("IndexedDBCursor::Advance"); |
| 53 | 55 |
| 54 transaction_->ScheduleTask( | 56 transaction_->ScheduleTask( |
| 55 task_type_, | 57 task_type_, |
| 56 base::Bind( | 58 base::Bind( |
| 57 &IndexedDBCursor::CursorAdvanceOperation, this, count, callbacks)); | 59 &IndexedDBCursor::CursorAdvanceOperation, this, count, callbacks)); |
| 58 } | 60 } |
| 59 | 61 |
| 60 void IndexedDBCursor::CursorAdvanceOperation( | 62 void IndexedDBCursor::CursorAdvanceOperation( |
| 61 uint32 count, | 63 uint32_t count, |
| 62 scoped_refptr<IndexedDBCallbacks> callbacks, | 64 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 63 IndexedDBTransaction* /*transaction*/) { | 65 IndexedDBTransaction* /*transaction*/) { |
| 64 IDB_TRACE("IndexedDBCursor::CursorAdvanceOperation"); | 66 IDB_TRACE("IndexedDBCursor::CursorAdvanceOperation"); |
| 65 leveldb::Status s; | 67 leveldb::Status s; |
| 66 // TODO(cmumford): Handle this error (crbug.com/363397). Although this will | 68 // TODO(cmumford): Handle this error (crbug.com/363397). Although this will |
| 67 // properly fail, caller will not know why, and any corruption | 69 // properly fail, caller will not know why, and any corruption |
| 68 // will be ignored. | 70 // will be ignored. |
| 69 if (!cursor_ || !cursor_->Advance(count, &s)) { | 71 if (!cursor_ || !cursor_->Advance(count, &s)) { |
| 70 cursor_.reset(); | 72 cursor_.reset(); |
| 71 callbacks->OnSuccess(nullptr); | 73 callbacks->OnSuccess(nullptr); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 198 } |
| 197 | 199 |
| 198 void IndexedDBCursor::Close() { | 200 void IndexedDBCursor::Close() { |
| 199 IDB_TRACE("IndexedDBCursor::Close"); | 201 IDB_TRACE("IndexedDBCursor::Close"); |
| 200 closed_ = true; | 202 closed_ = true; |
| 201 cursor_.reset(); | 203 cursor_.reset(); |
| 202 saved_cursor_.reset(); | 204 saved_cursor_.reset(); |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace content | 207 } // namespace content |
| OLD | NEW |