<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191776] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191776">191776</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-10-29 21:55:12 -0700 (Thu, 29 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: autoIncrement support.
https://bugs.webkit.org/show_bug.cgi?id=150695
Reviewed by Alex Christensen.
Source/WebCore:
Test: storage/indexeddb/modern/autoincrement-abort.html
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::addNewObjectStore):
(WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
(WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::putRecord):
(WebCore::IDBServer::MemoryIDBBackingStore::generateKeyNumber):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryObjectStore.h:
(WebCore::IDBServer::MemoryObjectStore::currentKeyGeneratorValue):
(WebCore::IDBServer::MemoryObjectStore::setKeyGeneratorValue):
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
LayoutTests:
* storage/indexeddb/modern/autoincrement-abort-expected.txt: Added.
* storage/indexeddb/modern/autoincrement-abort.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernautoincrementabortexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernautoincrementaborthtml">trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/LayoutTests/ChangeLog        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-10-29 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: autoIncrement support.
+ https://bugs.webkit.org/show_bug.cgi?id=150695
+
+ Reviewed by Alex Christensen.
+
+ * storage/indexeddb/modern/autoincrement-abort-expected.txt: Added.
+ * storage/indexeddb/modern/autoincrement-abort.html: Added.
+
</ins><span class="cx"> 2015-10-29 Michael Saboff <msaboff@apple.com>
</span><span class="cx">
</span><span class="cx"> Crash making a tail call from a getter to a host function
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernautoincrementabortexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt (0 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+ALERT: Initial upgrade needed: Old version - 0 New version - 1
+ALERT: Initial upgrade versionchange transaction complete
+ALERT: Opening readwrite transaction to bump the key generator, but it will be aborted
+ALERT: Key used for put was 1
+ALERT: Key used for put was 2
+ALERT: Key used for put was 3
+ALERT: Key used for put was 4
+ALERT: Key used for put was 5
+ALERT: Key used for put was 6
+ALERT: readwrite transaction abort
+ALERT: Opening readwrite transaction to make sure the key generator had successfully reverted
+ALERT: Key used for put was 1
+ALERT: Key used for put was 2
+ALERT: Key used for put was 3
+ALERT: Key used for put was 4
+ALERT: Key used for put was 5
+ALERT: Key used for put was 6
+ALERT: readwrite transaction complete
+ALERT: Opening readwrite transaction to make sure the key generator picks up where it should've left off
+ALERT: Key used for put was 7
+ALERT: Key used for put was 8
+ALERT: Key used for put was 9
+ALERT: Key used for put was 10
+ALERT: Key used for put was 11
+ALERT: Key used for put was 12
+ALERT: readwrite transaction complete
+ALERT: Done
+This test creates a new database with an objectstore that autoincrements.
+It then puts some things in that object store, checking the keys that were used.
+But it then aborts that transaction.
+Then it opens a new one and puts something in it, double checking that the key generator was reverted when the above transaction was aborted.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernautoincrementaborthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort.html (0 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/autoincrement-abort.html        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -0,0 +1,159 @@
</span><ins>+This test creates a new database with an objectstore that autoincrements.<br>
+It then puts some things in that object store, checking the keys that were used.<br>
+But it then aborts that transaction.<br>
+Then it opens a new one and puts something in it, double checking that the key generator was reverted when the above transaction was aborted.<br>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function done()
+{
+ alert("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open("AutoincrementAbortDatabase", 1);
+var database;
+
+createRequest.onupgradeneeded = function(event) {
+ alert("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ database = event.target.result;
+ var objectStore = database.createObjectStore('TestObjectStore', { autoIncrement: true });
+
+ versionTransaction.onabort = function(event) {
+ alert("Initial upgrade versionchange transaction unexpected abort");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ alert("Initial upgrade versionchange transaction complete");
+ continueTest1();
+ }
+
+ versionTransaction.onerror = function(event) {
+ alert("Initial upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+}
+
+function putChecker(event) {
+ alert("Key used for put was " + event.target.result);
+}
+
+function continueTest1()
+{
+ alert("Opening readwrite transaction to bump the key generator, but it will be aborted");
+ var transaction = database.transaction('TestObjectStore', "readwrite");
+ var objectStore = transaction.objectStore('TestObjectStore');
+
+ var request = objectStore.put("bar1");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar2");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar3");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar4");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar5");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar6");
+ request.onsuccess = function(event) {
+ putChecker(event);
+ transaction.abort();
+ }
+
+ transaction.onabort = function(event) {
+ alert("readwrite transaction abort");
+ continueTest2();
+ }
+
+ transaction.oncomplete = function(event) {
+ alert("readwrite transaction unexpected complete");
+ done();
+ }
+
+ transaction.onerror = function(event) {
+ alert("readwrite transaction unexpected error");
+ done();
+ }
+}
+
+function continueTest2()
+{
+ alert("Opening readwrite transaction to make sure the key generator had successfully reverted");
+
+ var transaction = database.transaction('TestObjectStore', "readwrite");
+ var objectStore = transaction.objectStore('TestObjectStore');
+
+ var request = objectStore.put("bar1");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar2");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar3");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar4");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar5");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar6");
+ request.onsuccess = putChecker;
+
+ transaction.onabort = function(event) {
+ alert("readwrite transaction unexpected abort");
+ done();
+ }
+
+ transaction.oncomplete = function(event) {
+ alert("readwrite transaction complete");
+ continueTest3();
+ }
+
+ transaction.onerror = function(event) {
+ alert("readwrite transaction unexpected error");
+ done();
+ }
+}
+
+function continueTest3()
+{
+ alert("Opening readwrite transaction to make sure the key generator picks up where it should've left off");
+
+ var transaction = database.transaction('TestObjectStore', "readwrite");
+ var objectStore = transaction.objectStore('TestObjectStore');
+
+ var request = objectStore.put("bar1");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar2");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar3");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar4");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar5");
+ request.onsuccess = putChecker;
+ var request = objectStore.put("bar6");
+ request.onsuccess = putChecker;
+
+ transaction.onabort = function(event) {
+ alert("readwrite transaction unexpected abort");
+ done();
+ }
+
+ transaction.oncomplete = function(event) {
+ alert("readwrite transaction complete");
+ done();
+ }
+
+ transaction.onerror = function(event) {
+ alert("readwrite transaction unexpected error");
+ done();
+ }
+}
+
+</script>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/ChangeLog        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2015-10-29 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: autoIncrement support.
+ https://bugs.webkit.org/show_bug.cgi?id=150695
+
+ Reviewed by Alex Christensen.
+
+ Test: storage/indexeddb/modern/autoincrement-abort.html
+
+ * Modules/indexeddb/server/IDBBackingStore.h:
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::addNewObjectStore):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::putRecord):
+ (WebCore::IDBServer::MemoryIDBBackingStore::generateKeyNumber):
+ * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+ * Modules/indexeddb/server/MemoryObjectStore.h:
+ (WebCore::IDBServer::MemoryObjectStore::currentKeyGeneratorValue):
+ (WebCore::IDBServer::MemoryObjectStore::setKeyGeneratorValue):
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
+
</ins><span class="cx"> 2015-10-29 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Make WebCore a framework in Mac CMake build
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx"> virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) = 0;
</span><span class="cx"> virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) = 0;
</span><span class="cx"> virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, ThreadSafeDataBuffer& outValue) = 0;
</span><ins>+ virtual IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber) = 0;
+
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace IDBServer
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -60,12 +60,9 @@
</span><span class="cx"> LOG(IndexedDB, "MemoryBackingStoreTransaction::addNewObjectStore()");
</span><span class="cx">
</span><span class="cx"> ASSERT(isVersionChange());
</span><del>-
- ASSERT(!m_objectStores.contains(&objectStore));
- m_objectStores.add(&objectStore);
</del><span class="cx"> m_versionChangeAddedObjectStores.add(&objectStore);
</span><span class="cx">
</span><del>- objectStore.writeTransactionStarted(*this);
</del><ins>+ addExistingObjectStore(objectStore);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MemoryBackingStoreTransaction::addExistingObjectStore(MemoryObjectStore& objectStore)
</span><span class="lines">@@ -78,6 +75,8 @@
</span><span class="cx"> m_objectStores.add(&objectStore);
</span><span class="cx">
</span><span class="cx"> objectStore.writeTransactionStarted(*this);
</span><ins>+
+ m_originalKeyGenerators.add(&objectStore, objectStore.currentKeyGeneratorValue());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MemoryBackingStoreTransaction::objectStoreDeleted(std::unique_ptr<MemoryObjectStore> objectStore)
</span><span class="lines">@@ -136,6 +135,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> for (auto objectStore : m_objectStores) {
</span><ins>+ ASSERT(m_originalKeyGenerators.contains(objectStore));
+ objectStore->setKeyGeneratorValue(m_originalKeyGenerators.get(objectStore));
+
</ins><span class="cx"> auto keyValueMap = m_originalValues.get(objectStore);
</span><span class="cx"> if (!keyValueMap)
</span><span class="cx"> continue;
</span><span class="lines">@@ -148,7 +150,6 @@
</span><span class="cx"> m_originalValues.remove(objectStore);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> finish();
</span><span class="cx">
</span><span class="cx"> for (auto objectStore : m_versionChangeAddedObjectStores)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx"> HashSet<MemoryObjectStore*> m_objectStores;
</span><span class="cx"> HashSet<MemoryObjectStore*> m_versionChangeAddedObjectStores;
</span><span class="cx">
</span><ins>+ HashMap<MemoryObjectStore*, uint64_t> m_originalKeyGenerators;
</ins><span class="cx"> HashMap<String, std::unique_ptr<MemoryObjectStore>> m_deletedObjectStores;
</span><span class="cx"> HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_originalValues;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -211,7 +211,7 @@
</span><span class="cx">
</span><span class="cx"> auto transaction = m_transactions.get(transactionIdentifier);
</span><span class="cx"> if (!transaction)
</span><del>- return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral("No backing store transaction found to get record"));
</del><ins>+ return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral("No backing store transaction found to put record"));
</ins><span class="cx">
</span><span class="cx"> MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
</span><span class="cx"> if (!objectStore)
</span><span class="lines">@@ -238,6 +238,22 @@
</span><span class="cx"> return IDBError();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBError MemoryIDBBackingStore::generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber)
+{
+ LOG(IndexedDB, "MemoryIDBBackingStore::generateKeyNumber");
+ ASSERT(objectStoreIdentifier);
+ ASSERT_UNUSED(transactionIdentifier, m_transactions.contains(transactionIdentifier));
+ ASSERT_UNUSED(transactionIdentifier, m_transactions.get(transactionIdentifier)->isWriting());
+
+ MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
+ RELEASE_ASSERT(objectStore);
+
+ keyNumber = objectStore->currentKeyGeneratorValue();
+ objectStore->setKeyGeneratorValue(keyNumber + 1);
+
+ return IDBError();
+}
+
</ins><span class="cx"> void MemoryIDBBackingStore::registerObjectStore(std::unique_ptr<MemoryObjectStore>&& objectStore)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(objectStore);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) override final;
</span><span class="cx"> virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
</span><span class="cx"> virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, ThreadSafeDataBuffer& outValue) override final;
</span><ins>+ virtual IDBError generateKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t& keyNumber) override final;
</ins><span class="cx">
</span><span class="cx"> void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&);
</span><span class="cx"> void restoreObjectStoreForVersionChangeAbort(std::unique_ptr<MemoryObjectStore>&&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -60,6 +60,9 @@
</span><span class="cx">
</span><span class="cx"> void setKeyValue(const IDBKeyData&, const ThreadSafeDataBuffer& value);
</span><span class="cx">
</span><ins>+ uint64_t currentKeyGeneratorValue() const { return m_keyGeneratorValue; }
+ void setKeyGeneratorValue(uint64_t value) { m_keyGeneratorValue = value; }
+
</ins><span class="cx"> ThreadSafeDataBuffer valueForKey(const IDBKeyData&) const;
</span><span class="cx">
</span><span class="cx"> const IDBObjectStoreInfo& info() const { return m_info; }
</span><span class="lines">@@ -70,6 +73,7 @@
</span><span class="cx"> IDBObjectStoreInfo m_info;
</span><span class="cx">
</span><span class="cx"> MemoryBackingStoreTransaction* m_writeTransaction { nullptr };
</span><ins>+ uint64_t m_keyGeneratorValue { 1 };
</ins><span class="cx">
</span><span class="cx"> std::unique_ptr<KeyValueMap> m_keyValueStore;
</span><span class="cx"> std::unique_ptr<std::set<IDBKeyData>> m_orderedKeys;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (191775 => 191776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-10-30 04:30:26 UTC (rev 191775)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-10-30 04:55:12 UTC (rev 191776)
</span><span class="lines">@@ -313,6 +313,7 @@
</span><span class="cx"> ASSERT(m_backingStore);
</span><span class="cx"> ASSERT(objectStoreIdentifier);
</span><span class="cx">
</span><ins>+ bool keyWasGenerated = false;
</ins><span class="cx"> IDBKeyData usedKey;
</span><span class="cx"> IDBError error;
</span><span class="cx">
</span><span class="lines">@@ -324,14 +325,18 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (objectStoreInfo->autoIncrement() && !keyData.isValid()) {
</span><del>- // FIXME: This is where generated key support goes
- error = IDBError(IDBExceptionCode::Unknown, ASCIILiteral("Key generators not supported yet"));
- m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
- return;
- }
</del><ins>+ uint64_t keyNumber;
+ error = m_backingStore->generateKeyNumber(transactionIdentifier, objectStoreIdentifier, keyNumber);
+ if (!error.isNull()) {
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
+ return;
+ }
+
+ usedKey.setNumberValue(keyNumber);
+ keyWasGenerated = true;
+ } else
+ usedKey = keyData;
</ins><span class="cx">
</span><del>- usedKey = keyData;
-
</del><span class="cx"> if (overwriteMode == IndexedDB::ObjectStoreOverwriteMode::NoOverwrite) {
</span><span class="cx"> bool keyExists;
</span><span class="cx"> error = m_backingStore->keyExistsInObjectStore(transactionIdentifier, objectStoreIdentifier, usedKey, keyExists);
</span></span></pre>
</div>
</div>
</body>
</html>