<!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>[191114] 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/191114">191114</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-10-15 09:41:30 -0700 (Thu, 15 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: Add basic transaction committing.
https://bugs.webkit.org/show_bug.cgi?id=150147

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/opendatabase-versions.html

* Modules/indexeddb/IDBTransaction.h:

* Modules/indexeddb/IndexedDB.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
(WebCore::IDBClient::IDBConnectionToServer::didCommitTransaction):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/client/IDBDatabaseImpl.cpp:
(WebCore::IDBClient::IDBDatabase::startVersionChangeTransaction):
(WebCore::IDBClient::IDBDatabase::commitTransaction):
(WebCore::IDBClient::IDBDatabase::didCommitTransaction):
(WebCore::IDBClient::IDBDatabase::didAbortTransaction):
(WebCore::IDBClient::IDBDatabase::didCommitOrAbortTransaction):
* Modules/indexeddb/client/IDBDatabaseImpl.h:

* Modules/indexeddb/client/IDBFactoryImpl.cpp:
(WebCore::IDBClient::IDBFactory::open):

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::onSuccess):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::IDBTransaction):
(WebCore::IDBClient::IDBTransaction::db):
(WebCore::IDBClient::IDBTransaction::hasPendingActivity):
(WebCore::IDBClient::IDBTransaction::isActive):
(WebCore::IDBClient::IDBTransaction::scheduleOperationTimer):
(WebCore::IDBClient::IDBTransaction::operationTimerFired):
(WebCore::IDBClient::IDBTransaction::commit):
(WebCore::IDBClient::IDBTransaction::didCommit):
(WebCore::IDBClient::IDBTransaction::fireOnComplete):
(WebCore::IDBClient::IDBTransaction::fireOnAbort):
(WebCore::IDBClient::IDBTransaction::enqueueEvent):
(WebCore::IDBClient::IDBTransaction::dispatchEvent):
* Modules/indexeddb/client/IDBTransactionImpl.h:
(WebCore::IDBClient::IDBTransaction::database):

* Modules/indexeddb/legacy/LegacyTransaction.cpp:
(WebCore::LegacyTransaction::db):
* Modules/indexeddb/legacy/LegacyTransaction.h:

* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::didCommitTransaction):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::registerTransaction):
(WebCore::IDBServer::IDBServer::unregisterTransaction):
(WebCore::IDBServer::IDBServer::commitTransaction):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::generateUniqueCallbackIdentifier):
(WebCore::IDBServer::UniqueIDBDatabase::storeCallback):
(WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
(WebCore::IDBServer::UniqueIDBDatabase::performCommitTransaction):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformCommitTransaction):
(WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
(WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabase.h:
(WebCore::IDBServer::UniqueIDBDatabase::server):

* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::~UniqueIDBDatabaseTransaction):
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::commit):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/IDBDatabaseInfo.h:
(WebCore::IDBDatabaseInfo::setVersion):

* Modules/indexeddb/shared/IDBError.cpp:
(WebCore::IDBError::isolatedCopy):
* Modules/indexeddb/shared/IDBError.h:

* Modules/indexeddb/shared/IDBRequestData.h:

* Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
(WebCore::IDBResourceIdentifier::isolatedCopy):
* Modules/indexeddb/shared/IDBResourceIdentifier.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didCommitTransaction):
(WebCore::InProcessIDBServer::commitTransaction):
* Modules/indexeddb/shared/InProcessIDBServer.h:

* WebCore.xcodeproj/project.pbxproj:

* platform/CrossThreadCopier.cpp:
(WebCore::IDBResourceIdentifier&gt;::copy):
(WebCore::IDBError&gt;::copy):
* platform/CrossThreadCopier.h:

LayoutTests:

