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 = | 327 const IndexedDBObjectStoreMetadata& object_store_metadata = |
334 metadata_.object_stores[object_store_id]; | 328 metadata_.object_stores[object_store_id]; |
335 | 329 |
336 transaction->ScheduleTask( | 330 transaction->ScheduleTask( |
337 base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, | 331 base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, |
ericu
2014/05/14 01:08:00
This change makes the RemoveObjectStore call async
jsbell
2014/05/14 11:05:52
That's the key bit of the patch.
Currently, scrip
| |
338 this, | 332 this, |
339 object_store_metadata), | |
340 base::Bind(&IndexedDBDatabase::DeleteObjectStoreAbortOperation, | |
341 this, | |
342 object_store_metadata)); | 333 object_store_metadata)); |
343 RemoveObjectStore(object_store_id); | |
344 } | 334 } |
345 | 335 |
346 void IndexedDBDatabase::CreateIndex(int64 transaction_id, | 336 void IndexedDBDatabase::CreateIndex(int64 transaction_id, |
347 int64 object_store_id, | 337 int64 object_store_id, |
348 int64 index_id, | 338 int64 index_id, |
349 const base::string16& name, | 339 const base::string16& name, |
350 const IndexedDBKeyPath& key_path, | 340 const IndexedDBKeyPath& key_path, |
351 bool unique, | 341 bool unique, |
352 bool multi_entry) { | 342 bool multi_entry) { |
353 IDB_TRACE("IndexedDBDatabase::CreateIndex"); | 343 IDB_TRACE("IndexedDBDatabase::CreateIndex"); |
354 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 344 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
355 if (!transaction) | 345 if (!transaction) |
356 return; | 346 return; |
357 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 347 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); |
358 | 348 |
359 if (!ValidateObjectStoreIdAndNewIndexId(object_store_id, index_id)) | 349 if (!ValidateObjectStoreIdAndNewIndexId(object_store_id, index_id)) |
360 return; | 350 return; |
351 | |
352 // Index creation is done synchronously since preemptive | |
353 // OpenCursor/SetIndexKeys may follow. | |
361 const IndexedDBIndexMetadata index_metadata( | 354 const IndexedDBIndexMetadata index_metadata( |
362 name, index_id, key_path, unique, multi_entry); | 355 name, index_id, key_path, unique, multi_entry); |
363 | 356 |
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(), | 357 if (!backing_store_->CreateIndex(transaction->BackingStoreTransaction(), |
383 transaction->database()->id(), | 358 transaction->database()->id(), |
384 object_store_id, | 359 object_store_id, |
385 index_metadata.id, | 360 index_metadata.id, |
386 index_metadata.name, | 361 index_metadata.name, |
387 index_metadata.key_path, | 362 index_metadata.key_path, |
388 index_metadata.unique, | 363 index_metadata.unique, |
389 index_metadata.multi_entry).ok()) { | 364 index_metadata.multi_entry).ok()) { |
390 base::string16 error_string = | 365 base::string16 error_string = |
391 ASCIIToUTF16("Internal error creating index '") + | 366 ASCIIToUTF16("Internal error creating index '") + |
392 index_metadata.name + ASCIIToUTF16("'."); | 367 index_metadata.name + ASCIIToUTF16("'."); |
393 transaction->Abort(IndexedDBDatabaseError( | 368 transaction->Abort(IndexedDBDatabaseError( |
394 blink::WebIDBDatabaseExceptionUnknownError, error_string)); | 369 blink::WebIDBDatabaseExceptionUnknownError, error_string)); |
395 return; | 370 return; |
396 } | 371 } |
372 | |
373 AddIndex(object_store_id, index_metadata, index_id); | |
374 transaction->ScheduleAbortTask( | |
375 base::Bind(&IndexedDBDatabase::CreateIndexAbortOperation, | |
376 this, | |
377 object_store_id, | |
378 index_id)); | |
397 } | 379 } |
398 | 380 |
399 void IndexedDBDatabase::CreateIndexAbortOperation( | 381 void IndexedDBDatabase::CreateIndexAbortOperation( |
400 int64 object_store_id, | 382 int64 object_store_id, |
401 int64 index_id, | 383 int64 index_id, |
402 IndexedDBTransaction* transaction) { | 384 IndexedDBTransaction* transaction) { |
403 IDB_TRACE("IndexedDBDatabase::CreateIndexAbortOperation"); | 385 IDB_TRACE("IndexedDBDatabase::CreateIndexAbortOperation"); |
404 DCHECK(!transaction); | 386 DCHECK(!transaction); |
405 RemoveIndex(object_store_id, index_id); | 387 RemoveIndex(object_store_id, index_id); |
406 } | 388 } |
407 | 389 |
408 void IndexedDBDatabase::DeleteIndex(int64 transaction_id, | 390 void IndexedDBDatabase::DeleteIndex(int64 transaction_id, |
409 int64 object_store_id, | 391 int64 object_store_id, |
410 int64 index_id) { | 392 int64 index_id) { |
411 IDB_TRACE("IndexedDBDatabase::DeleteIndex"); | 393 IDB_TRACE("IndexedDBDatabase::DeleteIndex"); |
412 IndexedDBTransaction* transaction = GetTransaction(transaction_id); | 394 IndexedDBTransaction* transaction = GetTransaction(transaction_id); |
413 if (!transaction) | 395 if (!transaction) |
414 return; | 396 return; |
415 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); | 397 DCHECK_EQ(transaction->mode(), indexed_db::TRANSACTION_VERSION_CHANGE); |
416 | 398 |
417 if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) | 399 if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) |
418 return; | 400 return; |
419 const IndexedDBIndexMetadata& index_metadata = | 401 const IndexedDBIndexMetadata& index_metadata = |
420 metadata_.object_stores[object_store_id].indexes[index_id]; | 402 metadata_.object_stores[object_store_id].indexes[index_id]; |
421 | 403 |
422 transaction->ScheduleTask( | 404 transaction->ScheduleTask( |
423 base::Bind(&IndexedDBDatabase::DeleteIndexOperation, | 405 base::Bind(&IndexedDBDatabase::DeleteIndexOperation, |
424 this, | 406 this, |
425 object_store_id, | 407 object_store_id, |
426 index_metadata), | |
427 base::Bind(&IndexedDBDatabase::DeleteIndexAbortOperation, | |
428 this, | |
429 object_store_id, | |
430 index_metadata)); | 408 index_metadata)); |
431 | |
432 RemoveIndex(object_store_id, index_id); | |
433 } | 409 } |
434 | 410 |
435 void IndexedDBDatabase::DeleteIndexOperation( | 411 void IndexedDBDatabase::DeleteIndexOperation( |
436 int64 object_store_id, | 412 int64 object_store_id, |
437 const IndexedDBIndexMetadata& index_metadata, | 413 const IndexedDBIndexMetadata& index_metadata, |
438 IndexedDBTransaction* transaction) { | 414 IndexedDBTransaction* transaction) { |
439 IDB_TRACE("IndexedDBDatabase::DeleteIndexOperation"); | 415 IDB_TRACE("IndexedDBDatabase::DeleteIndexOperation"); |
440 leveldb::Status s = | 416 leveldb::Status s = |
441 backing_store_->DeleteIndex(transaction->BackingStoreTransaction(), | 417 backing_store_->DeleteIndex(transaction->BackingStoreTransaction(), |
442 transaction->database()->id(), | 418 transaction->database()->id(), |
443 object_store_id, | 419 object_store_id, |
444 index_metadata.id); | 420 index_metadata.id); |
445 if (!s.ok()) { | 421 if (!s.ok()) { |
446 base::string16 error_string = | 422 base::string16 error_string = |
447 ASCIIToUTF16("Internal error deleting index '") + | 423 ASCIIToUTF16("Internal error deleting index '") + |
448 index_metadata.name + ASCIIToUTF16("'."); | 424 index_metadata.name + ASCIIToUTF16("'."); |
449 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 425 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
450 error_string); | 426 error_string); |
451 transaction->Abort(error); | 427 transaction->Abort(error); |
452 if (s.IsCorruption()) | 428 if (s.IsCorruption()) |
453 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 429 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
454 error); | 430 error); |
455 } | 431 } |
432 | |
433 RemoveIndex(object_store_id, index_metadata.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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 &IndexedDBDatabase::PutOperation, this, base::Passed(¶ms))); | 745 &IndexedDBDatabase::PutOperation, this, base::Passed(¶ms))); |
763 } | 746 } |
764 | 747 |
765 void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params, | 748 void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params, |
766 IndexedDBTransaction* transaction) { | 749 IndexedDBTransaction* transaction) { |
767 IDB_TRACE("IndexedDBDatabase::PutOperation"); | 750 IDB_TRACE("IndexedDBDatabase::PutOperation"); |
768 DCHECK_NE(transaction->mode(), indexed_db::TRANSACTION_READ_ONLY); | 751 DCHECK_NE(transaction->mode(), indexed_db::TRANSACTION_READ_ONLY); |
769 bool key_was_generated = false; | 752 bool key_was_generated = false; |
770 | 753 |
771 DCHECK(metadata_.object_stores.find(params->object_store_id) != | 754 DCHECK(metadata_.object_stores.find(params->object_store_id) != |
772 metadata_.object_stores.end()); | 755 metadata_.object_stores.end()); |
ericu
2014/05/14 01:08:00
Is using [] here the right fallback, or should we
jsbell
2014/05/14 11:17:12
The check is done at Put() time, so with this patc
| |
773 const IndexedDBObjectStoreMetadata& object_store = | 756 const IndexedDBObjectStoreMetadata& object_store = |
774 metadata_.object_stores[params->object_store_id]; | 757 metadata_.object_stores[params->object_store_id]; |
775 DCHECK(object_store.auto_increment || params->key->IsValid()); | 758 DCHECK(object_store.auto_increment || params->key->IsValid()); |
776 | 759 |
777 scoped_ptr<IndexedDBKey> key; | 760 scoped_ptr<IndexedDBKey> key; |
778 if (params->put_mode != IndexedDBDatabase::CURSOR_UPDATE && | 761 if (params->put_mode != IndexedDBDatabase::CURSOR_UPDATE && |
779 object_store.auto_increment && !params->key->IsValid()) { | 762 object_store.auto_increment && !params->key->IsValid()) { |
780 scoped_ptr<IndexedDBKey> auto_inc_key = GenerateKey( | 763 scoped_ptr<IndexedDBKey> auto_inc_key = GenerateKey( |
781 backing_store_.get(), transaction, id(), params->object_store_id); | 764 backing_store_.get(), transaction, id(), params->object_store_id); |
782 key_was_generated = true; | 765 key_was_generated = true; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1310 base::string16 error_string = | 1293 base::string16 error_string = |
1311 ASCIIToUTF16("Internal error deleting object store '") + | 1294 ASCIIToUTF16("Internal error deleting object store '") + |
1312 object_store_metadata.name + ASCIIToUTF16("'."); | 1295 object_store_metadata.name + ASCIIToUTF16("'."); |
1313 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 1296 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
1314 error_string); | 1297 error_string); |
1315 transaction->Abort(error); | 1298 transaction->Abort(error); |
1316 if (s.IsCorruption()) | 1299 if (s.IsCorruption()) |
1317 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), | 1300 factory_->HandleBackingStoreCorruption(backing_store_->origin_url(), |
1318 error); | 1301 error); |
1319 } | 1302 } |
1303 | |
1304 RemoveObjectStore(object_store_metadata.id); | |
1305 transaction->ScheduleAbortTask( | |
1306 base::Bind(&IndexedDBDatabase::DeleteObjectStoreAbortOperation, | |
1307 this, | |
1308 object_store_metadata)); | |
1320 } | 1309 } |
1321 | 1310 |
1322 void IndexedDBDatabase::VersionChangeOperation( | 1311 void IndexedDBDatabase::VersionChangeOperation( |
1323 int64 version, | 1312 int64 version, |
1324 scoped_refptr<IndexedDBCallbacks> callbacks, | 1313 scoped_refptr<IndexedDBCallbacks> callbacks, |
1325 scoped_ptr<IndexedDBConnection> connection, | 1314 scoped_ptr<IndexedDBConnection> connection, |
1326 IndexedDBTransaction* transaction) { | 1315 IndexedDBTransaction* transaction) { |
1327 IDB_TRACE("IndexedDBDatabase::VersionChangeOperation"); | 1316 IDB_TRACE("IndexedDBDatabase::VersionChangeOperation"); |
1328 int64 old_version = metadata_.int_version; | 1317 int64 old_version = metadata_.int_version; |
1329 DCHECK_GT(version, old_version); | 1318 DCHECK_GT(version, old_version); |
1330 metadata_.int_version = version; | 1319 |
1331 if (!backing_store_->UpdateIDBDatabaseIntVersion( | 1320 if (!backing_store_->UpdateIDBDatabaseIntVersion( |
1332 transaction->BackingStoreTransaction(), | 1321 transaction->BackingStoreTransaction(), id(), version)) { |
1333 id(), | |
1334 metadata_.int_version)) { | |
1335 IndexedDBDatabaseError error( | 1322 IndexedDBDatabaseError error( |
1336 blink::WebIDBDatabaseExceptionUnknownError, | 1323 blink::WebIDBDatabaseExceptionUnknownError, |
1337 ASCIIToUTF16( | 1324 ASCIIToUTF16( |
1338 "Internal error writing data to stable storage when " | 1325 "Internal error writing data to stable storage when " |
1339 "updating version.")); | 1326 "updating version.")); |
1340 callbacks->OnError(error); | 1327 callbacks->OnError(error); |
1341 transaction->Abort(error); | 1328 transaction->Abort(error); |
1342 return; | 1329 return; |
1343 } | 1330 } |
1331 | |
1332 transaction->ScheduleAbortTask( | |
1333 base::Bind(&IndexedDBDatabase::VersionChangeAbortOperation, | |
1334 this, | |
1335 metadata_.version, | |
1336 metadata_.int_version)); | |
1337 metadata_.int_version = version; | |
1338 metadata_.version = kNoStringVersion; | |
ericu
2014/05/14 01:08:00
Given that metadata_.version is obsolete, I don't
jsbell
2014/05/14 11:17:12
Intentional. It appeared to be missing, possibly a
| |
1339 | |
1344 DCHECK(!pending_second_half_open_); | 1340 DCHECK(!pending_second_half_open_); |
1345 pending_second_half_open_.reset( | 1341 pending_second_half_open_.reset( |
1346 new PendingSuccessCall(callbacks, connection.get(), version)); | 1342 new PendingSuccessCall(callbacks, connection.get(), version)); |
1347 callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); | 1343 callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); |
1348 } | 1344 } |
1349 | 1345 |
1350 void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, | 1346 void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, |
1351 bool committed) { | 1347 bool committed) { |
1352 DCHECK(transactions_.find(transaction->id()) != transactions_.end()); | 1348 DCHECK(transactions_.find(transaction->id()) != transactions_.end()); |
1353 DCHECK_EQ(transactions_[transaction->id()], transaction); | 1349 DCHECK_EQ(transactions_[transaction->id()], transaction); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1616 scoped_ptr<IndexedDBConnection> connection, | 1612 scoped_ptr<IndexedDBConnection> connection, |
1617 int64 transaction_id, | 1613 int64 transaction_id, |
1618 int64 requested_version) { | 1614 int64 requested_version) { |
1619 | 1615 |
1620 std::vector<int64> object_store_ids; | 1616 std::vector<int64> object_store_ids; |
1621 CreateTransaction(transaction_id, | 1617 CreateTransaction(transaction_id, |
1622 connection.get(), | 1618 connection.get(), |
1623 object_store_ids, | 1619 object_store_ids, |
1624 indexed_db::TRANSACTION_VERSION_CHANGE); | 1620 indexed_db::TRANSACTION_VERSION_CHANGE); |
1625 | 1621 |
1626 transactions_[transaction_id] | 1622 transactions_[transaction_id]->ScheduleTask( |
1627 ->ScheduleTask(base::Bind(&IndexedDBDatabase::VersionChangeOperation, | 1623 base::Bind(&IndexedDBDatabase::VersionChangeOperation, |
1628 this, | 1624 this, |
1629 requested_version, | 1625 requested_version, |
1630 callbacks, | 1626 callbacks, |
1631 base::Passed(&connection)), | 1627 base::Passed(&connection))); |
1632 base::Bind(&IndexedDBDatabase::VersionChangeAbortOperation, | |
1633 this, | |
1634 metadata_.version, | |
1635 metadata_.int_version)); | |
1636 | |
1637 DCHECK(!pending_second_half_open_); | 1628 DCHECK(!pending_second_half_open_); |
1638 } | 1629 } |
1639 | 1630 |
1640 void IndexedDBDatabase::DeleteDatabase( | 1631 void IndexedDBDatabase::DeleteDatabase( |
1641 scoped_refptr<IndexedDBCallbacks> callbacks) { | 1632 scoped_refptr<IndexedDBCallbacks> callbacks) { |
1642 | 1633 |
1643 if (IsDeleteDatabaseBlocked()) { | 1634 if (IsDeleteDatabaseBlocked()) { |
1644 for (ConnectionSet::const_iterator it = connections_.begin(); | 1635 for (ConnectionSet::const_iterator it = connections_.begin(); |
1645 it != connections_.end(); | 1636 it != connections_.end(); |
1646 ++it) { | 1637 ++it) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1766 const base::string16& previous_version, | 1757 const base::string16& previous_version, |
1767 int64 previous_int_version, | 1758 int64 previous_int_version, |
1768 IndexedDBTransaction* transaction) { | 1759 IndexedDBTransaction* transaction) { |
1769 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 1760 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
1770 DCHECK(!transaction); | 1761 DCHECK(!transaction); |
1771 metadata_.version = previous_version; | 1762 metadata_.version = previous_version; |
1772 metadata_.int_version = previous_int_version; | 1763 metadata_.int_version = previous_int_version; |
1773 } | 1764 } |
1774 | 1765 |
1775 } // namespace content | 1766 } // namespace content |
OLD | NEW |