Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: Source/modules/indexeddb/IDBObjectStore.cpp

Issue 14232020: Ensure IDB transactions started before success arrives see correct medata (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 int64_t indexId = m_metadata.maxIndexId + 1; 406 int64_t indexId = m_metadata.maxIndexId + 1;
407 backendDB()->createIndex(m_transaction->id(), id(), indexId, name, keyPath, unique, multiEntry); 407 backendDB()->createIndex(m_transaction->id(), id(), indexId, name, keyPath, unique, multiEntry);
408 408
409 ++m_metadata.maxIndexId; 409 ++m_metadata.maxIndexId;
410 410
411 IDBIndexMetadata metadata(name, indexId, keyPath, unique, multiEntry); 411 IDBIndexMetadata metadata(name, indexId, keyPath, unique, multiEntry);
412 RefPtr<IDBIndex> index = IDBIndex::create(metadata, this, m_transaction.get( )); 412 RefPtr<IDBIndex> index = IDBIndex::create(metadata, this, m_transaction.get( ));
413 m_indexMap.set(name, index); 413 m_indexMap.set(name, index);
414 m_metadata.indexes.set(indexId, metadata); 414 m_metadata.indexes.set(indexId, metadata);
415 m_transaction->db()->indexCreated(id(), metadata);
415 416
416 ASSERT(!ec); 417 ASSERT(!ec);
417 if (ec) 418 if (ec)
418 return 0; 419 return 0;
419 420
420 RefPtr<IDBRequest> indexRequest = openCursor(context, static_cast<IDBKeyRang e*>(0), IDBCursor::directionNext(), IDBDatabaseBackendInterface::PreemptiveTask, ec); 421 RefPtr<IDBRequest> indexRequest = openCursor(context, static_cast<IDBKeyRang e*>(0), IDBCursor::directionNext(), IDBDatabaseBackendInterface::PreemptiveTask, ec);
421 ASSERT(!ec); 422 ASSERT(!ec);
422 if (ec) 423 if (ec)
423 return 0; 424 return 0;
424 indexRequest->preventPropagation(); 425 indexRequest->preventPropagation();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 481 }
481 int64_t indexId = findIndexId(name); 482 int64_t indexId = findIndexId(name);
482 if (indexId == IDBIndexMetadata::InvalidId) { 483 if (indexId == IDBIndexMetadata::InvalidId) {
483 ec = IDBDatabaseException::NotFoundError; 484 ec = IDBDatabaseException::NotFoundError;
484 return; 485 return;
485 } 486 }
486 487
487 backendDB()->deleteIndex(m_transaction->id(), id(), indexId); 488 backendDB()->deleteIndex(m_transaction->id(), id(), indexId);
488 489
489 m_metadata.indexes.remove(indexId); 490 m_metadata.indexes.remove(indexId);
491 m_transaction->db()->indexDeleted(id(), indexId);
490 IDBIndexMap::iterator it = m_indexMap.find(name); 492 IDBIndexMap::iterator it = m_indexMap.find(name);
491 if (it != m_indexMap.end()) { 493 if (it != m_indexMap.end()) {
492 it->value->markDeleted(); 494 it->value->markDeleted();
493 m_indexMap.remove(name); 495 m_indexMap.remove(name);
494 } 496 }
495 } 497 }
496 498
497 PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* contex t, PassRefPtr<IDBKeyRange> range, const String& directionString, IDBDatabaseBack endInterface::TaskType taskType, ExceptionCode& ec) 499 PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* contex t, PassRefPtr<IDBKeyRange> range, const String& directionString, IDBDatabaseBack endInterface::TaskType taskType, ExceptionCode& ec)
498 { 500 {
499 IDB_TRACE("IDBObjectStore::openCursor"); 501 IDB_TRACE("IDBObjectStore::openCursor");
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 568 }
567 return IDBIndexMetadata::InvalidId; 569 return IDBIndexMetadata::InvalidId;
568 } 570 }
569 571
570 IDBDatabaseBackendInterface* IDBObjectStore::backendDB() const 572 IDBDatabaseBackendInterface* IDBObjectStore::backendDB() const
571 { 573 {
572 return m_transaction->backendDB(); 574 return m_transaction->backendDB();
573 } 575 }
574 576
575 } // namespace WebCore 577 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698