| 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_leveldb_coding.h" | 5 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 EncodeIDBKey(user_key, &encoded_key); | 1771 EncodeIDBKey(user_key, &encoded_key); |
| 1772 return Encode(database_id, object_store_id, encoded_key); | 1772 return Encode(database_id, object_store_id, encoded_key); |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 scoped_ptr<IndexedDBKey> ObjectStoreDataKey::user_key() const { | 1775 scoped_ptr<IndexedDBKey> ObjectStoreDataKey::user_key() const { |
| 1776 scoped_ptr<IndexedDBKey> key; | 1776 scoped_ptr<IndexedDBKey> key; |
| 1777 StringPiece slice(encoded_user_key_); | 1777 StringPiece slice(encoded_user_key_); |
| 1778 if (!DecodeIDBKey(&slice, &key)) { | 1778 if (!DecodeIDBKey(&slice, &key)) { |
| 1779 // TODO(jsbell): Return error. | 1779 // TODO(jsbell): Return error. |
| 1780 } | 1780 } |
| 1781 return key.Pass(); | 1781 return key; |
| 1782 } | 1782 } |
| 1783 | 1783 |
| 1784 const int64_t ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId; | 1784 const int64_t ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId; |
| 1785 | 1785 |
| 1786 ExistsEntryKey::ExistsEntryKey() {} | 1786 ExistsEntryKey::ExistsEntryKey() {} |
| 1787 ExistsEntryKey::~ExistsEntryKey() {} | 1787 ExistsEntryKey::~ExistsEntryKey() {} |
| 1788 | 1788 |
| 1789 bool ExistsEntryKey::Decode(StringPiece* slice, ExistsEntryKey* result) { | 1789 bool ExistsEntryKey::Decode(StringPiece* slice, ExistsEntryKey* result) { |
| 1790 KeyPrefix prefix; | 1790 KeyPrefix prefix; |
| 1791 if (!KeyPrefix::Decode(slice, &prefix)) | 1791 if (!KeyPrefix::Decode(slice, &prefix)) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1815 EncodeIDBKey(user_key, &encoded_key); | 1815 EncodeIDBKey(user_key, &encoded_key); |
| 1816 return Encode(database_id, object_store_id, encoded_key); | 1816 return Encode(database_id, object_store_id, encoded_key); |
| 1817 } | 1817 } |
| 1818 | 1818 |
| 1819 scoped_ptr<IndexedDBKey> ExistsEntryKey::user_key() const { | 1819 scoped_ptr<IndexedDBKey> ExistsEntryKey::user_key() const { |
| 1820 scoped_ptr<IndexedDBKey> key; | 1820 scoped_ptr<IndexedDBKey> key; |
| 1821 StringPiece slice(encoded_user_key_); | 1821 StringPiece slice(encoded_user_key_); |
| 1822 if (!DecodeIDBKey(&slice, &key)) { | 1822 if (!DecodeIDBKey(&slice, &key)) { |
| 1823 // TODO(jsbell): Return error. | 1823 // TODO(jsbell): Return error. |
| 1824 } | 1824 } |
| 1825 return key.Pass(); | 1825 return key; |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 const int64_t ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId; | 1828 const int64_t ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId; |
| 1829 | 1829 |
| 1830 bool BlobEntryKey::Decode(StringPiece* slice, BlobEntryKey* result) { | 1830 bool BlobEntryKey::Decode(StringPiece* slice, BlobEntryKey* result) { |
| 1831 KeyPrefix prefix; | 1831 KeyPrefix prefix; |
| 1832 if (!KeyPrefix::Decode(slice, &prefix)) | 1832 if (!KeyPrefix::Decode(slice, &prefix)) |
| 1833 return false; | 1833 return false; |
| 1834 DCHECK(prefix.database_id_); | 1834 DCHECK(prefix.database_id_); |
| 1835 DCHECK(prefix.object_store_id_); | 1835 DCHECK(prefix.object_store_id_); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 DCHECK_GE(index_id_, 0); | 2014 DCHECK_GE(index_id_, 0); |
| 2015 return index_id_; | 2015 return index_id_; |
| 2016 } | 2016 } |
| 2017 | 2017 |
| 2018 scoped_ptr<IndexedDBKey> IndexDataKey::user_key() const { | 2018 scoped_ptr<IndexedDBKey> IndexDataKey::user_key() const { |
| 2019 scoped_ptr<IndexedDBKey> key; | 2019 scoped_ptr<IndexedDBKey> key; |
| 2020 StringPiece slice(encoded_user_key_); | 2020 StringPiece slice(encoded_user_key_); |
| 2021 if (!DecodeIDBKey(&slice, &key)) { | 2021 if (!DecodeIDBKey(&slice, &key)) { |
| 2022 // TODO(jsbell): Return error. | 2022 // TODO(jsbell): Return error. |
| 2023 } | 2023 } |
| 2024 return key.Pass(); | 2024 return key; |
| 2025 } | 2025 } |
| 2026 | 2026 |
| 2027 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { | 2027 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { |
| 2028 scoped_ptr<IndexedDBKey> key; | 2028 scoped_ptr<IndexedDBKey> key; |
| 2029 StringPiece slice(encoded_primary_key_); | 2029 StringPiece slice(encoded_primary_key_); |
| 2030 if (!DecodeIDBKey(&slice, &key)) { | 2030 if (!DecodeIDBKey(&slice, &key)) { |
| 2031 // TODO(jsbell): Return error. | 2031 // TODO(jsbell): Return error. |
| 2032 } | 2032 } |
| 2033 return key.Pass(); | 2033 return key; |
| 2034 } | 2034 } |
| 2035 | 2035 |
| 2036 } // namespace content | 2036 } // namespace content |
| OLD | NEW |