| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // | 140 // |
| 141 // <database id, object store id, index id, index key, sequence number, | 141 // <database id, object store id, index id, index key, sequence number, |
| 142 // primary key> => "version", primary key [IndexDataKey] | 142 // primary key> => "version", primary key [IndexDataKey] |
| 143 // | 143 // |
| 144 // The sequence number is obsolete; it was used to allow two entries with the | 144 // The sequence number is obsolete; it was used to allow two entries with the |
| 145 // same user (index) key in non-unique indexes prior to the inclusion of the | 145 // same user (index) key in non-unique indexes prior to the inclusion of the |
| 146 // primary key in the data. | 146 // primary key in the data. |
| 147 | 147 |
| 148 | 148 |
| 149 using base::StringPiece; | 149 using base::StringPiece; |
| 150 using WebKit::WebIDBKeyType; | 150 using blink::WebIDBKeyType; |
| 151 using WebKit::WebIDBKeyTypeArray; | 151 using blink::WebIDBKeyTypeArray; |
| 152 using WebKit::WebIDBKeyTypeDate; | 152 using blink::WebIDBKeyTypeDate; |
| 153 using WebKit::WebIDBKeyTypeInvalid; | 153 using blink::WebIDBKeyTypeInvalid; |
| 154 using WebKit::WebIDBKeyTypeMin; | 154 using blink::WebIDBKeyTypeMin; |
| 155 using WebKit::WebIDBKeyTypeNull; | 155 using blink::WebIDBKeyTypeNull; |
| 156 using WebKit::WebIDBKeyTypeNumber; | 156 using blink::WebIDBKeyTypeNumber; |
| 157 using WebKit::WebIDBKeyTypeString; | 157 using blink::WebIDBKeyTypeString; |
| 158 using WebKit::WebIDBKeyPathType; | 158 using blink::WebIDBKeyPathType; |
| 159 using WebKit::WebIDBKeyPathTypeArray; | 159 using blink::WebIDBKeyPathTypeArray; |
| 160 using WebKit::WebIDBKeyPathTypeNull; | 160 using blink::WebIDBKeyPathTypeNull; |
| 161 using WebKit::WebIDBKeyPathTypeString; | 161 using blink::WebIDBKeyPathTypeString; |
| 162 | 162 |
| 163 namespace content { | 163 namespace content { |
| 164 | 164 |
| 165 // As most of the IndexedDBKeys and encoded values are short, we | 165 // As most of the IndexedDBKeys and encoded values are short, we |
| 166 // initialize some Vectors with a default inline buffer size to reduce | 166 // initialize some Vectors with a default inline buffer size to reduce |
| 167 // the memory re-allocations when the Vectors are appended. | 167 // the memory re-allocations when the Vectors are appended. |
| 168 static const size_t kDefaultInlineBufferSize = 32; | 168 static const size_t kDefaultInlineBufferSize = 32; |
| 169 | 169 |
| 170 static const unsigned char kIndexedDBKeyNullTypeByte = 0; | 170 static const unsigned char kIndexedDBKeyNullTypeByte = 0; |
| 171 static const unsigned char kIndexedDBKeyStringTypeByte = 1; | 171 static const unsigned char kIndexedDBKeyStringTypeByte = 1; |
| (...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { | 1879 scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { |
| 1880 scoped_ptr<IndexedDBKey> key; | 1880 scoped_ptr<IndexedDBKey> key; |
| 1881 StringPiece slice(encoded_primary_key_); | 1881 StringPiece slice(encoded_primary_key_); |
| 1882 if (!DecodeIDBKey(&slice, &key)) { | 1882 if (!DecodeIDBKey(&slice, &key)) { |
| 1883 // TODO(jsbell): Return error. | 1883 // TODO(jsbell): Return error. |
| 1884 } | 1884 } |
| 1885 return key.Pass(); | 1885 return key.Pass(); |
| 1886 } | 1886 } |
| 1887 | 1887 |
| 1888 } // namespace content | 1888 } // namespace content |
| OLD | NEW |