<!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>[196518] 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/196518">196518</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-02-12 15:01:20 -0800 (Fri, 12 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: Simplify the relationship between IDBObjectStore and IDBIndex.
https://bugs.webkit.org/show_bug.cgi?id=154187

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/deleteindex-3-private.html
       storage/indexeddb/modern/deleteindex-3.html

Instead of allowing IDBIndex to have two different lifecycle modes, it is now always
owned by an IDBObjectStore.

To support the case where an IDBIndex is deleted from its IDBObjectStore, the object
store simply hangs on to deleted indexes until it is destroyed itself.

* Modules/indexeddb/client/IDBIndexImpl.cpp:
(WebCore::IDBClient::IDBIndex::markAsDeleted):
(WebCore::IDBClient::IDBIndex::ref):
(WebCore::IDBClient::IDBIndex::deref):
* Modules/indexeddb/client/IDBIndexImpl.h:

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::deleteIndex):
* Modules/indexeddb/client/IDBObjectStoreImpl.h:

LayoutTests:

* storage/indexeddb/modern/deleteindex-3-expected.txt: Added.
* storage/indexeddb/modern/deleteindex-3-private-expected.txt: Added.
* storage/indexeddb/modern/deleteindex-3-private.html: Added.
* storage/indexeddb/modern/deleteindex-3.html: Added.
* storage/indexeddb/modern/resources/deleteindex-3.js: 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="#trunkSourceWebCoreModulesindexeddbclientIDBIndexImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBIndexImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex3expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex3privateexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex3privatehtml">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex3html">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcesdeleteindex3js">trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-3.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (196517 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-02-12 22:44:22 UTC (rev 196517)
+++ trunk/LayoutTests/ChangeLog        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-02-12  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Simplify the relationship between IDBObjectStore and IDBIndex.
+        https://bugs.webkit.org/show_bug.cgi?id=154187
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/deleteindex-3-expected.txt: Added.
+        * storage/indexeddb/modern/deleteindex-3-private-expected.txt: Added.
+        * storage/indexeddb/modern/deleteindex-3-private.html: Added.
+        * storage/indexeddb/modern/deleteindex-3.html: Added.
+        * storage/indexeddb/modern/resources/deleteindex-3.js: Added.
+
</ins><span class="cx"> 2016-02-12  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Implement @@search
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex3expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-expected.txt (0 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-expected.txt        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+This tests creating an index, deleting it, creating a new one with the same name, and making sure those two indexes aren't equal.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+First and Second indexes are the same: false
+First index keyPath: foo
+Second index keyPath: bar
+First index unique: false
+Second index unique: true
+First index references back to objectStore: true
+Second index references back to objectStore: true
+objectStore's index for 'FooIndex' is equal to first index: false
+objectStore's index for 'FooIndex' is equal to second index: true
+Initial upgrade versionchange transaction complete
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex3privateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private-expected.txt (0 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private-expected.txt        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+This tests creating an index, deleting it, creating a new one with the same name, and making sure those two indexes aren't equal.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+First and Second indexes are the same: false
+First index keyPath: foo
+Second index keyPath: bar
+First index unique: false
+Second index unique: true
+First index references back to objectStore: true
+Second index references back to objectStore: true
+objectStore's index for 'FooIndex' is equal to first index: false
+objectStore's index for 'FooIndex' is equal to second index: true
+Initial upgrade versionchange transaction complete
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex3privatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private.html (0 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3-private.html        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+enablePrivateBrowsing = true;
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/shared.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;resources/deleteindex-3.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex3html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3.html (0 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-3.html        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../resources/js-test.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/shared.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;resources/deleteindex-3.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcesdeleteindex3js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-3.js (0 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-3.js                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/deleteindex-3.js        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+description(&quot;This tests creating an index, deleting it, creating a new one with the same name, and making sure those two indexes aren't equal.&quot;);
+
+indexedDBTest(prepareDatabase);
+
+function prepareDatabase(event)
+{
+    var versionTransaction = event.target.transaction;
+    var database = event.target.result;
+    var objectStore = database.createObjectStore(&quot;TestObjectStore&quot;);
+    objectStore.put({ foo: &quot;a&quot;, bar: &quot;A&quot; }, 1);
+    objectStore.put({ foo: &quot;b&quot;, bar: &quot;B&quot; }, 2);
+
+    var index1 = objectStore.createIndex(&quot;FooIndex&quot;, &quot;foo&quot;);
+    objectStore.deleteIndex(&quot;FooIndex&quot;);
+    var index2 = objectStore.createIndex(&quot;FooIndex&quot;, &quot;bar&quot;, { unique: true });
+
+    debug(&quot;First and Second indexes are the same: &quot; + (index1 == index2));
+    debug(&quot;First index keyPath: &quot; + index1.keyPath);
+    debug(&quot;Second index keyPath: &quot; + index2.keyPath);
+    debug(&quot;First index unique: &quot; + index1.unique);
+    debug(&quot;Second index unique: &quot; + index2.unique);
+    debug(&quot;First index references back to objectStore: &quot; + (index1.objectStore == objectStore));
+    debug(&quot;Second index references back to objectStore: &quot; + (index2.objectStore == objectStore));
+    debug(&quot;objectStore's index for 'FooIndex' is equal to first index: &quot; + (objectStore.index(&quot;FooIndex&quot;) == index1));
+    debug(&quot;objectStore's index for 'FooIndex' is equal to second index: &quot; + (objectStore.index(&quot;FooIndex&quot;) == index2));
+    
+    versionTransaction.onabort = function(event) {
+        debug(&quot;Initial upgrade versionchange transaction unexpected abort&quot;);
+        finishJSTest();
+    }
+
+    versionTransaction.oncomplete = function(event) {
+        debug(&quot;Initial upgrade versionchange transaction complete&quot;);
+        finishJSTest();
+    }
+
+    versionTransaction.onerror = function(event) {
+        debug(&quot;Initial upgrade versionchange transaction unexpected error&quot; + event);
+        finishJSTest();
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (196517 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-02-12 22:44:22 UTC (rev 196517)
+++ trunk/Source/WebCore/ChangeLog        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-02-12  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Simplify the relationship between IDBObjectStore and IDBIndex.
+        https://bugs.webkit.org/show_bug.cgi?id=154187
+
+        Reviewed by Alex Christensen.
+
+        Tests: storage/indexeddb/modern/deleteindex-3-private.html
+               storage/indexeddb/modern/deleteindex-3.html
+
+        Instead of allowing IDBIndex to have two different lifecycle modes, it is now always
+        owned by an IDBObjectStore.
+        
+        To support the case where an IDBIndex is deleted from its IDBObjectStore, the object
+        store simply hangs on to deleted indexes until it is destroyed itself.
+        
+        * Modules/indexeddb/client/IDBIndexImpl.cpp:
+        (WebCore::IDBClient::IDBIndex::markAsDeleted):
+        (WebCore::IDBClient::IDBIndex::ref):
+        (WebCore::IDBClient::IDBIndex::deref):
+        * Modules/indexeddb/client/IDBIndexImpl.h:
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::deleteIndex):
+        * Modules/indexeddb/client/IDBObjectStoreImpl.h:
+
</ins><span class="cx"> 2016-02-12  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Font Loading] Implement CSSFontFace Boilerplate
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBIndexImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp (196517 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp        2016-02-12 22:44:22 UTC (rev 196517)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -339,49 +339,20 @@
</span><span class="cx">     return transaction.requestGetKey(context, *this, range);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IDBIndex::markAsDeleted(std::unique_ptr&lt;IDBIndex&gt;&amp;&amp; indexOwner)
</del><ins>+void IDBIndex::markAsDeleted()
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!m_deleted);
</span><del>-    ASSERT(!m_selfOwner);
-    ASSERT(indexOwner.get() == this);
-
-    // If nobody was keeping a ref to this IDBIndex while under IDBObjectStore ownership,
-    // it can be deleted now by letting indexOwner go out of scope.
-    if (!m_refCount)
-        return;
-
-    m_selfOwner = WTFMove(indexOwner);
-
-    // Now that the IDBIndex is managing its own lifetime, it must ref() its IDBObjectStore to keep it alive.
-    m_objectStoreRef = &amp;m_objectStore;
-
-    // It must undo all of the refs it had previously given its IDBObjectStore when the lifetimes were intertwined.
-    for (unsigned i = m_refCount; i &gt; 0; --i)
-        m_objectStore.deref();
-
</del><span class="cx">     m_deleted = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBIndex::ref()
</span><span class="cx"> {
</span><del>-    ++m_refCount;
-
-    if (!m_deleted)
-        m_objectStore.ref();
</del><ins>+    m_objectStore.ref();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBIndex::deref()
</span><span class="cx"> {
</span><del>-    --m_refCount;
-
-    if (!m_deleted)
-        m_objectStore.deref();
-    else {
-        // This IDBIndex has been detached from its IDBObjectStore so if its RefCount
-        // just went to 0 it should be destroyed.
-        if (!m_refCount)
-            m_selfOwner = nullptr;
-    }
</del><ins>+    m_objectStore.deref();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBClient
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBIndexImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h (196517 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h        2016-02-12 22:44:22 UTC (rev 196517)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> 
</span><span class="cx">     IDBObjectStore&amp; modernObjectStore() { return m_objectStore; }
</span><span class="cx"> 
</span><del>-    void markAsDeleted(std::unique_ptr&lt;IDBIndex&gt;&amp;&amp;);
</del><ins>+    void markAsDeleted();
</ins><span class="cx">     bool isDeleted() const { return m_deleted; }
</span><span class="cx"> 
</span><span class="cx">     virtual bool isModern() const override { return true; }
</span><span class="lines">@@ -96,19 +96,9 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_deleted { false };
</span><span class="cx"> 
</span><del>-    // Most of the time, an IDBObjectStore owns an IDBIndex through a std::unique_ptr.
-    // In that scenario, attempts to ref() the IDBIndex directly ref the IDBObjectStore, so it is okay to
-    // keep a raw reference to the IDBObjectStore because it will always outlive the IDBIndex.
</del><ins>+    // IDBIndex objects are always owned by their referencing IDBObjectStore.
+    // Indexes will never outlive ObjectStores so its okay to keep a raw C++ reference here.
</ins><span class="cx">     IDBObjectStore&amp; m_objectStore;
</span><del>-
-    // But when an IDBIndex is deleted from its IDBObjectStore that lifetime is no longer guaranteed.
-    // The IDBObjectStore no longer owns the IDBIndex, so the following needs to change:
-    // 1 - The IDBIndex must directly ref its IDBObjectStore to keep it alive.
-    // 2 - The IDBIndex becomes traditionally RefCounted.
-    // 2 - The IDBIndex holds its own std::unique_ptr, which it will clear out when its RefCount reaches 0.
-    RefPtr&lt;IDBObjectStore&gt; m_objectStoreRef;
-    unsigned m_refCount { 0 };
-    std::unique_ptr&lt;IDBIndex&gt; m_selfOwner;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBClient
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (196517 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2016-02-12 22:44:22 UTC (rev 196517)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -567,8 +567,11 @@
</span><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         Locker&lt;Lock&gt; locker(m_referencedIndexLock);
</span><del>-        if (auto index = m_referencedIndexes.take(name))
-            index-&gt;markAsDeleted(WTFMove(index));
</del><ins>+        if (auto index = m_referencedIndexes.take(name)) {
+            index-&gt;markAsDeleted();
+            m_deletedIndexes.add(WTFMove(index));
+        }
+
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_transaction-&gt;deleteIndex(m_info.identifier(), name);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h (196517 => 196518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h        2016-02-12 22:44:22 UTC (rev 196517)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h        2016-02-12 23:01:20 UTC (rev 196518)
</span><span class="lines">@@ -117,6 +117,7 @@
</span><span class="cx"> 
</span><span class="cx">     mutable Lock m_referencedIndexLock;
</span><span class="cx">     HashMap&lt;String, std::unique_ptr&lt;IDBIndex&gt;&gt; m_referencedIndexes;
</span><ins>+    HashSet&lt;std::unique_ptr&lt;IDBIndex&gt;&gt; m_deletedIndexes;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace IDBClient
</span></span></pre>
</div>
</div>

</body>
</html>