<!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>[194857] 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/194857">194857</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-01-11 09:39:25 -0800 (Mon, 11 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: Make MemoryIndex and MemoryObjectStore RefCounted.
https://bugs.webkit.org/show_bug.cgi?id=152966
Reviewed by Alex Christensen.
No new tests (Refactor, no change in behavior)
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::indexDeleted):
(WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreDeleted):
(WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore):
(WebCore::IDBServer::MemoryIDBBackingStore::deleteObjectStore):
(WebCore::IDBServer::MemoryIDBBackingStore::restoreObjectStoreForVersionChangeAbort):
(WebCore::IDBServer::MemoryIDBBackingStore::registerObjectStore):
(WebCore::IDBServer::MemoryIDBBackingStore::takeObjectStoreByName):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryIndex.cpp:
(WebCore::IDBServer::MemoryIndex::create):
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::create):
(WebCore::IDBServer::MemoryObjectStore::createIndex):
(WebCore::IDBServer::MemoryObjectStore::maybeRestoreDeletedIndex):
(WebCore::IDBServer::MemoryObjectStore::takeIndexByName):
(WebCore::IDBServer::MemoryObjectStore::deleteIndex):
(WebCore::IDBServer::MemoryObjectStore::updateIndexesForDeleteRecord):
(WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
(WebCore::IDBServer::MemoryObjectStore::registerIndex):
* Modules/indexeddb/server/MemoryObjectStore.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCoreModulesindexeddbserverMemoryIndexcpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIndexh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h</a></li>
<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="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/ChangeLog        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2016-01-11 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: Make MemoryIndex and MemoryObjectStore RefCounted.
+ https://bugs.webkit.org/show_bug.cgi?id=152966
+
+ Reviewed by Alex Christensen.
+
+ No new tests (Refactor, no change in behavior)
+
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::indexDeleted):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreDeleted):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore):
+ (WebCore::IDBServer::MemoryIDBBackingStore::deleteObjectStore):
+ (WebCore::IDBServer::MemoryIDBBackingStore::restoreObjectStoreForVersionChangeAbort):
+ (WebCore::IDBServer::MemoryIDBBackingStore::registerObjectStore):
+ (WebCore::IDBServer::MemoryIDBBackingStore::takeObjectStoreByName):
+ * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+
+ * Modules/indexeddb/server/MemoryIndex.cpp:
+ (WebCore::IDBServer::MemoryIndex::create):
+ * Modules/indexeddb/server/MemoryIndex.h:
+
+ * Modules/indexeddb/server/MemoryObjectStore.cpp:
+ (WebCore::IDBServer::MemoryObjectStore::create):
+ (WebCore::IDBServer::MemoryObjectStore::createIndex):
+ (WebCore::IDBServer::MemoryObjectStore::maybeRestoreDeletedIndex):
+ (WebCore::IDBServer::MemoryObjectStore::takeIndexByName):
+ (WebCore::IDBServer::MemoryObjectStore::deleteIndex):
+ (WebCore::IDBServer::MemoryObjectStore::updateIndexesForDeleteRecord):
+ (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
+ (WebCore::IDBServer::MemoryObjectStore::registerIndex):
+ * Modules/indexeddb/server/MemoryObjectStore.h:
+
</ins><span class="cx"> 2016-01-11 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix other builds after my MSVC build fix. :-|
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -86,10 +86,9 @@
</span><span class="cx"> m_indexes.add(&index);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MemoryBackingStoreTransaction::indexDeleted(std::unique_ptr<MemoryIndex> index)
</del><ins>+void MemoryBackingStoreTransaction::indexDeleted(Ref<MemoryIndex>&& index)
</ins><span class="cx"> {
</span><del>- ASSERT(index);
- m_indexes.remove(index.get());
</del><ins>+ m_indexes.remove(&index.get());
</ins><span class="cx">
</span><span class="cx"> auto addResult = m_deletedIndexes.add(index->info().name(), nullptr);
</span><span class="cx"> if (addResult.isNewEntry)
</span><span class="lines">@@ -110,11 +109,10 @@
</span><span class="cx"> m_originalKeyGenerators.add(&objectStore, objectStore.currentKeyGeneratorValue());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MemoryBackingStoreTransaction::objectStoreDeleted(std::unique_ptr<MemoryObjectStore> objectStore)
</del><ins>+void MemoryBackingStoreTransaction::objectStoreDeleted(Ref<MemoryObjectStore>&& objectStore)
</ins><span class="cx"> {
</span><del>- ASSERT(objectStore);
- ASSERT(m_objectStores.contains(objectStore.get()));
- m_objectStores.remove(objectStore.get());
</del><ins>+ ASSERT(m_objectStores.contains(&objectStore.get()));
+ m_objectStores.remove(&objectStore.get());
</ins><span class="cx">
</span><span class="cx"> objectStore->deleteAllIndexes(*this);
</span><span class="cx">
</span><span class="lines">@@ -182,17 +180,11 @@
</span><span class="cx">
</span><span class="cx"> TemporaryChange<bool> change(m_isAborting, true);
</span><span class="cx">
</span><del>- // This loop moves the underlying unique_ptrs from out of the m_deletedObjectStores map,
- // but the entries in the map still remain.
</del><span class="cx"> for (auto& objectStore : m_deletedObjectStores.values()) {
</span><del>- MemoryObjectStore* rawObjectStore = objectStore.get();
- m_backingStore.restoreObjectStoreForVersionChangeAbort(WTFMove(objectStore));
-
- ASSERT(!m_objectStores.contains(rawObjectStore));
- m_objectStores.add(rawObjectStore);
</del><ins>+ m_backingStore.restoreObjectStoreForVersionChangeAbort(*objectStore);
+ ASSERT(!m_objectStores.contains(objectStore.get()));
+ m_objectStores.add(objectStore);
</ins><span class="cx"> }
</span><del>-
- // This clears the entries from the map.
</del><span class="cx"> m_deletedObjectStores.clear();
</span><span class="cx">
</span><span class="cx"> if (m_originalDatabaseInfo) {
</span><span class="lines">@@ -206,17 +198,17 @@
</span><span class="cx"> iterator.key->replaceIndexValueStore(WTFMove(iterator.value));
</span><span class="cx"> m_clearedIndexValueStores.clear();
</span><span class="cx">
</span><del>- for (auto objectStore : m_objectStores) {
- ASSERT(m_originalKeyGenerators.contains(objectStore));
- objectStore->setKeyGeneratorValue(m_originalKeyGenerators.get(objectStore));
</del><ins>+ for (auto& objectStore : m_objectStores) {
+ ASSERT(m_originalKeyGenerators.contains(objectStore.get()));
+ objectStore->setKeyGeneratorValue(m_originalKeyGenerators.get(objectStore.get()));
</ins><span class="cx">
</span><del>- auto clearedKeyValueMap = m_clearedKeyValueMaps.take(objectStore);
</del><ins>+ auto clearedKeyValueMap = m_clearedKeyValueMaps.take(objectStore.get());
</ins><span class="cx"> if (clearedKeyValueMap) {
</span><del>- ASSERT(m_clearedOrderedKeys.contains(objectStore));
- objectStore->replaceKeyValueStore(WTFMove(clearedKeyValueMap), m_clearedOrderedKeys.take(objectStore));
</del><ins>+ ASSERT(m_clearedOrderedKeys.contains(objectStore.get()));
+ objectStore->replaceKeyValueStore(WTFMove(clearedKeyValueMap), m_clearedOrderedKeys.take(objectStore.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- auto keyValueMap = m_originalValues.take(objectStore);
</del><ins>+ auto keyValueMap = m_originalValues.take(objectStore.get());
</ins><span class="cx"> if (!keyValueMap)
</span><span class="cx"> continue;
</span><span class="cx">
</span><span class="lines">@@ -226,14 +218,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // This loop moves the underlying unique_ptrs from out of the m_deletedIndexes map,
- // but the entries in the map still remain.
- for (auto& index : m_deletedIndexes.values()) {
- MemoryObjectStore& objectStore = index->objectStore();
- objectStore.maybeRestoreDeletedIndex(WTFMove(index));
- }
-
- // This clears the entries from the map.
</del><ins>+ for (auto& index : m_deletedIndexes.values())
+ index->objectStore().maybeRestoreDeletedIndex(*index);
</ins><span class="cx"> m_deletedIndexes.clear();
</span><span class="cx">
</span><span class="cx"> finish();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -62,13 +62,13 @@
</span><span class="cx"> void addExistingObjectStore(MemoryObjectStore&);
</span><span class="cx">
</span><span class="cx"> void recordValueChanged(MemoryObjectStore&, const IDBKeyData&, ThreadSafeDataBuffer*);
</span><del>- void objectStoreDeleted(std::unique_ptr<MemoryObjectStore>);
</del><ins>+ void objectStoreDeleted(Ref<MemoryObjectStore>&&);
</ins><span class="cx"> void objectStoreCleared(MemoryObjectStore&, std::unique_ptr<KeyValueMap>&&, std::unique_ptr<std::set<IDBKeyData>>&&);
</span><span class="cx"> void indexCleared(MemoryIndex&, std::unique_ptr<IndexValueStore>&&);
</span><span class="cx">
</span><span class="cx"> void addNewIndex(MemoryIndex&);
</span><span class="cx"> void addExistingIndex(MemoryIndex&);
</span><del>- void indexDeleted(std::unique_ptr<MemoryIndex>);
</del><ins>+ void indexDeleted(Ref<MemoryIndex>&&);
</ins><span class="cx">
</span><span class="cx"> void abort();
</span><span class="cx"> void commit();
</span><span class="lines">@@ -86,14 +86,14 @@
</span><span class="cx"> bool m_inProgress { true };
</span><span class="cx"> bool m_isAborting { false };
</span><span class="cx">
</span><del>- HashSet<MemoryObjectStore*> m_objectStores;
- HashSet<MemoryObjectStore*> m_versionChangeAddedObjectStores;
- HashSet<MemoryIndex*> m_indexes;
- HashSet<MemoryIndex*> m_versionChangeAddedIndexes;
</del><ins>+ HashSet<RefPtr<MemoryObjectStore>> m_objectStores;
+ HashSet<RefPtr<MemoryObjectStore>> m_versionChangeAddedObjectStores;
+ HashSet<RefPtr<MemoryIndex>> m_indexes;
+ HashSet<RefPtr<MemoryIndex>> m_versionChangeAddedIndexes;
</ins><span class="cx">
</span><span class="cx"> HashMap<MemoryObjectStore*, uint64_t> m_originalKeyGenerators;
</span><del>- HashMap<String, std::unique_ptr<MemoryObjectStore>> m_deletedObjectStores;
- HashMap<String, std::unique_ptr<MemoryIndex>> m_deletedIndexes;
</del><ins>+ HashMap<String, RefPtr<MemoryObjectStore>> m_deletedObjectStores;
+ HashMap<String, RefPtr<MemoryIndex>> m_deletedIndexes;
</ins><span class="cx"> HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_originalValues;
</span><span class="cx"> HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_clearedKeyValueMaps;
</span><span class="cx"> HashMap<MemoryObjectStore*, std::unique_ptr<std::set<IDBKeyData>>> m_clearedOrderedKeys;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx"> ASSERT(rawTransaction);
</span><span class="cx"> ASSERT(rawTransaction->isVersionChange());
</span><span class="cx">
</span><del>- rawTransaction->addNewObjectStore(*objectStore);
</del><ins>+ rawTransaction->addNewObjectStore(objectStore.get());
</ins><span class="cx"> registerObjectStore(WTFMove(objectStore));
</span><span class="cx">
</span><span class="cx"> return IDBError();
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx"> return IDBError(IDBDatabaseException::ConstraintError);
</span><span class="cx">
</span><span class="cx"> m_databaseInfo->deleteObjectStore(objectStoreName);
</span><del>- transaction->objectStoreDeleted(WTFMove(objectStore));
</del><ins>+ transaction->objectStoreDeleted(*objectStore);
</ins><span class="cx">
</span><span class="cx"> return IDBError();
</span><span class="cx"> }
</span><span class="lines">@@ -226,7 +226,7 @@
</span><span class="cx"> unregisterObjectStore(objectStore);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MemoryIDBBackingStore::restoreObjectStoreForVersionChangeAbort(std::unique_ptr<MemoryObjectStore>&& objectStore)
</del><ins>+void MemoryIDBBackingStore::restoreObjectStoreForVersionChangeAbort(Ref<MemoryObjectStore>&& objectStore)
</ins><span class="cx"> {
</span><span class="cx"> registerObjectStore(WTFMove(objectStore));
</span><span class="cx"> }
</span><span class="lines">@@ -428,13 +428,12 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MemoryIDBBackingStore::registerObjectStore(std::unique_ptr<MemoryObjectStore>&& objectStore)
</del><ins>+void MemoryIDBBackingStore::registerObjectStore(Ref<MemoryObjectStore>&& objectStore)
</ins><span class="cx"> {
</span><del>- ASSERT(objectStore);
</del><span class="cx"> ASSERT(!m_objectStoresByIdentifier.contains(objectStore->info().identifier()));
</span><span class="cx"> ASSERT(!m_objectStoresByName.contains(objectStore->info().name()));
</span><span class="cx">
</span><del>- m_objectStoresByName.set(objectStore->info().name(), objectStore.get());
</del><ins>+ m_objectStoresByName.set(objectStore->info().name(), &objectStore.get());
</ins><span class="cx"> m_objectStoresByIdentifier.set(objectStore->info().identifier(), WTFMove(objectStore));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -447,13 +446,13 @@
</span><span class="cx"> m_objectStoresByIdentifier.remove(objectStore.info().identifier());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<MemoryObjectStore> MemoryIDBBackingStore::takeObjectStoreByName(const String& name)
</del><ins>+RefPtr<MemoryObjectStore> MemoryIDBBackingStore::takeObjectStoreByName(const String& name)
</ins><span class="cx"> {
</span><del>- auto rawObjectStore = m_objectStoresByName.take(name);
- if (!rawObjectStore)
</del><ins>+ auto objectStoreByName = m_objectStoresByName.take(name);
+ if (!objectStoreByName)
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- auto objectStore = m_objectStoresByIdentifier.take(rawObjectStore->info().identifier());
</del><ins>+ auto objectStore = m_objectStoresByIdentifier.take(objectStoreByName->info().identifier());
</ins><span class="cx"> ASSERT(objectStore);
</span><span class="cx">
</span><span class="cx"> return objectStore;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -71,21 +71,21 @@
</span><span class="cx"> virtual void deleteBackingStore() override final;
</span><span class="cx">
</span><span class="cx"> void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&);
</span><del>- void restoreObjectStoreForVersionChangeAbort(std::unique_ptr<MemoryObjectStore>&&);
</del><ins>+ void restoreObjectStoreForVersionChangeAbort(Ref<MemoryObjectStore>&&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> MemoryIDBBackingStore(const IDBDatabaseIdentifier&);
</span><span class="cx">
</span><del>- std::unique_ptr<MemoryObjectStore> takeObjectStoreByName(const String& name);
</del><ins>+ RefPtr<MemoryObjectStore> takeObjectStoreByName(const String& name);
</ins><span class="cx">
</span><span class="cx"> IDBDatabaseIdentifier m_identifier;
</span><span class="cx"> std::unique_ptr<IDBDatabaseInfo> m_databaseInfo;
</span><span class="cx">
</span><span class="cx"> HashMap<IDBResourceIdentifier, std::unique_ptr<MemoryBackingStoreTransaction>> m_transactions;
</span><span class="cx">
</span><del>- void registerObjectStore(std::unique_ptr<MemoryObjectStore>&&);
</del><ins>+ void registerObjectStore(Ref<MemoryObjectStore>&&);
</ins><span class="cx"> void unregisterObjectStore(MemoryObjectStore&);
</span><del>- HashMap<uint64_t, std::unique_ptr<MemoryObjectStore>> m_objectStoresByIdentifier;
</del><ins>+ HashMap<uint64_t, RefPtr<MemoryObjectStore>> m_objectStoresByIdentifier;
</ins><span class="cx"> HashMap<String, MemoryObjectStore*> m_objectStoresByName;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIndexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -40,9 +40,9 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="cx">
</span><del>-std::unique_ptr<MemoryIndex> MemoryIndex::create(const IDBIndexInfo& info, MemoryObjectStore& objectStore)
</del><ins>+Ref<MemoryIndex> MemoryIndex::create(const IDBIndexInfo& info, MemoryObjectStore& objectStore)
</ins><span class="cx"> {
</span><del>- return std::make_unique<MemoryIndex>(info, objectStore);
</del><ins>+ return adoptRef(*new MemoryIndex(info, objectStore));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MemoryIndex::MemoryIndex(const IDBIndexInfo& info, MemoryObjectStore& objectStore)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIndexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "MemoryIndexCursor.h"
</span><span class="cx"> #include <set>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/RefCounted.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -53,10 +54,9 @@
</span><span class="cx"> class MemoryBackingStoreTransaction;
</span><span class="cx"> class MemoryObjectStore;
</span><span class="cx">
</span><del>-class MemoryIndex {
- friend std::unique_ptr<MemoryIndex> std::make_unique<MemoryIndex>(const WebCore::IDBIndexInfo&, WebCore::IDBServer::MemoryObjectStore&);
</del><ins>+class MemoryIndex : public RefCounted<MemoryIndex> {
</ins><span class="cx"> public:
</span><del>- static std::unique_ptr<MemoryIndex> create(const IDBIndexInfo&, MemoryObjectStore&);
</del><ins>+ static Ref<MemoryIndex> create(const IDBIndexInfo&, MemoryObjectStore&);
</ins><span class="cx">
</span><span class="cx"> ~MemoryIndex();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="cx">
</span><del>-std::unique_ptr<MemoryObjectStore> MemoryObjectStore::create(const IDBObjectStoreInfo& info)
</del><ins>+Ref<MemoryObjectStore> MemoryObjectStore::create(const IDBObjectStoreInfo& info)
</ins><span class="cx"> {
</span><del>- return std::make_unique<MemoryObjectStore>(info);
</del><ins>+ return adoptRef(*new MemoryObjectStore(info));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MemoryObjectStore::MemoryObjectStore(const IDBObjectStoreInfo& info)
</span><span class="lines">@@ -92,23 +92,21 @@
</span><span class="cx"> auto index = MemoryIndex::create(info, *this);
</span><span class="cx">
</span><span class="cx"> // If there was an error populating the new index, then the current records in the object store violate its contraints
</span><del>- auto error = populateIndexWithExistingRecords(*index);
</del><ins>+ auto error = populateIndexWithExistingRecords(index.get());
</ins><span class="cx"> if (!error.isNull())
</span><span class="cx"> return error;
</span><span class="cx">
</span><span class="cx"> m_info.addExistingIndex(info);
</span><del>- transaction.addNewIndex(*index);
</del><ins>+ transaction.addNewIndex(index.get());
</ins><span class="cx"> registerIndex(WTFMove(index));
</span><span class="cx">
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MemoryObjectStore::maybeRestoreDeletedIndex(std::unique_ptr<MemoryIndex> index)
</del><ins>+void MemoryObjectStore::maybeRestoreDeletedIndex(Ref<MemoryIndex>&& index)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "MemoryObjectStore::maybeRestoreDeletedIndex");
</span><span class="cx">
</span><del>- ASSERT(index);
-
</del><span class="cx"> if (m_info.hasIndex(index->info().name()))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -116,7 +114,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(!m_indexesByIdentifier.contains(index->info().identifier()));
</span><span class="cx"> index->clearIndexValueStore();
</span><del>- auto error = populateIndexWithExistingRecords(*index);
</del><ins>+ auto error = populateIndexWithExistingRecords(index.get());
</ins><span class="cx">
</span><span class="cx"> // Since this index was installed in the object store before this transaction started,
</span><span class="cx"> // assuming things were in a valid state then, we should definitely be able to successfully
</span><span class="lines">@@ -126,13 +124,13 @@
</span><span class="cx"> registerIndex(WTFMove(index));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<MemoryIndex> MemoryObjectStore::takeIndexByName(const String& name)
</del><ins>+RefPtr<MemoryIndex> MemoryObjectStore::takeIndexByName(const String& name)
</ins><span class="cx"> {
</span><del>- auto rawIndex = m_indexesByName.take(name);
- if (!rawIndex)
</del><ins>+ auto indexByName = m_indexesByName.take(name);
+ if (!indexByName)
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- auto index = m_indexesByIdentifier.take(rawIndex->info().identifier());
</del><ins>+ auto index = m_indexesByIdentifier.take(indexByName->info().identifier());
</ins><span class="cx"> ASSERT(index);
</span><span class="cx">
</span><span class="cx"> return index;
</span><span class="lines">@@ -151,7 +149,7 @@
</span><span class="cx"> return IDBError(IDBDatabaseException::ConstraintError);
</span><span class="cx">
</span><span class="cx"> m_info.deleteIndex(indexName);
</span><del>- transaction.indexDeleted(WTFMove(index));
</del><ins>+ transaction.indexDeleted(*index);
</ins><span class="cx">
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="lines">@@ -294,7 +292,7 @@
</span><span class="cx">
</span><span class="cx"> void MemoryObjectStore::updateIndexesForDeleteRecord(const IDBKeyData& value)
</span><span class="cx"> {
</span><del>- for (auto* index : m_indexesByName.values())
</del><ins>+ for (auto& index : m_indexesByName.values())
</ins><span class="cx"> index->removeEntriesWithValueKey(value);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -309,7 +307,7 @@
</span><span class="cx"> IDBError error;
</span><span class="cx"> Vector<std::pair<MemoryIndex*, IndexKey>> changedIndexRecords;
</span><span class="cx">
</span><del>- for (auto* index : m_indexesByName.values()) {
</del><ins>+ for (auto& index : m_indexesByName.values()) {
</ins><span class="cx"> IndexKey indexKey;
</span><span class="cx"> generateIndexKeyForValue(UniqueIDBDatabase::databaseThreadExecState(), index->info(), jsValue, indexKey);
</span><span class="cx">
</span><span class="lines">@@ -320,7 +318,7 @@
</span><span class="cx"> if (!error.isNull())
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- changedIndexRecords.append(std::make_pair(index, indexKey));
</del><ins>+ changedIndexRecords.append(std::make_pair(index.get(), indexKey));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If any of the index puts failed, revert all of the ones that went through.
</span><span class="lines">@@ -446,13 +444,12 @@
</span><span class="cx"> return *lowestInRange;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MemoryObjectStore::registerIndex(std::unique_ptr<MemoryIndex>&& index)
</del><ins>+void MemoryObjectStore::registerIndex(Ref<MemoryIndex>&& index)
</ins><span class="cx"> {
</span><del>- ASSERT(index);
</del><span class="cx"> ASSERT(!m_indexesByIdentifier.contains(index->info().identifier()));
</span><span class="cx"> ASSERT(!m_indexesByName.contains(index->info().name()));
</span><span class="cx">
</span><del>- m_indexesByName.set(index->info().name(), index.get());
</del><ins>+ m_indexesByName.set(index->info().name(), &index.get());
</ins><span class="cx"> m_indexesByIdentifier.set(index->info().identifier(), WTFMove(index));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (194856 => 194857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2016-01-11 17:25:03 UTC (rev 194856)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2016-01-11 17:39:25 UTC (rev 194857)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "ThreadSafeDataBuffer.h"
</span><span class="cx"> #include <set>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/RefCounted.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -54,10 +55,9 @@
</span><span class="cx">
</span><span class="cx"> typedef HashMap<IDBKeyData, ThreadSafeDataBuffer, IDBKeyDataHash, IDBKeyDataHashTraits> KeyValueMap;
</span><span class="cx">
</span><del>-class MemoryObjectStore {
- friend std::unique_ptr<MemoryObjectStore> std::make_unique<MemoryObjectStore>(const WebCore::IDBObjectStoreInfo&);
</del><ins>+class MemoryObjectStore : public RefCounted<MemoryObjectStore> {
</ins><span class="cx"> public:
</span><del>- static std::unique_ptr<MemoryObjectStore> create(const IDBObjectStoreInfo&);
</del><ins>+ static Ref<MemoryObjectStore> create(const IDBObjectStoreInfo&);
</ins><span class="cx">
</span><span class="cx"> ~MemoryObjectStore();
</span><span class="cx">
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> IDBError createIndex(MemoryBackingStoreTransaction&, const IDBIndexInfo&);
</span><span class="cx"> IDBError deleteIndex(MemoryBackingStoreTransaction&, const String& indexName);
</span><span class="cx"> void deleteAllIndexes(MemoryBackingStoreTransaction&);
</span><del>- void registerIndex(std::unique_ptr<MemoryIndex>&&);
</del><ins>+ void registerIndex(Ref<MemoryIndex>&&);
</ins><span class="cx">
</span><span class="cx"> bool containsRecord(const IDBKeyData&);
</span><span class="cx"> void deleteRecord(const IDBKeyData&);
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx">
</span><span class="cx"> MemoryIndex* indexForIdentifier(uint64_t);
</span><span class="cx">
</span><del>- void maybeRestoreDeletedIndex(std::unique_ptr<MemoryIndex>);
</del><ins>+ void maybeRestoreDeletedIndex(Ref<MemoryIndex>&&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> MemoryObjectStore(const IDBObjectStoreInfo&);
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx"> void updateCursorsForPutRecord(std::set<IDBKeyData>::iterator);
</span><span class="cx"> void updateCursorsForDeleteRecord(const IDBKeyData&);
</span><span class="cx">
</span><del>- std::unique_ptr<MemoryIndex> takeIndexByName(const String& name);
</del><ins>+ RefPtr<MemoryIndex> takeIndexByName(const String& name);
</ins><span class="cx">
</span><span class="cx"> IDBObjectStoreInfo m_info;
</span><span class="cx">
</span><span class="lines">@@ -119,8 +119,8 @@
</span><span class="cx"> std::unique_ptr<std::set<IDBKeyData>> m_orderedKeys;
</span><span class="cx">
</span><span class="cx"> void unregisterIndex(MemoryIndex&);
</span><del>- HashMap<uint64_t, std::unique_ptr<MemoryIndex>> m_indexesByIdentifier;
- HashMap<String, MemoryIndex*> m_indexesByName;
</del><ins>+ HashMap<uint64_t, RefPtr<MemoryIndex>> m_indexesByIdentifier;
+ HashMap<String, RefPtr<MemoryIndex>> m_indexesByName;
</ins><span class="cx"> HashMap<IDBResourceIdentifier, std::unique_ptr<MemoryObjectStoreCursor>> m_cursors;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>