| 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 "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 13 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
| 14 #include "content/browser/indexed_db/indexed_db_metadata.h" | 14 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 15 #include "content/browser/indexed_db/indexed_db_tracing.h" | 15 #include "content/browser/indexed_db/indexed_db_tracing.h" |
| 16 #include "content/browser/indexed_db/indexed_db_value.h" |
| 16 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" | 17 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" |
| 17 #include "content/browser/indexed_db/leveldb/leveldb_database.h" | 18 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
| 18 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
| 19 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 20 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
| 20 #include "content/common/indexed_db/indexed_db_key.h" | 21 #include "content/common/indexed_db/indexed_db_key.h" |
| 21 #include "content/common/indexed_db/indexed_db_key_path.h" | 22 #include "content/common/indexed_db/indexed_db_key_path.h" |
| 22 #include "content/common/indexed_db/indexed_db_key_range.h" | 23 #include "content/common/indexed_db/indexed_db_key_range.h" |
| 23 #include "third_party/WebKit/public/platform/WebIDBTypes.h" | 24 #include "third_party/WebKit/public/platform/WebIDBTypes.h" |
| 24 #include "third_party/WebKit/public/web/WebSerializedScriptValueVersion.h" | 25 #include "third_party/WebKit/public/web/WebSerializedScriptValueVersion.h" |
| 25 #include "third_party/leveldatabase/env_chromium.h" | 26 #include "third_party/leveldatabase/env_chromium.h" |
| (...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 IndexMetaDataKey::EncodeMaxKey(database_id, object_store_id)); | 1164 IndexMetaDataKey::EncodeMaxKey(database_id, object_store_id)); |
| 1164 | 1165 |
| 1165 return ClearObjectStore(transaction, database_id, object_store_id); | 1166 return ClearObjectStore(transaction, database_id, object_store_id); |
| 1166 } | 1167 } |
| 1167 | 1168 |
| 1168 leveldb::Status IndexedDBBackingStore::GetRecord( | 1169 leveldb::Status IndexedDBBackingStore::GetRecord( |
| 1169 IndexedDBBackingStore::Transaction* transaction, | 1170 IndexedDBBackingStore::Transaction* transaction, |
| 1170 int64 database_id, | 1171 int64 database_id, |
| 1171 int64 object_store_id, | 1172 int64 object_store_id, |
| 1172 const IndexedDBKey& key, | 1173 const IndexedDBKey& key, |
| 1173 std::string* record) { | 1174 IndexedDBValue* record) { |
| 1174 IDB_TRACE("IndexedDBBackingStore::GetRecord"); | 1175 IDB_TRACE("IndexedDBBackingStore::GetRecord"); |
| 1175 if (!KeyPrefix::ValidIds(database_id, object_store_id)) | 1176 if (!KeyPrefix::ValidIds(database_id, object_store_id)) |
| 1176 return InvalidDBKeyStatus(); | 1177 return InvalidDBKeyStatus(); |
| 1177 LevelDBTransaction* leveldb_transaction = transaction->transaction(); | 1178 LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
| 1178 | 1179 |
| 1179 const std::string leveldb_key = | 1180 const std::string leveldb_key = |
| 1180 ObjectStoreDataKey::Encode(database_id, object_store_id, key); | 1181 ObjectStoreDataKey::Encode(database_id, object_store_id, key); |
| 1181 std::string data; | 1182 std::string data; |
| 1182 | 1183 |
| 1183 record->clear(); | 1184 record->clear(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1195 return leveldb::Status::NotFound("Record contained no data"); | 1196 return leveldb::Status::NotFound("Record contained no data"); |
| 1196 } | 1197 } |
| 1197 | 1198 |
| 1198 int64 version; | 1199 int64 version; |
| 1199 StringPiece slice(data); | 1200 StringPiece slice(data); |
| 1200 if (!DecodeVarInt(&slice, &version)) { | 1201 if (!DecodeVarInt(&slice, &version)) { |
| 1201 INTERNAL_READ_ERROR(GET_RECORD); | 1202 INTERNAL_READ_ERROR(GET_RECORD); |
| 1202 return InternalInconsistencyStatus(); | 1203 return InternalInconsistencyStatus(); |
| 1203 } | 1204 } |
| 1204 | 1205 |
| 1205 *record = slice.as_string(); | 1206 record->bits = slice.as_string(); |
| 1206 return s; | 1207 return s; |
| 1207 } | 1208 } |
| 1208 | 1209 |
| 1209 WARN_UNUSED_RESULT static leveldb::Status GetNewVersionNumber( | 1210 WARN_UNUSED_RESULT static leveldb::Status GetNewVersionNumber( |
| 1210 LevelDBTransaction* transaction, | 1211 LevelDBTransaction* transaction, |
| 1211 int64 database_id, | 1212 int64 database_id, |
| 1212 int64 object_store_id, | 1213 int64 object_store_id, |
| 1213 int64* new_version_number) { | 1214 int64* new_version_number) { |
| 1214 const std::string last_version_key = ObjectStoreMetaDataKey::Encode( | 1215 const std::string last_version_key = ObjectStoreMetaDataKey::Encode( |
| 1215 database_id, object_store_id, ObjectStoreMetaDataKey::LAST_VERSION); | 1216 database_id, object_store_id, ObjectStoreMetaDataKey::LAST_VERSION); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1236 | 1237 |
| 1237 *new_version_number = version; | 1238 *new_version_number = version; |
| 1238 return s; | 1239 return s; |
| 1239 } | 1240 } |
| 1240 | 1241 |
| 1241 leveldb::Status IndexedDBBackingStore::PutRecord( | 1242 leveldb::Status IndexedDBBackingStore::PutRecord( |
| 1242 IndexedDBBackingStore::Transaction* transaction, | 1243 IndexedDBBackingStore::Transaction* transaction, |
| 1243 int64 database_id, | 1244 int64 database_id, |
| 1244 int64 object_store_id, | 1245 int64 object_store_id, |
| 1245 const IndexedDBKey& key, | 1246 const IndexedDBKey& key, |
| 1246 const std::string& value, | 1247 const IndexedDBValue& value, |
| 1247 RecordIdentifier* record_identifier) { | 1248 RecordIdentifier* record_identifier) { |
| 1248 IDB_TRACE("IndexedDBBackingStore::PutRecord"); | 1249 IDB_TRACE("IndexedDBBackingStore::PutRecord"); |
| 1249 if (!KeyPrefix::ValidIds(database_id, object_store_id)) | 1250 if (!KeyPrefix::ValidIds(database_id, object_store_id)) |
| 1250 return InvalidDBKeyStatus(); | 1251 return InvalidDBKeyStatus(); |
| 1251 DCHECK(key.IsValid()); | 1252 DCHECK(key.IsValid()); |
| 1252 | 1253 |
| 1253 LevelDBTransaction* leveldb_transaction = transaction->transaction(); | 1254 LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
| 1254 int64 version = -1; | 1255 int64 version = -1; |
| 1255 leveldb::Status s = GetNewVersionNumber( | 1256 leveldb::Status s = GetNewVersionNumber( |
| 1256 leveldb_transaction, database_id, object_store_id, &version); | 1257 leveldb_transaction, database_id, object_store_id, &version); |
| 1257 if (!s.ok()) | 1258 if (!s.ok()) |
| 1258 return s; | 1259 return s; |
| 1259 DCHECK_GE(version, 0); | 1260 DCHECK_GE(version, 0); |
| 1260 const std::string object_storedata_key = | 1261 const std::string object_store_data_key = |
| 1261 ObjectStoreDataKey::Encode(database_id, object_store_id, key); | 1262 ObjectStoreDataKey::Encode(database_id, object_store_id, key); |
| 1262 | 1263 |
| 1263 std::string v; | 1264 std::string v; |
| 1264 EncodeVarInt(version, &v); | 1265 EncodeVarInt(version, &v); |
| 1265 v.append(value); | 1266 v.append(value.bits); |
| 1266 | 1267 |
| 1267 leveldb_transaction->Put(object_storedata_key, &v); | 1268 leveldb_transaction->Put(object_store_data_key, &v); |
| 1268 | 1269 |
| 1269 const std::string exists_entry_key = | 1270 const std::string exists_entry_key = |
| 1270 ExistsEntryKey::Encode(database_id, object_store_id, key); | 1271 ExistsEntryKey::Encode(database_id, object_store_id, key); |
| 1271 std::string version_encoded; | 1272 std::string version_encoded; |
| 1272 EncodeInt(version, &version_encoded); | 1273 EncodeInt(version, &version_encoded); |
| 1273 leveldb_transaction->Put(exists_entry_key, &version_encoded); | 1274 leveldb_transaction->Put(exists_entry_key, &version_encoded); |
| 1274 | 1275 |
| 1275 std::string key_encoded; | 1276 std::string key_encoded; |
| 1276 EncodeIDBKey(key, &key_encoded); | 1277 EncodeIDBKey(key, &key_encoded); |
| 1277 record_identifier->Reset(key_encoded, version); | 1278 record_identifier->Reset(key_encoded, version); |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 ObjectStoreKeyCursorImpl( | 2055 ObjectStoreKeyCursorImpl( |
| 2055 LevelDBTransaction* transaction, | 2056 LevelDBTransaction* transaction, |
| 2056 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 2057 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 2057 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} | 2058 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} |
| 2058 | 2059 |
| 2059 virtual Cursor* Clone() OVERRIDE { | 2060 virtual Cursor* Clone() OVERRIDE { |
| 2060 return new ObjectStoreKeyCursorImpl(this); | 2061 return new ObjectStoreKeyCursorImpl(this); |
| 2061 } | 2062 } |
| 2062 | 2063 |
| 2063 // IndexedDBBackingStore::Cursor | 2064 // IndexedDBBackingStore::Cursor |
| 2064 virtual std::string* value() OVERRIDE { | 2065 virtual IndexedDBValue* value() OVERRIDE { |
| 2065 NOTREACHED(); | 2066 NOTREACHED(); |
| 2066 return NULL; | 2067 return NULL; |
| 2067 } | 2068 } |
| 2068 virtual bool LoadCurrentRow() OVERRIDE; | 2069 virtual bool LoadCurrentRow() OVERRIDE; |
| 2069 | 2070 |
| 2070 protected: | 2071 protected: |
| 2071 virtual std::string EncodeKey(const IndexedDBKey& key) OVERRIDE { | 2072 virtual std::string EncodeKey(const IndexedDBKey& key) OVERRIDE { |
| 2072 return ObjectStoreDataKey::Encode( | 2073 return ObjectStoreDataKey::Encode( |
| 2073 cursor_options_.database_id, cursor_options_.object_store_id, key); | 2074 cursor_options_.database_id, cursor_options_.object_store_id, key); |
| 2074 } | 2075 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 class ObjectStoreCursorImpl : public IndexedDBBackingStore::Cursor { | 2112 class ObjectStoreCursorImpl : public IndexedDBBackingStore::Cursor { |
| 2112 public: | 2113 public: |
| 2113 ObjectStoreCursorImpl( | 2114 ObjectStoreCursorImpl( |
| 2114 LevelDBTransaction* transaction, | 2115 LevelDBTransaction* transaction, |
| 2115 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 2116 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 2116 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} | 2117 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} |
| 2117 | 2118 |
| 2118 virtual Cursor* Clone() OVERRIDE { return new ObjectStoreCursorImpl(this); } | 2119 virtual Cursor* Clone() OVERRIDE { return new ObjectStoreCursorImpl(this); } |
| 2119 | 2120 |
| 2120 // IndexedDBBackingStore::Cursor | 2121 // IndexedDBBackingStore::Cursor |
| 2121 virtual std::string* value() OVERRIDE { return ¤t_value_; } | 2122 virtual IndexedDBValue* value() OVERRIDE { return ¤t_value_; } |
| 2122 virtual bool LoadCurrentRow() OVERRIDE; | 2123 virtual bool LoadCurrentRow() OVERRIDE; |
| 2123 | 2124 |
| 2124 protected: | 2125 protected: |
| 2125 virtual std::string EncodeKey(const IndexedDBKey& key) OVERRIDE { | 2126 virtual std::string EncodeKey(const IndexedDBKey& key) OVERRIDE { |
| 2126 return ObjectStoreDataKey::Encode( | 2127 return ObjectStoreDataKey::Encode( |
| 2127 cursor_options_.database_id, cursor_options_.object_store_id, key); | 2128 cursor_options_.database_id, cursor_options_.object_store_id, key); |
| 2128 } | 2129 } |
| 2129 virtual std::string EncodeKey(const IndexedDBKey& key, | 2130 virtual std::string EncodeKey(const IndexedDBKey& key, |
| 2130 const IndexedDBKey& primary_key) OVERRIDE { | 2131 const IndexedDBKey& primary_key) OVERRIDE { |
| 2131 NOTREACHED(); | 2132 NOTREACHED(); |
| 2132 return std::string(); | 2133 return std::string(); |
| 2133 } | 2134 } |
| 2134 | 2135 |
| 2135 private: | 2136 private: |
| 2136 explicit ObjectStoreCursorImpl(const ObjectStoreCursorImpl* other) | 2137 explicit ObjectStoreCursorImpl(const ObjectStoreCursorImpl* other) |
| 2137 : IndexedDBBackingStore::Cursor(other), | 2138 : IndexedDBBackingStore::Cursor(other), |
| 2138 current_value_(other->current_value_) {} | 2139 current_value_(other->current_value_) {} |
| 2139 | 2140 |
| 2140 std::string current_value_; | 2141 IndexedDBValue current_value_; |
| 2141 }; | 2142 }; |
| 2142 | 2143 |
| 2143 bool ObjectStoreCursorImpl::LoadCurrentRow() { | 2144 bool ObjectStoreCursorImpl::LoadCurrentRow() { |
| 2144 StringPiece slice(iterator_->Key()); | 2145 StringPiece key_slice(iterator_->Key()); |
| 2145 ObjectStoreDataKey object_store_data_key; | 2146 ObjectStoreDataKey object_store_data_key; |
| 2146 if (!ObjectStoreDataKey::Decode(&slice, &object_store_data_key)) { | 2147 if (!ObjectStoreDataKey::Decode(&key_slice, &object_store_data_key)) { |
| 2147 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); | 2148 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); |
| 2148 return false; | 2149 return false; |
| 2149 } | 2150 } |
| 2150 | 2151 |
| 2151 current_key_ = object_store_data_key.user_key(); | 2152 current_key_ = object_store_data_key.user_key(); |
| 2152 | 2153 |
| 2153 int64 version; | 2154 int64 version; |
| 2154 slice = StringPiece(iterator_->Value()); | 2155 StringPiece value_slice = StringPiece(iterator_->Value()); |
| 2155 if (!DecodeVarInt(&slice, &version)) { | 2156 if (!DecodeVarInt(&value_slice, &version)) { |
| 2156 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); | 2157 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); |
| 2157 return false; | 2158 return false; |
| 2158 } | 2159 } |
| 2159 | 2160 |
| 2160 // TODO(jsbell): This re-encodes what was just decoded; try and optimize. | 2161 // TODO(jsbell): This re-encodes what was just decoded; try and optimize. |
| 2161 std::string encoded_key; | 2162 std::string encoded_key; |
| 2162 EncodeIDBKey(*current_key_, &encoded_key); | 2163 EncodeIDBKey(*current_key_, &encoded_key); |
| 2163 record_identifier_.Reset(encoded_key, version); | 2164 record_identifier_.Reset(encoded_key, version); |
| 2164 | 2165 |
| 2165 current_value_ = slice.as_string(); | 2166 current_value_.bits = value_slice.as_string(); |
| 2166 return true; | 2167 return true; |
| 2167 } | 2168 } |
| 2168 | 2169 |
| 2169 class IndexKeyCursorImpl : public IndexedDBBackingStore::Cursor { | 2170 class IndexKeyCursorImpl : public IndexedDBBackingStore::Cursor { |
| 2170 public: | 2171 public: |
| 2171 IndexKeyCursorImpl( | 2172 IndexKeyCursorImpl( |
| 2172 LevelDBTransaction* transaction, | 2173 LevelDBTransaction* transaction, |
| 2173 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 2174 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 2174 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} | 2175 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} |
| 2175 | 2176 |
| 2176 virtual Cursor* Clone() OVERRIDE { return new IndexKeyCursorImpl(this); } | 2177 virtual Cursor* Clone() OVERRIDE { return new IndexKeyCursorImpl(this); } |
| 2177 | 2178 |
| 2178 // IndexedDBBackingStore::Cursor | 2179 // IndexedDBBackingStore::Cursor |
| 2179 virtual std::string* value() OVERRIDE { | 2180 virtual IndexedDBValue* value() OVERRIDE { |
| 2180 NOTREACHED(); | 2181 NOTREACHED(); |
| 2181 return NULL; | 2182 return NULL; |
| 2182 } | 2183 } |
| 2183 virtual const IndexedDBKey& primary_key() const OVERRIDE { | 2184 virtual const IndexedDBKey& primary_key() const OVERRIDE { |
| 2184 return *primary_key_; | 2185 return *primary_key_; |
| 2185 } | 2186 } |
| 2186 virtual const IndexedDBBackingStore::RecordIdentifier& record_identifier() | 2187 virtual const IndexedDBBackingStore::RecordIdentifier& record_identifier() |
| 2187 const OVERRIDE { | 2188 const OVERRIDE { |
| 2188 NOTREACHED(); | 2189 NOTREACHED(); |
| 2189 return record_identifier_; | 2190 return record_identifier_; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 class IndexCursorImpl : public IndexedDBBackingStore::Cursor { | 2277 class IndexCursorImpl : public IndexedDBBackingStore::Cursor { |
| 2277 public: | 2278 public: |
| 2278 IndexCursorImpl( | 2279 IndexCursorImpl( |
| 2279 LevelDBTransaction* transaction, | 2280 LevelDBTransaction* transaction, |
| 2280 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) | 2281 const IndexedDBBackingStore::Cursor::CursorOptions& cursor_options) |
| 2281 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} | 2282 : IndexedDBBackingStore::Cursor(transaction, cursor_options) {} |
| 2282 | 2283 |
| 2283 virtual Cursor* Clone() OVERRIDE { return new IndexCursorImpl(this); } | 2284 virtual Cursor* Clone() OVERRIDE { return new IndexCursorImpl(this); } |
| 2284 | 2285 |
| 2285 // IndexedDBBackingStore::Cursor | 2286 // IndexedDBBackingStore::Cursor |
| 2286 virtual std::string* value() OVERRIDE { return ¤t_value_; } | 2287 virtual IndexedDBValue* value() OVERRIDE { return ¤t_value_; } |
| 2287 virtual const IndexedDBKey& primary_key() const OVERRIDE { | 2288 virtual const IndexedDBKey& primary_key() const OVERRIDE { |
| 2288 return *primary_key_; | 2289 return *primary_key_; |
| 2289 } | 2290 } |
| 2290 virtual const IndexedDBBackingStore::RecordIdentifier& record_identifier() | 2291 virtual const IndexedDBBackingStore::RecordIdentifier& record_identifier() |
| 2291 const OVERRIDE { | 2292 const OVERRIDE { |
| 2292 NOTREACHED(); | 2293 NOTREACHED(); |
| 2293 return record_identifier_; | 2294 return record_identifier_; |
| 2294 } | 2295 } |
| 2295 virtual bool LoadCurrentRow() OVERRIDE; | 2296 virtual bool LoadCurrentRow() OVERRIDE; |
| 2296 | 2297 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2311 } | 2312 } |
| 2312 | 2313 |
| 2313 private: | 2314 private: |
| 2314 explicit IndexCursorImpl(const IndexCursorImpl* other) | 2315 explicit IndexCursorImpl(const IndexCursorImpl* other) |
| 2315 : IndexedDBBackingStore::Cursor(other), | 2316 : IndexedDBBackingStore::Cursor(other), |
| 2316 primary_key_(new IndexedDBKey(*other->primary_key_)), | 2317 primary_key_(new IndexedDBKey(*other->primary_key_)), |
| 2317 current_value_(other->current_value_), | 2318 current_value_(other->current_value_), |
| 2318 primary_leveldb_key_(other->primary_leveldb_key_) {} | 2319 primary_leveldb_key_(other->primary_leveldb_key_) {} |
| 2319 | 2320 |
| 2320 scoped_ptr<IndexedDBKey> primary_key_; | 2321 scoped_ptr<IndexedDBKey> primary_key_; |
| 2321 std::string current_value_; | 2322 IndexedDBValue current_value_; |
| 2322 std::string primary_leveldb_key_; | 2323 std::string primary_leveldb_key_; |
| 2323 }; | 2324 }; |
| 2324 | 2325 |
| 2325 bool IndexCursorImpl::LoadCurrentRow() { | 2326 bool IndexCursorImpl::LoadCurrentRow() { |
| 2326 StringPiece slice(iterator_->Key()); | 2327 StringPiece slice(iterator_->Key()); |
| 2327 IndexDataKey index_data_key; | 2328 IndexDataKey index_data_key; |
| 2328 if (!IndexDataKey::Decode(&slice, &index_data_key)) { | 2329 if (!IndexDataKey::Decode(&slice, &index_data_key)) { |
| 2329 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); | 2330 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); |
| 2330 return false; | 2331 return false; |
| 2331 } | 2332 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 if (!DecodeVarInt(&slice, &object_store_data_version)) { | 2371 if (!DecodeVarInt(&slice, &object_store_data_version)) { |
| 2371 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); | 2372 INTERNAL_READ_ERROR(LOAD_CURRENT_ROW); |
| 2372 return false; | 2373 return false; |
| 2373 } | 2374 } |
| 2374 | 2375 |
| 2375 if (object_store_data_version != index_data_version) { | 2376 if (object_store_data_version != index_data_version) { |
| 2376 transaction_->Remove(iterator_->Key()); | 2377 transaction_->Remove(iterator_->Key()); |
| 2377 return false; | 2378 return false; |
| 2378 } | 2379 } |
| 2379 | 2380 |
| 2380 current_value_ = slice.as_string(); | 2381 current_value_.bits = slice.as_string(); |
| 2381 return true; | 2382 return true; |
| 2382 } | 2383 } |
| 2383 | 2384 |
| 2384 bool ObjectStoreCursorOptions( | 2385 bool ObjectStoreCursorOptions( |
| 2385 LevelDBTransaction* transaction, | 2386 LevelDBTransaction* transaction, |
| 2386 int64 database_id, | 2387 int64 database_id, |
| 2387 int64 object_store_id, | 2388 int64 object_store_id, |
| 2388 const IndexedDBKeyRange& range, | 2389 const IndexedDBKeyRange& range, |
| 2389 indexed_db::CursorDirection direction, | 2390 indexed_db::CursorDirection direction, |
| 2390 IndexedDBBackingStore::Cursor::CursorOptions* cursor_options) { | 2391 IndexedDBBackingStore::Cursor::CursorOptions* cursor_options) { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 } | 2645 } |
| 2645 | 2646 |
| 2646 void IndexedDBBackingStore::Transaction::Rollback() { | 2647 void IndexedDBBackingStore::Transaction::Rollback() { |
| 2647 IDB_TRACE("IndexedDBBackingStore::Transaction::Rollback"); | 2648 IDB_TRACE("IndexedDBBackingStore::Transaction::Rollback"); |
| 2648 DCHECK(transaction_.get()); | 2649 DCHECK(transaction_.get()); |
| 2649 transaction_->Rollback(); | 2650 transaction_->Rollback(); |
| 2650 transaction_ = NULL; | 2651 transaction_ = NULL; |
| 2651 } | 2652 } |
| 2652 | 2653 |
| 2653 } // namespace content | 2654 } // namespace content |
| OLD | NEW |