* storage/indexeddb/modern/opendatabase-versions-expected.txt: Added.
* storage/indexeddb/modern/opendatabase-versions.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="#trunkSourceWebCoreModulesindexeddbIDBTransactionh">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIndexedDBh">trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerDelegateh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBFactoryImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddblegacyLegacyTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddblegacyLegacyTransactionh">trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientcpp">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClienth">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientDelegateh">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBServerh">trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectioncpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectionh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBErrorcpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBErrorh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBRequestDatah">trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifiercpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifierh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformCrossThreadCopiercpp">trunk/Source/WebCore/platform/CrossThreadCopier.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformCrossThreadCopierh">trunk/Source/WebCore/platform/CrossThreadCopier.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernopendatabaseversionsexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernopendatabaseversionshtml">trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/LayoutTests/ChangeLog        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-10-14  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Add basic transaction committing.
+        https://bugs.webkit.org/show_bug.cgi?id=150147
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/opendatabase-versions-expected.txt: Added.
+        * storage/indexeddb/modern/opendatabase-versions.html: Added.
+
</ins><span class="cx"> 2015-10-15  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] DOM click event may not be dispatched when page has :active style and &lt;input type=&quot;search&quot;&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernopendatabaseversionsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt (0 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+ALERT: [object IDBOpenDBRequest] (firstPhase)
+ALERT: upgradeneeded (firstPhase): old version - 0 new version - 1
+ALERT: [object IDBTransaction]
+ALERT: Version change complete (firstPhase). Database version is now - 1
+ALERT: [object IDBOpenDBRequest] (secondPhase)
+ALERT: Successfully opened database at version 1 (secondPhase)
+ALERT: Done
+This test creates a new database with the default version, commits that versionchange transaction, and then reopens it at different versions to make sure the IDBOpenDBRequests behave appropriately.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernopendatabaseversionshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html (0 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+This test creates a new database with the default version, commits that versionchange transaction, and then reopens it at different versions to make sure the IDBOpenDBRequests behave appropriately.&lt;br&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var request = window.indexedDB.open(&quot;VersionTestDatabase&quot;);
+alert(request + &quot; (firstPhase)&quot;);
+
+request.onsuccess = function()
+{
+    alert(&quot;Unexpected success (firstPhase)&quot;);
+        done();
+}
+request.onerror = function(e)
+{
+    alert(&quot;Unexpected error (firstPhase)&quot;);
+        done();
+}
+
+request.onupgradeneeded = function(e)
+{
+    alert(&quot;upgradeneeded (firstPhase): old version - &quot; + e.oldVersion + &quot; new version - &quot; + e.newVersion);
+    alert(request.transaction);
+    request.transaction.oncomplete = function()
+    {
+        alert(&quot;Version change complete (firstPhase). Database version is now - &quot; + request.transaction.db.version);
+        secondPhase();
+    }
+    request.transaction.onabort = function()
+    {
+        alert(&quot;Version change transaction unexpected abort! (firstPhase)&quot;);
+        done();
+    }
+    request.transaction.onerror = function()
+    {
+        alert(&quot;Version change transaction unexpected error! (firstPhase)&quot;);
+        done();
+    }
+}
+
+function secondPhase()
+{
+    var request = window.indexedDB.open(&quot;VersionTestDatabase&quot;, 1);
+    alert(request + &quot; (secondPhase)&quot;);
+    request.onsuccess = function()
+    {
+        alert(&quot;Successfully opened database at version 1 (secondPhase)&quot;);
+
+        // FIXME: The following call will be used once bugs 150147-150150 are resolved.
+        // thirdPhase();
+        done();
+    }
+    request.onerror = function(e)
+    {
+        alert(&quot;Unexpected error (secondPhase)&quot; + e);
+        done();
+    }
+    request.onupgradeneeded = function(e)
+    {
+            alert(&quot;Unexpected upgrade needed (secondPhase)&quot; + e);
+            done();
+    }
+}
+
+function thirdPhase()
+{
+    var request = window.indexedDB.open(&quot;VersionTestDatabase&quot;, 2);
+    alert(request + &quot; (thirdPhase)&quot;);
+    request.onsuccess = function()
+    {
+     alert(&quot;Unexpected success (thirdPhase)&quot;);
+     done();
+    }
+    request.onerror = function(e)
+    {
+     alert(&quot;Unexpected error (thirdPhase)&quot;);
+     done();
+    }
+    request.onupgradeneeded = function(e)
+    {
+        alert(&quot;upgradeneeded (thirdPhase): old version - &quot; + e.oldVersion + &quot; new version - &quot; + e.newVersion);
+        alert(request.transaction);
+        request.transaction.oncomplete = function()
+        {
+            alert(&quot;Version change complete (thirdPhase). Database version is now - &quot; + request.transaction.db.version);
+            fourthPhase();
+        }
+        request.transaction.onabort = function()
+        {
+            alert(&quot;Version change transaction unexpected abort! (thirdPhase)&quot;);
+            done();
+        }
+        request.transaction.onerror = function()
+        {
+            alert(&quot;Version change transaction unexpected error! (thirdPhase)&quot;);
+            done();
+        }
+    } 
+}
+
+function fourthPhase()
+{
+    try {
+        // We've upgraded to version 2, so version 1 should not be openable.
+        window.indexedDB.open(&quot;VersionTestDatabase&quot;, 1);
+    } catch (e) {
+        alert(&quot;Caught exception &quot; + e);
+    }
+    done();
+}
+
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/ChangeLog        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -1,3 +1,115 @@
</span><ins>+2015-10-14  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Add basic transaction committing.
+        https://bugs.webkit.org/show_bug.cgi?id=150147
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/opendatabase-versions.html
+
+        * Modules/indexeddb/IDBTransaction.h:
+
+        * Modules/indexeddb/IndexedDB.h:
+
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
+        (WebCore::IDBClient::IDBConnectionToServer::didCommitTransaction):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+
+        * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
+        (WebCore::IDBClient::IDBDatabase::startVersionChangeTransaction):
+        (WebCore::IDBClient::IDBDatabase::commitTransaction):
+        (WebCore::IDBClient::IDBDatabase::didCommitTransaction):
+        (WebCore::IDBClient::IDBDatabase::didAbortTransaction):
+        (WebCore::IDBClient::IDBDatabase::didCommitOrAbortTransaction):
+        * Modules/indexeddb/client/IDBDatabaseImpl.h:
+
+        * Modules/indexeddb/client/IDBFactoryImpl.cpp:
+        (WebCore::IDBClient::IDBFactory::open):
+
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBOpenDBRequest::onSuccess):
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
+
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::IDBTransaction):
+        (WebCore::IDBClient::IDBTransaction::db):
+        (WebCore::IDBClient::IDBTransaction::hasPendingActivity):
+        (WebCore::IDBClient::IDBTransaction::isActive):
+        (WebCore::IDBClient::IDBTransaction::scheduleOperationTimer):
+        (WebCore::IDBClient::IDBTransaction::operationTimerFired):
+        (WebCore::IDBClient::IDBTransaction::commit):
+        (WebCore::IDBClient::IDBTransaction::didCommit):
+        (WebCore::IDBClient::IDBTransaction::fireOnComplete):
+        (WebCore::IDBClient::IDBTransaction::fireOnAbort):
+        (WebCore::IDBClient::IDBTransaction::enqueueEvent):
+        (WebCore::IDBClient::IDBTransaction::dispatchEvent):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        (WebCore::IDBClient::IDBTransaction::database):
+        
+        * Modules/indexeddb/legacy/LegacyTransaction.cpp:
+        (WebCore::LegacyTransaction::db):
+        * Modules/indexeddb/legacy/LegacyTransaction.h:
+        
+        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+        (WebCore::IDBServer::IDBConnectionToClient::didCommitTransaction):
+        * Modules/indexeddb/server/IDBConnectionToClient.h:
+        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+        
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::registerTransaction):
+        (WebCore::IDBServer::IDBServer::unregisterTransaction):
+        (WebCore::IDBServer::IDBServer::commitTransaction):
+        * Modules/indexeddb/server/IDBServer.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::generateUniqueCallbackIdentifier):
+        (WebCore::IDBServer::UniqueIDBDatabase::storeCallback):
+        (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabase::performCommitTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabase::didPerformCommitTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabase::performErrorCallback):
+        (WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction): Deleted.
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+        (WebCore::IDBServer::UniqueIDBDatabase::server):
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
+        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::UniqueIDBDatabaseTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::~UniqueIDBDatabaseTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::commit):
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
+        
+        * Modules/indexeddb/shared/IDBDatabaseInfo.h:
+        (WebCore::IDBDatabaseInfo::setVersion):
+        
+        * Modules/indexeddb/shared/IDBError.cpp:
+        (WebCore::IDBError::isolatedCopy):
+        * Modules/indexeddb/shared/IDBError.h:
+
+        * Modules/indexeddb/shared/IDBRequestData.h:
+
+        * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
+        (WebCore::IDBResourceIdentifier::isolatedCopy):
+        * Modules/indexeddb/shared/IDBResourceIdentifier.h:
+
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::didCommitTransaction):
+        (WebCore::InProcessIDBServer::commitTransaction):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * platform/CrossThreadCopier.cpp:
+        (WebCore::IDBResourceIdentifier&gt;::copy):
+        (WebCore::IDBError&gt;::copy):
+        * platform/CrossThreadCopier.h:
+
</ins><span class="cx"> 2015-10-15  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] DOM click event may not be dispatched when page has :active style and &lt;input type=&quot;search&quot;&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Implement the IDBTransaction IDL
</span><span class="cx">     virtual const String&amp; mode() const = 0;
</span><del>-    virtual IDBDatabase* db() const = 0;
</del><ins>+    virtual IDBDatabase* db() = 0;
</ins><span class="cx">     virtual RefPtr&lt;DOMError&gt; error() const = 0;
</span><span class="cx">     virtual RefPtr&lt;IDBObjectStore&gt; objectStore(const String&amp; name, ExceptionCode&amp;) = 0;
</span><span class="cx">     virtual void abort(ExceptionCode&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIndexedDBh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/IndexedDB.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -39,6 +39,13 @@
</span><span class="cx"> };
</span><span class="cx"> const unsigned TransactionModeMaximum = 2;
</span><span class="cx"> 
</span><ins>+enum class TransactionState {
+    Unstarted,
+    Running,
+    Committing,
+    Finished,
+};
+
</ins><span class="cx"> enum class CursorDirection {
</span><span class="cx">     Next = 0,
</span><span class="cx">     NextNoDuplicate = 1,
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -93,6 +93,26 @@
</span><span class="cx">     request-&gt;requestCompleted(resultData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBConnectionToServer::commitTransaction(IDBTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;IDBConnectionToServer::commitTransaction&quot;);
+    ASSERT(!m_committingTransactions.contains(transaction.info().identifier()));
+    m_committingTransactions.set(transaction.info().identifier(), &amp;transaction);
+
+    auto identifier = transaction.info().identifier();
+    m_delegate-&gt;commitTransaction(identifier);
+}
+
+void IDBConnectionToServer::didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp; error)
+{
+    LOG(IndexedDB, &quot;IDBConnectionToServer::didCommitTransaction&quot;);
+
+    auto transaction = m_committingTransactions.take(transactionIdentifier);
+    ASSERT(transaction);
+
+    transaction-&gt;didCommit(error);
+}
+
</ins><span class="cx"> void IDBConnectionToServer::fireVersionChangeEvent(uint64_t /*databaseConnectionIdentifier*/ , uint64_t /*requestedVersion*/)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBConnectionToServer::fireVersionChangeEvent&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -37,12 +37,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class IDBError;
</ins><span class="cx"> class IDBResultData;
</span><span class="cx"> 
</span><span class="cx"> namespace IDBClient {
</span><span class="cx"> 
</span><span class="cx"> class IDBDatabase;
</span><span class="cx"> class IDBOpenDBRequest;
</span><ins>+class IDBTransaction;
</ins><span class="cx"> 
</span><span class="cx"> class IDBConnectionToServer : public RefCounted&lt;IDBConnectionToServer&gt; {
</span><span class="cx"> public:
</span><span class="lines">@@ -56,6 +58,9 @@
</span><span class="cx">     void openDatabase(IDBOpenDBRequest&amp;);
</span><span class="cx">     void didOpenDatabase(const IDBResultData&amp;);
</span><span class="cx"> 
</span><ins>+    void commitTransaction(IDBTransaction&amp;);
+    void didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;);
+
</ins><span class="cx">     void fireVersionChangeEvent(uint64_t databaseConnectionIdentifier, uint64_t requestedVersion);
</span><span class="cx"> 
</span><span class="cx">     void registerDatabaseConnection(IDBDatabase&amp;);
</span><span class="lines">@@ -68,6 +73,7 @@
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;IDBResourceIdentifier, RefPtr&lt;IDBClient::IDBOpenDBRequest&gt;&gt; m_openDBRequestMap;
</span><span class="cx">     HashSet&lt;RefPtr&lt;IDBDatabase&gt;&gt; m_databaseConnections;
</span><ins>+    HashMap&lt;IDBResourceIdentifier, RefPtr&lt;IDBTransaction&gt;&gt; m_committingTransactions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBClient
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class IDBRequestData;
</span><ins>+class IDBResourceIdentifier;
</ins><span class="cx"> 
</span><span class="cx"> namespace IDBClient {
</span><span class="cx"> 
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx">     virtual uint64_t identifier() const = 0;
</span><span class="cx">     virtual void deleteDatabase(IDBRequestData&amp;) = 0;
</span><span class="cx">     virtual void openDatabase(IDBRequestData&amp;) = 0;
</span><ins>+    virtual void commitTransaction(IDBResourceIdentifier&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void ref() = 0;
</span><span class="cx">     virtual void deref() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -128,11 +128,52 @@
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;IDBTransaction&gt; transaction = IDBTransaction::create(*this, info);
</span><span class="cx">     m_versionChangeTransaction = &amp;transaction.get();
</span><ins>+
</ins><span class="cx">     m_activeTransactions.set(transaction-&gt;info().identifier(), &amp;transaction.get());
</span><span class="cx"> 
</span><span class="cx">     return WTF::move(transaction);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBDatabase::commitTransaction(IDBTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;IDBDatabase::commitTransaction&quot;);
+
+    auto refTransaction = m_activeTransactions.take(transaction.info().identifier());
+    ASSERT(refTransaction);
+    m_committingTransactions.set(transaction.info().identifier(), WTF::move(refTransaction));
+
+    m_connection-&gt;commitTransaction(transaction);
+}
+
+void IDBDatabase::didCommitTransaction(IDBTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;IDBDatabase::didCommitTransaction&quot;);
+
+    if (m_versionChangeTransaction == &amp;transaction)
+        m_info.setVersion(transaction.info().newVersion());
+
+    didCommitOrAbortTransaction(transaction);
+}
+
+void IDBDatabase::didAbortTransaction(IDBTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;IDBDatabase::didAbortTransaction&quot;);
+    didCommitOrAbortTransaction(transaction);
+}
+
+void IDBDatabase::didCommitOrAbortTransaction(IDBTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;IDBDatabase::didCommitOrAbortTransaction&quot;);
+
+    if (m_versionChangeTransaction == &amp;transaction)
+        m_versionChangeTransaction = nullptr;
+    
+    ASSERT(m_activeTransactions.contains(transaction.info().identifier()) || m_committingTransactions.contains(transaction.info().identifier()));
+
+    m_activeTransactions.remove(transaction.info().identifier());
+    m_committingTransactions.remove(transaction.info().identifier());
+}
+
</ins><span class="cx"> } // namespace IDBClient
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -72,15 +72,21 @@
</span><span class="cx">     const IDBDatabaseInfo&amp; info() const { return m_info; }
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;IDBTransaction&gt; startVersionChangeTransaction(const IDBTransactionInfo&amp;);
</span><ins>+    void commitTransaction(IDBTransaction&amp;);
+    void didCommitTransaction(IDBTransaction&amp;);
+    void didAbortTransaction(IDBTransaction&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     IDBDatabase(ScriptExecutionContext&amp;, IDBConnectionToServer&amp;, const IDBResultData&amp;);
</span><span class="cx"> 
</span><ins>+    void didCommitOrAbortTransaction(IDBTransaction&amp;);
+    
</ins><span class="cx">     Ref&lt;IDBConnectionToServer&gt; m_connection;
</span><span class="cx">     IDBDatabaseInfo m_info;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;IDBTransaction&gt; m_versionChangeTransaction;
</span><span class="cx">     HashMap&lt;IDBResourceIdentifier, RefPtr&lt;IDBTransaction&gt;&gt; m_activeTransactions;
</span><ins>+    HashMap&lt;IDBResourceIdentifier, RefPtr&lt;IDBTransaction&gt;&gt; m_committingTransactions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBClient
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBFactoryImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return openInternal(context, name, 0, ec).release();
</del><ins>+    return openInternal(context, name, version, ec).release();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;IDBOpenDBRequest&gt; IDBFactory::openInternal(ScriptExecutionContext* context, const String&amp; name, unsigned long long version, ExceptionCode&amp; ec)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -62,16 +62,24 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> void IDBOpenDBRequest::onError(const IDBResultData&amp; data)
</span><span class="cx"> {
</span><span class="cx">     m_domError = DOMError::create(data.error().name());
</span><span class="cx">     enqueueEvent(Event::create(eventNames().errorEvent, true, true));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IDBOpenDBRequest::onSuccess(const IDBResultData&amp;)
</del><ins>+void IDBOpenDBRequest::onSuccess(const IDBResultData&amp; resultData)
</ins><span class="cx"> {
</span><del>-    // FIXME: Implement
</del><ins>+    LOG(IndexedDB, &quot;IDBOpenDBRequest::onSuccess()&quot;);
+
+    if (!scriptExecutionContext())
+        return;
+
+    Ref&lt;IDBDatabase&gt; database = IDBDatabase::create(*scriptExecutionContext(), connection(), resultData);
+    m_result = IDBAny::create(WTF::move(database));
+    m_readyState = IDBRequestReadyState::Done;
+
+    enqueueEvent(Event::create(eventNames().successEvent, false, false));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBOpenDBRequest::onUpgradeNeeded(const IDBResultData&amp; resultData)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">     void onUpgradeNeeded(const IDBResultData&amp;);
</span><span class="cx"> 
</span><span class="cx">     IDBDatabaseIdentifier m_databaseIdentifier;
</span><del>-    uint64_t m_version;
</del><ins>+    uint64_t m_version { 0 };
</ins><span class="cx">     RefPtr&lt;DOMError&gt; m_domError;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -29,8 +29,12 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DOMError.h&quot;
</span><ins>+#include &quot;EventQueue.h&quot;
</ins><span class="cx"> #include &quot;IDBDatabaseImpl.h&quot;
</span><ins>+#include &quot;IDBEventDispatcher.h&quot;
</ins><span class="cx"> #include &quot;IDBObjectStore.h&quot;
</span><ins>+#include &quot;Logging.h&quot;
+#include &quot;ScriptExecutionContext.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBClient {
</span><span class="lines">@@ -42,9 +46,14 @@
</span><span class="cx"> 
</span><span class="cx"> IDBTransaction::IDBTransaction(IDBDatabase&amp; database, const IDBTransactionInfo&amp; info)
</span><span class="cx">     : WebCore::IDBTransaction(database.scriptExecutionContext())
</span><ins>+    , m_database(database)
</ins><span class="cx">     , m_info(info)
</span><ins>+    , m_operationTimer(*this, &amp;IDBTransaction::operationTimerFired)
+
</ins><span class="cx"> {
</span><span class="cx">     suspendIfNeeded();
</span><ins>+    scheduleOperationTimer();
+    m_state = IndexedDB::TransactionState::Running;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IDBTransaction::~IDBTransaction()
</span><span class="lines">@@ -65,10 +74,9 @@
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebCore::IDBDatabase* IDBTransaction::db() const
</del><ins>+WebCore::IDBDatabase* IDBTransaction::db()
</ins><span class="cx"> {
</span><del>-    ASSERT_NOT_REACHED();
-    return nullptr;
</del><ins>+    return &amp;m_database.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;DOMError&gt; IDBTransaction::error() const
</span><span class="lines">@@ -98,6 +106,107 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool IDBTransaction::hasPendingActivity() const
+{
+    return m_state != IndexedDB::TransactionState::Finished;
+}
+
+bool IDBTransaction::isActive() const
+{
+    return m_state == IndexedDB::TransactionState::Running;
+}
+
+void IDBTransaction::scheduleOperationTimer()
+{
+    if (!m_operationTimer.isActive())
+        m_operationTimer.startOneShot(0);
+}
+
+void IDBTransaction::operationTimerFired()
+{
+    LOG(IndexedDB, &quot;IDBTransaction::operationTimerFired&quot;);
+
+    if (m_state == IndexedDB::TransactionState::Unstarted)
+        return;
+
+    // FIXME: Once transactions can do things, like configure the database or insert data into it,
+    // those operations will be handled here, and will prevent the transaction from committing
+    // as long as outstanding operations exist.
+
+    if (isActive())
+        commit();
+}
+
+void IDBTransaction::commit()
+{
+    LOG(IndexedDB, &quot;IDBTransaction::commit&quot;);
+
+    if (m_state != IndexedDB::TransactionState::Running) {
+        m_state = IndexedDB::TransactionState::Finished;
+        return;
+    }
+
+    m_state = IndexedDB::TransactionState::Committing;
+
+    m_database-&gt;commitTransaction(*this);
+}
+
+void IDBTransaction::didCommit(const IDBError&amp; error)
+{
+    LOG(IndexedDB, &quot;IDBTransaction::didCommit&quot;);
+
+    ASSERT(m_state == IndexedDB::TransactionState::Committing);
+
+    if (error.isNull()) {
+        m_database-&gt;didCommitTransaction(*this);
+        fireOnComplete();
+    } else {
+        m_database-&gt;didAbortTransaction(*this);
+        m_idbError = error;
+        fireOnAbort();
+    }
+
+    m_state = IndexedDB::TransactionState::Finished;
+}
+
+void IDBTransaction::fireOnComplete()
+{
+    LOG(IndexedDB, &quot;IDBTransaction::fireOnComplete&quot;);
+    enqueueEvent(Event::create(eventNames().completeEvent, false, false));
+}
+
+void IDBTransaction::fireOnAbort()
+{
+    LOG(IndexedDB, &quot;IDBTransaction::fireOnAbort&quot;);
+    enqueueEvent(Event::create(eventNames().abortEvent, true, false));
+}
+
+void IDBTransaction::enqueueEvent(Ref&lt;Event&gt; event)
+{
+    ASSERT(m_state != IndexedDB::TransactionState::Finished);
+
+    if (!scriptExecutionContext())
+        return;
+
+    event-&gt;setTarget(this);
+    scriptExecutionContext()-&gt;eventQueue().enqueueEvent(&amp;event.get());
+}
+
+bool IDBTransaction::dispatchEvent(PassRefPtr&lt;Event&gt; event)
+{
+    LOG(IndexedDB, &quot;IDBTransaction::dispatchEvent&quot;);
+
+    ASSERT(scriptExecutionContext());
+    ASSERT(event-&gt;target() == this);
+    ASSERT(event-&gt;type() == eventNames().completeEvent || event-&gt;type() == eventNames().abortEvent);
+
+    Vector&lt;RefPtr&lt;EventTarget&gt;&gt; targets;
+    targets.append(this);
+    targets.append(db());
+
+    return IDBEventDispatcher::dispatch(event.get(), targets);
+}
+
</ins><span class="cx"> } // namespace IDBClient
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -28,8 +28,12 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><ins>+#include &quot;IDBError.h&quot;
</ins><span class="cx"> #include &quot;IDBTransaction.h&quot;
</span><span class="cx"> #include &quot;IDBTransactionInfo.h&quot;
</span><ins>+#include &quot;IndexedDB.h&quot;
+#include &quot;Timer.h&quot;
+#include &lt;heap/StrongInlines.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBClient {
</span><span class="lines">@@ -44,7 +48,7 @@
</span><span class="cx"> 
</span><span class="cx">     // IDBTransaction IDL
</span><span class="cx">     virtual const String&amp; mode() const override final;
</span><del>-    virtual WebCore::IDBDatabase* db() const override final;
</del><ins>+    virtual WebCore::IDBDatabase* db() override final;
</ins><span class="cx">     virtual RefPtr&lt;DOMError&gt; error() const override final;
</span><span class="cx">     virtual RefPtr&lt;IDBObjectStore&gt; objectStore(const String&amp; name, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual void abort(ExceptionCode&amp;) override final;
</span><span class="lines">@@ -53,16 +57,39 @@
</span><span class="cx">     virtual ScriptExecutionContext* scriptExecutionContext() const override final { return ActiveDOMObject::scriptExecutionContext(); }
</span><span class="cx">     virtual void refEventTarget() override final { ref(); }
</span><span class="cx">     virtual void derefEventTarget() override final { deref(); }
</span><ins>+    using EventTarget::dispatchEvent;
+    virtual bool dispatchEvent(PassRefPtr&lt;Event&gt;) override final;
</ins><span class="cx"> 
</span><span class="cx">     virtual const char* activeDOMObjectName() const override final;
</span><span class="cx">     virtual bool canSuspendForPageCache() const override final;
</span><ins>+    virtual bool hasPendingActivity() const override final;
</ins><span class="cx"> 
</span><span class="cx">     const IDBTransactionInfo info() const { return m_info; }
</span><ins>+    IDBDatabase&amp; database() { return m_database.get(); }
+    const IDBDatabase&amp; database() const { return m_database.get(); }
</ins><span class="cx"> 
</span><ins>+    void didCommit(const IDBError&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBTransaction(IDBDatabase&amp;, const IDBTransactionInfo&amp;);
</span><span class="cx"> 
</span><ins>+    bool isActive() const;
+    void commit();
+
+    void scheduleOperationTimer();
+    void operationTimerFired();
+
+    void fireOnComplete();
+    void fireOnAbort();
+    void enqueueEvent(Ref&lt;Event&gt;);
+
+    Ref&lt;IDBDatabase&gt; m_database;
</ins><span class="cx">     IDBTransactionInfo m_info;
</span><ins>+
+    IndexedDB::TransactionState m_state { IndexedDB::TransactionState::Unstarted };
+    IDBError m_idbError;
+
+    Timer m_operationTimer;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBClient
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddblegacyLegacyTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx">     return modeToString(m_mode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IDBDatabase* LegacyTransaction::db() const
</del><ins>+IDBDatabase* LegacyTransaction::db()
</ins><span class="cx"> {
</span><span class="cx">     return m_database.get();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddblegacyLegacyTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyTransaction.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     bool isVersionChange() const { return m_mode == IndexedDB::TransactionMode::VersionChange; }
</span><span class="cx"> 
</span><span class="cx">     virtual const String&amp; mode() const override final;
</span><del>-    virtual IDBDatabase* db() const override final;
</del><ins>+    virtual IDBDatabase* db() override final;
</ins><span class="cx">     virtual RefPtr&lt;DOMError&gt; error() const override final { return m_error; }
</span><span class="cx">     virtual RefPtr&lt;IDBObjectStore&gt; objectStore(const String&amp; name, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual void abort(ExceptionCode&amp;) override final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -58,6 +58,11 @@
</span><span class="cx">     m_delegate-&gt;didOpenDatabase(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBConnectionToClient::didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp; error)
+{
+    m_delegate-&gt;didCommitTransaction(transactionIdentifier, error);
+}
+
</ins><span class="cx"> void IDBConnectionToClient::fireVersionChangeEvent(UniqueIDBDatabaseConnection&amp; connection, uint64_t requestedVersion)
</span><span class="cx"> {
</span><span class="cx">     m_delegate-&gt;fireVersionChangeEvent(connection, requestedVersion);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class IDBError;
+class IDBResourceIdentifier;
</ins><span class="cx"> class IDBResultData;
</span><span class="cx"> 
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -48,6 +50,7 @@
</span><span class="cx"> 
</span><span class="cx">     void didDeleteDatabase(const IDBResultData&amp;);
</span><span class="cx">     void didOpenDatabase(const IDBResultData&amp;);
</span><ins>+    void didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void fireVersionChangeEvent(UniqueIDBDatabaseConnection&amp;, uint64_t requestedVersion);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class IDBError;
+class IDBResourceIdentifier;
</ins><span class="cx"> class IDBResultData;
</span><span class="cx"> 
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -44,6 +46,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void didDeleteDatabase(const IDBResultData&amp;) = 0;
</span><span class="cx">     virtual void didOpenDatabase(const IDBResultData&amp;) = 0;
</span><ins>+    virtual void didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void fireVersionChangeEvent(UniqueIDBDatabaseConnection&amp;, uint64_t requestedVersion) = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -63,6 +63,20 @@
</span><span class="cx">     m_connectionMap.remove(connection.identifier());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBServer::registerTransaction(UniqueIDBDatabaseTransaction&amp; transaction)
+{
+    ASSERT(!m_transactions.contains(transaction.info().identifier()));
+    m_transactions.set(transaction.info().identifier(), &amp;transaction);
+}
+
+void IDBServer::unregisterTransaction(UniqueIDBDatabaseTransaction&amp; transaction)
+{
+    ASSERT(m_transactions.contains(transaction.info().identifier()));
+    ASSERT(m_transactions.get(transaction.info().identifier()) == &amp;transaction);
+
+    m_transactions.remove(transaction.info().identifier());
+}
+
</ins><span class="cx"> void IDBServer::registerDatabaseConnection(UniqueIDBDatabaseConnection&amp; connection)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_databaseConnections.contains(connection.identifier()));
</span><span class="lines">@@ -128,6 +142,20 @@
</span><span class="cx">     connection-&gt;didDeleteDatabase(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBServer::commitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier)
+{
+    LOG(IndexedDB, &quot;IDBServer::commitTransaction&quot;);
+
+    auto transaction = m_transactions.get(transactionIdentifier);
+    if (!transaction) {
+        // If there is no transaction there is nothing to commit.
+        // We also have no access to a connection over which to message failure-to-commit.
+        return;
+    }
+
+    transaction-&gt;commit();
+}
+
</ins><span class="cx"> void IDBServer::postDatabaseTask(std::unique_ptr&lt;CrossThreadTask&gt;&amp;&amp; task)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -57,12 +57,15 @@
</span><span class="cx">     // Operations requested by the client.
</span><span class="cx">     void openDatabase(const IDBRequestData&amp;);
</span><span class="cx">     void deleteDatabase(const IDBRequestData&amp;);
</span><ins>+    void commitTransaction(const IDBResourceIdentifier&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void postDatabaseTask(std::unique_ptr&lt;CrossThreadTask&gt;&amp;&amp;);
</span><span class="cx">     void postDatabaseTaskReply(std::unique_ptr&lt;CrossThreadTask&gt;&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     void registerDatabaseConnection(UniqueIDBDatabaseConnection&amp;);
</span><span class="cx">     void unregisterDatabaseConnection(UniqueIDBDatabaseConnection&amp;);
</span><ins>+    void registerTransaction(UniqueIDBDatabaseTransaction&amp;);
+    void unregisterTransaction(UniqueIDBDatabaseTransaction&amp;);
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;IDBBackingStore&gt; createBackingStore(const IDBDatabaseIdentifier&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -87,6 +90,7 @@
</span><span class="cx">     MessageQueue&lt;CrossThreadTask&gt; m_databaseReplyQueue;
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;uint64_t, UniqueIDBDatabaseConnection*&gt; m_databaseConnections;
</span><ins>+    HashMap&lt;IDBResourceIdentifier, UniqueIDBDatabaseTransaction*&gt; m_transactions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBServer
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -124,6 +124,20 @@
</span><span class="cx">     return !m_openDatabaseConnections.isEmpty();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static uint64_t generateUniqueCallbackIdentifier()
+{
+    ASSERT(isMainThread());
+    static uint64_t currentID = 0;
+    return ++currentID;
+}
+
+uint64_t UniqueIDBDatabase::storeCallback(ErrorCallback callback)
+{
+    uint64_t identifier = generateUniqueCallbackIdentifier();
+    m_errorCallbacks.set(identifier, callback);
+    return identifier;
+}
+
</ins><span class="cx"> void UniqueIDBDatabase::startVersionChangeTransaction()
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::startVersionChangeTransaction&quot;);
</span><span class="lines">@@ -141,8 +155,7 @@
</span><span class="cx"> 
</span><span class="cx">     addOpenDatabaseConnection(*m_versionChangeDatabaseConnection);
</span><span class="cx"> 
</span><del>-    m_versionChangeTransaction = m_versionChangeDatabaseConnection-&gt;createVersionChangeTransaction(requestedVersion);
-    m_inProgressTransactions.set(m_versionChangeTransaction-&gt;info().identifier(), m_versionChangeTransaction);
</del><ins>+    m_versionChangeTransaction = &amp;m_versionChangeDatabaseConnection-&gt;createVersionChangeTransaction(requestedVersion);
</ins><span class="cx"> 
</span><span class="cx">     auto result = IDBResultData::openDatabaseUpgradeNeeded(operation-&gt;requestData().requestIdentifier(), *m_versionChangeTransaction);
</span><span class="cx">     operation-&gt;connection().didOpenDatabase(result);
</span><span class="lines">@@ -196,6 +209,55 @@
</span><span class="cx">     handleOpenDatabaseOperations();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction&amp; transaction, ErrorCallback callback)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::commitTransaction&quot;);
+
+    if (m_versionChangeTransaction == &amp;transaction) {
+        ASSERT(&amp;m_versionChangeTransaction-&gt;databaseConnection() == m_versionChangeDatabaseConnection);
+        m_databaseInfo-&gt;setVersion(transaction.info().newVersion());
+        m_versionChangeTransaction = nullptr;
+        m_versionChangeDatabaseConnection = nullptr;
+    }
+
+    uint64_t callbackID = storeCallback(callback);
+    m_server.postDatabaseTask(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::performCommitTransaction, callbackID, transaction.info().identifier()));
+}
+
+void UniqueIDBDatabase::performCommitTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp;)
+{
+    ASSERT(!isMainThread());
+    LOG(IndexedDB, &quot;(db) UniqueIDBDatabase::performCommitTransaction&quot;);
+
+    // FIXME: Commit transaction in backing store, once that exists.
+
+    IDBError error;
+    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::didPerformCommitTransaction, callbackIdentifier, error));
+
+}
+
+void UniqueIDBDatabase::didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&amp; error)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::didPerformCommitTransaction&quot;);
+
+    performErrorCallback(callbackIdentifier, error);
+}
+
+void UniqueIDBDatabase::transactionDestroyed(UniqueIDBDatabaseTransaction&amp; transaction)
+{
+    if (m_versionChangeTransaction == &amp;transaction)
+        m_versionChangeTransaction = nullptr;
+}
+
+void UniqueIDBDatabase::performErrorCallback(uint64_t callbackIdentifier, const IDBError&amp; error)
+{
+    auto callback = m_errorCallbacks.take(callbackIdentifier);
+    ASSERT(callback);
+    callback(error);
+}
+
</ins><span class="cx"> } // namespace IDBServer
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class IDBError;
</ins><span class="cx"> class IDBRequestData;
</span><span class="cx"> 
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -48,6 +49,8 @@
</span><span class="cx"> class IDBConnectionToClient;
</span><span class="cx"> class IDBServer;
</span><span class="cx"> 
</span><ins>+typedef std::function&lt;void(const IDBError&amp;)&gt; ErrorCallback;
+
</ins><span class="cx"> class UniqueIDBDatabase : public ThreadSafeRefCounted&lt;UniqueIDBDatabase&gt; {
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;UniqueIDBDatabase&gt; create(IDBServer&amp; server, const IDBDatabaseIdentifier&amp; identifier)
</span><span class="lines">@@ -58,7 +61,11 @@
</span><span class="cx">     void openDatabaseConnection(IDBConnectionToClient&amp;, const IDBRequestData&amp;);
</span><span class="cx"> 
</span><span class="cx">     const IDBDatabaseInfo&amp; info() const;
</span><ins>+    IDBServer&amp; server() { return m_server; }
</ins><span class="cx"> 
</span><ins>+    void commitTransaction(UniqueIDBDatabaseTransaction&amp;, ErrorCallback);
+    void transactionDestroyed(UniqueIDBDatabaseTransaction&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     UniqueIDBDatabase(IDBServer&amp;, const IDBDatabaseIdentifier&amp;);
</span><span class="cx">     
</span><span class="lines">@@ -68,13 +75,19 @@
</span><span class="cx"> 
</span><span class="cx">     void startVersionChangeTransaction();
</span><span class="cx">     void notifyConnectionsOfVersionChange();
</span><ins>+
+    uint64_t storeCallback(ErrorCallback);
</ins><span class="cx">     
</span><span class="cx">     // Database thread operations
</span><span class="cx">     void openBackingStore(const IDBDatabaseIdentifier&amp;);
</span><ins>+    void performCommitTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier);
</ins><span class="cx"> 
</span><span class="cx">     // Main thread callbacks
</span><span class="cx">     void didOpenBackingStore(const IDBDatabaseInfo&amp;);
</span><ins>+    void didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&amp;);
</ins><span class="cx"> 
</span><ins>+    void performErrorCallback(uint64_t callbackIdentifier, const IDBError&amp;);
+
</ins><span class="cx">     IDBServer&amp; m_server;
</span><span class="cx">     IDBDatabaseIdentifier m_identifier;
</span><span class="cx">     
</span><span class="lines">@@ -84,12 +97,12 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;IDBServerOperation&gt; m_versionChangeOperation;
</span><span class="cx">     RefPtr&lt;UniqueIDBDatabaseConnection&gt; m_versionChangeDatabaseConnection;
</span><ins>+    UniqueIDBDatabaseTransaction* m_versionChangeTransaction { nullptr };
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;UniqueIDBDatabaseTransaction&gt; m_versionChangeTransaction;
-    HashMap&lt;IDBResourceIdentifier, RefPtr&lt;UniqueIDBDatabaseTransaction&gt;&gt; m_inProgressTransactions;
-
</del><span class="cx">     std::unique_ptr&lt;IDBBackingStore&gt; m_backingStore;
</span><span class="cx">     std::unique_ptr&lt;IDBDatabaseInfo&gt; m_databaseInfo;
</span><ins>+
+    HashMap&lt;uint64_t, ErrorCallback&gt; m_errorCallbacks;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBServer
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">     m_connectionToClient.fireVersionChangeEvent(*this, requestedVersion);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;UniqueIDBDatabaseTransaction&gt; UniqueIDBDatabaseConnection::createVersionChangeTransaction(uint64_t newVersion)
</del><ins>+UniqueIDBDatabaseTransaction&amp; UniqueIDBDatabaseConnection::createVersionChangeTransaction(uint64_t newVersion)
</ins><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;UniqueIDBDatabaseConnection::createVersionChangeTransaction&quot;);
</span><span class="cx">     ASSERT(!m_closePending);
</span><span class="lines">@@ -69,9 +69,21 @@
</span><span class="cx">     Ref&lt;UniqueIDBDatabaseTransaction&gt; transaction = UniqueIDBDatabaseTransaction::create(*this, info);
</span><span class="cx">     m_transactionMap.set(transaction-&gt;info().identifier(), &amp;transaction.get());
</span><span class="cx"> 
</span><del>-    return WTF::move(transaction);
</del><ins>+    return transaction.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UniqueIDBDatabaseConnection::didCommitTransaction(UniqueIDBDatabaseTransaction&amp; transaction, const IDBError&amp; error)
+{
+    LOG(IndexedDB, &quot;UniqueIDBDatabaseConnection::didCommitTransaction&quot;);
+
+    auto transactionIdentifier = transaction.info().identifier();
+
+    ASSERT(m_transactionMap.contains(transactionIdentifier));
+    m_transactionMap.remove(transactionIdentifier);
+
+    m_connectionToClient.didCommitTransaction(transactionIdentifier, error);
+}
+
</ins><span class="cx"> } // namespace IDBServer
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -34,6 +34,9 @@
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><ins>+
+class IDBError;
+
</ins><span class="cx"> namespace IDBServer {
</span><span class="cx"> 
</span><span class="cx"> class IDBConnectionToClient;
</span><span class="lines">@@ -51,8 +54,10 @@
</span><span class="cx">     bool closePending() const { return m_closePending; }
</span><span class="cx"> 
</span><span class="cx">     void fireVersionChangeEvent(uint64_t requestedVersion);
</span><del>-    Ref&lt;UniqueIDBDatabaseTransaction&gt; createVersionChangeTransaction(uint64_t newVersion);
</del><ins>+    UniqueIDBDatabaseTransaction&amp; createVersionChangeTransaction(uint64_t newVersion);
</ins><span class="cx"> 
</span><ins>+    void didCommitTransaction(UniqueIDBDatabaseTransaction&amp;, const IDBError&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     UniqueIDBDatabaseConnection(UniqueIDBDatabase&amp;, IDBConnectionToClient&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -28,6 +28,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><ins>+#include &quot;IDBServer.h&quot;
+#include &quot;Logging.h&quot;
+#include &quot;UniqueIDBDatabase.h&quot;
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="cx"> 
</span><span class="lines">@@ -40,8 +44,26 @@
</span><span class="cx">     : m_databaseConnection(connection)
</span><span class="cx">     , m_transactionInfo(info)
</span><span class="cx"> {
</span><ins>+    m_databaseConnection-&gt;database().server().registerTransaction(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+UniqueIDBDatabaseTransaction::~UniqueIDBDatabaseTransaction()
+{
+    m_databaseConnection-&gt;database().transactionDestroyed(*this);
+    m_databaseConnection-&gt;database().server().unregisterTransaction(*this);
+}
+
+void UniqueIDBDatabaseTransaction::commit()
+{
+    LOG(IndexedDB, &quot;UniqueIDBDatabaseTransaction::commit&quot;);
+
+    RefPtr&lt;UniqueIDBDatabaseTransaction&gt; self(this);
+    m_databaseConnection-&gt;database().commitTransaction(*this, [this, self](const IDBError&amp; error) {
+        LOG(IndexedDB, &quot;UniqueIDBDatabaseTransaction::commit (callback)&quot;);
+        m_databaseConnection-&gt;didCommitTransaction(*this, error);
+    });
+}
+
</ins><span class="cx"> } // namespace IDBServer
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -42,9 +42,13 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;UniqueIDBDatabaseTransaction&gt; create(UniqueIDBDatabaseConnection&amp;, IDBTransactionInfo&amp;);
</span><span class="cx"> 
</span><ins>+    ~UniqueIDBDatabaseTransaction();
+
</ins><span class="cx">     UniqueIDBDatabaseConnection&amp; databaseConnection() { return m_databaseConnection.get(); }
</span><span class="cx">     const IDBTransactionInfo&amp; info() const { return m_transactionInfo; }
</span><span class="cx"> 
</span><ins>+    void commit();
+
</ins><span class="cx"> private:
</span><span class="cx">     UniqueIDBDatabaseTransaction(UniqueIDBDatabaseConnection&amp;, IDBTransactionInfo&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -39,6 +39,8 @@
</span><span class="cx">     IDBDatabaseInfo isolatedCopy() const;
</span><span class="cx"> 
</span><span class="cx">     const String&amp; name() const { return m_name; }
</span><ins>+
+    void setVersion(uint64_t version) { m_version = version; }
</ins><span class="cx">     uint64_t version() const { return m_version; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBErrorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -55,6 +55,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IDBError IDBError::isolatedCopy() const
+{
+    return { m_code, m_message.isolatedCopy() };
+}
+
</ins><span class="cx"> IDBError&amp; IDBError::operator=(const IDBError&amp; other)
</span><span class="cx"> {
</span><span class="cx">     m_code = other.m_code;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -51,6 +51,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isNull() const { return m_code == IDBExceptionCode::None; }
</span><span class="cx"> 
</span><ins>+    IDBError isolatedCopy() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBExceptionCode m_code { IDBExceptionCode::None };
</span><span class="cx">     String m_message;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBRequestDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> namespace IDBClient {
</span><span class="cx"> class IDBConnectionToServer;
</span><span class="cx"> class IDBOpenDBRequest;
</span><ins>+class IDBTransaction;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class IDBRequestData {
</span><span class="lines">@@ -51,7 +52,7 @@
</span><span class="cx">     IDBResourceIdentifier m_requestIdentifier;
</span><span class="cx">     IDBDatabaseIdentifier m_databaseIdentifier;
</span><span class="cx"> 
</span><del>-    uint64_t m_requestedVersion;
</del><ins>+    uint64_t m_requestedVersion { 0 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifiercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -73,6 +73,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IDBResourceIdentifier IDBResourceIdentifier::isolatedCopy() const
+{
+    return IDBResourceIdentifier(m_idbConnectionIdentifier, m_resourceNumber);
+}
+
</ins><span class="cx"> IDBResourceIdentifier IDBResourceIdentifier::emptyValue()
</span><span class="cx"> {
</span><span class="cx">     return IDBResourceIdentifier(0, 0);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResourceIdentifierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResourceIdentifier.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -69,7 +69,9 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     uint64_t connectionIdentifier() const { return m_idbConnectionIdentifier; }
</span><del>-    
</del><ins>+
+    IDBResourceIdentifier isolatedCopy() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBResourceIdentifier() = delete;
</span><span class="cx">     IDBResourceIdentifier(uint64_t connectionIdentifier, uint64_t resourceIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -102,6 +102,22 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InProcessIDBServer::didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp; error)
+{
+    RefPtr&lt;InProcessIDBServer&gt; self(this);
+    RunLoop::current().dispatch([this, self, transactionIdentifier, error] {
+        m_connectionToServer-&gt;didCommitTransaction(transactionIdentifier, error);
+    });
+}
+
+void InProcessIDBServer::commitTransaction(IDBResourceIdentifier&amp; resourceIdentifier)
+{
+    RefPtr&lt;InProcessIDBServer&gt; self(this);
+    RunLoop::current().dispatch([this, self, resourceIdentifier] {
+        m_server-&gt;commitTransaction(resourceIdentifier);
+    });
+}
+
</ins><span class="cx"> void InProcessIDBServer::fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&amp; connection, uint64_t requestedVersion)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InProcessIDBServer&gt; self(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -56,11 +56,13 @@
</span><span class="cx">     // IDBConnectionToServer
</span><span class="cx">     virtual void deleteDatabase(IDBRequestData&amp;) override final;
</span><span class="cx">     virtual void openDatabase(IDBRequestData&amp;) override final;
</span><ins>+    virtual void commitTransaction(IDBResourceIdentifier&amp;) override final;
</ins><span class="cx"> 
</span><span class="cx">     // IDBConnectionToClient
</span><span class="cx">     virtual uint64_t identifier() const override;
</span><span class="cx">     virtual void didDeleteDatabase(const IDBResultData&amp;) override final;
</span><span class="cx">     virtual void didOpenDatabase(const IDBResultData&amp;) override final;
</span><ins>+    virtual void didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;) override final;
</ins><span class="cx">     virtual void fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&amp;, uint64_t requestedVersion) override final;
</span><span class="cx"> 
</span><span class="cx">     virtual void ref() override { RefCounted&lt;InProcessIDBServer&gt;::ref(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -1967,7 +1967,7 @@
</span><span class="cx">                 5145B1091BC48E2E00E86219 /* IDBResourceIdentifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5145B1071BC4890B00E86219 /* IDBResourceIdentifier.cpp */; };
</span><span class="cx">                 5145B10A1BC48E2E00E86219 /* IDBResourceIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 5145B1081BC4890B00E86219 /* IDBResourceIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5148453E1BB9D07E006A72ED /* IDBError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5148453C1BB9D076006A72ED /* IDBError.cpp */; };
</span><del>-                5148453F1BB9D07E006A72ED /* IDBError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5148453D1BB9D076006A72ED /* IDBError.h */; };
</del><ins>+                5148453F1BB9D07E006A72ED /* IDBError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5148453D1BB9D076006A72ED /* IDBError.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514B3F750C722055000530DF /* FileSystemMac.mm */; };
</span><span class="cx">                 514C76370CE9225E007EF3CD /* JSSQLError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76350CE9225E007EF3CD /* JSSQLError.cpp */; };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformCrossThreadCopiercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/CrossThreadCopier.cpp (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/CrossThreadCopier.cpp        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/platform/CrossThreadCopier.cpp        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -45,9 +45,11 @@
</span><span class="cx"> #include &quot;IDBDatabaseIdentifier.h&quot;
</span><span class="cx"> #include &quot;IDBDatabaseInfo.h&quot;
</span><span class="cx"> #include &quot;IDBDatabaseMetadata.h&quot;
</span><ins>+#include &quot;IDBError.h&quot;
</ins><span class="cx"> #include &quot;IDBGetResult.h&quot;
</span><span class="cx"> #include &quot;IDBKeyData.h&quot;
</span><span class="cx"> #include &quot;IDBKeyRangeData.h&quot;
</span><ins>+#include &quot;IDBResourceIdentifier.h&quot;
</ins><span class="cx"> #include &quot;IDBTransactionInfo.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -145,6 +147,16 @@
</span><span class="cx">     return info.isolatedCopy();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+CrossThreadCopierBase&lt;false, false, IDBResourceIdentifier&gt;::Type CrossThreadCopierBase&lt;false, false, IDBResourceIdentifier&gt;::copy(const IDBResourceIdentifier&amp; identifier)
+{
+    return identifier.isolatedCopy();
+}
+
+CrossThreadCopierBase&lt;false, false, IDBError&gt;::Type CrossThreadCopierBase&lt;false, false, IDBError&gt;::copy(const IDBError&amp; error)
+{
+    return error.isolatedCopy();
+}
+
</ins><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><span class="cx"> // Test CrossThreadCopier using COMPILE_ASSERT.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformCrossThreadCopierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/CrossThreadCopier.h (191113 => 191114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/CrossThreadCopier.h        2015-10-15 16:08:24 UTC (rev 191113)
+++ trunk/Source/WebCore/platform/CrossThreadCopier.h        2015-10-15 16:41:30 UTC (rev 191114)
</span><span class="lines">@@ -203,6 +203,18 @@
</span><span class="cx">         static Type copy(const IDBDatabaseIdentifier&amp;);
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    class IDBError;
+    template&lt;&gt; struct WEBCORE_EXPORT CrossThreadCopierBase&lt;false, false, IDBError&gt; {
+        typedef IDBError Type;
+        static Type copy(const IDBError&amp;);
+    };
+
+    class IDBResourceIdentifier;
+    template&lt;&gt; struct WEBCORE_EXPORT CrossThreadCopierBase&lt;false, false, IDBResourceIdentifier&gt; {
+        typedef IDBResourceIdentifier Type;
+        static Type copy(const IDBResourceIdentifier&amp;);
+    };
+
</ins><span class="cx">     class IDBTransactionInfo;
</span><span class="cx">     template&lt;&gt; struct WEBCORE_EXPORT CrossThreadCopierBase&lt;false, false, IDBTransactionInfo&gt; {
</span><span class="cx">         typedef IDBTransactionInfo Type;
</span></span></pre>
</div>
</div>

</body>
</html>