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_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 270 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 271 if (!transaction) | 271 if (!transaction) |
| 272 return; | 272 return; |
| 273 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 273 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); |
| 274 | 274 |
| 275 if (ContainsKey(metadata_.object_stores, object_store_id)) { | 275 if (ContainsKey(metadata_.object_stores, object_store_id)) { |
| 276 DLOG(ERROR) << "Invalid object_store_id"; | 276 DLOG(ERROR) << "Invalid object_store_id"; |
| 277 return; | 277 return; |
| 278 } | 278 } |
| 279 | 279 |
| 280 // Store creation is done synchronously, as it may be followed by | |
| 281 // index creation (also sync) since preemptive OpenCursor/SetIndexKeys | |
| 282 // may follow. | |
| 280 IndexedDBObjectStoreMetadata object_store_metadata( | 283 IndexedDBObjectStoreMetadata object_store_metadata( |
| 281 name, | 284 name, |
| 282 object_store_id, | 285 object_store_id, |
| 283 key_path, | 286 key_path, |
| 284 auto_increment, | 287 auto_increment, |
| 285 IndexedDBDatabase::kMinimumIndexId); | 288 IndexedDBDatabase::kMinimumIndexId); |
| 286 | 289 |
| 287 transaction->ScheduleTask( | |
| 288 base::Bind(&IndexedDBDatabase::CreateObjectStoreOperation, | |
| 289 this, | |
| 290 object_store_metadata), | |
| 291 base::Bind(&IndexedDBDatabase::CreateObjectStoreAbortOperation, | |
| 292 this, | |
| 293 object_store_id)); | |
| 294 | |
| 295 AddObjectStore(object_store_metadata, object_store_id); | |
| 296 } | |
| 297 | |
| 298 void IndexedDBDatabase::CreateObjectStoreOperation( | |
| 299 const IndexedDBObjectStoreMetadata& object_store_metadata, | |
| 300 IndexedDBTransaction* transaction) { | |
| 301 IDB_TRACE("IndexedDBDatabase::CreateObjectStoreOperation"); | |
| 302 leveldb::Status s = | 290 leveldb::Status s = |
| 303 backing_store_->CreateObjectStore(transaction->BackingStoreTransaction(), | 291 backing_store_->CreateObjectStore(transaction->BackingStoreTransaction(), |
| 304 transaction->database()->id(), | 292 transaction->database()->id(), |
| 305 object_store_metadata.id, | 293 object_store_metadata.id, |
| 306 object_store_metadata.name, | 294 object_store_metadata.name, |
| 307 object_store_metadata.key_path, | 295 object_store_metadata.key_path, |
| 308 object_store_metadata.auto_increment); | 296 object_store_metadata.auto_increment); |
| 309 if (!s.ok()) { | 297 if (!s.ok()) { |
| 310 IndexedDBDatabaseError error( | 298 IndexedDBDatabaseError error( |
| 311 blink::WebIDBDatabaseExceptionUnknownError, | 299 blink::WebIDBDatabaseExceptionUnknownError, |
| 312 ASCIIToUTF16("Internal error creating object store '") + | 300 ASCIIToUTF16("Internal error creating object store '") + |
| 313 object_store_metadata.name + ASCIIToUTF16("'.")); | 301 object_store_metadata.name + ASCIIToUTF16("'.")); |
| 314 transaction->Abort(error); | 302 transaction->Abort(error); |
| 315 if (s.IsCorruption()) | 303 if (s.IsCorruption()) |
| 316 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 304 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 317 error); | 305 error); |
| 318 return; | 306 return; |
| 319 } | 307 } |
| 308 | |
| 309 AddObjectStore(object_store_metadata, object_store_id); | |
| 310 transaction->ScheduleAbortTask( | |
| 311 base::Bind(&IndexedDBDatabase::CreateObjectStoreAbortOperation, | |
| 312 this, | |
| 313 object_store_id)); | |
| 320 } | 314 } |
| 321 | 315 |
| 322 void IndexedDBDatabase::DeleteObjectStore(int64 transaction_id, | 316 void IndexedDBDatabase::DeleteObjectStore(int64 transaction_id, |
| 323 int64 object_store_id) { | 317 int64 object_store_id) { |
| 324 IDB_TRACE("IndexedDBDatabase::DeleteObjectStore"); | 318 IDB_TRACE("IndexedDBDatabase::DeleteObjectStore"); |
| 325 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 319 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 326 if (!transaction) | 320 if (!transaction) |
| 327 return; | 321 return; |
| 328 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 322 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); |
| 329 | 323 |
| 330 if (!ValidateObjectStoreId(object_store_id)) | 324 if (!ValidateObjectStoreId(object_store_id)) |
| 331 return; | 325 return; |
| 332 | 326 |
| 333 const IndexedDBObjectStoreMetadata& object_store_metadata = | |
| 334 metadata_.object_stores[object_store_id]; | |
| 335 | |
| 336 transaction->ScheduleTask( | 327 transaction->ScheduleTask( |
| 337 base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, | 328 base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, |
| 338 this, | 329 this, |
| 339 object_store_metadata), | 330 object_store_id)); |
| 340 base::Bind(&IndexedDBDatabase::DeleteObjectStoreAbortOperation, | |
| 341 this, | |
| 342 object_store_metadata)); | |
| 343 RemoveObjectStore(object_store_id); | |
| 344 } | 331 } |
| 345 | 332 |
| 346 void IndexedDBDatabase::CreateIndex(int64 transaction_id, | 333 void IndexedDBDatabase::CreateIndex(int64 transaction_id, |
| 347 int64 object_store_id, | 334 int64 object_store_id, |
| 348 int64 index_id, | 335 int64 index_id, |
| 349 const base::string16& name, | 336 const base::string16& name, |
| 350 const IndexedDBKeyPath& key_path, | 337 const IndexedDBKeyPath& key_path, |
| 351 bool unique, | 338 bool unique, |
| 352 bool multi_entry) { | 339 bool multi_entry) { |
| 353 IDB_TRACE("IndexedDBDatabase::CreateIndex"); | 340 IDB_TRACE("IndexedDBDatabase::CreateIndex"); |
| 354 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 341 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 355 if (!transaction) | 342 if (!transaction) |
| 356 return; | 343 return; |
| 357 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 344 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); |
| 358 | 345 |
| 359 if (!ValidateObjectStoreIdAndNewIndexId(object_store_id, index_id)) | 346 if (!ValidateObjectStoreIdAndNewIndexId(object_store_id, index_id)) |
| 360 return; | 347 return; |
| 348 | |
| 349 // Index creation is done synchronously since preemptive | |
| 350 // OpenCursor/SetIndexKeys may follow. | |
| 361 const IndexedDBIndexMetadata index_metadata( | 351 const IndexedDBIndexMetadata index_metadata( |
| 362 name, index_id, key_path, unique, multi_entry); | 352 name, index_id, key_path, unique, multi_entry); |
| 363 | 353 |
| 364 transaction->ScheduleTask( | |
| 365 base::Bind(&IndexedDBDatabase::CreateIndexOperation, | |
| 366 this, | |
| 367 object_store_id, | |
| 368 index_metadata), | |
| 369 base::Bind(&IndexedDBDatabase::CreateIndexAbortOperation, | |
| 370 this, | |
| 371 object_store_id, | |
| 372 index_id)); | |
| 373 | |
| 374 AddIndex(object_store_id, index_metadata, index_id); | |
| 375 } | |
| 376 | |
| 377 void IndexedDBDatabase::CreateIndexOperation( | |
| 378 int64 object_store_id, | |
| 379 const IndexedDBIndexMetadata& index_metadata, | |
| 380 IndexedDBTransaction* transaction) { | |
| 381 IDB_TRACE("IndexedDBDatabase::CreateIndexOperation"); | |
| 382 if (!backing_store_->CreateIndex(transaction->BackingStoreTransaction(), | 354 if (!backing_store_->CreateIndex(transaction->BackingStoreTransaction(), |
| 383 transaction->database()->id(), | 355 transaction->database()->id(), |
| 384 object_store_id, | 356 object_store_id, |
| 385 index_metadata.id, | 357 index_metadata.id, |
| 386 index_metadata.name, | 358 index_metadata.name, |
| 387 index_metadata.key_path, | 359 index_metadata.key_path, |
| 388 index_metadata.unique, | 360 index_metadata.unique, |
| 389 index_metadata.multi_entry).ok()) { | 361 index_metadata.multi_entry).ok()) { |
| 390 base::string16 error_string = | 362 base::string16 error_string = |
| 391 ASCIIToUTF16("Internal error creating index '") + | 363 ASCIIToUTF16("Internal error creating index '") + |
| 392 index_metadata.name + ASCIIToUTF16("'."); | 364 index_metadata.name + ASCIIToUTF16("'."); |
| 393 transaction->Abort(IndexedDBDatabaseError( | 365 transaction->Abort(IndexedDBDatabaseError( |
| 394 blink::WebIDBDatabaseExceptionUnknownError, error_string)); | 366 blink::WebIDBDatabaseExceptionUnknownError, error_string)); |
| 395 return; | 367 return; |
| 396 } | 368 } |
| 369 | |
| 370 AddIndex(object_store_id, index_metadata, index_id); | |
| 371 transaction->ScheduleAbortTask( | |
| 372 base::Bind(&IndexedDBDatabase::CreateIndexAbortOperation, | |
| 373 this, | |
| 374 object_store_id, | |
| 375 index_id)); | |
| 397 } | 376 } |
| 398 | 377 |
| 399 void IndexedDBDatabase::CreateIndexAbortOperation( | 378 void IndexedDBDatabase::CreateIndexAbortOperation( |
| 400 int64 object_store_id, | 379 int64 object_store_id, |
| 401 int64 index_id, | 380 int64 index_id, |
| 402 IndexedDBTransaction* transaction) { | 381 IndexedDBTransaction* transaction) { |
| 403 IDB_TRACE("IndexedDBDatabase::CreateIndexAbortOperation"); | 382 IDB_TRACE("IndexedDBDatabase::CreateIndexAbortOperation"); |
| 404 DCHECK(!transaction); | 383 DCHECK(!transaction); |
| 405 RemoveIndex(object_store_id, index_id); | 384 RemoveIndex(object_store_id, index_id); |
| 406 } | 385 } |
| 407 | 386 |
| 408 void IndexedDBDatabase::DeleteIndex(int64 transaction_id, | 387 void IndexedDBDatabase::DeleteIndex(int64 transaction_id, |
| 409 int64 object_store_id, | 388 int64 object_store_id, |
| 410 int64 index_id) { | 389 int64 index_id) { |
| 411 IDB_TRACE("IndexedDBDatabase::DeleteIndex"); | 390 IDB_TRACE("IndexedDBDatabase::DeleteIndex"); |
| 412 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 391 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
| 413 if (!transaction) | 392 if (!transaction) |
| 414 return; | 393 return; |
| 415 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 394 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); |
| 416 | 395 |
| 417 if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) | 396 if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) |
| 418 return; | 397 return; |
| 419 const IndexedDBIndexMetadata& index_metadata = | |
| 420 metadata_.object_stores[object_store_id].indexes[index_id]; | |
| 421 | 398 |
| 422 transaction->ScheduleTask( | 399 transaction->ScheduleTask( |
| 423 base::Bind(&IndexedDBDatabase::DeleteIndexOperation, | 400 base::Bind(&IndexedDBDatabase::DeleteIndexOperation, |
| 424 this, | 401 this, |
| 425 object_store_id, | 402 object_store_id, |
| 426 index_metadata), | 403 index_id)); |
| 427 base::Bind(&IndexedDBDatabase::DeleteIndexAbortOperation, | |
| 428 this, | |
| 429 object_store_id, | |
| 430 index_metadata)); | |
| 431 | |
| 432 RemoveIndex(object_store_id, index_id); | |
| 433 } | 404 } |
| 434 | 405 |
| 435 void IndexedDBDatabase::DeleteIndexOperation( | 406 void IndexedDBDatabase::DeleteIndexOperation( |
| 436 int64 object_store_id, | 407 int64 object_store_id, |
| 437 const IndexedDBIndexMetadata& index_metadata, | 408 int64 index_id, |
| 438 IndexedDBTransaction* transaction) { | 409 IndexedDBTransaction* transaction) { |
| 439 IDB_TRACE("IndexedDBDatabase::DeleteIndexOperation"); | 410 IDB_TRACE("IndexedDBDatabase::DeleteIndexOperation"); |
| 411 | |
| 412 const IndexedDBIndexMetadata index_metadata = | |
| 413 metadata_.object_stores[object_store_id].indexes[index_id]; | |
| 414 | |
| 440 leveldb::Status s = | 415 leveldb::Status s = |
| 441 backing_store_->DeleteIndex(transaction->BackingStoreTransaction(), | 416 backing_store_->DeleteIndex(transaction->BackingStoreTransaction(), |
| 442 transaction->database()->id(), | 417 transaction->database()->id(), |
| 443 object_store_id, | 418 object_store_id, |
| 444 index_metadata.id); | 419 index_id); |
| 445 if (!s.ok()) { | 420 if (!s.ok()) { |
| 446 base::string16 error_string = | 421 base::string16 error_string = |
| 447 ASCIIToUTF16("Internal error deleting index '") + | 422 ASCIIToUTF16("Internal error deleting index '") + |
| 448 index_metadata.name + ASCIIToUTF16("'."); | 423 index_metadata.name + ASCIIToUTF16("'."); |
| 449 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 424 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| 450 error_string); | 425 error_string); |
| 451 transaction->Abort(error); | 426 transaction->Abort(error); |
| 452 if (s.IsCorruption()) | 427 if (s.IsCorruption()) |
| 453 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 428 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 454 error); | 429 error); |
| 430 return; | |
|
jsbell
2014/05/19 22:07:08
Seems safer to early exit here; if the backing sto
| |
| 455 } | 431 } |
| 432 | |
| 433 RemoveIndex(object_store_id, index_id); | |
| 434 transaction->ScheduleAbortTask( | |
| 435 base::Bind(&IndexedDBDatabase::DeleteIndexAbortOperation, | |
| 436 this, | |
| 437 object_store_id, | |
| 438 index_metadata)); | |
| 456 } | 439 } |
| 457 | 440 |
| 458 void IndexedDBDatabase::DeleteIndexAbortOperation( | 441 void IndexedDBDatabase::DeleteIndexAbortOperation( |
| 459 int64 object_store_id, | 442 int64 object_store_id, |
| 460 const IndexedDBIndexMetadata& index_metadata, | 443 const IndexedDBIndexMetadata& index_metadata, |
| 461 IndexedDBTransaction* transaction) { | 444 IndexedDBTransaction* transaction) { |
| 462 IDB_TRACE("IndexedDBDatabase::DeleteIndexAbortOperation"); | 445 IDB_TRACE("IndexedDBDatabase::DeleteIndexAbortOperation"); |
| 463 DCHECK(!transaction); | 446 DCHECK(!transaction); |
| 464 AddIndex(object_store_id, index_metadata, IndexedDBIndexMetadata::kInvalidId); | 447 AddIndex(object_store_id, index_metadata, IndexedDBIndexMetadata::kInvalidId); |
| 465 } | 448 } |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1292 if (s.IsCorruption()) { | 1275 if (s.IsCorruption()) { |
| 1293 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 1276 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 1294 error); | 1277 error); |
| 1295 } | 1278 } |
| 1296 return; | 1279 return; |
| 1297 } | 1280 } |
| 1298 callbacks->OnSuccess(); | 1281 callbacks->OnSuccess(); |
| 1299 } | 1282 } |
| 1300 | 1283 |
| 1301 void IndexedDBDatabase::DeleteObjectStoreOperation( | 1284 void IndexedDBDatabase::DeleteObjectStoreOperation( |
| 1302 const IndexedDBObjectStoreMetadata& object_store_metadata, | 1285 int64 object_store_id, |
| 1303 IndexedDBTransaction* transaction) { | 1286 IndexedDBTransaction* transaction) { |
| 1304 IDB_TRACE("IndexedDBDatabase::DeleteObjectStoreOperation"); | 1287 IDB_TRACE("IndexedDBDatabase::DeleteObjectStoreOperation"); |
| 1288 | |
| 1289 const IndexedDBObjectStoreMetadata object_store_metadata = | |
|
cmumford
2014/05/20 15:29:33
Can this be a const reference?
jsbell
2014/05/20 15:34:43
No, because metadata_ is mutated by RemoveObjectSt
| |
| 1290 metadata_.object_stores[object_store_id]; | |
| 1305 leveldb::Status s = | 1291 leveldb::Status s = |
| 1306 backing_store_->DeleteObjectStore(transaction->BackingStoreTransaction(), | 1292 backing_store_->DeleteObjectStore(transaction->BackingStoreTransaction(), |
| 1307 transaction->database()->id(), | 1293 transaction->database()->id(), |
| 1308 object_store_metadata.id); | 1294 object_store_id); |
| 1309 if (!s.ok()) { | 1295 if (!s.ok()) { |
| 1310 base::string16 error_string = | 1296 base::string16 error_string = |
| 1311 ASCIIToUTF16("Internal error deleting object store '") + | 1297 ASCIIToUTF16("Internal error deleting object store '") + |
| 1312 object_store_metadata.name + ASCIIToUTF16("'."); | 1298 object_store_metadata.name + ASCIIToUTF16("'."); |
| 1313 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 1299 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
| 1314 error_string); | 1300 error_string); |
| 1315 transaction->Abort(error); | 1301 transaction->Abort(error); |
| 1316 if (s.IsCorruption()) | 1302 if (s.IsCorruption()) |
| 1317 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 1303 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
| 1318 error); | 1304 error); |
| 1305 return; | |
|
jsbell
2014/05/19 22:07:08
Ditto.
| |
| 1319 } | 1306 } |
| 1307 | |
| 1308 RemoveObjectStore(object_store_id); | |
| 1309 transaction->ScheduleAbortTask( | |
| 1310 base::Bind(&IndexedDBDatabase::DeleteObjectStoreAbortOperation, | |
| 1311 this, | |
| 1312 object_store_metadata)); | |
| 1320 } | 1313 } |
| 1321 | 1314 |
| 1322 void IndexedDBDatabase::VersionChangeOperation( | 1315 void IndexedDBDatabase::VersionChangeOperation( |
| 1323 int64 version, | 1316 int64 version, |
| 1324 scoped_refptr<IndexedDBCallbacks> callbacks, | 1317 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 1325 scoped_ptr<IndexedDBConnection> connection, | 1318 scoped_ptr<IndexedDBConnection> connection, |
| 1326 IndexedDBTransaction* transaction) { | 1319 IndexedDBTransaction* transaction) { |
| 1327 IDB_TRACE("IndexedDBDatabase::VersionChangeOperation"); | 1320 IDB_TRACE("IndexedDBDatabase::VersionChangeOperation"); |
| 1328 int64 old_version = metadata_.int_version; | 1321 int64 old_version = metadata_.int_version; |
| 1329 DCHECK_GT(version, old_version); | 1322 DCHECK_GT(version, old_version); |
| 1330 metadata_.int_version = version; | 1323 |
| 1331 if (!backing_store_->UpdateIDBDatabaseIntVersion( | 1324 if (!backing_store_->UpdateIDBDatabaseIntVersion( |
| 1332 transaction->BackingStoreTransaction(), | 1325 transaction->BackingStoreTransaction(), id(), version)) { |
| 1333 id(), | |
| 1334 metadata_.int_version)) { | |
| 1335 IndexedDBDatabaseError error( | 1326 IndexedDBDatabaseError error( |
| 1336 blink::WebIDBDatabaseExceptionUnknownError, | 1327 blink::WebIDBDatabaseExceptionUnknownError, |
| 1337 ASCIIToUTF16( | 1328 ASCIIToUTF16( |
| 1338 "Internal error writing data to stable storage when " | 1329 "Internal error writing data to stable storage when " |
| 1339 "updating version.")); | 1330 "updating version.")); |
| 1340 callbacks->OnError(error); | 1331 callbacks->OnError(error); |
| 1341 transaction->Abort(error); | 1332 transaction->Abort(error); |
| 1342 return; | 1333 return; |
| 1343 } | 1334 } |
| 1335 | |
| 1336 transaction->ScheduleAbortTask( | |
| 1337 base::Bind(&IndexedDBDatabase::VersionChangeAbortOperation, | |
| 1338 this, | |
| 1339 metadata_.version, | |
| 1340 metadata_.int_version)); | |
| 1341 metadata_.int_version = version; | |
| 1342 metadata_.version = kNoStringVersion; | |
| 1343 | |
| 1344 DCHECK(!pending_second_half_open_); | 1344 DCHECK(!pending_second_half_open_); |
| 1345 pending_second_half_open_.reset( | 1345 pending_second_half_open_.reset( |
| 1346 new PendingSuccessCall(callbacks, connection.get(), version)); | 1346 new PendingSuccessCall(callbacks, connection.get(), version)); |
| 1347 callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); | 1347 callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, | 1350 void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, |
| 1351 bool committed) { | 1351 bool committed) { |
| 1352 DCHECK(transactions_.find(transaction->id()) != transactions_.end()); | 1352 DCHECK(transactions_.find(transaction->id()) != transactions_.end()); |
| 1353 DCHECK_EQ(transactions_[transaction->id()], transaction); | 1353 DCHECK_EQ(transactions_[transaction->id()], transaction); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1616 scoped_ptr<IndexedDBConnection> connection, | 1616 scoped_ptr<IndexedDBConnection> connection, |
| 1617 int64 transaction_id, | 1617 int64 transaction_id, |
| 1618 int64 requested_version) { | 1618 int64 requested_version) { |
| 1619 | 1619 |
| 1620 std::vector<int64> object_store_ids; | 1620 std::vector<int64> object_store_ids; |
| 1621 CreateTransaction(transaction_id, | 1621 CreateTransaction(transaction_id, |
| 1622 connection.get(), | 1622 connection.get(), |
| 1623 object_store_ids, | 1623 object_store_ids, |
| 1624 indexed_db::TRANSACTION_VERSION_CHANGE); | 1624 indexed_db::TRANSACTION_VERSION_CHANGE); |
| 1625 | 1625 |
| 1626 transactions_[transaction_id] | 1626 transactions_[transaction_id]->ScheduleTask( |
| 1627 ->ScheduleTask(base::Bind(&IndexedDBDatabase::VersionChangeOperation, | 1627 base::Bind(&IndexedDBDatabase::VersionChangeOperation, |
| 1628 this, | 1628 this, |
| 1629 requested_version, | 1629 requested_version, |
| 1630 callbacks, | 1630 callbacks, |
| 1631 base::Passed(&connection)), | 1631 base::Passed(&connection))); |
| 1632 base::Bind(&IndexedDBDatabase::VersionChangeAbortOperation, | |
| 1633 this, | |
| 1634 metadata_.version, | |
| 1635 metadata_.int_version)); | |
| 1636 | |
| 1637 DCHECK(!pending_second_half_open_); | 1632 DCHECK(!pending_second_half_open_); |
| 1638 } | 1633 } |
| 1639 | 1634 |
| 1640 void IndexedDBDatabase::DeleteDatabase( | 1635 void IndexedDBDatabase::DeleteDatabase( |
| 1641 scoped_refptr<IndexedDBCallbacks> callbacks) { | 1636 scoped_refptr<IndexedDBCallbacks> callbacks) { |
| 1642 | 1637 |
| 1643 if (IsDeleteDatabaseBlocked()) { | 1638 if (IsDeleteDatabaseBlocked()) { |
| 1644 for (ConnectionSet::const_iterator it = connections_.begin(); | 1639 for (ConnectionSet::const_iterator it = connections_.begin(); |
| 1645 it != connections_.end(); | 1640 it != connections_.end(); |
| 1646 ++it) { | 1641 ++it) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1766 const base::string16& previous_version, | 1761 const base::string16& previous_version, |
| 1767 int64 previous_int_version, | 1762 int64 previous_int_version, |
| 1768 IndexedDBTransaction* transaction) { | 1763 IndexedDBTransaction* transaction) { |
| 1769 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 1764 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
| 1770 DCHECK(!transaction); | 1765 DCHECK(!transaction); |
| 1771 metadata_.version = previous_version; | 1766 metadata_.version = previous_version; |
| 1772 metadata_.int_version = previous_int_version; | 1767 metadata_.int_version = previous_int_version; |
| 1773 } | 1768 } |
| 1774 | 1769 |
| 1775 } // namespace content | 1770 } // namespace content |
| OLD | NEW |