<!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>[191598] trunk/Source/WebCore</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/191598">191598</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-10-26 14:07:21 -0700 (Mon, 26 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: Backing store objectStores (plumbing for b/150468).
https://bugs.webkit.org/show_bug.cgi?id=150543

Reviewed by Alex Christensen.

No new tests (No change in behavior, plumbing for future testability)

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/server/IDBBackingStore.h:

* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::addNewObjectStore):
(WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
(WebCore::IDBServer::MemoryBackingStoreTransaction::commit):
(WebCore::IDBServer::MemoryBackingStoreTransaction::finish):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
(WebCore::IDBServer::MemoryBackingStoreTransaction::isWriting):

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore):
(WebCore::IDBServer::MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:

* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::create):
(WebCore::IDBServer::MemoryObjectStore::MemoryObjectStore):
(WebCore::IDBServer::MemoryObjectStore::~MemoryObjectStore):
(WebCore::IDBServer::MemoryObjectStore::writeTransactionStarted):
(WebCore::IDBServer::MemoryObjectStore::writeTransactionFinished):
* Modules/indexeddb/server/MemoryObjectStore.h:
(WebCore::IDBServer::MemoryObjectStore::info):

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):

* Modules/indexeddb/shared/IDBError.cpp:
(WebCore::idbErrorName):
(WebCore::idbErrorDescription):
* Modules/indexeddb/shared/IDBError.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</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="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</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="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -902,6 +902,7 @@
</span><span class="cx">     Modules/indexeddb/server/IDBServerOperation.cpp
</span><span class="cx">     Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
</span><span class="cx">     Modules/indexeddb/server/MemoryIDBBackingStore.cpp
</span><ins>+    Modules/indexeddb/server/MemoryObjectStore.cpp
</ins><span class="cx">     Modules/indexeddb/server/UniqueIDBDatabase.cpp
</span><span class="cx">     Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp
</span><span class="cx">     Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/ChangeLog        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2015-10-26  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Backing store objectStores (plumbing for b/150468).
+        https://bugs.webkit.org/show_bug.cgi?id=150543
+
+        Reviewed by Alex Christensen.
+
+        No new tests (No change in behavior, plumbing for future testability)
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * Modules/indexeddb/server/IDBBackingStore.h:
+
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::addNewObjectStore):
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::commit):
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::finish):
+        * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+        (WebCore::IDBServer::MemoryBackingStoreTransaction::isWriting):
+
+        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+        (WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore):
+        (WebCore::IDBServer::MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort):
+        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+
+        * Modules/indexeddb/server/MemoryObjectStore.cpp:
+        (WebCore::IDBServer::MemoryObjectStore::create):
+        (WebCore::IDBServer::MemoryObjectStore::MemoryObjectStore):
+        (WebCore::IDBServer::MemoryObjectStore::~MemoryObjectStore):
+        (WebCore::IDBServer::MemoryObjectStore::writeTransactionStarted):
+        (WebCore::IDBServer::MemoryObjectStore::writeTransactionFinished):
+        * Modules/indexeddb/server/MemoryObjectStore.h:
+        (WebCore::IDBServer::MemoryObjectStore::info):
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
+
+        * Modules/indexeddb/shared/IDBError.cpp:
+        (WebCore::idbErrorName):
+        (WebCore::idbErrorDescription):
+        * Modules/indexeddb/shared/IDBError.h:
+
</ins><span class="cx"> 2015-10-26  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Null dereference loading Blink layout test editing/execCommand/indent-inline-box-crash.html
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class IDBObjectStoreInfo;
</ins><span class="cx"> class IDBResourceIdentifier;
</span><span class="cx"> class IDBTransactionInfo;
</span><span class="cx"> 
</span><span class="lines">@@ -47,6 +48,8 @@
</span><span class="cx">     virtual IDBError beginTransaction(const IDBTransactionInfo&amp;) = 0;
</span><span class="cx">     virtual IDBError abortTransaction(const IDBResourceIdentifier&amp; transactionIdentifier) = 0;
</span><span class="cx">     virtual IDBError commitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier) = 0;
</span><ins>+
+    virtual IDBError createObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBObjectStoreInfo&amp;) = 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 (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;IndexedDB.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MemoryIDBBackingStore.h&quot;
</span><ins>+#include &quot;MemoryObjectStore.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -53,6 +54,19 @@
</span><span class="cx">     ASSERT(!m_inProgress);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MemoryBackingStoreTransaction::addNewObjectStore(MemoryObjectStore&amp; objectStore)
+{
+    LOG(IndexedDB, &quot;MemoryBackingStoreTransaction::addNewObjectStore()&quot;);
+
+    ASSERT(isVersionChange());
+
+    ASSERT(!m_objectStores.contains(&amp;objectStore));
+    m_objectStores.add(&amp;objectStore);
+    m_versionChangeAddedObjectStores.add(&amp;objectStore);
+
+    objectStore.writeTransactionStarted(*this);
+}
+
</ins><span class="cx"> void MemoryBackingStoreTransaction::abort()
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;MemoryBackingStoreTransaction::abort()&quot;);
</span><span class="lines">@@ -62,14 +76,28 @@
</span><span class="cx">         m_backingStore.setDatabaseInfo(*m_originalDatabaseInfo);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_inProgress = false;
</del><ins>+    finish();
+
+    for (auto objectStore : m_versionChangeAddedObjectStores)
+        m_backingStore.removeObjectStoreForVersionChangeAbort(*objectStore);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MemoryBackingStoreTransaction::commit()
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;MemoryBackingStoreTransaction::commit()&quot;);
</span><span class="cx"> 
</span><ins>+    finish();
+}
+
+void MemoryBackingStoreTransaction::finish()
+{
</ins><span class="cx">     m_inProgress = false;
</span><ins>+
+    if (!isWriting())
+        return;
+
+    for (auto objectStore : m_objectStores)
+        objectStore-&gt;writeTransactionFinished(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBServer
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -30,11 +30,13 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;IDBDatabaseInfo.h&quot;
</span><span class="cx"> #include &quot;IDBTransactionInfo.h&quot;
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="cx"> 
</span><span class="cx"> class MemoryIDBBackingStore;
</span><ins>+class MemoryObjectStore;
</ins><span class="cx"> 
</span><span class="cx"> class MemoryBackingStoreTransaction {
</span><span class="cx">     friend std::unique_ptr&lt;MemoryBackingStoreTransaction&gt; std::make_unique&lt;MemoryBackingStoreTransaction&gt;(WebCore::IDBServer::MemoryIDBBackingStore&amp;, const WebCore::IDBTransactionInfo&amp;);
</span><span class="lines">@@ -44,21 +46,30 @@
</span><span class="cx">     ~MemoryBackingStoreTransaction();
</span><span class="cx"> 
</span><span class="cx">     bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
</span><ins>+    bool isWriting() const { return m_info.mode() != IndexedDB::TransactionMode::ReadOnly; }
</ins><span class="cx"> 
</span><span class="cx">     const IDBDatabaseInfo&amp; originalDatabaseInfo() const;
</span><span class="cx"> 
</span><ins>+    void addNewObjectStore(MemoryObjectStore&amp;);
+
</ins><span class="cx">     void abort();
</span><span class="cx">     void commit();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     MemoryBackingStoreTransaction(MemoryIDBBackingStore&amp;, const IDBTransactionInfo&amp;);
</span><span class="cx"> 
</span><ins>+    void finish();
+
</ins><span class="cx">     MemoryIDBBackingStore&amp; m_backingStore;
</span><span class="cx">     IDBTransactionInfo m_info;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;IDBDatabaseInfo&gt; m_originalDatabaseInfo;
</span><span class="cx"> 
</span><span class="cx">     bool m_inProgress { true };
</span><ins>+
+    HashSet&lt;MemoryObjectStore*&gt; m_objectStores;
+    HashSet&lt;MemoryObjectStore*&gt; m_versionChangeAddedObjectStores;
+
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBServer
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;MemoryObjectStore.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -102,6 +103,39 @@
</span><span class="cx">     return IDBError();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IDBError MemoryIDBBackingStore::createObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBObjectStoreInfo&amp; info)
+{
+    LOG(IndexedDB, &quot;MemoryIDBBackingStore::createObjectStore&quot;);
+
+    ASSERT(m_databaseInfo);
+    if (m_databaseInfo-&gt;hasObjectStore(info.name()))
+        return IDBError(IDBExceptionCode::ConstraintError);
+
+    ASSERT(!m_objectStores.contains(info.identifier()));
+    auto objectStore = MemoryObjectStore::create(info);
+
+    m_databaseInfo-&gt;addExistingObjectStore(info);
+
+    auto rawTransaction = m_transactions.get(transactionIdentifier);
+    ASSERT(rawTransaction);
+    ASSERT(rawTransaction-&gt;isVersionChange());
+
+    rawTransaction-&gt;addNewObjectStore(*objectStore);
+    m_objectStores.set(info.identifier(), WTF::move(objectStore));
+
+    return IDBError();
+}
+
+void MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort(MemoryObjectStore&amp; objectStore)
+{
+    LOG(IndexedDB, &quot;MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort&quot;);
+
+    ASSERT(m_objectStores.contains(objectStore.info().identifier()));
+    ASSERT(m_objectStores.get(objectStore.info().identifier()) == &amp;objectStore);
+
+    m_objectStores.remove(objectStore.info().identifier());
+}
+
</ins><span class="cx"> } // namespace IDBServer
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -37,6 +37,8 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="cx"> 
</span><ins>+class MemoryObjectStore;
+
</ins><span class="cx"> class MemoryIDBBackingStore : public IDBBackingStore {
</span><span class="cx">     friend std::unique_ptr&lt;MemoryIDBBackingStore&gt; std::make_unique&lt;MemoryIDBBackingStore&gt;(const WebCore::IDBDatabaseIdentifier&amp;);
</span><span class="cx"> public:
</span><span class="lines">@@ -50,7 +52,10 @@
</span><span class="cx">     virtual IDBError beginTransaction(const IDBTransactionInfo&amp;) override final;
</span><span class="cx">     virtual IDBError abortTransaction(const IDBResourceIdentifier&amp; transactionIdentifier) override final;
</span><span class="cx">     virtual IDBError commitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier) override final;
</span><ins>+    virtual IDBError createObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBObjectStoreInfo&amp;) override final;
</ins><span class="cx"> 
</span><ins>+    void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     MemoryIDBBackingStore(const IDBDatabaseIdentifier&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -58,7 +63,7 @@
</span><span class="cx">     std::unique_ptr&lt;IDBDatabaseInfo&gt; m_databaseInfo;
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;IDBResourceIdentifier, std::unique_ptr&lt;MemoryBackingStoreTransaction&gt;&gt; m_transactions;
</span><del>-
</del><ins>+    HashMap&lt;uint64_t, std::unique_ptr&lt;MemoryObjectStore&gt;&gt; m_objectStores;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBServer
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecppfromrev191597trunkSourceWebCoreModulesindexeddbsharedIDBErrorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (from rev 191597, trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h) (0 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp                                (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MemoryObjectStore.h&quot;
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include &quot;Logging.h&quot;
+
+namespace WebCore {
+namespace IDBServer {
+
+std::unique_ptr&lt;MemoryObjectStore&gt; MemoryObjectStore::create(const IDBObjectStoreInfo&amp; info)
+{
+    return std::make_unique&lt;MemoryObjectStore&gt;(info);
+}
+
+MemoryObjectStore::MemoryObjectStore(const IDBObjectStoreInfo&amp; info)
+    : m_info(info)
+{
+}
+
+MemoryObjectStore::~MemoryObjectStore()
+{
+    ASSERT(!m_writeTransaction);
+}
+
+void MemoryObjectStore::writeTransactionStarted(MemoryBackingStoreTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;MemoryObjectStore::writeTransactionStarted&quot;);
+
+    ASSERT(!m_writeTransaction);
+    m_writeTransaction = &amp;transaction;
+}
+
+void MemoryObjectStore::writeTransactionFinished(MemoryBackingStoreTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;MemoryObjectStore::writeTransactionFinished&quot;);
+
+    ASSERT_UNUSED(transaction, m_writeTransaction == &amp;transaction);
+    m_writeTransaction = nullptr;
+}
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorehfromrev191597trunkSourceWebCoreModulesindexeddbsharedIDBErrorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (from rev 191597, trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h) (0 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h                                (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MemoryObjectStore_h
+#define MemoryObjectStore_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include &quot;IDBObjectStoreInfo.h&quot;
+
+namespace WebCore {
+namespace IDBServer {
+
+class MemoryBackingStoreTransaction;
+
+class MemoryObjectStore {
+    friend std::unique_ptr&lt;MemoryObjectStore&gt; std::make_unique&lt;MemoryObjectStore&gt;(const WebCore::IDBObjectStoreInfo&amp;);
+public:
+    static std::unique_ptr&lt;MemoryObjectStore&gt; create(const IDBObjectStoreInfo&amp;);
+
+    ~MemoryObjectStore();
+
+    void writeTransactionStarted(MemoryBackingStoreTransaction&amp;);
+    void writeTransactionFinished(MemoryBackingStoreTransaction&amp;);
+
+    const IDBObjectStoreInfo&amp; info() const { return m_info; }
+
+private:
+    MemoryObjectStore(const IDBObjectStoreInfo&amp;);
+
+    IDBObjectStoreInfo m_info;
+
+    MemoryBackingStoreTransaction* m_writeTransaction { nullptr };
+};
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // MemoryObjectStore_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -222,6 +222,9 @@
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::createObjectStore&quot;);
</span><span class="cx"> 
</span><ins>+    ASSERT(m_backingStore);
+    m_backingStore-&gt;createObjectStore(transaction.info().identifier(), info);
+
</ins><span class="cx">     uint64_t callbackID = storeCallback(callback);
</span><span class="cx">     m_server.postDatabaseTask(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::performCreateObjectStore, callbackID, transaction.info().identifier(), info));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBErrorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.cpp        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx">         static NeverDestroyed&lt;String&gt; entry = ASCIILiteral(&quot;UnknownError&quot;);
</span><span class="cx">         return entry;
</span><span class="cx">     }
</span><ins>+    case IDBExceptionCode::ConstraintError: {
+        static NeverDestroyed&lt;String&gt; entry = ASCIILiteral(&quot;ConstraintError&quot;);
+        return entry;
+    }
</ins><span class="cx">     case IDBExceptionCode::VersionError: {
</span><span class="cx">         static NeverDestroyed&lt;String&gt; entry = ASCIILiteral(&quot;VersionError&quot;);
</span><span class="cx">         return entry;
</span><span class="lines">@@ -61,6 +65,10 @@
</span><span class="cx">         static NeverDestroyed&lt;String&gt; entry = ASCIILiteral(&quot;Operation failed for reasons unrelated to the database itself and not covered by any other errors.&quot;);
</span><span class="cx">         return entry.get();
</span><span class="cx">     }
</span><ins>+    case IDBExceptionCode::ConstraintError: {
+        static NeverDestroyed&lt;String&gt; entry = ASCIILiteral(&quot;Mutation operation in the transaction failed because a constraint was not satisfied.&quot;);
+        return entry.get();
+    }
</ins><span class="cx">     case IDBExceptionCode::VersionError: {
</span><span class="cx">         static NeverDestroyed&lt;String&gt; entry = ASCIILiteral(&quot;An attempt was made to open a database using a lower version than the existing version.&quot;);
</span><span class="cx">         return entry.get();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBError.h        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> enum class IDBExceptionCode {
</span><span class="cx">     None = 0,
</span><span class="cx">     Unknown,
</span><ins>+    ConstraintError,
</ins><span class="cx">     VersionError,
</span><span class="cx"> 
</span><span class="cx">     // Indexed DB existing exception codes with IDB-specific error messages:
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191597 => 191598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-26 20:16:53 UTC (rev 191597)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-10-26 21:07:21 UTC (rev 191598)
</span><span class="lines">@@ -2051,6 +2051,8 @@
</span><span class="cx">                 51741D110B07259A00ED442C /* HistoryItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51741D0D0B07259A00ED442C /* HistoryItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51741D120B07259A00ED442C /* HistoryItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51741D0E0B07259A00ED442C /* HistoryItem.cpp */; };
</span><span class="cx">                 5174E20A10A1F44F00F95E6F /* PopStateEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 5174E20810A1F44F00F95E6F /* PopStateEvent.h */; };
</span><ins>+                51771DFE1BDB485000CAE8E4 /* MemoryObjectStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51771DFC1BDB475600CAE8E4 /* MemoryObjectStore.cpp */; };
+                51771DFF1BDB485000CAE8E4 /* MemoryObjectStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51771DFD1BDB475600CAE8E4 /* MemoryObjectStore.h */; };
</ins><span class="cx">                 5179CE24195C81420019C198 /* GamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5179CE23195C81420019C198 /* GamepadProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5179CE26195C821D0019C198 /* GamepadProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5179CE25195C821D0019C198 /* GamepadProvider.cpp */; };
</span><span class="cx">                 5179CE2A195C91860019C198 /* GamepadProviderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5179CE29195C91860019C198 /* GamepadProviderClient.h */; };
</span><span class="lines">@@ -9472,6 +9474,8 @@
</span><span class="cx">                 51741D0E0B07259A00ED442C /* HistoryItem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HistoryItem.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5174E20810A1F44F00F95E6F /* PopStateEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopStateEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5174E20B10A1F49A00F95E6F /* PopStateEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PopStateEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51771DFC1BDB475600CAE8E4 /* MemoryObjectStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryObjectStore.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51771DFD1BDB475600CAE8E4 /* MemoryObjectStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryObjectStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5179CE23195C81420019C198 /* GamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5179CE25195C821D0019C198 /* GamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadProvider.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5179CE29195C91860019C198 /* GamepadProviderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadProviderClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16844,6 +16848,8 @@
</span><span class="cx">                                 51E1BAC11BD806470055D81F /* MemoryBackingStoreTransaction.h */,
</span><span class="cx">                                 51BA4AC81BBC5B9E00DF3D6D /* MemoryIDBBackingStore.cpp */,
</span><span class="cx">                                 51BA4AC91BBC5B9E00DF3D6D /* MemoryIDBBackingStore.h */,
</span><ins>+                                51771DFC1BDB475600CAE8E4 /* MemoryObjectStore.cpp */,
+                                51771DFD1BDB475600CAE8E4 /* MemoryObjectStore.h */,
</ins><span class="cx">                                 518864DE1BBAF30F00E540C9 /* UniqueIDBDatabase.cpp */,
</span><span class="cx">                                 518864DF1BBAF30F00E540C9 /* UniqueIDBDatabase.h */,
</span><span class="cx">                                 5198F7A21BBDAA2900E2CC5F /* UniqueIDBDatabaseConnection.cpp */,
</span><span class="lines">@@ -24899,6 +24905,7 @@
</span><span class="cx">                                 85031B3E0A44EFC700F992E0 /* DataTransfer.h in Headers */,
</span><span class="cx">                                 4B8AF4AA0B1CE02B00687690 /* DataTransferAccessPolicy.h in Headers */,
</span><span class="cx">                                 81AC5999131636E60009A7E0 /* DataTransferItem.h in Headers */,
</span><ins>+                                51771DFF1BDB485000CAE8E4 /* MemoryObjectStore.h in Headers */,
</ins><span class="cx">                                 81AC599A131636E60009A7E0 /* DataTransferItemList.h in Headers */,
</span><span class="cx">                                 E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */,
</span><span class="cx">                                 E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */,
</span><span class="lines">@@ -28539,6 +28546,7 @@
</span><span class="cx">                                 BCC0657D0F3CE1B700CD2D87 /* ClientRect.cpp in Sources */,
</span><span class="cx">                                 BCC065800F3CE1B700CD2D87 /* ClientRectList.cpp in Sources */,
</span><span class="cx">                                 85031B3F0A44EFC700F992E0 /* ClipboardEvent.cpp in Sources */,
</span><ins>+                                51771DFE1BDB485000CAE8E4 /* MemoryObjectStore.cpp in Sources */,
</ins><span class="cx">                                 580371611A66F00A00BAF519 /* ClipRect.cpp in Sources */,
</span><span class="cx">                                 CDEA76351460B71A008B31F1 /* Clock.cpp in Sources */,
</span><span class="cx">                                 CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>