Chromium Code Reviews| 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_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
| 13 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/trace_event/memory_dump_manager.h" | 22 #include "base/trace_event/memory_dump_manager.h" |
| 22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 23 #include "content/browser/child_process_security_policy_impl.h" | 24 #include "content/browser/child_process_security_policy_impl.h" |
| 24 #include "content/browser/indexed_db/indexed_db_blob_info.h" | 25 #include "content/browser/indexed_db/indexed_db_blob_info.h" |
| 25 #include "content/browser/indexed_db/indexed_db_class_factory.h" | 26 #include "content/browser/indexed_db/indexed_db_class_factory.h" |
| 26 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 27 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 965 base::SequencedTaskRunner* task_runner, | 966 base::SequencedTaskRunner* task_runner, |
| 966 bool clean_journal, | 967 bool clean_journal, |
| 967 leveldb::Status* status) { | 968 leveldb::Status* status) { |
| 968 IDB_TRACE("IndexedDBBackingStore::Open"); | 969 IDB_TRACE("IndexedDBBackingStore::Open"); |
| 969 DCHECK(!path_base.empty()); | 970 DCHECK(!path_base.empty()); |
| 970 *is_disk_full = false; | 971 *is_disk_full = false; |
| 971 | 972 |
| 972 data_loss_info->status = blink::WebIDBDataLossNone; | 973 data_loss_info->status = blink::WebIDBDataLossNone; |
| 973 *status = leveldb::Status::OK(); | 974 *status = leveldb::Status::OK(); |
| 974 | 975 |
| 975 std::unique_ptr<LevelDBComparator> comparator(new Comparator()); | 976 std::unique_ptr<LevelDBComparator> comparator(base::MakeUnique<Comparator>()); |
| 976 | 977 |
| 977 if (!base::IsStringASCII(path_base.AsUTF8Unsafe())) { | 978 if (!base::IsStringASCII(path_base.AsUTF8Unsafe())) { |
| 978 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII, | 979 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII, |
| 979 origin); | 980 origin); |
| 980 } | 981 } |
| 981 if (!base::CreateDirectory(path_base)) { | 982 if (!base::CreateDirectory(path_base)) { |
| 982 *status = | 983 *status = |
| 983 leveldb::Status::IOError("Unable to create IndexedDB database path"); | 984 leveldb::Status::IOError("Unable to create IndexedDB database path"); |
| 984 LOG(ERROR) << status->ToString() << ": \"" << path_base.AsUTF8Unsafe() | 985 LOG(ERROR) << status->ToString() << ": \"" << path_base.AsUTF8Unsafe() |
| 985 << "\""; | 986 << "\""; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1110 } | 1111 } |
| 1111 | 1112 |
| 1112 // static | 1113 // static |
| 1113 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::OpenInMemory( | 1114 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::OpenInMemory( |
| 1114 const Origin& origin, | 1115 const Origin& origin, |
| 1115 LevelDBFactory* leveldb_factory, | 1116 LevelDBFactory* leveldb_factory, |
| 1116 base::SequencedTaskRunner* task_runner, | 1117 base::SequencedTaskRunner* task_runner, |
| 1117 leveldb::Status* status) { | 1118 leveldb::Status* status) { |
| 1118 IDB_TRACE("IndexedDBBackingStore::OpenInMemory"); | 1119 IDB_TRACE("IndexedDBBackingStore::OpenInMemory"); |
| 1119 | 1120 |
| 1120 std::unique_ptr<LevelDBComparator> comparator(new Comparator()); | 1121 std::unique_ptr<LevelDBComparator> comparator(base::MakeUnique<Comparator>()); |
|
cmumford
2016/08/13 00:08:38
I know this is nothing new in your CL, but compara
jsbell
2016/08/16 03:05:28
The comparator is passed through (as a unique_ptr
| |
| 1121 std::unique_ptr<LevelDBDatabase> db = | 1122 std::unique_ptr<LevelDBDatabase> db = |
| 1122 LevelDBDatabase::OpenInMemory(comparator.get()); | 1123 LevelDBDatabase::OpenInMemory(comparator.get()); |
| 1123 if (!db) { | 1124 if (!db) { |
| 1124 LOG(ERROR) << "LevelDBDatabase::OpenInMemory failed."; | 1125 LOG(ERROR) << "LevelDBDatabase::OpenInMemory failed."; |
| 1125 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_MEMORY_FAILED, origin); | 1126 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_MEMORY_FAILED, origin); |
| 1126 return scoped_refptr<IndexedDBBackingStore>(); | 1127 return scoped_refptr<IndexedDBBackingStore>(); |
| 1127 } | 1128 } |
| 1128 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_MEMORY_SUCCESS, origin); | 1129 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_MEMORY_SUCCESS, origin); |
| 1129 base::trace_event::MemoryDumpManager::GetInstance() | 1130 base::trace_event::MemoryDumpManager::GetInstance() |
| 1130 ->RegisterDumpProviderWithSequencedTaskRunner( | 1131 ->RegisterDumpProviderWithSequencedTaskRunner( |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2325 | 2326 |
| 2326 void WriteBlobToFileOnIOThread(const FilePath& file_path, | 2327 void WriteBlobToFileOnIOThread(const FilePath& file_path, |
| 2327 const GURL& blob_url, | 2328 const GURL& blob_url, |
| 2328 const base::Time& last_modified, | 2329 const base::Time& last_modified, |
| 2329 net::URLRequestContext* request_context) { | 2330 net::URLRequestContext* request_context) { |
| 2330 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 2331 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 2331 std::unique_ptr<storage::FileStreamWriter> writer( | 2332 std::unique_ptr<storage::FileStreamWriter> writer( |
| 2332 storage::FileStreamWriter::CreateForLocalFile( | 2333 storage::FileStreamWriter::CreateForLocalFile( |
| 2333 task_runner_.get(), file_path, 0, | 2334 task_runner_.get(), file_path, 0, |
| 2334 storage::FileStreamWriter::CREATE_NEW_FILE)); | 2335 storage::FileStreamWriter::CREATE_NEW_FILE)); |
| 2335 std::unique_ptr<FileWriterDelegate> delegate(new FileWriterDelegate( | 2336 std::unique_ptr<FileWriterDelegate> delegate( |
| 2336 std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); | 2337 base::MakeUnique<FileWriterDelegate>( |
| 2338 std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); | |
| 2337 | 2339 |
| 2338 DCHECK(blob_url.is_valid()); | 2340 DCHECK(blob_url.is_valid()); |
| 2339 std::unique_ptr<net::URLRequest> blob_request( | 2341 std::unique_ptr<net::URLRequest> blob_request( |
| 2340 request_context->CreateRequest(blob_url, net::DEFAULT_PRIORITY, | 2342 request_context->CreateRequest(blob_url, net::DEFAULT_PRIORITY, |
| 2341 delegate.get())); | 2343 delegate.get())); |
| 2342 | 2344 |
| 2343 this->file_path_ = file_path; | 2345 this->file_path_ = file_path; |
| 2344 this->last_modified_ = last_modified; | 2346 this->last_modified_ = last_modified; |
| 2345 | 2347 |
| 2346 delegate->Start(std::move(blob_request), | 2348 delegate->Start(std::move(blob_request), |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3088 else | 3090 else |
| 3089 return InvalidDBKeyStatus(); | 3091 return InvalidDBKeyStatus(); |
| 3090 } | 3092 } |
| 3091 | 3093 |
| 3092 IndexedDBBackingStore::Cursor::Cursor( | 3094 IndexedDBBackingStore::Cursor::Cursor( |
| 3093 const IndexedDBBackingStore::Cursor* other) | 3095 const IndexedDBBackingStore::Cursor* other) |
| 3094 : backing_store_(other->backing_store_), | 3096 : backing_store_(other->backing_store_), |
| 3095 transaction_(other->transaction_), | 3097 transaction_(other->transaction_), |
| 3096 database_id_(other->database_id_), | 3098 database_id_(other->database_id_), |
| 3097 cursor_options_(other->cursor_options_), | 3099 cursor_options_(other->cursor_options_), |
| 3098 current_key_(new IndexedDBKey(*other->current_key_)) { | 3100 current_key_(base::MakeUnique<IndexedDBKey>(*other->current_key_)) { |
| 3099 if (other->iterator_) { | 3101 if (other->iterator_) { |
| 3100 iterator_ = transaction_->transaction()->CreateIterator(); | 3102 iterator_ = transaction_->transaction()->CreateIterator(); |
| 3101 | 3103 |
| 3102 if (other->iterator_->IsValid()) { | 3104 if (other->iterator_->IsValid()) { |
| 3103 leveldb::Status s = iterator_->Seek(other->iterator_->Key()); | 3105 leveldb::Status s = iterator_->Seek(other->iterator_->Key()); |
| 3104 // TODO(cmumford): Handle this error (crbug.com/363397) | 3106 // TODO(cmumford): Handle this error (crbug.com/363397) |
| 3105 DCHECK(iterator_->IsValid()); | 3107 DCHECK(iterator_->IsValid()); |
| 3106 } | 3108 } |
| 3107 } | 3109 } |
| 3108 } | 3110 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3372 ObjectStoreKeyCursorImpl( | 3374 ObjectStoreKeyCursorImpl( |
| 3373 scoped_refptr<IndexedDBBackingStore> backing_store, | 3375 scoped_refptr<IndexedDBBackingStore> backing_store, |
| 3374 IndexedDBBackingStore::Transaction* transaction, | 3376 IndexedDBBackingStore::Transaction* transaction, |
| 3375 int64_t database_id, | 3377 int64_t database_id, |
| 3376 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 3378 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 3377 : IndexedDBBackingStore::Cursor(backing_store, | 3379 : IndexedDBBackingStore::Cursor(backing_store, |
| 3378 transaction, | 3380 transaction, |
| 3379 database_id, | 3381 database_id, |
| 3380 cursor_options) {} | 3382 cursor_options) {} |
| 3381 | 3383 |
| 3382 Cursor* Clone() override { return new ObjectStoreKeyCursorImpl(this); } | 3384 std::unique_ptr<Cursor> Clone() override { |
| 3385 return base::WrapUnique(new ObjectStoreKeyCursorImpl(this)); | |
| 3386 } | |
| 3383 | 3387 |
| 3384 // IndexedDBBackingStore::Cursor | 3388 // IndexedDBBackingStore::Cursor |
| 3385 IndexedDBValue* value() override { | 3389 IndexedDBValue* value() override { |
| 3386 NOTREACHED(); | 3390 NOTREACHED(); |
| 3387 return NULL; | 3391 return NULL; |
| 3388 } | 3392 } |
| 3389 bool LoadCurrentRow(leveldb::Status* s) override; | 3393 bool LoadCurrentRow(leveldb::Status* s) override; |
| 3390 | 3394 |
| 3391 protected: | 3395 protected: |
| 3392 std::string EncodeKey(const IndexedDBKey& key) override { | 3396 std::string EncodeKey(const IndexedDBKey& key) override { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3438 ObjectStoreCursorImpl( | 3442 ObjectStoreCursorImpl( |
| 3439 scoped_refptr<IndexedDBBackingStore> backing_store, | 3443 scoped_refptr<IndexedDBBackingStore> backing_store, |
| 3440 IndexedDBBackingStore::Transaction* transaction, | 3444 IndexedDBBackingStore::Transaction* transaction, |
| 3441 int64_t database_id, | 3445 int64_t database_id, |
| 3442 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 3446 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 3443 : IndexedDBBackingStore::Cursor(backing_store, | 3447 : IndexedDBBackingStore::Cursor(backing_store, |
| 3444 transaction, | 3448 transaction, |
| 3445 database_id, | 3449 database_id, |
| 3446 cursor_options) {} | 3450 cursor_options) {} |
| 3447 | 3451 |
| 3448 Cursor* Clone() override { return new ObjectStoreCursorImpl(this); } | 3452 std::unique_ptr<Cursor> Clone() override { |
| 3453 return base::WrapUnique(new ObjectStoreCursorImpl(this)); | |
| 3454 } | |
| 3449 | 3455 |
| 3450 // IndexedDBBackingStore::Cursor | 3456 // IndexedDBBackingStore::Cursor |
| 3451 IndexedDBValue* value() override { return ¤t_value_; } | 3457 IndexedDBValue* value() override { return ¤t_value_; } |
| 3452 bool LoadCurrentRow(leveldb::Status* s) override; | 3458 bool LoadCurrentRow(leveldb::Status* s) override; |
| 3453 | 3459 |
| 3454 protected: | 3460 protected: |
| 3455 std::string EncodeKey(const IndexedDBKey& key) override { | 3461 std::string EncodeKey(const IndexedDBKey& key) override { |
| 3456 return ObjectStoreDataKey::Encode( | 3462 return ObjectStoreDataKey::Encode( |
| 3457 cursor_options_.database_id, cursor_options_.object_store_id, key); | 3463 cursor_options_.database_id, cursor_options_.object_store_id, key); |
| 3458 } | 3464 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3510 IndexKeyCursorImpl( | 3516 IndexKeyCursorImpl( |
| 3511 scoped_refptr<IndexedDBBackingStore> backing_store, | 3517 scoped_refptr<IndexedDBBackingStore> backing_store, |
| 3512 IndexedDBBackingStore::Transaction* transaction, | 3518 IndexedDBBackingStore::Transaction* transaction, |
| 3513 int64_t database_id, | 3519 int64_t database_id, |
| 3514 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 3520 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 3515 : IndexedDBBackingStore::Cursor(backing_store, | 3521 : IndexedDBBackingStore::Cursor(backing_store, |
| 3516 transaction, | 3522 transaction, |
| 3517 database_id, | 3523 database_id, |
| 3518 cursor_options) {} | 3524 cursor_options) {} |
| 3519 | 3525 |
| 3520 Cursor* Clone() override { return new IndexKeyCursorImpl(this); } | 3526 std::unique_ptr<Cursor> Clone() override { |
| 3527 return base::WrapUnique(new IndexKeyCursorImpl(this)); | |
| 3528 } | |
| 3521 | 3529 |
| 3522 // IndexedDBBackingStore::Cursor | 3530 // IndexedDBBackingStore::Cursor |
| 3523 IndexedDBValue* value() override { | 3531 IndexedDBValue* value() override { |
| 3524 NOTREACHED(); | 3532 NOTREACHED(); |
| 3525 return NULL; | 3533 return NULL; |
| 3526 } | 3534 } |
| 3527 const IndexedDBKey& primary_key() const override { return *primary_key_; } | 3535 const IndexedDBKey& primary_key() const override { return *primary_key_; } |
| 3528 const IndexedDBBackingStore::RecordIdentifier& record_identifier() | 3536 const IndexedDBBackingStore::RecordIdentifier& record_identifier() |
| 3529 const override { | 3537 const override { |
| 3530 NOTREACHED(); | 3538 NOTREACHED(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3544 return IndexDataKey::Encode(cursor_options_.database_id, | 3552 return IndexDataKey::Encode(cursor_options_.database_id, |
| 3545 cursor_options_.object_store_id, | 3553 cursor_options_.object_store_id, |
| 3546 cursor_options_.index_id, | 3554 cursor_options_.index_id, |
| 3547 key, | 3555 key, |
| 3548 primary_key); | 3556 primary_key); |
| 3549 } | 3557 } |
| 3550 | 3558 |
| 3551 private: | 3559 private: |
| 3552 explicit IndexKeyCursorImpl(const IndexKeyCursorImpl* other) | 3560 explicit IndexKeyCursorImpl(const IndexKeyCursorImpl* other) |
| 3553 : IndexedDBBackingStore::Cursor(other), | 3561 : IndexedDBBackingStore::Cursor(other), |
| 3554 primary_key_(new IndexedDBKey(*other->primary_key_)) {} | 3562 primary_key_(base::MakeUnique<IndexedDBKey>(*other->primary_key_)) {} |
| 3555 | 3563 |
| 3556 std::unique_ptr<IndexedDBKey> primary_key_; | 3564 std::unique_ptr<IndexedDBKey> primary_key_; |
| 3557 | 3565 |
| 3558 DISALLOW_COPY_AND_ASSIGN(IndexKeyCursorImpl); | 3566 DISALLOW_COPY_AND_ASSIGN(IndexKeyCursorImpl); |
| 3559 }; | 3567 }; |
| 3560 | 3568 |
| 3561 bool IndexKeyCursorImpl::LoadCurrentRow(leveldb::Status* s) { | 3569 bool IndexKeyCursorImpl::LoadCurrentRow(leveldb::Status* s) { |
| 3562 StringPiece slice(iterator_->Key()); | 3570 StringPiece slice(iterator_->Key()); |
| 3563 IndexDataKey index_data_key; | 3571 IndexDataKey index_data_key; |
| 3564 if (!IndexDataKey::Decode(&slice, &index_data_key)) { | 3572 if (!IndexDataKey::Decode(&slice, &index_data_key)) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3626 IndexCursorImpl( | 3634 IndexCursorImpl( |
| 3627 scoped_refptr<IndexedDBBackingStore> backing_store, | 3635 scoped_refptr<IndexedDBBackingStore> backing_store, |
| 3628 IndexedDBBackingStore::Transaction* transaction, | 3636 IndexedDBBackingStore::Transaction* transaction, |
| 3629 int64_t database_id, | 3637 int64_t database_id, |
| 3630 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 3638 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 3631 : IndexedDBBackingStore::Cursor(backing_store, | 3639 : IndexedDBBackingStore::Cursor(backing_store, |
| 3632 transaction, | 3640 transaction, |
| 3633 database_id, | 3641 database_id, |
| 3634 cursor_options) {} | 3642 cursor_options) {} |
| 3635 | 3643 |
| 3636 Cursor* Clone() override { return new IndexCursorImpl(this); } | 3644 std::unique_ptr<Cursor> Clone() override { |
| 3645 return base::WrapUnique(new IndexCursorImpl(this)); | |
| 3646 } | |
| 3637 | 3647 |
| 3638 // IndexedDBBackingStore::Cursor | 3648 // IndexedDBBackingStore::Cursor |
| 3639 IndexedDBValue* value() override { return ¤t_value_; } | 3649 IndexedDBValue* value() override { return ¤t_value_; } |
| 3640 const IndexedDBKey& primary_key() const override { return *primary_key_; } | 3650 const IndexedDBKey& primary_key() const override { return *primary_key_; } |
| 3641 const IndexedDBBackingStore::RecordIdentifier& record_identifier() | 3651 const IndexedDBBackingStore::RecordIdentifier& record_identifier() |
| 3642 const override { | 3652 const override { |
| 3643 NOTREACHED(); | 3653 NOTREACHED(); |
| 3644 return record_identifier_; | 3654 return record_identifier_; |
| 3645 } | 3655 } |
| 3646 bool LoadCurrentRow(leveldb::Status* s) override; | 3656 bool LoadCurrentRow(leveldb::Status* s) override; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 3657 return IndexDataKey::Encode(cursor_options_.database_id, | 3667 return IndexDataKey::Encode(cursor_options_.database_id, |
| 3658 cursor_options_.object_store_id, | 3668 cursor_options_.object_store_id, |
| 3659 cursor_options_.index_id, | 3669 cursor_options_.index_id, |
| 3660 key, | 3670 key, |
| 3661 primary_key); | 3671 primary_key); |
| 3662 } | 3672 } |
| 3663 | 3673 |
| 3664 private: | 3674 private: |
| 3665 explicit IndexCursorImpl(const IndexCursorImpl* other) | 3675 explicit IndexCursorImpl(const IndexCursorImpl* other) |
| 3666 : IndexedDBBackingStore::Cursor(other), | 3676 : IndexedDBBackingStore::Cursor(other), |
| 3667 primary_key_(new IndexedDBKey(*other->primary_key_)), | 3677 primary_key_(base::MakeUnique<IndexedDBKey>(*other->primary_key_)), |
| 3668 current_value_(other->current_value_), | 3678 current_value_(other->current_value_), |
| 3669 primary_leveldb_key_(other->primary_leveldb_key_) {} | 3679 primary_leveldb_key_(other->primary_leveldb_key_) {} |
| 3670 | 3680 |
| 3671 std::unique_ptr<IndexedDBKey> primary_key_; | 3681 std::unique_ptr<IndexedDBKey> primary_key_; |
| 3672 IndexedDBValue current_value_; | 3682 IndexedDBValue current_value_; |
| 3673 std::string primary_leveldb_key_; | 3683 std::string primary_leveldb_key_; |
| 3674 | 3684 |
| 3675 DISALLOW_COPY_AND_ASSIGN(IndexCursorImpl); | 3685 DISALLOW_COPY_AND_ASSIGN(IndexCursorImpl); |
| 3676 }; | 3686 }; |
| 3677 | 3687 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3900 *s = leveldb::Status::OK(); | 3910 *s = leveldb::Status::OK(); |
| 3901 LevelDBTransaction* leveldb_transaction = transaction->transaction(); | 3911 LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
| 3902 IndexedDBBackingStore::Cursor::CursorOptions cursor_options; | 3912 IndexedDBBackingStore::Cursor::CursorOptions cursor_options; |
| 3903 if (!ObjectStoreCursorOptions(leveldb_transaction, | 3913 if (!ObjectStoreCursorOptions(leveldb_transaction, |
| 3904 database_id, | 3914 database_id, |
| 3905 object_store_id, | 3915 object_store_id, |
| 3906 range, | 3916 range, |
| 3907 direction, | 3917 direction, |
| 3908 &cursor_options)) | 3918 &cursor_options)) |
| 3909 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); | 3919 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); |
| 3910 std::unique_ptr<ObjectStoreCursorImpl> cursor(new ObjectStoreCursorImpl( | 3920 std::unique_ptr<ObjectStoreCursorImpl> cursor( |
| 3911 this, transaction, database_id, cursor_options)); | 3921 base::MakeUnique<ObjectStoreCursorImpl>(this, transaction, database_id, |
| 3922 cursor_options)); | |
| 3912 if (!cursor->FirstSeek(s)) | 3923 if (!cursor->FirstSeek(s)) |
| 3913 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); | 3924 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); |
| 3914 | 3925 |
| 3915 return std::move(cursor); | 3926 return std::move(cursor); |
| 3916 } | 3927 } |
| 3917 | 3928 |
| 3918 std::unique_ptr<IndexedDBBackingStore::Cursor> | 3929 std::unique_ptr<IndexedDBBackingStore::Cursor> |
| 3919 IndexedDBBackingStore::OpenObjectStoreKeyCursor( | 3930 IndexedDBBackingStore::OpenObjectStoreKeyCursor( |
| 3920 IndexedDBBackingStore::Transaction* transaction, | 3931 IndexedDBBackingStore::Transaction* transaction, |
| 3921 int64_t database_id, | 3932 int64_t database_id, |
| 3922 int64_t object_store_id, | 3933 int64_t object_store_id, |
| 3923 const IndexedDBKeyRange& range, | 3934 const IndexedDBKeyRange& range, |
| 3924 blink::WebIDBCursorDirection direction, | 3935 blink::WebIDBCursorDirection direction, |
| 3925 leveldb::Status* s) { | 3936 leveldb::Status* s) { |
| 3926 IDB_TRACE("IndexedDBBackingStore::OpenObjectStoreKeyCursor"); | 3937 IDB_TRACE("IndexedDBBackingStore::OpenObjectStoreKeyCursor"); |
| 3927 *s = leveldb::Status::OK(); | 3938 *s = leveldb::Status::OK(); |
| 3928 LevelDBTransaction* leveldb_transaction = transaction->transaction(); | 3939 LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
| 3929 IndexedDBBackingStore::Cursor::CursorOptions cursor_options; | 3940 IndexedDBBackingStore::Cursor::CursorOptions cursor_options; |
| 3930 if (!ObjectStoreCursorOptions(leveldb_transaction, | 3941 if (!ObjectStoreCursorOptions(leveldb_transaction, |
| 3931 database_id, | 3942 database_id, |
| 3932 object_store_id, | 3943 object_store_id, |
| 3933 range, | 3944 range, |
| 3934 direction, | 3945 direction, |
| 3935 &cursor_options)) | 3946 &cursor_options)) |
| 3936 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); | 3947 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); |
| 3937 std::unique_ptr<ObjectStoreKeyCursorImpl> cursor(new ObjectStoreKeyCursorImpl( | 3948 std::unique_ptr<ObjectStoreKeyCursorImpl> cursor( |
| 3938 this, transaction, database_id, cursor_options)); | 3949 base::MakeUnique<ObjectStoreKeyCursorImpl>(this, transaction, database_id, |
| 3950 cursor_options)); | |
| 3939 if (!cursor->FirstSeek(s)) | 3951 if (!cursor->FirstSeek(s)) |
| 3940 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); | 3952 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); |
| 3941 | 3953 |
| 3942 return std::move(cursor); | 3954 return std::move(cursor); |
| 3943 } | 3955 } |
| 3944 | 3956 |
| 3945 std::unique_ptr<IndexedDBBackingStore::Cursor> | 3957 std::unique_ptr<IndexedDBBackingStore::Cursor> |
| 3946 IndexedDBBackingStore::OpenIndexKeyCursor( | 3958 IndexedDBBackingStore::OpenIndexKeyCursor( |
| 3947 IndexedDBBackingStore::Transaction* transaction, | 3959 IndexedDBBackingStore::Transaction* transaction, |
| 3948 int64_t database_id, | 3960 int64_t database_id, |
| 3949 int64_t object_store_id, | 3961 int64_t object_store_id, |
| 3950 int64_t index_id, | 3962 int64_t index_id, |
| 3951 const IndexedDBKeyRange& range, | 3963 const IndexedDBKeyRange& range, |
| 3952 blink::WebIDBCursorDirection direction, | 3964 blink::WebIDBCursorDirection direction, |
| 3953 leveldb::Status* s) { | 3965 leveldb::Status* s) { |
| 3954 IDB_TRACE("IndexedDBBackingStore::OpenIndexKeyCursor"); | 3966 IDB_TRACE("IndexedDBBackingStore::OpenIndexKeyCursor"); |
| 3955 *s = leveldb::Status::OK(); | 3967 *s = leveldb::Status::OK(); |
| 3956 LevelDBTransaction* leveldb_transaction = transaction->transaction(); | 3968 LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
| 3957 IndexedDBBackingStore::Cursor::CursorOptions cursor_options; | 3969 IndexedDBBackingStore::Cursor::CursorOptions cursor_options; |
| 3958 if (!IndexCursorOptions(leveldb_transaction, | 3970 if (!IndexCursorOptions(leveldb_transaction, |
| 3959 database_id, | 3971 database_id, |
| 3960 object_store_id, | 3972 object_store_id, |
| 3961 index_id, | 3973 index_id, |
| 3962 range, | 3974 range, |
| 3963 direction, | 3975 direction, |
| 3964 &cursor_options)) | 3976 &cursor_options)) |
| 3965 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); | 3977 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); |
| 3966 std::unique_ptr<IndexKeyCursorImpl> cursor( | 3978 std::unique_ptr<IndexKeyCursorImpl> cursor( |
| 3967 new IndexKeyCursorImpl(this, transaction, database_id, cursor_options)); | 3979 base::MakeUnique<IndexKeyCursorImpl>(this, transaction, database_id, |
| 3980 cursor_options)); | |
| 3968 if (!cursor->FirstSeek(s)) | 3981 if (!cursor->FirstSeek(s)) |
| 3969 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); | 3982 return std::unique_ptr<IndexedDBBackingStore::Cursor>(); |
| 3970 | 3983 |
| 3971 return std::move(cursor); | 3984 return std::move(cursor); |
| 3972 } | 3985 } |
| 3973 | 3986 |
| 3974 std::unique_ptr<IndexedDBBackingStore::Cursor> | 3987 std::unique_ptr<IndexedDBBackingStore::Cursor> |
| 3975 IndexedDBBackingStore::OpenIndexCursor( | 3988 IndexedDBBackingStore::OpenIndexCursor( |
| 3976 IndexedDBBackingStore::Transaction* transaction, | 3989 IndexedDBBackingStore::Transaction* transaction, |
| 3977 int64_t database_id, | 3990 int64_t database_id, |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4467 | 4480 |
| 4468 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( | 4481 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( |
| 4469 const WriteDescriptor& other) = default; | 4482 const WriteDescriptor& other) = default; |
| 4470 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = | 4483 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = |
| 4471 default; | 4484 default; |
| 4472 IndexedDBBackingStore::Transaction::WriteDescriptor& | 4485 IndexedDBBackingStore::Transaction::WriteDescriptor& |
| 4473 IndexedDBBackingStore::Transaction::WriteDescriptor:: | 4486 IndexedDBBackingStore::Transaction::WriteDescriptor:: |
| 4474 operator=(const WriteDescriptor& other) = default; | 4487 operator=(const WriteDescriptor& other) = default; |
| 4475 | 4488 |
| 4476 } // namespace content | 4489 } // namespace content |
| OLD | NEW |