| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // ---------- | 153 // ---------- |
| 154 // The prefix is followed by a type byte, the encoded IDB index key, a | 154 // The prefix is followed by a type byte, the encoded IDB index key, a |
| 155 // "sequence" number (obsolete; var int), and the encoded IDB primary key. | 155 // "sequence" number (obsolete; var int), and the encoded IDB primary key. |
| 156 // | 156 // |
| 157 // <database id, object store id, index id, index key, sequence number, | 157 // <database id, object store id, index id, index key, sequence number, |
| 158 // primary key> => "version", primary key [IndexDataKey] | 158 // primary key> => "version", primary key [IndexDataKey] |
| 159 // | 159 // |
| 160 // The sequence number is obsolete; it was used to allow two entries with the | 160 // The sequence number is obsolete; it was used to allow two entries with the |
| 161 // same user (index) key in non-unique indexes prior to the inclusion of the | 161 // same user (index) key in non-unique indexes prior to the inclusion of the |
| 162 // primary key in the data. | 162 // primary key in the data. |
| 163 // |
| 164 // Note: In order to be compatible with LevelDB's Bloom filter each bit of the |
| 165 // encoded key needs to used and "not ignored" by the comparator. |
| 163 | 166 |
| 164 using base::StringPiece; | 167 using base::StringPiece; |
| 165 using blink::WebIDBKeyType; | 168 using blink::WebIDBKeyType; |
| 166 using blink::WebIDBKeyTypeArray; | 169 using blink::WebIDBKeyTypeArray; |
| 167 using blink::WebIDBKeyTypeBinary; | 170 using blink::WebIDBKeyTypeBinary; |
| 168 using blink::WebIDBKeyTypeDate; | 171 using blink::WebIDBKeyTypeDate; |
| 169 using blink::WebIDBKeyTypeInvalid; | 172 using blink::WebIDBKeyTypeInvalid; |
| 170 using blink::WebIDBKeyTypeMin; | 173 using blink::WebIDBKeyTypeMin; |
| 171 using blink::WebIDBKeyTypeNull; | 174 using blink::WebIDBKeyTypeNull; |
| 172 using blink::WebIDBKeyTypeNumber; | 175 using blink::WebIDBKeyTypeNumber; |
| (...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { | 2033 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { |
| 2031 scoped_ptr<IndexedDBKey> key; | 2034 scoped_ptr<IndexedDBKey> key; |
| 2032 StringPiece slice(encoded_primary_key_); | 2035 StringPiece slice(encoded_primary_key_); |
| 2033 if (!DecodeIDBKey(&slice, &key)) { | 2036 if (!DecodeIDBKey(&slice, &key)) { |
| 2034 // TODO(jsbell): Return error. | 2037 // TODO(jsbell): Return error. |
| 2035 } | 2038 } |
| 2036 return key.Pass(); | 2039 return key.Pass(); |
| 2037 } | 2040 } |
| 2038 | 2041 |
| 2039 } // namespace content | 2042 } // namespace content |
| OLD | NEW |