<!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>[177813] trunk/Source</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/177813">177813</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-12-29 13:12:28 -0800 (Mon, 29 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move storage code from WebCore to WebKit
https://bugs.webkit.org/show_bug.cgi?id=139558
Reviewed by Darin Adler.
Source/WebCore:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* platform/MemoryPressureHandler.cpp:
Source/WebKit:
* Storage/StorageAreaImpl.cpp: Renamed from Source/WebCore/storage/StorageAreaImpl.cpp.
(WebCore::StorageAreaImpl::~StorageAreaImpl):
(WebCore::StorageAreaImpl::StorageAreaImpl):
(WebCore::StorageAreaImpl::create):
(WebCore::StorageAreaImpl::copy):
(WebCore::StorageAreaImpl::canAccessStorage):
(WebCore::StorageAreaImpl::storageType):
(WebCore::StorageAreaImpl::length):
(WebCore::StorageAreaImpl::key):
(WebCore::StorageAreaImpl::item):
(WebCore::StorageAreaImpl::setItem):
(WebCore::StorageAreaImpl::removeItem):
(WebCore::StorageAreaImpl::clear):
(WebCore::StorageAreaImpl::contains):
(WebCore::StorageAreaImpl::importItems):
(WebCore::StorageAreaImpl::close):
(WebCore::StorageAreaImpl::clearForOriginDeletion):
(WebCore::StorageAreaImpl::sync):
(WebCore::StorageAreaImpl::blockUntilImportComplete):
(WebCore::StorageAreaImpl::memoryBytesUsedByCache):
(WebCore::StorageAreaImpl::incrementAccessCount):
(WebCore::StorageAreaImpl::decrementAccessCount):
(WebCore::StorageAreaImpl::closeDatabaseTimerFired):
(WebCore::StorageAreaImpl::closeDatabaseIfIdle):
(WebCore::StorageAreaImpl::dispatchStorageEvent):
* Storage/StorageAreaImpl.h: Renamed from Source/WebCore/storage/StorageAreaImpl.h.
* Storage/StorageAreaSync.cpp: Renamed from Source/WebCore/storage/StorageAreaSync.cpp.
(WebCore::StorageAreaSync::StorageAreaSync):
(WebCore::StorageAreaSync::create):
(WebCore::StorageAreaSync::~StorageAreaSync):
(WebCore::StorageAreaSync::scheduleFinalSync):
(WebCore::StorageAreaSync::scheduleItemForSync):
(WebCore::StorageAreaSync::scheduleClear):
(WebCore::StorageAreaSync::scheduleCloseDatabase):
(WebCore::StorageAreaSync::syncTimerFired):
(WebCore::StorageAreaSync::openDatabase):
(WebCore::StorageAreaSync::migrateItemTableIfNeeded):
(WebCore::StorageAreaSync::performImport):
(WebCore::StorageAreaSync::markImported):
(WebCore::StorageAreaSync::blockUntilImportComplete):
(WebCore::StorageAreaSync::sync):
(WebCore::StorageAreaSync::performSync):
(WebCore::StorageAreaSync::deleteEmptyDatabase):
(WebCore::StorageAreaSync::scheduleSync):
* Storage/StorageAreaSync.h: Renamed from Source/WebCore/storage/StorageAreaSync.h.
* Storage/StorageNamespaceImpl.cpp: Renamed from Source/WebCore/storage/StorageNamespaceImpl.cpp.
(WebCore::localStorageNamespaceMap):
(WebCore::StorageNamespaceImpl::createSessionStorageNamespace):
(WebCore::StorageNamespaceImpl::getOrCreateLocalStorageNamespace):
(WebCore::StorageNamespaceImpl::StorageNamespaceImpl):
(WebCore::StorageNamespaceImpl::~StorageNamespaceImpl):
(WebCore::StorageNamespaceImpl::copy):
(WebCore::StorageNamespaceImpl::storageArea):
(WebCore::StorageNamespaceImpl::close):
(WebCore::StorageNamespaceImpl::clearOriginForDeletion):
(WebCore::StorageNamespaceImpl::clearAllOriginsForDeletion):
(WebCore::StorageNamespaceImpl::sync):
(WebCore::StorageNamespaceImpl::closeIdleLocalStorageDatabases):
* Storage/StorageNamespaceImpl.h: Renamed from Source/WebCore/storage/StorageNamespaceImpl.h.
* Storage/StorageSyncManager.cpp: Renamed from Source/WebCore/storage/StorageSyncManager.cpp.
(WebCore::StorageSyncManager::create):
(WebCore::StorageSyncManager::StorageSyncManager):
(WebCore::StorageSyncManager::~StorageSyncManager):
(WebCore::StorageSyncManager::fullDatabaseFilename):
(WebCore::StorageSyncManager::dispatch):
(WebCore::StorageSyncManager::close):
* Storage/StorageSyncManager.h: Renamed from Source/WebCore/storage/StorageSyncManager.h.
* Storage/StorageThread.cpp: Renamed from Source/WebCore/storage/StorageThread.cpp.
(WebCore::activeStorageThreads):
(WebCore::StorageThread::StorageThread):
(WebCore::StorageThread::~StorageThread):
(WebCore::StorageThread::start):
(WebCore::StorageThread::threadEntryPointCallback):
(WebCore::StorageThread::threadEntryPoint):
(WebCore::StorageThread::dispatch):
(WebCore::StorageThread::terminate):
(WebCore::StorageThread::performTerminate):
(WebCore::StorageThread::releaseFastMallocFreeMemoryInAllThreads):
* Storage/StorageThread.h: Renamed from Source/WebCore/storage/StorageThread.h.
* Storage/StorageTracker.cpp: Renamed from Source/WebCore/storage/StorageTracker.cpp.
(WebCore::StorageTracker::initializeTracker):
(WebCore::StorageTracker::internalInitialize):
(WebCore::StorageTracker::tracker):
(WebCore::StorageTracker::StorageTracker):
(WebCore::StorageTracker::setDatabaseDirectoryPath):
(WebCore::StorageTracker::databaseDirectoryPath):
(WebCore::StorageTracker::trackerDatabasePath):
(WebCore::ensureDatabaseFileExists):
(WebCore::StorageTracker::openTrackerDatabase):
(WebCore::StorageTracker::importOriginIdentifiers):
(WebCore::StorageTracker::finishedImportingOriginIdentifiers):
(WebCore::StorageTracker::syncImportOriginIdentifiers):
(WebCore::StorageTracker::syncFileSystemAndTrackerDatabase):
(WebCore::StorageTracker::setOriginDetails):
(WebCore::StorageTracker::syncSetOriginDetails):
(WebCore::StorageTracker::origins):
(WebCore::StorageTracker::deleteAllOrigins):
(WebCore::truncateDatabaseFile):
(WebCore::StorageTracker::syncDeleteAllOrigins):
(WebCore::StorageTracker::deleteOriginWithIdentifier):
(WebCore::StorageTracker::deleteOrigin):
(WebCore::StorageTracker::syncDeleteOrigin):
(WebCore::StorageTracker::willDeleteAllOrigins):
(WebCore::StorageTracker::willDeleteOrigin):
(WebCore::StorageTracker::canDeleteOrigin):
(WebCore::StorageTracker::cancelDeletingOrigin):
(WebCore::StorageTracker::isActive):
(WebCore::StorageTracker::setIsActive):
(WebCore::StorageTracker::databasePathForOrigin):
(WebCore::StorageTracker::diskUsageForOrigin):
* Storage/StorageTracker.h: Renamed from Source/WebCore/storage/StorageTracker.h.
(WebCore::StorageTracker::storageDatabaseIdleInterval):
(WebCore::StorageTracker::setStorageDatabaseIdleInterval):
* Storage/StorageTrackerClient.h: Renamed from Source/WebCore/storage/StorageTrackerClient.h.
(WebCore::StorageTrackerClient::~StorageTrackerClient):
* Storage/WebStorageNamespaceProvider.cpp:
* WebKit.vcxproj/WebKit/WebKit.vcxproj:
* WebKit.vcxproj/WebKit/WebKit.vcxproj.filters:
* WebKit.xcodeproj/project.pbxproj:
Source/WebKit/mac:
* Storage/WebStorageManager.mm:
* Storage/WebStorageTrackerClient.h:
* WebView/WebView.mm:
Source/WebKit2:
* WebProcess/WebProcess.cpp:</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="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlercpp">trunk/Source/WebCore/platform/MemoryPressureHandler.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitStorageWebStorageNamespaceProvidercpp">trunk/Source/WebKit/Storage/WebStorageNamespaceProvider.cpp</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojWebKitWebKitvcxproj">trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojWebKitWebKitvcxprojfilters">trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebStorageManagermm">trunk/Source/WebKit/mac/Storage/WebStorageManager.mm</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebStorageManagerInternalh">trunk/Source/WebKit/mac/Storage/WebStorageManagerInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebStorageTrackerClienth">trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitStorageStorageAreaImplcpp">trunk/Source/WebKit/Storage/StorageAreaImpl.cpp</a></li>
<li><a href="#trunkSourceWebKitStorageStorageAreaImplh">trunk/Source/WebKit/Storage/StorageAreaImpl.h</a></li>
<li><a href="#trunkSourceWebKitStorageStorageAreaSynccpp">trunk/Source/WebKit/Storage/StorageAreaSync.cpp</a></li>
<li><a href="#trunkSourceWebKitStorageStorageAreaSynch">trunk/Source/WebKit/Storage/StorageAreaSync.h</a></li>
<li><a href="#trunkSourceWebKitStorageStorageNamespaceImplcpp">trunk/Source/WebKit/Storage/StorageNamespaceImpl.cpp</a></li>
<li><a href="#trunkSourceWebKitStorageStorageNamespaceImplh">trunk/Source/WebKit/Storage/StorageNamespaceImpl.h</a></li>
<li><a href="#trunkSourceWebKitStorageStorageSyncManagercpp">trunk/Source/WebKit/Storage/StorageSyncManager.cpp</a></li>
<li><a href="#trunkSourceWebKitStorageStorageSyncManagerh">trunk/Source/WebKit/Storage/StorageSyncManager.h</a></li>
<li><a href="#trunkSourceWebKitStorageStorageThreadcpp">trunk/Source/WebKit/Storage/StorageThread.cpp</a></li>
<li><a href="#trunkSourceWebKitStorageStorageThreadh">trunk/Source/WebKit/Storage/StorageThread.h</a></li>
<li><a href="#trunkSourceWebKitStorageStorageTrackercpp">trunk/Source/WebKit/Storage/StorageTracker.cpp</a></li>
<li><a href="#trunkSourceWebKitStorageStorageTrackerh">trunk/Source/WebKit/Storage/StorageTracker.h</a></li>
<li><a href="#trunkSourceWebKitStorageStorageTrackerClienth">trunk/Source/WebKit/Storage/StorageTrackerClient.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorestorageStorageAreaImplcpp">trunk/Source/WebCore/storage/StorageAreaImpl.cpp</a></li>
<li><a href="#trunkSourceWebCorestorageStorageAreaImplh">trunk/Source/WebCore/storage/StorageAreaImpl.h</a></li>
<li><a href="#trunkSourceWebCorestorageStorageAreaSynccpp">trunk/Source/WebCore/storage/StorageAreaSync.cpp</a></li>
<li><a href="#trunkSourceWebCorestorageStorageAreaSynch">trunk/Source/WebCore/storage/StorageAreaSync.h</a></li>
<li><a href="#trunkSourceWebCorestorageStorageNamespaceImplcpp">trunk/Source/WebCore/storage/StorageNamespaceImpl.cpp</a></li>
<li><a href="#trunkSourceWebCorestorageStorageNamespaceImplh">trunk/Source/WebCore/storage/StorageNamespaceImpl.h</a></li>
<li><a href="#trunkSourceWebCorestorageStorageSyncManagercpp">trunk/Source/WebCore/storage/StorageSyncManager.cpp</a></li>
<li><a href="#trunkSourceWebCorestorageStorageSyncManagerh">trunk/Source/WebCore/storage/StorageSyncManager.h</a></li>
<li><a href="#trunkSourceWebCorestorageStorageThreadcpp">trunk/Source/WebCore/storage/StorageThread.cpp</a></li>
<li><a href="#trunkSourceWebCorestorageStorageThreadh">trunk/Source/WebCore/storage/StorageThread.h</a></li>
<li><a href="#trunkSourceWebCorestorageStorageTrackercpp">trunk/Source/WebCore/storage/StorageTracker.cpp</a></li>
<li><a href="#trunkSourceWebCorestorageStorageTrackerh">trunk/Source/WebCore/storage/StorageTracker.h</a></li>
<li><a href="#trunkSourceWebCorestorageStorageTrackerClienth">trunk/Source/WebCore/storage/StorageTrackerClient.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 (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -2483,16 +2483,10 @@
</span><span class="cx"> replay/UserInputBridge.cpp
</span><span class="cx">
</span><span class="cx"> storage/Storage.cpp
</span><del>- storage/StorageAreaImpl.cpp
- storage/StorageAreaSync.cpp
</del><span class="cx"> storage/StorageEvent.cpp
</span><span class="cx"> storage/StorageEventDispatcher.cpp
</span><span class="cx"> storage/StorageMap.cpp
</span><del>- storage/StorageNamespaceImpl.cpp
</del><span class="cx"> storage/StorageNamespaceProvider.cpp
</span><del>- storage/StorageSyncManager.cpp
- storage/StorageThread.cpp
- storage/StorageTracker.cpp
</del><span class="cx">
</span><span class="cx"> style/InlineTextBoxStyle.cpp
</span><span class="cx"> style/StyleFontSizeFunctions.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/ChangeLog        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-12-29 Anders Carlsson <andersca@apple.com>
+
+ Move storage code from WebCore to WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=139558
+
+ Reviewed by Darin Adler.
+
+ * WebCore.exp.in:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/MemoryPressureHandler.cpp:
+
</ins><span class="cx"> 2014-12-29 Sebastian Dröge <sebastian@centricular.com>
</span><span class="cx">
</span><span class="cx"> [GStreamer] Rewrite MediaSource implementation
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -199,6 +199,7 @@
</span><span class="cx"> __ZN7WebCore11PageOverlay8setFrameENS_7IntRectE
</span><span class="cx"> __ZN7WebCore11SQLResultOkE
</span><span class="cx"> __ZN7WebCore11URLWithDataEP6NSDataP5NSURL
</span><ins>+__ZN7WebCore11getFileSizeERKN3WTF6StringERx
</ins><span class="cx"> __ZN7WebCore11getURLBytesEPK7__CFURLRN3WTF6VectorIcLm512ENS3_15CrashOnOverflowEEE
</span><span class="cx"> __ZN7WebCore11getURLBytesEPK7__CFURLRN3WTF7CStringE
</span><span class="cx"> __ZN7WebCore11iBeamCursorEv
</span><span class="lines">@@ -336,7 +337,6 @@
</span><span class="cx"> __ZN7WebCore13ResourceErrorC1EP9__CFError
</span><span class="cx"> __ZN7WebCore13SQLResultDoneE
</span><span class="cx"> __ZN7WebCore13SelectionRectC1ERKNS_7IntRectEbi
</span><del>-__ZN7WebCore13StorageThread39releaseFastMallocFreeMemoryInAllThreadsEv
</del><span class="cx"> __ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDERKN3WTF6StringEb
</span><span class="cx"> __ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDEdNS_17CSSPrimitiveValue9UnitTypesEb
</span><span class="cx"> __ZN7WebCore13TextIndicator6createERKNS_17TextIndicatorDataE
</span><span class="lines">@@ -459,13 +459,6 @@
</span><span class="cx"> __ZN7WebCore14SecurityPolicy27resetOriginAccessWhitelistsEv
</span><span class="cx"> __ZN7WebCore14SecurityPolicy29addOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
</span><span class="cx"> __ZN7WebCore14SecurityPolicy32removeOriginAccessWhitelistEntryERKNS_14SecurityOriginERKN3WTF6StringES7_b
</span><del>-__ZN7WebCore14StorageTracker12deleteOriginEPNS_14SecurityOriginE
-__ZN7WebCore14StorageTracker16deleteAllOriginsEv
-__ZN7WebCore14StorageTracker17initializeTrackerERKN3WTF6StringEPNS_20StorageTrackerClientE
-__ZN7WebCore14StorageTracker18diskUsageForOriginEPNS_14SecurityOriginE
-__ZN7WebCore14StorageTracker32syncFileSystemAndTrackerDatabaseEv
-__ZN7WebCore14StorageTracker7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOriginEEELm0ENS1_15CrashOnOverflowEEE
-__ZN7WebCore14StorageTracker7trackerEv
</del><span class="cx"> __ZN7WebCore14SubframeLoader12allowPluginsENS_28ReasonForCallingAllowPluginsE
</span><span class="cx"> __ZN7WebCore14TileController14setTilesOpaqueEb
</span><span class="cx"> __ZN7WebCore14TileController15containerLayersEv
</span><span class="lines">@@ -653,6 +646,7 @@
</span><span class="cx"> __ZN7WebCore15SQLiteStatement8bindBlobEiPKvi
</span><span class="cx"> __ZN7WebCore15SQLiteStatement8bindBlobEiRKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore15SQLiteStatement8bindTextEiRKN3WTF6StringE
</span><ins>+__ZN7WebCore15SQLiteStatement8finalizeEv
</ins><span class="cx"> __ZN7WebCore15SQLiteStatement9bindInt64Eix
</span><span class="cx"> __ZN7WebCore15SQLiteStatementC1ERNS_14SQLiteDatabaseERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore15SQLiteStatementD1Ev
</span><span class="lines">@@ -904,8 +898,6 @@
</span><span class="cx"> __ZN7WebCore20ResourceResponseBase6setURLERKNS_3URLE
</span><span class="cx"> __ZN7WebCore20ResourceResponseBase9setSourceENS0_6SourceE
</span><span class="cx"> __ZN7WebCore20ResourceResponseBaseC2Ev
</span><del>-__ZN7WebCore20StorageNamespaceImpl29createSessionStorageNamespaceEj
-__ZN7WebCore20StorageNamespaceImpl32getOrCreateLocalStorageNamespaceERKN3WTF6StringEj
</del><span class="cx"> __ZN7WebCore20TransformationMatrix5scaleEd
</span><span class="cx"> __ZN7WebCore20TransformationMatrix9translateEdd
</span><span class="cx"> __ZN7WebCore20UserGestureIndicator7s_stateE
</span><span class="lines">@@ -956,6 +948,8 @@
</span><span class="cx"> __ZN7WebCore21ResourceLoadScheduler6removeEPNS_14ResourceLoaderE
</span><span class="cx"> __ZN7WebCore21ResourceLoadSchedulerC2Ev
</span><span class="cx"> __ZN7WebCore21ResourceLoadSchedulerD2Ev
</span><ins>+__ZN7WebCore21SQLiteDatabaseTracker35decrementTransactionInProgressCountEv
+__ZN7WebCore21SQLiteDatabaseTracker35incrementTransactionInProgressCountEv
</ins><span class="cx"> __ZN7WebCore21SQLiteDatabaseTracker9setClientEPNS_27SQLiteDatabaseTrackerClientE
</span><span class="cx"> __ZN7WebCore21SerializedScriptValue11deserializeEPK15OpaqueJSContextPPK13OpaqueJSValue
</span><span class="cx"> __ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1ENS6_15CrashOnOverflowEEENS_22SerializationErrorModeE
</span><span class="lines">@@ -1007,6 +1001,8 @@
</span><span class="cx"> __ZN7WebCore22RuntimeEnabledFeatures14sharedFeaturesEv
</span><span class="cx"> __ZN7WebCore22ScriptExecutionContext26canSuspendActiveDOMObjectsEv
</span><span class="cx"> __ZN7WebCore22ScriptExecutionContext2vmEv
</span><ins>+__ZN7WebCore22StorageEventDispatcher26dispatchLocalStorageEventsERKN3WTF6StringES4_S4_PNS_14SecurityOriginEPNS_5FrameE
+__ZN7WebCore22StorageEventDispatcher28dispatchSessionStorageEventsERKN3WTF6StringES4_S4_PNS_14SecurityOriginEPNS_5FrameE
</ins><span class="cx"> __ZN7WebCore22StorageEventDispatcher34dispatchLocalStorageEventsToFramesERNS_9PageGroupERKN3WTF6VectorINS3_6RefPtrINS_5FrameEEELm0ENS3_15CrashOnOverflowEEERKNS3_6StringESE_SE_SE_PNS_14SecurityOriginE
</span><span class="cx"> __ZN7WebCore22URLByCanonicalizingURLEP5NSURL
</span><span class="cx"> __ZN7WebCore22URLWithUserTypedStringEP8NSStringP5NSURL
</span><span class="lines">@@ -1564,6 +1560,8 @@
</span><span class="cx"> __ZN7WebCore9PageCache6removeEPNS_11HistoryItemE
</span><span class="cx"> __ZN7WebCore9PageGroup16syncLocalStorageEv
</span><span class="cx"> __ZN7WebCore9PageGroup17closeLocalStorageEv
</span><ins>+__ZN7WebCore9PageGroup26clearLocalStorageForOriginEPNS_14SecurityOriginE
+__ZN7WebCore9PageGroup30clearLocalStorageForAllOriginsEv
</ins><span class="cx"> __ZN7WebCore9PageGroup30closeIdleLocalStorageDatabasesEv
</span><span class="cx"> __ZN7WebCore9PageGroup9pageGroupERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore9Scrollbar11mouseExitedEv
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -17885,16 +17885,10 @@
</span><span class="cx"> <ClCompile Include="..\history\HistoryItem.cpp" />
</span><span class="cx"> <ClCompile Include="..\history\PageCache.cpp" />
</span><span class="cx"> <ClCompile Include="..\storage\Storage.cpp" />
</span><del>- <ClCompile Include="..\storage\StorageAreaImpl.cpp" />
- <ClCompile Include="..\storage\StorageAreaSync.cpp" />
</del><span class="cx"> <ClCompile Include="..\storage\StorageEvent.cpp" />
</span><span class="cx"> <ClCompile Include="..\storage\StorageEventDispatcher.cpp" />
</span><span class="cx"> <ClCompile Include="..\storage\StorageMap.cpp" />
</span><del>- <ClCompile Include="..\storage\StorageNamespaceImpl.cpp" />
</del><span class="cx"> <ClCompile Include="..\storage\StorageNamespaceProvider.cpp" />
</span><del>- <ClCompile Include="..\storage\StorageSyncManager.cpp" />
- <ClCompile Include="..\storage\StorageThread.cpp" />
- <ClCompile Include="..\storage\StorageTracker.cpp" />
</del><span class="cx"> <ClCompile Include="..\style\InlineTextBoxStyle.cpp" />
</span><span class="cx"> <ClCompile Include="..\style\StyleFontSizeFunctions.cpp" />
</span><span class="cx"> <ClCompile Include="..\style\StyleResolveForDocument.cpp" />
</span><span class="lines">@@ -21293,17 +21287,11 @@
</span><span class="cx"> <ClInclude Include="..\history\PageCache.h" />
</span><span class="cx"> <ClInclude Include="..\storage\Storage.h" />
</span><span class="cx"> <ClInclude Include="..\storage\StorageArea.h" />
</span><del>- <ClInclude Include="..\storage\StorageAreaImpl.h" />
- <ClInclude Include="..\storage\StorageAreaSync.h" />
</del><span class="cx"> <ClInclude Include="..\storage\StorageEvent.h" />
</span><span class="cx"> <ClInclude Include="..\storage\StorageEventDispatcher.h" />
</span><span class="cx"> <ClInclude Include="..\storage\StorageMap.h" />
</span><span class="cx"> <ClInclude Include="..\storage\StorageNamespace.h" />
</span><del>- <ClInclude Include="..\storage\StorageNamespaceImpl.h" />
</del><span class="cx"> <ClInclude Include="..\storage\StorageNamespaceProvider.h" />
</span><del>- <ClInclude Include="..\storage\StorageSyncManager.h" />
- <ClInclude Include="..\storage\StorageThread.h" />
- <ClInclude Include="..\storage\StorageTracker.h" />
</del><span class="cx"> <ClInclude Include="..\style\InlineTextBoxStyle.h" />
</span><span class="cx"> <ClInclude Include="..\style\StyleFontSizeFunctions.h" />
</span><span class="cx"> <ClInclude Include="..\style\StyleResolveForDocument.h" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -4686,12 +4686,6 @@
</span><span class="cx"> <ClCompile Include="..\storage\Storage.cpp">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\storage\StorageAreaImpl.cpp">
- <Filter>storage</Filter>
- </ClCompile>
- <ClCompile Include="..\storage\StorageAreaSync.cpp">
- <Filter>storage</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\storage\StorageEvent.cpp">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -4701,21 +4695,9 @@
</span><span class="cx"> <ClCompile Include="..\storage\StorageMap.cpp">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\storage\StorageNamespaceImpl.cpp">
- <Filter>storage</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\storage\StorageNamespaceProvider.cpp">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\storage\StorageSyncManager.cpp">
- <Filter>storage</Filter>
- </ClCompile>
- <ClCompile Include="..\storage\StorageThread.cpp">
- <Filter>storage</Filter>
- </ClCompile>
- <ClCompile Include="..\storage\StorageTracker.cpp">
- <Filter>storage</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\bridge\jsc\BridgeJSC.cpp">
</span><span class="cx"> <Filter>bridge</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -12417,12 +12399,6 @@
</span><span class="cx"> <ClInclude Include="..\storage\StorageArea.h">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClInclude>
</span><del>- <ClInclude Include="..\storage\StorageAreaImpl.h">
- <Filter>storage</Filter>
- </ClInclude>
- <ClInclude Include="..\storage\StorageAreaSync.h">
- <Filter>storage</Filter>
- </ClInclude>
</del><span class="cx"> <ClInclude Include="..\storage\StorageEvent.h">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClInclude>
</span><span class="lines">@@ -12435,18 +12411,6 @@
</span><span class="cx"> <ClInclude Include="..\storage\StorageNamespace.h">
</span><span class="cx"> <Filter>storage</Filter>
</span><span class="cx"> </ClInclude>
</span><del>- <ClInclude Include="..\storage\StorageNamespaceImpl.h">
- <Filter>storage</Filter>
- </ClInclude>
- <ClInclude Include="..\storage\StorageSyncManager.h">
- <Filter>storage</Filter>
- </ClInclude>
- <ClInclude Include="..\storage\StorageThread.h">
- <Filter>storage</Filter>
- </ClInclude>
- <ClInclude Include="..\storage\StorageTracker.h">
- <Filter>storage</Filter>
- </ClInclude>
</del><span class="cx"> <ClInclude Include="..\bridge\Bridge.h">
</span><span class="cx"> <Filter>bridge</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1388,9 +1388,6 @@
</span><span class="cx">                 37F818FD0D657606005E1F05 /* WebCoreURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 37F818FE0D657606005E1F05 /* WebCoreURLResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */; };
</span><span class="cx">                 37FD4298118368460093C029 /* TreeDepthLimit.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FD4297118368460093C029 /* TreeDepthLimit.h */; };
</span><del>-                3AB02D2A12D4F91600FBB694 /* StorageTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AB02D2812D4F91600FBB694 /* StorageTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                3AB02D2B12D4F91600FBB694 /* StorageTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3AB02D2912D4F91600FBB694 /* StorageTracker.cpp */; };
-                3AC3680012EF7A09006A3D6F /* StorageTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AC367FE12EF7A09006A3D6F /* StorageTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AC648B1129E146500C3EB25 /* EditingBoundary.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 3C244FEBA375AC633F88BE6F /* RenderLayerModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */; };
</span><span class="lines">@@ -1852,8 +1849,6 @@
</span><span class="cx">                 511EF2CF17F0FDF100E4FA16 /* JSIDBAnyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2CC17F0FDF100E4FA16 /* JSIDBAnyCustom.cpp */; };
</span><span class="cx">                 511EF2D017F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2CD17F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp */; };
</span><span class="cx">                 511EF2D117F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2CE17F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp */; };
</span><del>-                511F23190DC160DA004F0032 /* StorageThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511F23150DC160DA004F0032 /* StorageThread.cpp */; };
-                511F231A0DC160DA004F0032 /* StorageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F23160DC160DA004F0032 /* StorageThread.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 5123AF181890A4CA0031CDC9 /* IDBKeyRangeData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5123AF161890A4CA0031CDC9 /* IDBKeyRangeData.cpp */; };
</span><span class="cx">                 5123AF191890A4CA0031CDC9 /* IDBKeyRangeData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5123AF171890A4CA0031CDC9 /* IDBKeyRangeData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5123AF1D18918AE40031CDC9 /* IDBGetResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 5123AF1C18918AE40031CDC9 /* IDBGetResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -5547,20 +5542,12 @@
</span><span class="cx">                 C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
</span><span class="cx">                 C50B561712119D23008B46E0 /* GroupSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C50B561512119D23008B46E0 /* GroupSettings.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = C50D0E810FF4272900AC2644 /* StorageNamespace.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                C5102D940FD9AA2D00FAFF04 /* StorageSyncManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */; };
-                C5102D950FD9AA2D00FAFF04 /* StorageSyncManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5102D930FD9AA2D00FAFF04 /* StorageSyncManager.cpp */; };
-                C5102ECF0FD9EF8C00FAFF04 /* StorageAreaSync.h in Headers */ = {isa = PBXBuildFile; fileRef = C5102ECD0FD9EF8C00FAFF04 /* StorageAreaSync.h */; };
-                C5102ED00FD9EF8C00FAFF04 /* StorageAreaSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5102ECE0FD9EF8C00FAFF04 /* StorageAreaSync.cpp */; };
</del><span class="cx">                 C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */; };
</span><span class="cx">                 C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C5137CF111A58378004ADB99 /* JSDOMStringList.h */; };
</span><del>-                C5160EEA1004543A00A7CEE2 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5160EE81004543A00A7CEE2 /* StorageAreaImpl.cpp */; };
-                C5160EEB1004543A00A7CEE2 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */; };
</del><span class="cx">                 C5278B0C17F212EA003A2998 /* PlatformPasteboardIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */; };
</span><span class="cx">                 C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C544274911A57E7A0063A749 /* DOMStringList.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55610F011A704EB00B82D27 /* DOMStringList.cpp */; };
</span><span class="cx">                 C55C7BA11718AFBA001327E4 /* RenderThemeIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C55C7BA01718AFBA001327E4 /* RenderThemeIOS.mm */; };
</span><del>-                C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; };
</del><span class="cx">                 C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */; };
</span><span class="cx">                 C57FEDE11212EE9C0097BE65 /* FileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */; };
</span><span class="cx">                 C58361A91744523F00173511 /* FontServicesIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = C58361A71744523F00173511 /* FontServicesIOS.h */; };
</span><span class="lines">@@ -8453,9 +8440,6 @@
</span><span class="cx">                 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponse.mm; sourceTree = "<group>"; };
</span><span class="cx">                 37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrailingFloatsRootInlineBox.h; sourceTree = "<group>"; };
</span><span class="cx">                 37FD4297118368460093C029 /* TreeDepthLimit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreeDepthLimit.h; sourceTree = "<group>"; };
</span><del>-                3AB02D2812D4F91600FBB694 /* StorageTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageTracker.h; sourceTree = "<group>"; };
-                3AB02D2912D4F91600FBB694 /* StorageTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageTracker.cpp; sourceTree = "<group>"; };
-                3AC367FE12EF7A09006A3D6F /* StorageTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageTrackerClient.h; sourceTree = "<group>"; };
</del><span class="cx">                 3AC648B1129E146500C3EB25 /* EditingBoundary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBoundary.h; sourceTree = "<group>"; };
</span><span class="cx">                 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerModelObject.h; sourceTree = "<group>"; };
</span><span class="cx">                 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerModelObject.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -8979,8 +8963,6 @@
</span><span class="cx">                 511EF2CC17F0FDF100E4FA16 /* JSIDBAnyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAnyCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 511EF2CD17F0FDF100E4FA16 /* JSIDBDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBDatabaseCustom.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 511EF2CE17F0FDF100E4FA16 /* JSIDBObjectStoreCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBObjectStoreCustom.cpp; sourceTree = "<group>"; };
</span><del>-                511F23150DC160DA004F0032 /* StorageThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageThread.cpp; sourceTree = "<group>"; };
-                511F23160DC160DA004F0032 /* StorageThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageThread.h; sourceTree = "<group>"; };
</del><span class="cx">                 5123AF161890A4CA0031CDC9 /* IDBKeyRangeData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBKeyRangeData.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5123AF171890A4CA0031CDC9 /* IDBKeyRangeData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBKeyRangeData.h; sourceTree = "<group>"; };
</span><span class="cx">                 5123AF1C18918AE40031CDC9 /* IDBGetResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBGetResult.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -13022,21 +13004,13 @@
</span><span class="cx">                 C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 C50B561512119D23008B46E0 /* GroupSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupSettings.h; sourceTree = "<group>"; };
</span><span class="cx">                 C50D0E810FF4272900AC2644 /* StorageNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespace.h; sourceTree = "<group>"; };
</span><del>-                C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageSyncManager.h; sourceTree = "<group>"; };
-                C5102D930FD9AA2D00FAFF04 /* StorageSyncManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageSyncManager.cpp; sourceTree = "<group>"; };
-                C5102ECD0FD9EF8C00FAFF04 /* StorageAreaSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaSync.h; sourceTree = "<group>"; };
-                C5102ECE0FD9EF8C00FAFF04 /* StorageAreaSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaSync.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringList.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 C5137CF111A58378004ADB99 /* JSDOMStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMStringList.h; sourceTree = "<group>"; };
</span><del>-                C5160EE81004543A00A7CEE2 /* StorageAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageAreaImpl.cpp; sourceTree = "<group>"; };
-                C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageAreaImpl.h; sourceTree = "<group>"; };
</del><span class="cx">                 C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatformPasteboardIOS.mm; path = ios/PlatformPasteboardIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 C544274911A57E7A0063A749 /* DOMStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStringList.h; sourceTree = "<group>"; };
</span><span class="cx">                 C544274A11A57E7A0063A749 /* DOMStringList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMStringList.idl; sourceTree = "<group>"; };
</span><span class="cx">                 C55610F011A704EB00B82D27 /* DOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMStringList.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 C55C7BA01718AFBA001327E4 /* RenderThemeIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderThemeIOS.mm; sourceTree = "<group>"; };
</span><del>-                C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespaceImpl.h; sourceTree = "<group>"; };
-                C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceImpl.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndex.h; sourceTree = "<group>"; };
</span><span class="cx">                 C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystem.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 C58361A71744523F00173511 /* FontServicesIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontServicesIOS.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -15146,10 +15120,6 @@
</span><span class="cx">                                 51E3F9C40DA059DC00250911 /* Storage.h */,
</span><span class="cx">                                 51E3F9D10DA05D7100250911 /* Storage.idl */,
</span><span class="cx">                                 51BE37DE0DAEE00E001085FC /* StorageArea.h */,
</span><del>-                                C5160EE81004543A00A7CEE2 /* StorageAreaImpl.cpp */,
-                                C5160EE91004543A00A7CEE2 /* StorageAreaImpl.h */,
-                                C5102ECE0FD9EF8C00FAFF04 /* StorageAreaSync.cpp */,
-                                C5102ECD0FD9EF8C00FAFF04 /* StorageAreaSync.h */,
</del><span class="cx">                                 51E0BABA0DA5547100A9E417 /* StorageEvent.cpp */,
</span><span class="cx">                                 51E0BAB90DA5547100A9E417 /* StorageEvent.h */,
</span><span class="cx">                                 51E0BABD0DA5548400A9E417 /* StorageEvent.idl */,
</span><span class="lines">@@ -15158,17 +15128,8 @@
</span><span class="cx">                                 51E0BB370DA5ACB600A9E417 /* StorageMap.cpp */,
</span><span class="cx">                                 51E0BB360DA5ACB600A9E417 /* StorageMap.h */,
</span><span class="cx">                                 C50D0E810FF4272900AC2644 /* StorageNamespace.h */,
</span><del>-                                C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */,
-                                C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */,
</del><span class="cx">                                 1A3763691A2E68BB009A7EE2 /* StorageNamespaceProvider.cpp */,
</span><span class="cx">                                 1A37636A1A2E68BB009A7EE2 /* StorageNamespaceProvider.h */,
</span><del>-                                C5102D930FD9AA2D00FAFF04 /* StorageSyncManager.cpp */,
-                                C5102D920FD9AA2D00FAFF04 /* StorageSyncManager.h */,
-                                511F23150DC160DA004F0032 /* StorageThread.cpp */,
-                                511F23160DC160DA004F0032 /* StorageThread.h */,
-                                3AB02D2912D4F91600FBB694 /* StorageTracker.cpp */,
-                                3AB02D2812D4F91600FBB694 /* StorageTracker.h */,
-                                3AC367FE12EF7A09006A3D6F /* StorageTrackerClient.h */,
</del><span class="cx">                         );
</span><span class="cx">                         indentWidth = 4;
</span><span class="cx">                         path = storage;
</span><span class="lines">@@ -26209,17 +26170,10 @@
</span><span class="cx">                                 A5AFB350115151A700B045CB /* StepRange.h in Headers */,
</span><span class="cx">                                 1AC2D845171734A100652FC0 /* Storage.h in Headers */,
</span><span class="cx">                                 51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */,
</span><del>-                                C5160EEB1004543A00A7CEE2 /* StorageAreaImpl.h in Headers */,
-                                C5102ECF0FD9EF8C00FAFF04 /* StorageAreaSync.h in Headers */,
</del><span class="cx">                                 51E0BABB0DA5547100A9E417 /* StorageEvent.h in Headers */,
</span><span class="cx">                                 C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */,
</span><span class="cx">                                 51E0BB380DA5ACB600A9E417 /* StorageMap.h in Headers */,
</span><span class="cx">                                 C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */,
</span><del>-                                C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */,
-                                C5102D940FD9AA2D00FAFF04 /* StorageSyncManager.h in Headers */,
-                                511F231A0DC160DA004F0032 /* StorageThread.h in Headers */,
-                                3AB02D2A12D4F91600FBB694 /* StorageTracker.h in Headers */,
-                                3AC3680012EF7A09006A3D6F /* StorageTrackerClient.h in Headers */,
</del><span class="cx">                                 81AC6C36131C57D30009A7E0 /* StringCallback.h in Headers */,
</span><span class="cx">                                 B23540F30D00782E002382FA /* StringTruncator.h in Headers */,
</span><span class="cx">                                 9B6C41531344949000085B62 /* StringWithDirection.h in Headers */,
</span><span class="lines">@@ -29630,15 +29584,9 @@
</span><span class="cx">                                 BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */,
</span><span class="cx">                                 A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */,
</span><span class="cx">                                 51E3F9C70DA059DC00250911 /* Storage.cpp in Sources */,
</span><del>-                                C5160EEA1004543A00A7CEE2 /* StorageAreaImpl.cpp in Sources */,
-                                C5102ED00FD9EF8C00FAFF04 /* StorageAreaSync.cpp in Sources */,
</del><span class="cx">                                 51E0BABC0DA5547100A9E417 /* StorageEvent.cpp in Sources */,
</span><span class="cx">                                 C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */,
</span><span class="cx">                                 51E0BB390DA5ACB600A9E417 /* StorageMap.cpp in Sources */,
</span><del>-                                C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */,
-                                C5102D950FD9AA2D00FAFF04 /* StorageSyncManager.cpp in Sources */,
-                                511F23190DC160DA004F0032 /* StorageThread.cpp in Sources */,
-                                3AB02D2B12D4F91600FBB694 /* StorageTracker.cpp in Sources */,
</del><span class="cx">                                 8102C5881325BB1100DDE67A /* StringCallback.cpp in Sources */,
</span><span class="cx">                                 B23540F20D00782E002382FA /* StringTruncator.cpp in Sources */,
</span><span class="cx">                                 BC5EB6A20E81DC4F00B25965 /* StyleBackgroundData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PageCache.h"
</span><span class="cx"> #include "ScrollingThread.h"
</span><del>-#include "StorageThread.h"
</del><span class="cx"> #include "WorkerThread.h"
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> #include <wtf/FastMalloc.h>
</span></span></pre></div>
<a id="trunkSourceWebCorestorageStorageAreaImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageAreaImpl.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageAreaImpl.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageAreaImpl.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,301 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 "config.h"
-#include "StorageAreaImpl.h"
-
-#include "Frame.h"
-#include "SecurityOrigin.h"
-#include "StorageAreaSync.h"
-#include "StorageEventDispatcher.h"
-#include "StorageMap.h"
-#include "StorageSyncManager.h"
-#include "StorageTracker.h"
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-StorageAreaImpl::~StorageAreaImpl()
-{
- ASSERT(isMainThread());
-}
-
-inline StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota)
- : m_storageType(storageType)
- , m_securityOrigin(origin)
- , m_storageMap(StorageMap::create(quota))
- , m_storageSyncManager(syncManager)
-#ifndef NDEBUG
- , m_isShutdown(false)
-#endif
- , m_accessCount(0)
- , m_closeDatabaseTimer(*this, &StorageAreaImpl::closeDatabaseTimerFired)
-{
- ASSERT(isMainThread());
- ASSERT(m_securityOrigin);
- ASSERT(m_storageMap);
-
- // Accessing the shared global StorageTracker when a StorageArea is created
- // ensures that the tracker is properly initialized before anyone actually needs to use it.
- StorageTracker::tracker();
-}
-
-Ref<StorageAreaImpl> StorageAreaImpl::create(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota)
-{
- Ref<StorageAreaImpl> area = adoptRef(*new StorageAreaImpl(storageType, origin, syncManager, quota));
-
- // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing,
- // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
- if (area->m_storageSyncManager) {
- area->m_storageAreaSync = StorageAreaSync::create(area->m_storageSyncManager, area.ptr(), area->m_securityOrigin->databaseIdentifier());
- ASSERT(area->m_storageAreaSync);
- }
-
- return area;
-}
-
-PassRefPtr<StorageAreaImpl> StorageAreaImpl::copy()
-{
- ASSERT(!m_isShutdown);
- return adoptRef(new StorageAreaImpl(this));
-}
-
-StorageAreaImpl::StorageAreaImpl(StorageAreaImpl* area)
- : m_storageType(area->m_storageType)
- , m_securityOrigin(area->m_securityOrigin)
- , m_storageMap(area->m_storageMap)
- , m_storageSyncManager(area->m_storageSyncManager)
-#ifndef NDEBUG
- , m_isShutdown(area->m_isShutdown)
-#endif
- , m_accessCount(0)
- , m_closeDatabaseTimer(*this, &StorageAreaImpl::closeDatabaseTimerFired)
-{
- ASSERT(isMainThread());
- ASSERT(m_securityOrigin);
- ASSERT(m_storageMap);
- ASSERT(!m_isShutdown);
-}
-
-bool StorageAreaImpl::canAccessStorage(Frame* frame)
-{
- return frame && frame->page();
-}
-
-StorageType StorageAreaImpl::storageType() const
-{
- return m_storageType;
-}
-
-unsigned StorageAreaImpl::length()
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- return m_storageMap->length();
-}
-
-String StorageAreaImpl::key(unsigned index)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- return m_storageMap->key(index);
-}
-
-String StorageAreaImpl::item(const String& key)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- return m_storageMap->getItem(key);
-}
-
-void StorageAreaImpl::setItem(Frame* sourceFrame, const String& key, const String& value, bool& quotaException)
-{
- ASSERT(!m_isShutdown);
- ASSERT(!value.isNull());
- blockUntilImportComplete();
-
- String oldValue;
- RefPtr<StorageMap> newMap = m_storageMap->setItem(key, value, oldValue, quotaException);
- if (newMap)
- m_storageMap = newMap.release();
-
- if (quotaException)
- return;
-
- if (oldValue == value)
- return;
-
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleItemForSync(key, value);
-
- dispatchStorageEvent(key, oldValue, value, sourceFrame);
-}
-
-void StorageAreaImpl::removeItem(Frame* sourceFrame, const String& key)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- String oldValue;
- RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue);
- if (newMap)
- m_storageMap = newMap.release();
-
- if (oldValue.isNull())
- return;
-
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleItemForSync(key, String());
-
- dispatchStorageEvent(key, oldValue, String(), sourceFrame);
-}
-
-void StorageAreaImpl::clear(Frame* sourceFrame)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- if (!m_storageMap->length())
- return;
-
- unsigned quota = m_storageMap->quota();
- m_storageMap = StorageMap::create(quota);
-
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleClear();
-
- dispatchStorageEvent(String(), String(), String(), sourceFrame);
-}
-
-bool StorageAreaImpl::contains(const String& key)
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- return m_storageMap->contains(key);
-}
-
-void StorageAreaImpl::importItems(const HashMap<String, String>& items)
-{
- ASSERT(!m_isShutdown);
-
- m_storageMap->importItems(items);
-}
-
-void StorageAreaImpl::close()
-{
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleFinalSync();
-
-#ifndef NDEBUG
- m_isShutdown = true;
-#endif
-}
-
-void StorageAreaImpl::clearForOriginDeletion()
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- if (m_storageMap->length()) {
- unsigned quota = m_storageMap->quota();
- m_storageMap = StorageMap::create(quota);
- }
-
- if (m_storageAreaSync) {
- m_storageAreaSync->scheduleClear();
- m_storageAreaSync->scheduleCloseDatabase();
- }
-}
-
-void StorageAreaImpl::sync()
-{
- ASSERT(!m_isShutdown);
- blockUntilImportComplete();
-
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleSync();
-}
-
-void StorageAreaImpl::blockUntilImportComplete() const
-{
- if (m_storageAreaSync)
- m_storageAreaSync->blockUntilImportComplete();
-}
-
-size_t StorageAreaImpl::memoryBytesUsedByCache()
-{
- return 0;
-}
-
-void StorageAreaImpl::incrementAccessCount()
-{
- m_accessCount++;
-
- if (m_closeDatabaseTimer.isActive())
- m_closeDatabaseTimer.stop();
-}
-
-void StorageAreaImpl::decrementAccessCount()
-{
- ASSERT(m_accessCount);
- --m_accessCount;
-
- if (!m_accessCount) {
- if (m_closeDatabaseTimer.isActive())
- m_closeDatabaseTimer.stop();
- m_closeDatabaseTimer.startOneShot(StorageTracker::tracker().storageDatabaseIdleInterval());
- }
-}
-
-void StorageAreaImpl::closeDatabaseTimerFired()
-{
- blockUntilImportComplete();
- if (m_storageAreaSync)
- m_storageAreaSync->scheduleCloseDatabase();
-}
-
-void StorageAreaImpl::closeDatabaseIfIdle()
-{
- if (m_closeDatabaseTimer.isActive()) {
- ASSERT(!m_accessCount);
- m_closeDatabaseTimer.stop();
-
- closeDatabaseTimerFired();
- }
-}
-
-void StorageAreaImpl::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)
-{
- if (m_storageType == LocalStorage)
- StorageEventDispatcher::dispatchLocalStorageEvents(key, oldValue, newValue, m_securityOrigin.get(), sourceFrame);
- else
- StorageEventDispatcher::dispatchSessionStorageEvents(key, oldValue, newValue, m_securityOrigin.get(), sourceFrame);
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageAreaImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageAreaImpl.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageAreaImpl.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageAreaImpl.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,100 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 StorageAreaImpl_h
-#define StorageAreaImpl_h
-
-#include "StorageArea.h"
-#include "Timer.h"
-
-#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class SecurityOrigin;
-class StorageMap;
-class StorageAreaSync;
-
-class StorageAreaImpl : public StorageArea {
-public:
- static Ref<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
- virtual ~StorageAreaImpl();
-
- virtual unsigned length() override;
- virtual String key(unsigned index) override;
- virtual String item(const String& key) override;
- virtual void setItem(Frame* sourceFrame, const String& key, const String& value, bool& quotaException) override;
- virtual void removeItem(Frame* sourceFrame, const String& key) override;
- virtual void clear(Frame* sourceFrame) override;
- virtual bool contains(const String& key) override;
-
- virtual bool canAccessStorage(Frame* sourceFrame) override;
- virtual StorageType storageType() const override;
-
- virtual size_t memoryBytesUsedByCache() override;
-
- virtual void incrementAccessCount();
- virtual void decrementAccessCount();
- virtual void closeDatabaseIfIdle();
-
- PassRefPtr<StorageAreaImpl> copy();
- void close();
-
- // Only called from a background thread.
- void importItems(const HashMap<String, String>& items);
-
- // Used to clear a StorageArea and close db before backing db file is deleted.
- void clearForOriginDeletion();
-
- void sync();
-
-private:
- StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
- explicit StorageAreaImpl(StorageAreaImpl*);
-
- void blockUntilImportComplete() const;
- void closeDatabaseTimerFired();
-
- void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
-
- StorageType m_storageType;
- RefPtr<SecurityOrigin> m_securityOrigin;
- RefPtr<StorageMap> m_storageMap;
-
- RefPtr<StorageAreaSync> m_storageAreaSync;
- RefPtr<StorageSyncManager> m_storageSyncManager;
-
-#ifndef NDEBUG
- bool m_isShutdown;
-#endif
- unsigned m_accessCount;
- Timer m_closeDatabaseTimer;
-};
-
-} // namespace WebCore
-
-#endif // StorageAreaImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageAreaSynccpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageAreaSync.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageAreaSync.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageAreaSync.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,536 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008, 2009, 2010 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 "config.h"
-#include "StorageAreaSync.h"
-
-#include "FileSystem.h"
-#include "SQLiteDatabaseTracker.h"
-#include "SQLiteStatement.h"
-#include "SQLiteTransaction.h"
-#include "StorageAreaImpl.h"
-#include "StorageSyncManager.h"
-#include "StorageTracker.h"
-#include "SuddenTermination.h"
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-// If the StorageArea undergoes rapid changes, don't sync each change to disk.
-// Instead, queue up a batch of items to sync and actually do the sync at the following interval.
-static const double StorageSyncInterval = 1.0;
-
-// A sane limit on how many items we'll schedule to sync all at once. This makes it
-// much harder to starve the rest of LocalStorage and the OS's IO subsystem in general.
-static const int MaxiumItemsToSync = 100;
-
-inline StorageAreaSync::StorageAreaSync(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageAreaImpl> storageArea, const String& databaseIdentifier)
- : m_syncTimer(*this, &StorageAreaSync::syncTimerFired)
- , m_itemsCleared(false)
- , m_finalSyncScheduled(false)
- , m_storageArea(storageArea)
- , m_syncManager(storageSyncManager)
- , m_databaseIdentifier(databaseIdentifier.isolatedCopy())
- , m_clearItemsWhileSyncing(false)
- , m_syncScheduled(false)
- , m_syncInProgress(false)
- , m_databaseOpenFailed(false)
- , m_syncCloseDatabase(false)
- , m_importComplete(false)
-{
- ASSERT(isMainThread());
- ASSERT(m_storageArea);
- ASSERT(m_syncManager);
-
- // FIXME: If it can't import, then the default WebKit behavior should be that of private browsing,
- // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
- RefPtr<StorageAreaSync> protector(this);
- m_syncManager->dispatch([protector] {
- protector->performImport();
- });
-}
-
-Ref<StorageAreaSync> StorageAreaSync::create(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageAreaImpl> storageArea, const String& databaseIdentifier)
-{
- return adoptRef(*new StorageAreaSync(storageSyncManager, storageArea, databaseIdentifier));
-}
-
-StorageAreaSync::~StorageAreaSync()
-{
- ASSERT(isMainThread());
- ASSERT(!m_syncTimer.isActive());
- ASSERT(m_finalSyncScheduled);
-}
-
-void StorageAreaSync::scheduleFinalSync()
-{
- ASSERT(isMainThread());
- // FIXME: We do this to avoid races, but it'd be better to make things safe without blocking.
- blockUntilImportComplete();
- m_storageArea = 0; // This is done in blockUntilImportComplete() but this is here as a form of documentation that we must be absolutely sure the ref count cycle is broken.
-
- if (m_syncTimer.isActive())
- m_syncTimer.stop();
- else {
- // The following is balanced by the call to enableSuddenTermination in the
- // syncTimerFired function.
- disableSuddenTermination();
- }
- // FIXME: This is synchronous. We should do it on the background process, but
- // we should do it safely.
- m_finalSyncScheduled = true;
- syncTimerFired();
-
- RefPtr<StorageAreaSync> protector(this);
- m_syncManager->dispatch([protector] {
- protector->deleteEmptyDatabase();
- });
-}
-
-void StorageAreaSync::scheduleItemForSync(const String& key, const String& value)
-{
- ASSERT(isMainThread());
- ASSERT(!m_finalSyncScheduled);
-
- m_changedItems.set(key, value);
- if (!m_syncTimer.isActive()) {
- m_syncTimer.startOneShot(StorageSyncInterval);
-
- // The following is balanced by the call to enableSuddenTermination in the
- // syncTimerFired function.
- disableSuddenTermination();
- }
-}
-
-void StorageAreaSync::scheduleClear()
-{
- ASSERT(isMainThread());
- ASSERT(!m_finalSyncScheduled);
-
- m_changedItems.clear();
- m_itemsCleared = true;
- if (!m_syncTimer.isActive()) {
- m_syncTimer.startOneShot(StorageSyncInterval);
-
- // The following is balanced by the call to enableSuddenTermination in the
- // syncTimerFired function.
- disableSuddenTermination();
- }
-}
-
-void StorageAreaSync::scheduleCloseDatabase()
-{
- ASSERT(isMainThread());
- ASSERT(!m_finalSyncScheduled);
-
- if (!m_database.isOpen())
- return;
-
- m_syncCloseDatabase = true;
-
- if (!m_syncTimer.isActive()) {
- m_syncTimer.startOneShot(StorageSyncInterval);
-
- // The following is balanced by the call to enableSuddenTermination in the
- // syncTimerFired function.
- disableSuddenTermination();
- }
-}
-
-void StorageAreaSync::syncTimerFired()
-{
- ASSERT(isMainThread());
-
- bool partialSync = false;
- {
- MutexLocker locker(m_syncLock);
-
- // Do not schedule another sync if we're still trying to complete the
- // previous one. But, if we're shutting down, schedule it anyway.
- if (m_syncInProgress && !m_finalSyncScheduled) {
- ASSERT(!m_syncTimer.isActive());
- m_syncTimer.startOneShot(StorageSyncInterval);
- return;
- }
-
- if (m_itemsCleared) {
- m_itemsPendingSync.clear();
- m_clearItemsWhileSyncing = true;
- m_itemsCleared = false;
- }
-
- HashMap<String, String>::iterator changed_it = m_changedItems.begin();
- HashMap<String, String>::iterator changed_end = m_changedItems.end();
- for (int count = 0; changed_it != changed_end; ++count, ++changed_it) {
- if (count >= MaxiumItemsToSync && !m_finalSyncScheduled) {
- partialSync = true;
- break;
- }
- m_itemsPendingSync.set(changed_it->key.isolatedCopy(), changed_it->value.isolatedCopy());
- }
-
- if (partialSync) {
- // We can't do the fast path of simply clearing all items, so we'll need to manually
- // remove them one by one. Done under lock since m_itemsPendingSync is modified by
- // the background thread.
- HashMap<String, String>::iterator pending_it = m_itemsPendingSync.begin();
- HashMap<String, String>::iterator pending_end = m_itemsPendingSync.end();
- for (; pending_it != pending_end; ++pending_it)
- m_changedItems.remove(pending_it->key);
- }
-
- if (!m_syncScheduled) {
- m_syncScheduled = true;
-
- // The following is balanced by the call to enableSuddenTermination in the
- // performSync function.
- disableSuddenTermination();
-
- RefPtr<StorageAreaSync> protector(this);
- m_syncManager->dispatch([protector] {
- protector->performSync();
- });
- }
- }
-
- if (partialSync) {
- // If we didn't finish syncing, then we need to finish the job later.
- ASSERT(!m_syncTimer.isActive());
- m_syncTimer.startOneShot(StorageSyncInterval);
- } else {
- // The following is balanced by the calls to disableSuddenTermination in the
- // scheduleItemForSync, scheduleClear, and scheduleFinalSync functions.
- enableSuddenTermination();
-
- m_changedItems.clear();
- }
-}
-
-void StorageAreaSync::openDatabase(OpenDatabaseParamType openingStrategy)
-{
- ASSERT(!isMainThread());
- ASSERT(!m_database.isOpen());
- ASSERT(!m_databaseOpenFailed);
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier);
-
- if (!fileExists(databaseFilename) && openingStrategy == SkipIfNonExistent)
- return;
-
- if (databaseFilename.isEmpty()) {
- LOG_ERROR("Filename for local storage database is empty - cannot open for persistent storage");
- markImported();
- m_databaseOpenFailed = true;
- return;
- }
-
- // A StorageTracker thread may have been scheduled to delete the db we're
- // reopening, so cancel possible deletion.
- StorageTracker::tracker().cancelDeletingOrigin(m_databaseIdentifier);
-
- if (!m_database.open(databaseFilename)) {
- LOG_ERROR("Failed to open database file %s for local storage", databaseFilename.utf8().data());
- markImported();
- m_databaseOpenFailed = true;
- return;
- }
-
- migrateItemTableIfNeeded();
-
- if (!m_database.executeCommand("CREATE TABLE IF NOT EXISTS ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)")) {
- LOG_ERROR("Failed to create table ItemTable for local storage");
- markImported();
- m_databaseOpenFailed = true;
- return;
- }
-
- StorageTracker::tracker().setOriginDetails(m_databaseIdentifier, databaseFilename);
-}
-
-void StorageAreaSync::migrateItemTableIfNeeded()
-{
- if (!m_database.tableExists("ItemTable"))
- return;
-
- {
- SQLiteStatement query(m_database, "SELECT value FROM ItemTable LIMIT 1");
- // this query isn't ever executed.
- if (query.isColumnDeclaredAsBlob(0))
- return;
- }
-
- // alter table for backward compliance, change the value type from TEXT to BLOB.
- static const char* commands[] = {
- "DROP TABLE IF EXISTS ItemTable2",
- "CREATE TABLE ItemTable2 (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)",
- "INSERT INTO ItemTable2 SELECT * from ItemTable",
- "DROP TABLE ItemTable",
- "ALTER TABLE ItemTable2 RENAME TO ItemTable",
- 0,
- };
-
- SQLiteTransaction transaction(m_database, false);
- transaction.begin();
- for (size_t i = 0; commands[i]; ++i) {
- if (!m_database.executeCommand(commands[i])) {
- LOG_ERROR("Failed to migrate table ItemTable for local storage when executing: %s", commands[i]);
- transaction.rollback();
-
- // finally it will try to keep a backup of ItemTable for the future restoration.
- // NOTICE: this will essentially DELETE the current database, but that's better
- // than continually hitting this case and never being able to use the local storage.
- // if this is ever hit, it's definitely a bug.
- ASSERT_NOT_REACHED();
- if (!m_database.executeCommand("ALTER TABLE ItemTable RENAME TO Backup_ItemTable"))
- LOG_ERROR("Failed to save ItemTable after migration job failed.");
-
- return;
- }
- }
- transaction.commit();
-}
-
-void StorageAreaSync::performImport()
-{
- ASSERT(!isMainThread());
- ASSERT(!m_database.isOpen());
-
- openDatabase(SkipIfNonExistent);
- if (!m_database.isOpen()) {
- markImported();
- return;
- }
-
- SQLiteStatement query(m_database, "SELECT key, value FROM ItemTable");
- if (query.prepare() != SQLResultOk) {
- LOG_ERROR("Unable to select items from ItemTable for local storage");
- markImported();
- return;
- }
-
- HashMap<String, String> itemMap;
-
- int result = query.step();
- while (result == SQLResultRow) {
- itemMap.set(query.getColumnText(0), query.getColumnBlobAsString(1));
- result = query.step();
- }
-
- if (result != SQLResultDone) {
- LOG_ERROR("Error reading items from ItemTable for local storage");
- markImported();
- return;
- }
-
- m_storageArea->importItems(itemMap);
-
- markImported();
-}
-
-void StorageAreaSync::markImported()
-{
- MutexLocker locker(m_importLock);
- m_importComplete = true;
- m_importCondition.signal();
-}
-
-// FIXME: In the future, we should allow use of StorageAreas while it's importing (when safe to do so).
-// Blocking everything until the import is complete is by far the simplest and safest thing to do, but
-// there is certainly room for safe optimization: Key/length will never be able to make use of such an
-// optimization (since the order of iteration can change as items are being added). Get can return any
-// item currently in the map. Get/remove can work whether or not it's in the map, but we'll need a list
-// of items the import should not overwrite. Clear can also work, but it'll need to kill the import
-// job first.
-void StorageAreaSync::blockUntilImportComplete()
-{
- ASSERT(isMainThread());
-
- // Fast path. We set m_storageArea to 0 only after m_importComplete being true.
- if (!m_storageArea)
- return;
-
- MutexLocker locker(m_importLock);
- while (!m_importComplete)
- m_importCondition.wait(m_importLock);
- m_storageArea = 0;
-}
-
-void StorageAreaSync::sync(bool clearItems, const HashMap<String, String>& items)
-{
- ASSERT(!isMainThread());
-
- if (items.isEmpty() && !clearItems && !m_syncCloseDatabase)
- return;
- if (m_databaseOpenFailed)
- return;
-
- if (!m_database.isOpen() && m_syncCloseDatabase) {
- m_syncCloseDatabase = false;
- return;
- }
-
- if (!m_database.isOpen())
- openDatabase(CreateIfNonExistent);
- if (!m_database.isOpen())
- return;
-
- // Closing this db because it is about to be deleted by StorageTracker.
- // The delete will be cancelled if StorageAreaSync needs to reopen the db
- // to write new items created after the request to delete the db.
- if (m_syncCloseDatabase) {
- m_syncCloseDatabase = false;
- m_database.close();
- return;
- }
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- // If the clear flag is set, then we clear all items out before we write any new ones in.
- if (clearItems) {
- SQLiteStatement clear(m_database, "DELETE FROM ItemTable");
- if (clear.prepare() != SQLResultOk) {
- LOG_ERROR("Failed to prepare clear statement - cannot write to local storage database");
- return;
- }
-
- int result = clear.step();
- if (result != SQLResultDone) {
- LOG_ERROR("Failed to clear all items in the local storage database - %i", result);
- return;
- }
- }
-
- SQLiteStatement insert(m_database, "INSERT INTO ItemTable VALUES (?, ?)");
- if (insert.prepare() != SQLResultOk) {
- LOG_ERROR("Failed to prepare insert statement - cannot write to local storage database");
- return;
- }
-
- SQLiteStatement remove(m_database, "DELETE FROM ItemTable WHERE key=?");
- if (remove.prepare() != SQLResultOk) {
- LOG_ERROR("Failed to prepare delete statement - cannot write to local storage database");
- return;
- }
-
- HashMap<String, String>::const_iterator end = items.end();
-
- SQLiteTransaction transaction(m_database);
- transaction.begin();
- for (HashMap<String, String>::const_iterator it = items.begin(); it != end; ++it) {
- // Based on the null-ness of the second argument, decide whether this is an insert or a delete.
- SQLiteStatement& query = it->value.isNull() ? remove : insert;
-
- query.bindText(1, it->key);
-
- // If the second argument is non-null, we're doing an insert, so bind it as the value.
- if (!it->value.isNull())
- query.bindBlob(2, it->value);
-
- int result = query.step();
- if (result != SQLResultDone) {
- LOG_ERROR("Failed to update item in the local storage database - %i", result);
- break;
- }
-
- query.reset();
- }
- transaction.commit();
-}
-
-void StorageAreaSync::performSync()
-{
- ASSERT(!isMainThread());
-
- bool clearItems;
- HashMap<String, String> items;
- {
- MutexLocker locker(m_syncLock);
-
- ASSERT(m_syncScheduled);
-
- clearItems = m_clearItemsWhileSyncing;
- m_itemsPendingSync.swap(items);
-
- m_clearItemsWhileSyncing = false;
- m_syncScheduled = false;
- m_syncInProgress = true;
- }
-
- sync(clearItems, items);
-
- {
- MutexLocker locker(m_syncLock);
- m_syncInProgress = false;
- }
-
- // The following is balanced by the call to disableSuddenTermination in the
- // syncTimerFired function.
- enableSuddenTermination();
-}
-
-void StorageAreaSync::deleteEmptyDatabase()
-{
- ASSERT(!isMainThread());
- if (!m_database.isOpen())
- return;
-
- SQLiteStatement query(m_database, "SELECT COUNT(*) FROM ItemTable");
- if (query.prepare() != SQLResultOk) {
- LOG_ERROR("Unable to count number of rows in ItemTable for local storage");
- return;
- }
-
- int result = query.step();
- if (result != SQLResultRow) {
- LOG_ERROR("No results when counting number of rows in ItemTable for local storage");
- return;
- }
-
- int count = query.getColumnInt(0);
- if (!count) {
- query.finalize();
- m_database.close();
- if (StorageTracker::tracker().isActive()) {
- StringImpl* databaseIdentifierCopy = &m_databaseIdentifier.impl()->isolatedCopy().leakRef();
- callOnMainThread([databaseIdentifierCopy] {
- StorageTracker::tracker().deleteOriginWithIdentifier(databaseIdentifierCopy);
- databaseIdentifierCopy->deref();
- });
- } else {
- String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier);
- if (!deleteFile(databaseFilename))
- LOG_ERROR("Failed to delete database file %s\n", databaseFilename.utf8().data());
- }
- }
-}
-
-void StorageAreaSync::scheduleSync()
-{
- syncTimerFired();
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageAreaSynch"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageAreaSync.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageAreaSync.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageAreaSync.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,106 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008, 2009, 2010 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 StorageAreaSync_h
-#define StorageAreaSync_h
-
-#include "SQLiteDatabase.h"
-#include "Timer.h"
-#include <wtf/HashMap.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-class Frame;
-class StorageAreaImpl;
-class StorageSyncManager;
-
-class StorageAreaSync : public ThreadSafeRefCounted<StorageAreaSync> {
-public:
- static Ref<StorageAreaSync> create(PassRefPtr<StorageSyncManager>, PassRefPtr<StorageAreaImpl>, const String& databaseIdentifier);
- ~StorageAreaSync();
-
- void scheduleFinalSync();
- void blockUntilImportComplete();
-
- void scheduleItemForSync(const String& key, const String& value);
- void scheduleClear();
- void scheduleCloseDatabase();
-
- void scheduleSync();
-
-private:
- StorageAreaSync(PassRefPtr<StorageSyncManager>, PassRefPtr<StorageAreaImpl>, const String& databaseIdentifier);
-
- Timer m_syncTimer;
- HashMap<String, String> m_changedItems;
- bool m_itemsCleared;
-
- bool m_finalSyncScheduled;
-
- RefPtr<StorageAreaImpl> m_storageArea;
- RefPtr<StorageSyncManager> m_syncManager;
-
- // The database handle will only ever be opened and used on the background thread.
- SQLiteDatabase m_database;
-
- // The following members are subject to thread synchronization issues.
-public:
- // Called from the background thread
- void performImport();
- void performSync();
- void deleteEmptyDatabase();
-
-private:
- enum OpenDatabaseParamType {
- CreateIfNonExistent,
- SkipIfNonExistent
- };
-
- void syncTimerFired();
- void openDatabase(OpenDatabaseParamType openingStrategy);
- void sync(bool clearItems, const HashMap<String, String>& items);
-
- const String m_databaseIdentifier;
-
- Mutex m_syncLock;
- HashMap<String, String> m_itemsPendingSync;
- bool m_clearItemsWhileSyncing;
- bool m_syncScheduled;
- bool m_syncInProgress;
- bool m_databaseOpenFailed;
-
- bool m_syncCloseDatabase;
-
- mutable Mutex m_importLock;
- ThreadCondition m_importCondition;
- bool m_importComplete;
- void markImported();
- void migrateItemTableIfNeeded();
-};
-
-} // namespace WebCore
-
-#endif // StorageAreaSync_h
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageNamespaceImplcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageNamespaceImpl.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageNamespaceImpl.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageNamespaceImpl.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,176 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 "config.h"
-#include "StorageNamespaceImpl.h"
-
-#include "SecurityOriginHash.h"
-#include "StorageAreaImpl.h"
-#include "StorageMap.h"
-#include "StorageSyncManager.h"
-#include "StorageTracker.h"
-#include <wtf/MainThread.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-static HashMap<String, StorageNamespaceImpl*>& localStorageNamespaceMap()
-{
- static NeverDestroyed<HashMap<String, StorageNamespaceImpl*>> localStorageNamespaceMap;
-
- return localStorageNamespaceMap;
-}
-
-RefPtr<StorageNamespaceImpl> StorageNamespaceImpl::createSessionStorageNamespace(unsigned quota)
-{
- return adoptRef(new StorageNamespaceImpl(SessionStorage, String(), quota));
-}
-
-RefPtr<StorageNamespaceImpl> StorageNamespaceImpl::getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota)
-{
- ASSERT(!databasePath.isNull());
-
- auto& slot = localStorageNamespaceMap().add(databasePath, nullptr).iterator->value;
- if (slot)
- return slot;
-
- RefPtr<StorageNamespaceImpl> storageNamespace = adoptRef(new StorageNamespaceImpl(LocalStorage, databasePath, quota));
- slot = storageNamespace.get();
-
- return storageNamespace;
-}
-
-StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path, unsigned quota)
- : m_storageType(storageType)
- , m_path(path.isolatedCopy())
- , m_syncManager(0)
- , m_quota(quota)
- , m_isShutdown(false)
-{
- if (m_storageType == LocalStorage && !m_path.isEmpty())
- m_syncManager = StorageSyncManager::create(m_path);
-}
-
-StorageNamespaceImpl::~StorageNamespaceImpl()
-{
- ASSERT(isMainThread());
-
- if (m_storageType == LocalStorage) {
- ASSERT(localStorageNamespaceMap().get(m_path) == this);
- localStorageNamespaceMap().remove(m_path);
- }
-
- if (!m_isShutdown)
- close();
-}
-
-PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy(Page*)
-{
- ASSERT(isMainThread());
- ASSERT(!m_isShutdown);
- ASSERT(m_storageType == SessionStorage);
-
- RefPtr<StorageNamespaceImpl> newNamespace = adoptRef(new StorageNamespaceImpl(m_storageType, m_path, m_quota));
-
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator i = m_storageAreaMap.begin(); i != end; ++i)
- newNamespace->m_storageAreaMap.set(i->key, i->value->copy());
- return newNamespace.release();
-}
-
-PassRefPtr<StorageArea> StorageNamespaceImpl::storageArea(PassRefPtr<SecurityOrigin> prpOrigin)
-{
- ASSERT(isMainThread());
- ASSERT(!m_isShutdown);
-
- RefPtr<SecurityOrigin> origin = prpOrigin;
- RefPtr<StorageAreaImpl> storageArea;
- if ((storageArea = m_storageAreaMap.get(origin)))
- return storageArea.release();
-
- storageArea = StorageAreaImpl::create(m_storageType, origin, m_syncManager, m_quota);
- m_storageAreaMap.set(origin.release(), storageArea);
- return storageArea.release();
-}
-
-void StorageNamespaceImpl::close()
-{
- ASSERT(isMainThread());
-
- if (m_isShutdown)
- return;
-
- // If we're session storage, we shouldn't need to do any work here.
- if (m_storageType == SessionStorage) {
- ASSERT(!m_syncManager);
- return;
- }
-
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
- it->value->close();
-
- if (m_syncManager)
- m_syncManager->close();
-
- m_isShutdown = true;
-}
-
-void StorageNamespaceImpl::clearOriginForDeletion(SecurityOrigin* origin)
-{
- ASSERT(isMainThread());
-
- RefPtr<StorageAreaImpl> storageArea = m_storageAreaMap.get(origin);
- if (storageArea)
- storageArea->clearForOriginDeletion();
-}
-
-void StorageNamespaceImpl::clearAllOriginsForDeletion()
-{
- ASSERT(isMainThread());
-
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
- it->value->clearForOriginDeletion();
-}
-
-void StorageNamespaceImpl::sync()
-{
- ASSERT(isMainThread());
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
- it->value->sync();
-}
-
-void StorageNamespaceImpl::closeIdleLocalStorageDatabases()
-{
- ASSERT(isMainThread());
- StorageAreaMap::iterator end = m_storageAreaMap.end();
- for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
- it->value->closeDatabaseIfIdle();
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageNamespaceImplh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageNamespaceImpl.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageNamespaceImpl.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageNamespaceImpl.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,79 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 StorageNamespaceImpl_h
-#define StorageNamespaceImpl_h
-
-#include "SecurityOriginHash.h"
-#include "StorageArea.h"
-#include "StorageNamespace.h"
-#include <wtf/HashMap.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class StorageAreaImpl;
-
-class StorageNamespaceImpl : public StorageNamespace {
-public:
- WEBCORE_EXPORT static RefPtr<StorageNamespaceImpl> createSessionStorageNamespace(unsigned quota);
- WEBCORE_EXPORT static RefPtr<StorageNamespaceImpl> getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota);
- virtual ~StorageNamespaceImpl();
-
- virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) override;
- virtual PassRefPtr<StorageNamespace> copy(Page* newPage) override;
- virtual void close() override;
-
- // Not removing the origin's StorageArea from m_storageAreaMap because
- // we're just deleting the underlying db file. If an item is added immediately
- // after file deletion, we want the same StorageArea to eventually trigger
- // a sync and for StorageAreaSync to recreate the backing db file.
- virtual void clearOriginForDeletion(SecurityOrigin*) override;
- virtual void clearAllOriginsForDeletion() override;
- virtual void sync() override;
- virtual void closeIdleLocalStorageDatabases() override;
-
-private:
- StorageNamespaceImpl(StorageType, const String& path, unsigned quota);
-
- typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl>> StorageAreaMap;
- StorageAreaMap m_storageAreaMap;
-
- StorageType m_storageType;
-
- // Only used if m_storageType == LocalStorage and the path was not "" in our constructor.
- String m_path;
- RefPtr<StorageSyncManager> m_syncManager;
-
- // The default quota for each new storage area.
- unsigned m_quota;
-
- bool m_isShutdown;
-};
-
-} // namespace WebCore
-
-#endif // StorageNamespaceImpl_h
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageSyncManagercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageSyncManager.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageSyncManager.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageSyncManager.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,86 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 "config.h"
-#include "StorageSyncManager.h"
-
-#include "FileSystem.h"
-#include "StorageThread.h"
-#include <wtf/MainThread.h>
-#include <wtf/text/CString.h>
-
-namespace WebCore {
-
-Ref<StorageSyncManager> StorageSyncManager::create(const String& path)
-{
- return adoptRef(*new StorageSyncManager(path));
-}
-
-StorageSyncManager::StorageSyncManager(const String& path)
- : m_thread(std::make_unique<StorageThread>())
- , m_path(path.isolatedCopy())
-{
- ASSERT(isMainThread());
- ASSERT(!m_path.isEmpty());
- m_thread->start();
-}
-
-StorageSyncManager::~StorageSyncManager()
-{
- ASSERT(isMainThread());
- ASSERT(!m_thread);
-}
-
-// Called on a background thread.
-String StorageSyncManager::fullDatabaseFilename(const String& databaseIdentifier)
-{
- if (!makeAllDirectories(m_path)) {
- LOG_ERROR("Unabled to create LocalStorage database path %s", m_path.utf8().data());
- return String();
- }
-
- return pathByAppendingComponent(m_path, databaseIdentifier + ".localstorage");
-}
-
-void StorageSyncManager::dispatch(const std::function<void ()>& function)
-{
- ASSERT(isMainThread());
- ASSERT(m_thread);
-
- if (m_thread)
- m_thread->dispatch(function);
-}
-
-void StorageSyncManager::close()
-{
- ASSERT(isMainThread());
-
- if (m_thread) {
- m_thread->terminate();
- m_thread = nullptr;
- }
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageSyncManagerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageSyncManager.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageSyncManager.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageSyncManager.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 StorageSyncManager_h
-#define StorageSyncManager_h
-
-#include <functional>
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class StorageThread;
-class StorageAreaSync;
-
-class StorageSyncManager : public RefCounted<StorageSyncManager> {
-public:
- static Ref<StorageSyncManager> create(const String& path);
- ~StorageSyncManager();
-
- void dispatch(const std::function<void ()>&);
- void close();
-
-private:
- explicit StorageSyncManager(const String& path);
-
- std::unique_ptr<StorageThread> m_thread;
-
-// The following members are subject to thread synchronization issues
-public:
- // To be called from the background thread:
- String fullDatabaseFilename(const String& databaseIdentifier);
-
-private:
- String m_path;
-};
-
-} // namespace WebCore
-
-#endif // StorageSyncManager_h
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageThreadcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageThread.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageThread.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageThread.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,115 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 "config.h"
-#include "StorageThread.h"
-
-#include <wtf/AutodrainedPool.h>
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-static HashSet<StorageThread*>& activeStorageThreads()
-{
- ASSERT(isMainThread());
- DEPRECATED_DEFINE_STATIC_LOCAL(HashSet<StorageThread*>, threads, ());
- return threads;
-}
-
-StorageThread::StorageThread()
- : m_threadID(0)
-{
- ASSERT(isMainThread());
-}
-
-StorageThread::~StorageThread()
-{
- ASSERT(isMainThread());
- ASSERT(!m_threadID);
-}
-
-bool StorageThread::start()
-{
- ASSERT(isMainThread());
- if (!m_threadID)
- m_threadID = createThread(StorageThread::threadEntryPointCallback, this, "WebCore: LocalStorage");
- activeStorageThreads().add(this);
- return m_threadID;
-}
-
-void StorageThread::threadEntryPointCallback(void* thread)
-{
- static_cast<StorageThread*>(thread)->threadEntryPoint();
-}
-
-void StorageThread::threadEntryPoint()
-{
- ASSERT(!isMainThread());
-
- while (auto function = m_queue.waitForMessage()) {
- AutodrainedPool pool;
- (*function)();
- }
-}
-
-void StorageThread::dispatch(const std::function<void ()>& function)
-{
- ASSERT(isMainThread());
- ASSERT(!m_queue.killed() && m_threadID);
- m_queue.append(std::make_unique<std::function<void ()>>(function));
-}
-
-void StorageThread::terminate()
-{
- ASSERT(isMainThread());
- ASSERT(!m_queue.killed() && m_threadID);
- activeStorageThreads().remove(this);
- // Even in weird, exceptional cases, don't wait on a nonexistent thread to terminate.
- if (!m_threadID)
- return;
-
- m_queue.append(std::make_unique<std::function<void ()>>([this] {
- performTerminate();
- }));
- waitForThreadCompletion(m_threadID);
- ASSERT(m_queue.killed());
- m_threadID = 0;
-}
-
-void StorageThread::performTerminate()
-{
- ASSERT(!isMainThread());
- m_queue.kill();
-}
-
-void StorageThread::releaseFastMallocFreeMemoryInAllThreads()
-{
- HashSet<StorageThread*>& threads = activeStorageThreads();
-
- for (HashSet<StorageThread*>::iterator it = threads.begin(), end = threads.end(); it != end; ++it)
- (*it)->dispatch(WTF::releaseFastMallocFreeMemory);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageThreadh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageThread.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageThread.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageThread.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,67 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 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 StorageThread_h
-#define StorageThread_h
-
-#include <functional>
-#include <wtf/HashSet.h>
-#include <wtf/MessageQueue.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
-
-namespace WebCore {
-
-class StorageAreaSync;
-class StorageTask;
-
-class StorageThread {
- WTF_MAKE_NONCOPYABLE(StorageThread); WTF_MAKE_FAST_ALLOCATED;
-public:
- StorageThread();
- ~StorageThread();
-
- bool start();
- void terminate();
-
- void dispatch(const std::function<void()>&);
-
- static void releaseFastMallocFreeMemoryInAllThreads();
-
-private:
- // Called on background thread.
- static void threadEntryPointCallback(void*);
- void threadEntryPoint();
-
- // Background thread part of the terminate procedure.
- void performTerminate();
-
- ThreadIdentifier m_threadID;
- MessageQueue<std::function<void()>> m_queue;
-};
-
-} // namespace WebCore
-
-#endif // StorageThread_h
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageTrackercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageTracker.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageTracker.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageTracker.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,660 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 "config.h"
-#include "StorageTracker.h"
-
-#include "FileSystem.h"
-#include "PageGroup.h"
-#include "SQLiteDatabaseTracker.h"
-#include "SQLiteStatement.h"
-#include "SecurityOrigin.h"
-#include "StorageThread.h"
-#include "StorageTrackerClient.h"
-#include "TextEncoding.h"
-#include <wtf/MainThread.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/Vector.h>
-#include <wtf/text/CString.h>
-
-#if PLATFORM(IOS)
-#include <sqlite3_private.h>
-#endif
-
-namespace WebCore {
-
-static StorageTracker* storageTracker = 0;
-
-// If there is no document referencing a storage database, close the underlying database
-// after it has been idle for m_StorageDatabaseIdleInterval seconds.
-static const double DefaultStorageDatabaseIdleInterval = 300;
-
-void StorageTracker::initializeTracker(const String& storagePath, StorageTrackerClient* client)
-{
- ASSERT(isMainThread());
- ASSERT(!storageTracker || !storageTracker->m_client);
-
- if (!storageTracker)
- storageTracker = new StorageTracker(storagePath);
-
- storageTracker->m_client = client;
- storageTracker->m_needsInitialization = true;
-}
-
-void StorageTracker::internalInitialize()
-{
- m_needsInitialization = false;
-
- ASSERT(isMainThread());
-
- // Make sure text encoding maps have been built on the main thread, as the StorageTracker thread might try to do it there instead.
- // FIXME (<rdar://problem/9127819>): Is there a more explicit way of doing this besides accessing the UTF8Encoding?
- UTF8Encoding();
-
- storageTracker->setIsActive(true);
- storageTracker->m_thread->start();
- storageTracker->importOriginIdentifiers();
-}
-
-StorageTracker& StorageTracker::tracker()
-{
- if (!storageTracker)
- storageTracker = new StorageTracker("");
- if (storageTracker->m_needsInitialization)
- storageTracker->internalInitialize();
-
- return *storageTracker;
-}
-
-StorageTracker::StorageTracker(const String& storagePath)
- : m_storageDirectoryPath(storagePath.isolatedCopy())
- , m_client(0)
- , m_thread(std::make_unique<StorageThread>())
- , m_isActive(false)
- , m_needsInitialization(false)
- , m_StorageDatabaseIdleInterval(DefaultStorageDatabaseIdleInterval)
-{
-}
-
-void StorageTracker::setDatabaseDirectoryPath(const String& path)
-{
- MutexLocker locker(m_databaseMutex);
-
- if (m_database.isOpen())
- m_database.close();
-
- m_storageDirectoryPath = path.isolatedCopy();
-
- {
- MutexLocker locker(m_originSetMutex);
- m_originSet.clear();
- }
-
- if (!m_isActive)
- return;
-
- importOriginIdentifiers();
-}
-
-String StorageTracker::databaseDirectoryPath() const
-{
- return m_storageDirectoryPath.isolatedCopy();
-}
-
-String StorageTracker::trackerDatabasePath()
-{
- ASSERT(!m_databaseMutex.tryLock());
- return pathByAppendingComponent(m_storageDirectoryPath, "StorageTracker.db");
-}
-
-static bool ensureDatabaseFileExists(const String& fileName, bool createIfDoesNotExist)
-{
- if (createIfDoesNotExist)
- return makeAllDirectories(directoryName(fileName));
-
- return fileExists(fileName);
-}
-
-void StorageTracker::openTrackerDatabase(bool createIfDoesNotExist)
-{
- ASSERT(m_isActive);
- ASSERT(!isMainThread());
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- ASSERT(!m_databaseMutex.tryLock());
-
- if (m_database.isOpen())
- return;
-
- String databasePath = trackerDatabasePath();
-
- if (!ensureDatabaseFileExists(databasePath, createIfDoesNotExist)) {
- if (createIfDoesNotExist)
- LOG_ERROR("Failed to create database file '%s'", databasePath.ascii().data());
- return;
- }
-
- if (!m_database.open(databasePath)) {
- LOG_ERROR("Failed to open databasePath %s.", databasePath.ascii().data());
- return;
- }
-
- m_database.disableThreadingChecks();
-
- if (!m_database.tableExists("Origins")) {
- if (!m_database.executeCommand("CREATE TABLE Origins (origin TEXT UNIQUE ON CONFLICT REPLACE, path TEXT);"))
- LOG_ERROR("Failed to create Origins table.");
- }
-}
-
-void StorageTracker::importOriginIdentifiers()
-{
- if (!m_isActive)
- return;
-
- ASSERT(isMainThread());
- ASSERT(m_thread);
-
- m_thread->dispatch([this] {
- syncImportOriginIdentifiers();
- });
-}
-
-void StorageTracker::finishedImportingOriginIdentifiers()
-{
- MutexLocker locker(m_databaseMutex);
- if (m_client)
- m_client->didFinishLoadingOrigins();
-}
-
-void StorageTracker::syncImportOriginIdentifiers()
-{
- ASSERT(m_isActive);
-
- ASSERT(!isMainThread());
-
- {
- MutexLocker locker(m_databaseMutex);
-
- // Don't force creation of StorageTracker's db just because a tracker
- // was initialized. It will be created if local storage dbs are found
- // by syncFileSystemAndTrackerDatabse() or the next time a local storage
- // db is created by StorageAreaSync.
- openTrackerDatabase(false);
-
- if (m_database.isOpen()) {
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- SQLiteStatement statement(m_database, "SELECT origin FROM Origins");
- if (statement.prepare() != SQLResultOk) {
- LOG_ERROR("Failed to prepare statement.");
- return;
- }
-
- int result;
-
- {
- MutexLocker lockOrigins(m_originSetMutex);
- while ((result = statement.step()) == SQLResultRow)
- m_originSet.add(statement.getColumnText(0).isolatedCopy());
- }
-
- if (result != SQLResultDone) {
- LOG_ERROR("Failed to read in all origins from the database.");
- return;
- }
- }
- }
-
- syncFileSystemAndTrackerDatabase();
-
- {
- MutexLocker locker(m_clientMutex);
-
- if (m_client) {
- MutexLocker locker(m_originSetMutex);
- OriginSet::const_iterator end = m_originSet.end();
- for (OriginSet::const_iterator it = m_originSet.begin(); it != end; ++it)
- m_client->dispatchDidModifyOrigin(*it);
- }
- }
-
- callOnMainThread([this] {
- finishedImportingOriginIdentifiers();
- });
-}
-
-void StorageTracker::syncFileSystemAndTrackerDatabase()
-{
- ASSERT(!isMainThread());
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- ASSERT(m_isActive);
-
- Vector<String> paths;
- {
- MutexLocker locker(m_databaseMutex);
- paths = listDirectory(m_storageDirectoryPath, "*.localstorage");
- }
-
- // Use a copy of m_originSet to find expired entries and to schedule their
- // deletions from disk and from m_originSet.
- OriginSet originSetCopy;
- {
- MutexLocker locker(m_originSetMutex);
- for (OriginSet::const_iterator it = m_originSet.begin(), end = m_originSet.end(); it != end; ++it)
- originSetCopy.add((*it).isolatedCopy());
- }
-
- // Add missing StorageTracker records.
- OriginSet foundOrigins;
- String fileExtension = ASCIILiteral(".localstorage");
-
- for (Vector<String>::const_iterator it = paths.begin(), end = paths.end(); it != end; ++it) {
- const String& path = *it;
-
- if (path.length() > fileExtension.length() && path.endsWith(fileExtension, true)) {
- String file = pathGetFileName(path);
- String originIdentifier = file.substring(0, file.length() - fileExtension.length());
- if (!originSetCopy.contains(originIdentifier))
- syncSetOriginDetails(originIdentifier, path);
-
- foundOrigins.add(originIdentifier);
- }
- }
-
- // Delete stale StorageTracker records.
- for (OriginSet::const_iterator it = originSetCopy.begin(), end = originSetCopy.end(); it != end; ++it) {
- const String& originIdentifier = *it;
- if (foundOrigins.contains(originIdentifier))
- continue;
-
- String originIdentifierCopy = originIdentifier.isolatedCopy();
- callOnMainThread([this, originIdentifierCopy] {
- deleteOriginWithIdentifier(originIdentifierCopy);
- });
- }
-}
-
-void StorageTracker::setOriginDetails(const String& originIdentifier, const String& databaseFile)
-{
- if (!m_isActive)
- return;
-
- {
- MutexLocker locker(m_originSetMutex);
-
- if (m_originSet.contains(originIdentifier))
- return;
-
- m_originSet.add(originIdentifier);
- }
-
- String originIdentifierCopy = originIdentifier.isolatedCopy();
- String databaseFileCopy = databaseFile.isolatedCopy();
- auto function = [this, originIdentifierCopy, databaseFileCopy] {
- syncSetOriginDetails(originIdentifierCopy, databaseFileCopy);
- };
-
- if (isMainThread()) {
- ASSERT(m_thread);
- m_thread->dispatch(function);
- } else {
- // FIXME: This weird ping-ponging was done to fix a deadlock. We should figure out a cleaner way to avoid it instead.
- callOnMainThread([this, function] {
- m_thread->dispatch(function);
- });
- }
-}
-
-void StorageTracker::syncSetOriginDetails(const String& originIdentifier, const String& databaseFile)
-{
- ASSERT(!isMainThread());
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- MutexLocker locker(m_databaseMutex);
-
- openTrackerDatabase(true);
-
- if (!m_database.isOpen())
- return;
-
- SQLiteStatement statement(m_database, "INSERT INTO Origins VALUES (?, ?)");
- if (statement.prepare() != SQLResultOk) {
- LOG_ERROR("Unable to establish origin '%s' in the tracker", originIdentifier.ascii().data());
- return;
- }
-
- statement.bindText(1, originIdentifier);
- statement.bindText(2, databaseFile);
-
- if (statement.step() != SQLResultDone)
- LOG_ERROR("Unable to establish origin '%s' in the tracker", originIdentifier.ascii().data());
-
- {
- MutexLocker locker(m_originSetMutex);
- if (!m_originSet.contains(originIdentifier))
- m_originSet.add(originIdentifier);
- }
-
- {
- MutexLocker locker(m_clientMutex);
- if (m_client)
- m_client->dispatchDidModifyOrigin(originIdentifier);
- }
-}
-
-void StorageTracker::origins(Vector<RefPtr<SecurityOrigin>>& result)
-{
- ASSERT(m_isActive);
-
- if (!m_isActive)
- return;
-
- MutexLocker locker(m_originSetMutex);
-
- for (OriginSet::const_iterator it = m_originSet.begin(), end = m_originSet.end(); it != end; ++it)
- result.append(SecurityOrigin::createFromDatabaseIdentifier(*it));
-}
-
-void StorageTracker::deleteAllOrigins()
-{
- ASSERT(m_isActive);
- ASSERT(isMainThread());
- ASSERT(m_thread);
-
- if (!m_isActive)
- return;
-
- {
- MutexLocker locker(m_originSetMutex);
- willDeleteAllOrigins();
- m_originSet.clear();
- }
-
- PageGroup::clearLocalStorageForAllOrigins();
-
- m_thread->dispatch([this] {
- syncDeleteAllOrigins();
- });
-}
-
-#if PLATFORM(IOS)
-static void truncateDatabaseFile(SQLiteDatabase& database)
-{
- sqlite3_file_control(database.sqlite3Handle(), 0, SQLITE_TRUNCATE_DATABASE, 0);
-}
-#endif
-
-void StorageTracker::syncDeleteAllOrigins()
-{
- ASSERT(!isMainThread());
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- MutexLocker locker(m_databaseMutex);
-
- openTrackerDatabase(false);
- if (!m_database.isOpen())
- return;
-
- SQLiteStatement statement(m_database, "SELECT origin, path FROM Origins");
- if (statement.prepare() != SQLResultOk) {
- LOG_ERROR("Failed to prepare statement.");
- return;
- }
-
- int result;
- while ((result = statement.step()) == SQLResultRow) {
- if (!canDeleteOrigin(statement.getColumnText(0)))
- continue;
-
- deleteFile(statement.getColumnText(1));
-
- {
- MutexLocker locker(m_clientMutex);
- if (m_client)
- m_client->dispatchDidModifyOrigin(statement.getColumnText(0));
- }
- }
-
- if (result != SQLResultDone)
- LOG_ERROR("Failed to read in all origins from the database.");
-
- if (m_database.isOpen()) {
-#if PLATFORM(IOS)
- truncateDatabaseFile(m_database);
-#endif
- m_database.close();
- }
-
-#if !PLATFORM(IOS)
- if (!deleteFile(trackerDatabasePath())) {
- // In the case where it is not possible to delete the database file (e.g some other program
- // like a virus scanner is accessing it), make sure to remove all entries.
- openTrackerDatabase(false);
- if (!m_database.isOpen())
- return;
- SQLiteStatement deleteStatement(m_database, "DELETE FROM Origins");
- if (deleteStatement.prepare() != SQLResultOk) {
- LOG_ERROR("Unable to prepare deletion of all origins");
- return;
- }
- if (!deleteStatement.executeCommand()) {
- LOG_ERROR("Unable to execute deletion of all origins");
- return;
- }
- }
- deleteEmptyDirectory(m_storageDirectoryPath);
-#endif
-}
-
-void StorageTracker::deleteOriginWithIdentifier(const String& originIdentifier)
-{
- deleteOrigin(&SecurityOrigin::createFromDatabaseIdentifier(originIdentifier).get());
-}
-
-void StorageTracker::deleteOrigin(SecurityOrigin* origin)
-{
- ASSERT(m_isActive);
- ASSERT(isMainThread());
- ASSERT(m_thread);
-
- if (!m_isActive)
- return;
-
- // Before deleting database, we need to clear in-memory local storage data
- // in StorageArea, and to close the StorageArea db. It's possible for an
- // item to be added immediately after closing the db and cause StorageAreaSync
- // to reopen the db before the db is deleted by a StorageTracker thread.
- // In this case, reopening the db in StorageAreaSync will cancel a pending
- // StorageTracker db deletion.
- PageGroup::clearLocalStorageForOrigin(origin);
-
- String originId = origin->databaseIdentifier();
-
- {
- MutexLocker locker(m_originSetMutex);
- willDeleteOrigin(originId);
- m_originSet.remove(originId);
- }
-
- String originIdCopy = originId.isolatedCopy();
- m_thread->dispatch([this, originIdCopy] {
- syncDeleteOrigin(originIdCopy);
- });
-}
-
-void StorageTracker::syncDeleteOrigin(const String& originIdentifier)
-{
- ASSERT(!isMainThread());
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- MutexLocker locker(m_databaseMutex);
-
- if (!canDeleteOrigin(originIdentifier)) {
- LOG_ERROR("Attempted to delete origin '%s' while it was being created\n", originIdentifier.ascii().data());
- return;
- }
-
- openTrackerDatabase(false);
- if (!m_database.isOpen())
- return;
-
- String path = databasePathForOrigin(originIdentifier);
- if (path.isEmpty()) {
- // It is possible to get a request from the API to delete the storage for an origin that
- // has no such storage.
- return;
- }
-
- SQLiteStatement deleteStatement(m_database, "DELETE FROM Origins where origin=?");
- if (deleteStatement.prepare() != SQLResultOk) {
- LOG_ERROR("Unable to prepare deletion of origin '%s'", originIdentifier.ascii().data());
- return;
- }
- deleteStatement.bindText(1, originIdentifier);
- if (!deleteStatement.executeCommand()) {
- LOG_ERROR("Unable to execute deletion of origin '%s'", originIdentifier.ascii().data());
- return;
- }
-
- deleteFile(path);
-
- bool shouldDeleteTrackerFiles = false;
- {
- MutexLocker locker(m_originSetMutex);
- m_originSet.remove(originIdentifier);
- shouldDeleteTrackerFiles = m_originSet.isEmpty();
- }
-
- if (shouldDeleteTrackerFiles) {
-#if PLATFORM(IOS)
- truncateDatabaseFile(m_database);
-#endif
- m_database.close();
-#if !PLATFORM(IOS)
- deleteFile(trackerDatabasePath());
- deleteEmptyDirectory(m_storageDirectoryPath);
-#endif
- }
-
- {
- MutexLocker locker(m_clientMutex);
- if (m_client)
- m_client->dispatchDidModifyOrigin(originIdentifier);
- }
-}
-
-void StorageTracker::willDeleteAllOrigins()
-{
- ASSERT(!m_originSetMutex.tryLock());
-
- OriginSet::const_iterator end = m_originSet.end();
- for (OriginSet::const_iterator it = m_originSet.begin(); it != end; ++it)
- m_originsBeingDeleted.add((*it).isolatedCopy());
-}
-
-void StorageTracker::willDeleteOrigin(const String& originIdentifier)
-{
- ASSERT(isMainThread());
- ASSERT(!m_originSetMutex.tryLock());
-
- m_originsBeingDeleted.add(originIdentifier);
-}
-
-bool StorageTracker::canDeleteOrigin(const String& originIdentifier)
-{
- ASSERT(!m_databaseMutex.tryLock());
- MutexLocker locker(m_originSetMutex);
- return m_originsBeingDeleted.contains(originIdentifier);
-}
-
-void StorageTracker::cancelDeletingOrigin(const String& originIdentifier)
-{
- if (!m_isActive)
- return;
-
- MutexLocker locker(m_databaseMutex);
- {
- MutexLocker locker(m_originSetMutex);
- if (!m_originsBeingDeleted.isEmpty())
- m_originsBeingDeleted.remove(originIdentifier);
- }
-}
-
-bool StorageTracker::isActive()
-{
- return m_isActive;
-}
-
-void StorageTracker::setIsActive(bool flag)
-{
- m_isActive = flag;
-}
-
-String StorageTracker::databasePathForOrigin(const String& originIdentifier)
-{
- ASSERT(!m_databaseMutex.tryLock());
- ASSERT(m_isActive);
-
- if (!m_database.isOpen())
- return String();
-
- SQLiteTransactionInProgressAutoCounter transactionCounter;
-
- SQLiteStatement pathStatement(m_database, "SELECT path FROM Origins WHERE origin=?");
- if (pathStatement.prepare() != SQLResultOk) {
- LOG_ERROR("Unable to prepare selection of path for origin '%s'", originIdentifier.ascii().data());
- return String();
- }
- pathStatement.bindText(1, originIdentifier);
- int result = pathStatement.step();
- if (result != SQLResultRow)
- return String();
-
- return pathStatement.getColumnText(0);
-}
-
-long long StorageTracker::diskUsageForOrigin(SecurityOrigin* origin)
-{
- if (!m_isActive)
- return 0;
-
- MutexLocker locker(m_databaseMutex);
-
- String path = databasePathForOrigin(origin->databaseIdentifier());
- if (path.isEmpty())
- return 0;
-
- long long size;
- return getFileSize(path, size) ? size : 0;
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageTrackerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageTracker.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageTracker.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageTracker.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,120 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 StorageTracker_h
-#define StorageTracker_h
-
-#include "SQLiteDatabase.h"
-#include <wtf/HashSet.h>
-#include <wtf/Vector.h>
-#include <wtf/text/StringHash.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class StorageTask;
-class StorageThread;
-class SecurityOrigin;
-class StorageTrackerClient;
-
-class StorageTracker {
- WTF_MAKE_NONCOPYABLE(StorageTracker);
- WTF_MAKE_FAST_ALLOCATED;
-public:
- WEBCORE_EXPORT static void initializeTracker(const String& storagePath, StorageTrackerClient*);
- WEBCORE_EXPORT static StorageTracker& tracker();
-
- void setDatabaseDirectoryPath(const String&);
- String databaseDirectoryPath() const;
-
- void setOriginDetails(const String& originIdentifier, const String& databaseFile);
-
- WEBCORE_EXPORT void deleteAllOrigins();
- WEBCORE_EXPORT void deleteOrigin(SecurityOrigin*);
- void deleteOriginWithIdentifier(const String& originIdentifier);
- WEBCORE_EXPORT void origins(Vector<RefPtr<SecurityOrigin>>& result);
- WEBCORE_EXPORT long long diskUsageForOrigin(SecurityOrigin*);
-
- void cancelDeletingOrigin(const String& originIdentifier);
-
- bool isActive();
-
- double storageDatabaseIdleInterval() { return m_StorageDatabaseIdleInterval; }
- void setStorageDatabaseIdleInterval(double interval) { m_StorageDatabaseIdleInterval = interval; }
-
- WEBCORE_EXPORT void syncFileSystemAndTrackerDatabase();
-
-private:
- explicit StorageTracker(const String& storagePath);
-
- void internalInitialize();
-
- String trackerDatabasePath();
- void openTrackerDatabase(bool createIfDoesNotExist);
-
- void importOriginIdentifiers();
- void finishedImportingOriginIdentifiers();
-
- void deleteTrackerFiles();
- String databasePathForOrigin(const String& originIdentifier);
-
- bool canDeleteOrigin(const String& originIdentifier);
- void willDeleteOrigin(const String& originIdentifier);
- void willDeleteAllOrigins();
-
- void originFilePaths(Vector<String>& paths);
-
- void setIsActive(bool);
-
- // Sync to disk on background thread.
- void syncDeleteAllOrigins();
- void syncDeleteOrigin(const String& originIdentifier);
- void syncSetOriginDetails(const String& originIdentifier, const String& databaseFile);
- void syncImportOriginIdentifiers();
-
- // Mutex for m_database and m_storageDirectoryPath.
- Mutex m_databaseMutex;
- SQLiteDatabase m_database;
- String m_storageDirectoryPath;
-
- Mutex m_clientMutex;
- StorageTrackerClient* m_client;
-
- // Guard for m_originSet and m_originsBeingDeleted.
- Mutex m_originSetMutex;
- typedef HashSet<String> OriginSet;
- OriginSet m_originSet;
- OriginSet m_originsBeingDeleted;
-
- std::unique_ptr<StorageThread> m_thread;
-
- bool m_isActive;
- bool m_needsInitialization;
- double m_StorageDatabaseIdleInterval;
-};
-
-} // namespace WebCore
-
-#endif // StorageTracker_h
</del></span></pre></div>
<a id="trunkSourceWebCorestorageStorageTrackerClienth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/storage/StorageTrackerClient.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/storage/StorageTrackerClient.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebCore/storage/StorageTrackerClient.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,42 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 StorageTrackerClient_h
-#define StorageTrackerClient_h
-
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class StorageTrackerClient {
-public:
- virtual ~StorageTrackerClient() { }
- virtual void dispatchDidModifyOrigin(const String& originIdentifier) = 0;
- virtual void didFinishLoadingOrigins() = 0;
-};
-
-} // namespace WebCore
-
-#endif // StorageTrackerClient_h
</del></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/ChangeLog        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,3 +1,130 @@
</span><ins>+2014-12-29 Anders Carlsson <andersca@apple.com>
+
+ Move storage code from WebCore to WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=139558
+
+ Reviewed by Darin Adler.
+
+ * Storage/StorageAreaImpl.cpp: Renamed from Source/WebCore/storage/StorageAreaImpl.cpp.
+ (WebCore::StorageAreaImpl::~StorageAreaImpl):
+ (WebCore::StorageAreaImpl::StorageAreaImpl):
+ (WebCore::StorageAreaImpl::create):
+ (WebCore::StorageAreaImpl::copy):
+ (WebCore::StorageAreaImpl::canAccessStorage):
+ (WebCore::StorageAreaImpl::storageType):
+ (WebCore::StorageAreaImpl::length):
+ (WebCore::StorageAreaImpl::key):
+ (WebCore::StorageAreaImpl::item):
+ (WebCore::StorageAreaImpl::setItem):
+ (WebCore::StorageAreaImpl::removeItem):
+ (WebCore::StorageAreaImpl::clear):
+ (WebCore::StorageAreaImpl::contains):
+ (WebCore::StorageAreaImpl::importItems):
+ (WebCore::StorageAreaImpl::close):
+ (WebCore::StorageAreaImpl::clearForOriginDeletion):
+ (WebCore::StorageAreaImpl::sync):
+ (WebCore::StorageAreaImpl::blockUntilImportComplete):
+ (WebCore::StorageAreaImpl::memoryBytesUsedByCache):
+ (WebCore::StorageAreaImpl::incrementAccessCount):
+ (WebCore::StorageAreaImpl::decrementAccessCount):
+ (WebCore::StorageAreaImpl::closeDatabaseTimerFired):
+ (WebCore::StorageAreaImpl::closeDatabaseIfIdle):
+ (WebCore::StorageAreaImpl::dispatchStorageEvent):
+ * Storage/StorageAreaImpl.h: Renamed from Source/WebCore/storage/StorageAreaImpl.h.
+ * Storage/StorageAreaSync.cpp: Renamed from Source/WebCore/storage/StorageAreaSync.cpp.
+ (WebCore::StorageAreaSync::StorageAreaSync):
+ (WebCore::StorageAreaSync::create):
+ (WebCore::StorageAreaSync::~StorageAreaSync):
+ (WebCore::StorageAreaSync::scheduleFinalSync):
+ (WebCore::StorageAreaSync::scheduleItemForSync):
+ (WebCore::StorageAreaSync::scheduleClear):
+ (WebCore::StorageAreaSync::scheduleCloseDatabase):
+ (WebCore::StorageAreaSync::syncTimerFired):
+ (WebCore::StorageAreaSync::openDatabase):
+ (WebCore::StorageAreaSync::migrateItemTableIfNeeded):
+ (WebCore::StorageAreaSync::performImport):
+ (WebCore::StorageAreaSync::markImported):
+ (WebCore::StorageAreaSync::blockUntilImportComplete):
+ (WebCore::StorageAreaSync::sync):
+ (WebCore::StorageAreaSync::performSync):
+ (WebCore::StorageAreaSync::deleteEmptyDatabase):
+ (WebCore::StorageAreaSync::scheduleSync):
+ * Storage/StorageAreaSync.h: Renamed from Source/WebCore/storage/StorageAreaSync.h.
+ * Storage/StorageNamespaceImpl.cpp: Renamed from Source/WebCore/storage/StorageNamespaceImpl.cpp.
+ (WebCore::localStorageNamespaceMap):
+ (WebCore::StorageNamespaceImpl::createSessionStorageNamespace):
+ (WebCore::StorageNamespaceImpl::getOrCreateLocalStorageNamespace):
+ (WebCore::StorageNamespaceImpl::StorageNamespaceImpl):
+ (WebCore::StorageNamespaceImpl::~StorageNamespaceImpl):
+ (WebCore::StorageNamespaceImpl::copy):
+ (WebCore::StorageNamespaceImpl::storageArea):
+ (WebCore::StorageNamespaceImpl::close):
+ (WebCore::StorageNamespaceImpl::clearOriginForDeletion):
+ (WebCore::StorageNamespaceImpl::clearAllOriginsForDeletion):
+ (WebCore::StorageNamespaceImpl::sync):
+ (WebCore::StorageNamespaceImpl::closeIdleLocalStorageDatabases):
+ * Storage/StorageNamespaceImpl.h: Renamed from Source/WebCore/storage/StorageNamespaceImpl.h.
+ * Storage/StorageSyncManager.cpp: Renamed from Source/WebCore/storage/StorageSyncManager.cpp.
+ (WebCore::StorageSyncManager::create):
+ (WebCore::StorageSyncManager::StorageSyncManager):
+ (WebCore::StorageSyncManager::~StorageSyncManager):
+ (WebCore::StorageSyncManager::fullDatabaseFilename):
+ (WebCore::StorageSyncManager::dispatch):
+ (WebCore::StorageSyncManager::close):
+ * Storage/StorageSyncManager.h: Renamed from Source/WebCore/storage/StorageSyncManager.h.
+ * Storage/StorageThread.cpp: Renamed from Source/WebCore/storage/StorageThread.cpp.
+ (WebCore::activeStorageThreads):
+ (WebCore::StorageThread::StorageThread):
+ (WebCore::StorageThread::~StorageThread):
+ (WebCore::StorageThread::start):
+ (WebCore::StorageThread::threadEntryPointCallback):
+ (WebCore::StorageThread::threadEntryPoint):
+ (WebCore::StorageThread::dispatch):
+ (WebCore::StorageThread::terminate):
+ (WebCore::StorageThread::performTerminate):
+ (WebCore::StorageThread::releaseFastMallocFreeMemoryInAllThreads):
+ * Storage/StorageThread.h: Renamed from Source/WebCore/storage/StorageThread.h.
+ * Storage/StorageTracker.cpp: Renamed from Source/WebCore/storage/StorageTracker.cpp.
+ (WebCore::StorageTracker::initializeTracker):
+ (WebCore::StorageTracker::internalInitialize):
+ (WebCore::StorageTracker::tracker):
+ (WebCore::StorageTracker::StorageTracker):
+ (WebCore::StorageTracker::setDatabaseDirectoryPath):
+ (WebCore::StorageTracker::databaseDirectoryPath):
+ (WebCore::StorageTracker::trackerDatabasePath):
+ (WebCore::ensureDatabaseFileExists):
+ (WebCore::StorageTracker::openTrackerDatabase):
+ (WebCore::StorageTracker::importOriginIdentifiers):
+ (WebCore::StorageTracker::finishedImportingOriginIdentifiers):
+ (WebCore::StorageTracker::syncImportOriginIdentifiers):
+ (WebCore::StorageTracker::syncFileSystemAndTrackerDatabase):
+ (WebCore::StorageTracker::setOriginDetails):
+ (WebCore::StorageTracker::syncSetOriginDetails):
+ (WebCore::StorageTracker::origins):
+ (WebCore::StorageTracker::deleteAllOrigins):
+ (WebCore::truncateDatabaseFile):
+ (WebCore::StorageTracker::syncDeleteAllOrigins):
+ (WebCore::StorageTracker::deleteOriginWithIdentifier):
+ (WebCore::StorageTracker::deleteOrigin):
+ (WebCore::StorageTracker::syncDeleteOrigin):
+ (WebCore::StorageTracker::willDeleteAllOrigins):
+ (WebCore::StorageTracker::willDeleteOrigin):
+ (WebCore::StorageTracker::canDeleteOrigin):
+ (WebCore::StorageTracker::cancelDeletingOrigin):
+ (WebCore::StorageTracker::isActive):
+ (WebCore::StorageTracker::setIsActive):
+ (WebCore::StorageTracker::databasePathForOrigin):
+ (WebCore::StorageTracker::diskUsageForOrigin):
+ * Storage/StorageTracker.h: Renamed from Source/WebCore/storage/StorageTracker.h.
+ (WebCore::StorageTracker::storageDatabaseIdleInterval):
+ (WebCore::StorageTracker::setStorageDatabaseIdleInterval):
+ * Storage/StorageTrackerClient.h: Renamed from Source/WebCore/storage/StorageTrackerClient.h.
+ (WebCore::StorageTrackerClient::~StorageTrackerClient):
+ * Storage/WebStorageNamespaceProvider.cpp:
+ * WebKit.vcxproj/WebKit/WebKit.vcxproj:
+ * WebKit.vcxproj/WebKit/WebKit.vcxproj.filters:
+ * WebKit.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2014-12-22 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win] Build fix after r177668.
</span></span></pre></div>
<a id="trunkSourceWebKitStorageStorageAreaImplcppfromrev177812trunkSourceWebCorestorageStorageAreaImplcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageAreaImpl.cpp (from rev 177812, trunk/Source/WebCore/storage/StorageAreaImpl.cpp) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageAreaImpl.cpp         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageAreaImpl.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,300 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 "StorageAreaImpl.h"
+
+#include "StorageAreaSync.h"
+#include "StorageSyncManager.h"
+#include "StorageTracker.h"
+#include <WebCore/Frame.h>
+#include <WebCore/SecurityOrigin.h>
+#include <WebCore/StorageEventDispatcher.h>
+#include <WebCore/StorageMap.h>
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+StorageAreaImpl::~StorageAreaImpl()
+{
+ ASSERT(isMainThread());
+}
+
+inline StorageAreaImpl::StorageAreaImpl(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota)
+ : m_storageType(storageType)
+ , m_securityOrigin(origin)
+ , m_storageMap(StorageMap::create(quota))
+ , m_storageSyncManager(syncManager)
+#ifndef NDEBUG
+ , m_isShutdown(false)
+#endif
+ , m_accessCount(0)
+ , m_closeDatabaseTimer(*this, &StorageAreaImpl::closeDatabaseTimerFired)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_securityOrigin);
+ ASSERT(m_storageMap);
+
+ // Accessing the shared global StorageTracker when a StorageArea is created
+ // ensures that the tracker is properly initialized before anyone actually needs to use it.
+ StorageTracker::tracker();
+}
+
+Ref<StorageAreaImpl> StorageAreaImpl::create(StorageType storageType, PassRefPtr<SecurityOrigin> origin, PassRefPtr<StorageSyncManager> syncManager, unsigned quota)
+{
+ Ref<StorageAreaImpl> area = adoptRef(*new StorageAreaImpl(storageType, origin, syncManager, quota));
+
+ // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing,
+ // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
+ if (area->m_storageSyncManager) {
+ area->m_storageAreaSync = StorageAreaSync::create(area->m_storageSyncManager, area.ptr(), area->m_securityOrigin->databaseIdentifier());
+ ASSERT(area->m_storageAreaSync);
+ }
+
+ return area;
+}
+
+PassRefPtr<StorageAreaImpl> StorageAreaImpl::copy()
+{
+ ASSERT(!m_isShutdown);
+ return adoptRef(new StorageAreaImpl(this));
+}
+
+StorageAreaImpl::StorageAreaImpl(StorageAreaImpl* area)
+ : m_storageType(area->m_storageType)
+ , m_securityOrigin(area->m_securityOrigin)
+ , m_storageMap(area->m_storageMap)
+ , m_storageSyncManager(area->m_storageSyncManager)
+#ifndef NDEBUG
+ , m_isShutdown(area->m_isShutdown)
+#endif
+ , m_accessCount(0)
+ , m_closeDatabaseTimer(*this, &StorageAreaImpl::closeDatabaseTimerFired)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_securityOrigin);
+ ASSERT(m_storageMap);
+ ASSERT(!m_isShutdown);
+}
+
+bool StorageAreaImpl::canAccessStorage(Frame* frame)
+{
+ return frame && frame->page();
+}
+
+StorageType StorageAreaImpl::storageType() const
+{
+ return m_storageType;
+}
+
+unsigned StorageAreaImpl::length()
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ return m_storageMap->length();
+}
+
+String StorageAreaImpl::key(unsigned index)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ return m_storageMap->key(index);
+}
+
+String StorageAreaImpl::item(const String& key)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ return m_storageMap->getItem(key);
+}
+
+void StorageAreaImpl::setItem(Frame* sourceFrame, const String& key, const String& value, bool& quotaException)
+{
+ ASSERT(!m_isShutdown);
+ ASSERT(!value.isNull());
+ blockUntilImportComplete();
+
+ String oldValue;
+ RefPtr<StorageMap> newMap = m_storageMap->setItem(key, value, oldValue, quotaException);
+ if (newMap)
+ m_storageMap = newMap.release();
+
+ if (quotaException)
+ return;
+
+ if (oldValue == value)
+ return;
+
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleItemForSync(key, value);
+
+ dispatchStorageEvent(key, oldValue, value, sourceFrame);
+}
+
+void StorageAreaImpl::removeItem(Frame* sourceFrame, const String& key)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ String oldValue;
+ RefPtr<StorageMap> newMap = m_storageMap->removeItem(key, oldValue);
+ if (newMap)
+ m_storageMap = newMap.release();
+
+ if (oldValue.isNull())
+ return;
+
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleItemForSync(key, String());
+
+ dispatchStorageEvent(key, oldValue, String(), sourceFrame);
+}
+
+void StorageAreaImpl::clear(Frame* sourceFrame)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ if (!m_storageMap->length())
+ return;
+
+ unsigned quota = m_storageMap->quota();
+ m_storageMap = StorageMap::create(quota);
+
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleClear();
+
+ dispatchStorageEvent(String(), String(), String(), sourceFrame);
+}
+
+bool StorageAreaImpl::contains(const String& key)
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ return m_storageMap->contains(key);
+}
+
+void StorageAreaImpl::importItems(const HashMap<String, String>& items)
+{
+ ASSERT(!m_isShutdown);
+
+ m_storageMap->importItems(items);
+}
+
+void StorageAreaImpl::close()
+{
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleFinalSync();
+
+#ifndef NDEBUG
+ m_isShutdown = true;
+#endif
+}
+
+void StorageAreaImpl::clearForOriginDeletion()
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ if (m_storageMap->length()) {
+ unsigned quota = m_storageMap->quota();
+ m_storageMap = StorageMap::create(quota);
+ }
+
+ if (m_storageAreaSync) {
+ m_storageAreaSync->scheduleClear();
+ m_storageAreaSync->scheduleCloseDatabase();
+ }
+}
+
+void StorageAreaImpl::sync()
+{
+ ASSERT(!m_isShutdown);
+ blockUntilImportComplete();
+
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleSync();
+}
+
+void StorageAreaImpl::blockUntilImportComplete() const
+{
+ if (m_storageAreaSync)
+ m_storageAreaSync->blockUntilImportComplete();
+}
+
+size_t StorageAreaImpl::memoryBytesUsedByCache()
+{
+ return 0;
+}
+
+void StorageAreaImpl::incrementAccessCount()
+{
+ m_accessCount++;
+
+ if (m_closeDatabaseTimer.isActive())
+ m_closeDatabaseTimer.stop();
+}
+
+void StorageAreaImpl::decrementAccessCount()
+{
+ ASSERT(m_accessCount);
+ --m_accessCount;
+
+ if (!m_accessCount) {
+ if (m_closeDatabaseTimer.isActive())
+ m_closeDatabaseTimer.stop();
+ m_closeDatabaseTimer.startOneShot(StorageTracker::tracker().storageDatabaseIdleInterval());
+ }
+}
+
+void StorageAreaImpl::closeDatabaseTimerFired()
+{
+ blockUntilImportComplete();
+ if (m_storageAreaSync)
+ m_storageAreaSync->scheduleCloseDatabase();
+}
+
+void StorageAreaImpl::closeDatabaseIfIdle()
+{
+ if (m_closeDatabaseTimer.isActive()) {
+ ASSERT(!m_accessCount);
+ m_closeDatabaseTimer.stop();
+
+ closeDatabaseTimerFired();
+ }
+}
+
+void StorageAreaImpl::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)
+{
+ if (m_storageType == LocalStorage)
+ StorageEventDispatcher::dispatchLocalStorageEvents(key, oldValue, newValue, m_securityOrigin.get(), sourceFrame);
+ else
+ StorageEventDispatcher::dispatchSessionStorageEvents(key, oldValue, newValue, m_securityOrigin.get(), sourceFrame);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageAreaImplhfromrev177812trunkSourceWebCorestorageStorageAreaImplh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageAreaImpl.h (from rev 177812, trunk/Source/WebCore/storage/StorageAreaImpl.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageAreaImpl.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageAreaImpl.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 StorageAreaImpl_h
+#define StorageAreaImpl_h
+
+#include <WebCore/StorageArea.h>
+#include <WebCore/Timer.h>
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class SecurityOrigin;
+class StorageMap;
+class StorageAreaSync;
+
+class StorageAreaImpl : public StorageArea {
+public:
+ static Ref<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
+ virtual ~StorageAreaImpl();
+
+ virtual unsigned length() override;
+ virtual String key(unsigned index) override;
+ virtual String item(const String& key) override;
+ virtual void setItem(Frame* sourceFrame, const String& key, const String& value, bool& quotaException) override;
+ virtual void removeItem(Frame* sourceFrame, const String& key) override;
+ virtual void clear(Frame* sourceFrame) override;
+ virtual bool contains(const String& key) override;
+
+ virtual bool canAccessStorage(Frame* sourceFrame) override;
+ virtual StorageType storageType() const override;
+
+ virtual size_t memoryBytesUsedByCache() override;
+
+ virtual void incrementAccessCount();
+ virtual void decrementAccessCount();
+ virtual void closeDatabaseIfIdle();
+
+ PassRefPtr<StorageAreaImpl> copy();
+ void close();
+
+ // Only called from a background thread.
+ void importItems(const HashMap<String, String>& items);
+
+ // Used to clear a StorageArea and close db before backing db file is deleted.
+ void clearForOriginDeletion();
+
+ void sync();
+
+private:
+ StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
+ explicit StorageAreaImpl(StorageAreaImpl*);
+
+ void blockUntilImportComplete() const;
+ void closeDatabaseTimerFired();
+
+ void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
+
+ StorageType m_storageType;
+ RefPtr<SecurityOrigin> m_securityOrigin;
+ RefPtr<StorageMap> m_storageMap;
+
+ RefPtr<StorageAreaSync> m_storageAreaSync;
+ RefPtr<StorageSyncManager> m_storageSyncManager;
+
+#ifndef NDEBUG
+ bool m_isShutdown;
+#endif
+ unsigned m_accessCount;
+ Timer m_closeDatabaseTimer;
+};
+
+} // namespace WebCore
+
+#endif // StorageAreaImpl_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageAreaSynccppfromrev177812trunkSourceWebCorestorageStorageAreaSynccpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageAreaSync.cpp (from rev 177812, trunk/Source/WebCore/storage/StorageAreaSync.cpp) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageAreaSync.cpp         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageAreaSync.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,535 @@
</span><ins>+/*
+ * Copyright (C) 2008, 2009, 2010 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 "StorageAreaSync.h"
+
+#include "StorageAreaImpl.h"
+#include "StorageSyncManager.h"
+#include "StorageTracker.h"
+#include <WebCore/FileSystem.h>
+#include <WebCore/SQLiteDatabaseTracker.h>
+#include <WebCore/SQLiteStatement.h>
+#include <WebCore/SQLiteTransaction.h>
+#include <WebCore/SuddenTermination.h>
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+// If the StorageArea undergoes rapid changes, don't sync each change to disk.
+// Instead, queue up a batch of items to sync and actually do the sync at the following interval.
+static const double StorageSyncInterval = 1.0;
+
+// A sane limit on how many items we'll schedule to sync all at once. This makes it
+// much harder to starve the rest of LocalStorage and the OS's IO subsystem in general.
+static const int MaxiumItemsToSync = 100;
+
+inline StorageAreaSync::StorageAreaSync(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageAreaImpl> storageArea, const String& databaseIdentifier)
+ : m_syncTimer(*this, &StorageAreaSync::syncTimerFired)
+ , m_itemsCleared(false)
+ , m_finalSyncScheduled(false)
+ , m_storageArea(storageArea)
+ , m_syncManager(storageSyncManager)
+ , m_databaseIdentifier(databaseIdentifier.isolatedCopy())
+ , m_clearItemsWhileSyncing(false)
+ , m_syncScheduled(false)
+ , m_syncInProgress(false)
+ , m_databaseOpenFailed(false)
+ , m_syncCloseDatabase(false)
+ , m_importComplete(false)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_storageArea);
+ ASSERT(m_syncManager);
+
+ // FIXME: If it can't import, then the default WebKit behavior should be that of private browsing,
+ // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894
+ RefPtr<StorageAreaSync> protector(this);
+ m_syncManager->dispatch([protector] {
+ protector->performImport();
+ });
+}
+
+Ref<StorageAreaSync> StorageAreaSync::create(PassRefPtr<StorageSyncManager> storageSyncManager, PassRefPtr<StorageAreaImpl> storageArea, const String& databaseIdentifier)
+{
+ return adoptRef(*new StorageAreaSync(storageSyncManager, storageArea, databaseIdentifier));
+}
+
+StorageAreaSync::~StorageAreaSync()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_syncTimer.isActive());
+ ASSERT(m_finalSyncScheduled);
+}
+
+void StorageAreaSync::scheduleFinalSync()
+{
+ ASSERT(isMainThread());
+ // FIXME: We do this to avoid races, but it'd be better to make things safe without blocking.
+ blockUntilImportComplete();
+ m_storageArea = 0; // This is done in blockUntilImportComplete() but this is here as a form of documentation that we must be absolutely sure the ref count cycle is broken.
+
+ if (m_syncTimer.isActive())
+ m_syncTimer.stop();
+ else {
+ // The following is balanced by the call to enableSuddenTermination in the
+ // syncTimerFired function.
+ disableSuddenTermination();
+ }
+ // FIXME: This is synchronous. We should do it on the background process, but
+ // we should do it safely.
+ m_finalSyncScheduled = true;
+ syncTimerFired();
+
+ RefPtr<StorageAreaSync> protector(this);
+ m_syncManager->dispatch([protector] {
+ protector->deleteEmptyDatabase();
+ });
+}
+
+void StorageAreaSync::scheduleItemForSync(const String& key, const String& value)
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_finalSyncScheduled);
+
+ m_changedItems.set(key, value);
+ if (!m_syncTimer.isActive()) {
+ m_syncTimer.startOneShot(StorageSyncInterval);
+
+ // The following is balanced by the call to enableSuddenTermination in the
+ // syncTimerFired function.
+ disableSuddenTermination();
+ }
+}
+
+void StorageAreaSync::scheduleClear()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_finalSyncScheduled);
+
+ m_changedItems.clear();
+ m_itemsCleared = true;
+ if (!m_syncTimer.isActive()) {
+ m_syncTimer.startOneShot(StorageSyncInterval);
+
+ // The following is balanced by the call to enableSuddenTermination in the
+ // syncTimerFired function.
+ disableSuddenTermination();
+ }
+}
+
+void StorageAreaSync::scheduleCloseDatabase()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_finalSyncScheduled);
+
+ if (!m_database.isOpen())
+ return;
+
+ m_syncCloseDatabase = true;
+
+ if (!m_syncTimer.isActive()) {
+ m_syncTimer.startOneShot(StorageSyncInterval);
+
+ // The following is balanced by the call to enableSuddenTermination in the
+ // syncTimerFired function.
+ disableSuddenTermination();
+ }
+}
+
+void StorageAreaSync::syncTimerFired()
+{
+ ASSERT(isMainThread());
+
+ bool partialSync = false;
+ {
+ MutexLocker locker(m_syncLock);
+
+ // Do not schedule another sync if we're still trying to complete the
+ // previous one. But, if we're shutting down, schedule it anyway.
+ if (m_syncInProgress && !m_finalSyncScheduled) {
+ ASSERT(!m_syncTimer.isActive());
+ m_syncTimer.startOneShot(StorageSyncInterval);
+ return;
+ }
+
+ if (m_itemsCleared) {
+ m_itemsPendingSync.clear();
+ m_clearItemsWhileSyncing = true;
+ m_itemsCleared = false;
+ }
+
+ HashMap<String, String>::iterator changed_it = m_changedItems.begin();
+ HashMap<String, String>::iterator changed_end = m_changedItems.end();
+ for (int count = 0; changed_it != changed_end; ++count, ++changed_it) {
+ if (count >= MaxiumItemsToSync && !m_finalSyncScheduled) {
+ partialSync = true;
+ break;
+ }
+ m_itemsPendingSync.set(changed_it->key.isolatedCopy(), changed_it->value.isolatedCopy());
+ }
+
+ if (partialSync) {
+ // We can't do the fast path of simply clearing all items, so we'll need to manually
+ // remove them one by one. Done under lock since m_itemsPendingSync is modified by
+ // the background thread.
+ HashMap<String, String>::iterator pending_it = m_itemsPendingSync.begin();
+ HashMap<String, String>::iterator pending_end = m_itemsPendingSync.end();
+ for (; pending_it != pending_end; ++pending_it)
+ m_changedItems.remove(pending_it->key);
+ }
+
+ if (!m_syncScheduled) {
+ m_syncScheduled = true;
+
+ // The following is balanced by the call to enableSuddenTermination in the
+ // performSync function.
+ disableSuddenTermination();
+
+ RefPtr<StorageAreaSync> protector(this);
+ m_syncManager->dispatch([protector] {
+ protector->performSync();
+ });
+ }
+ }
+
+ if (partialSync) {
+ // If we didn't finish syncing, then we need to finish the job later.
+ ASSERT(!m_syncTimer.isActive());
+ m_syncTimer.startOneShot(StorageSyncInterval);
+ } else {
+ // The following is balanced by the calls to disableSuddenTermination in the
+ // scheduleItemForSync, scheduleClear, and scheduleFinalSync functions.
+ enableSuddenTermination();
+
+ m_changedItems.clear();
+ }
+}
+
+void StorageAreaSync::openDatabase(OpenDatabaseParamType openingStrategy)
+{
+ ASSERT(!isMainThread());
+ ASSERT(!m_database.isOpen());
+ ASSERT(!m_databaseOpenFailed);
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier);
+
+ if (!fileExists(databaseFilename) && openingStrategy == SkipIfNonExistent)
+ return;
+
+ if (databaseFilename.isEmpty()) {
+ LOG_ERROR("Filename for local storage database is empty - cannot open for persistent storage");
+ markImported();
+ m_databaseOpenFailed = true;
+ return;
+ }
+
+ // A StorageTracker thread may have been scheduled to delete the db we're
+ // reopening, so cancel possible deletion.
+ StorageTracker::tracker().cancelDeletingOrigin(m_databaseIdentifier);
+
+ if (!m_database.open(databaseFilename)) {
+ LOG_ERROR("Failed to open database file %s for local storage", databaseFilename.utf8().data());
+ markImported();
+ m_databaseOpenFailed = true;
+ return;
+ }
+
+ migrateItemTableIfNeeded();
+
+ if (!m_database.executeCommand("CREATE TABLE IF NOT EXISTS ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)")) {
+ LOG_ERROR("Failed to create table ItemTable for local storage");
+ markImported();
+ m_databaseOpenFailed = true;
+ return;
+ }
+
+ StorageTracker::tracker().setOriginDetails(m_databaseIdentifier, databaseFilename);
+}
+
+void StorageAreaSync::migrateItemTableIfNeeded()
+{
+ if (!m_database.tableExists("ItemTable"))
+ return;
+
+ {
+ SQLiteStatement query(m_database, "SELECT value FROM ItemTable LIMIT 1");
+ // this query isn't ever executed.
+ if (query.isColumnDeclaredAsBlob(0))
+ return;
+ }
+
+ // alter table for backward compliance, change the value type from TEXT to BLOB.
+ static const char* commands[] = {
+ "DROP TABLE IF EXISTS ItemTable2",
+ "CREATE TABLE ItemTable2 (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)",
+ "INSERT INTO ItemTable2 SELECT * from ItemTable",
+ "DROP TABLE ItemTable",
+ "ALTER TABLE ItemTable2 RENAME TO ItemTable",
+ 0,
+ };
+
+ SQLiteTransaction transaction(m_database, false);
+ transaction.begin();
+ for (size_t i = 0; commands[i]; ++i) {
+ if (!m_database.executeCommand(commands[i])) {
+ LOG_ERROR("Failed to migrate table ItemTable for local storage when executing: %s", commands[i]);
+ transaction.rollback();
+
+ // finally it will try to keep a backup of ItemTable for the future restoration.
+ // NOTICE: this will essentially DELETE the current database, but that's better
+ // than continually hitting this case and never being able to use the local storage.
+ // if this is ever hit, it's definitely a bug.
+ ASSERT_NOT_REACHED();
+ if (!m_database.executeCommand("ALTER TABLE ItemTable RENAME TO Backup_ItemTable"))
+ LOG_ERROR("Failed to save ItemTable after migration job failed.");
+
+ return;
+ }
+ }
+ transaction.commit();
+}
+
+void StorageAreaSync::performImport()
+{
+ ASSERT(!isMainThread());
+ ASSERT(!m_database.isOpen());
+
+ openDatabase(SkipIfNonExistent);
+ if (!m_database.isOpen()) {
+ markImported();
+ return;
+ }
+
+ SQLiteStatement query(m_database, "SELECT key, value FROM ItemTable");
+ if (query.prepare() != SQLResultOk) {
+ LOG_ERROR("Unable to select items from ItemTable for local storage");
+ markImported();
+ return;
+ }
+
+ HashMap<String, String> itemMap;
+
+ int result = query.step();
+ while (result == SQLResultRow) {
+ itemMap.set(query.getColumnText(0), query.getColumnBlobAsString(1));
+ result = query.step();
+ }
+
+ if (result != SQLResultDone) {
+ LOG_ERROR("Error reading items from ItemTable for local storage");
+ markImported();
+ return;
+ }
+
+ m_storageArea->importItems(itemMap);
+
+ markImported();
+}
+
+void StorageAreaSync::markImported()
+{
+ MutexLocker locker(m_importLock);
+ m_importComplete = true;
+ m_importCondition.signal();
+}
+
+// FIXME: In the future, we should allow use of StorageAreas while it's importing (when safe to do so).
+// Blocking everything until the import is complete is by far the simplest and safest thing to do, but
+// there is certainly room for safe optimization: Key/length will never be able to make use of such an
+// optimization (since the order of iteration can change as items are being added). Get can return any
+// item currently in the map. Get/remove can work whether or not it's in the map, but we'll need a list
+// of items the import should not overwrite. Clear can also work, but it'll need to kill the import
+// job first.
+void StorageAreaSync::blockUntilImportComplete()
+{
+ ASSERT(isMainThread());
+
+ // Fast path. We set m_storageArea to 0 only after m_importComplete being true.
+ if (!m_storageArea)
+ return;
+
+ MutexLocker locker(m_importLock);
+ while (!m_importComplete)
+ m_importCondition.wait(m_importLock);
+ m_storageArea = 0;
+}
+
+void StorageAreaSync::sync(bool clearItems, const HashMap<String, String>& items)
+{
+ ASSERT(!isMainThread());
+
+ if (items.isEmpty() && !clearItems && !m_syncCloseDatabase)
+ return;
+ if (m_databaseOpenFailed)
+ return;
+
+ if (!m_database.isOpen() && m_syncCloseDatabase) {
+ m_syncCloseDatabase = false;
+ return;
+ }
+
+ if (!m_database.isOpen())
+ openDatabase(CreateIfNonExistent);
+ if (!m_database.isOpen())
+ return;
+
+ // Closing this db because it is about to be deleted by StorageTracker.
+ // The delete will be cancelled if StorageAreaSync needs to reopen the db
+ // to write new items created after the request to delete the db.
+ if (m_syncCloseDatabase) {
+ m_syncCloseDatabase = false;
+ m_database.close();
+ return;
+ }
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ // If the clear flag is set, then we clear all items out before we write any new ones in.
+ if (clearItems) {
+ SQLiteStatement clear(m_database, "DELETE FROM ItemTable");
+ if (clear.prepare() != SQLResultOk) {
+ LOG_ERROR("Failed to prepare clear statement - cannot write to local storage database");
+ return;
+ }
+
+ int result = clear.step();
+ if (result != SQLResultDone) {
+ LOG_ERROR("Failed to clear all items in the local storage database - %i", result);
+ return;
+ }
+ }
+
+ SQLiteStatement insert(m_database, "INSERT INTO ItemTable VALUES (?, ?)");
+ if (insert.prepare() != SQLResultOk) {
+ LOG_ERROR("Failed to prepare insert statement - cannot write to local storage database");
+ return;
+ }
+
+ SQLiteStatement remove(m_database, "DELETE FROM ItemTable WHERE key=?");
+ if (remove.prepare() != SQLResultOk) {
+ LOG_ERROR("Failed to prepare delete statement - cannot write to local storage database");
+ return;
+ }
+
+ HashMap<String, String>::const_iterator end = items.end();
+
+ SQLiteTransaction transaction(m_database);
+ transaction.begin();
+ for (HashMap<String, String>::const_iterator it = items.begin(); it != end; ++it) {
+ // Based on the null-ness of the second argument, decide whether this is an insert or a delete.
+ SQLiteStatement& query = it->value.isNull() ? remove : insert;
+
+ query.bindText(1, it->key);
+
+ // If the second argument is non-null, we're doing an insert, so bind it as the value.
+ if (!it->value.isNull())
+ query.bindBlob(2, it->value);
+
+ int result = query.step();
+ if (result != SQLResultDone) {
+ LOG_ERROR("Failed to update item in the local storage database - %i", result);
+ break;
+ }
+
+ query.reset();
+ }
+ transaction.commit();
+}
+
+void StorageAreaSync::performSync()
+{
+ ASSERT(!isMainThread());
+
+ bool clearItems;
+ HashMap<String, String> items;
+ {
+ MutexLocker locker(m_syncLock);
+
+ ASSERT(m_syncScheduled);
+
+ clearItems = m_clearItemsWhileSyncing;
+ m_itemsPendingSync.swap(items);
+
+ m_clearItemsWhileSyncing = false;
+ m_syncScheduled = false;
+ m_syncInProgress = true;
+ }
+
+ sync(clearItems, items);
+
+ {
+ MutexLocker locker(m_syncLock);
+ m_syncInProgress = false;
+ }
+
+ // The following is balanced by the call to disableSuddenTermination in the
+ // syncTimerFired function.
+ enableSuddenTermination();
+}
+
+void StorageAreaSync::deleteEmptyDatabase()
+{
+ ASSERT(!isMainThread());
+ if (!m_database.isOpen())
+ return;
+
+ SQLiteStatement query(m_database, "SELECT COUNT(*) FROM ItemTable");
+ if (query.prepare() != SQLResultOk) {
+ LOG_ERROR("Unable to count number of rows in ItemTable for local storage");
+ return;
+ }
+
+ int result = query.step();
+ if (result != SQLResultRow) {
+ LOG_ERROR("No results when counting number of rows in ItemTable for local storage");
+ return;
+ }
+
+ int count = query.getColumnInt(0);
+ if (!count) {
+ query.finalize();
+ m_database.close();
+ if (StorageTracker::tracker().isActive()) {
+ StringImpl* databaseIdentifierCopy = &m_databaseIdentifier.impl()->isolatedCopy().leakRef();
+ callOnMainThread([databaseIdentifierCopy] {
+ StorageTracker::tracker().deleteOriginWithIdentifier(databaseIdentifierCopy);
+ databaseIdentifierCopy->deref();
+ });
+ } else {
+ String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier);
+ if (!deleteFile(databaseFilename))
+ LOG_ERROR("Failed to delete database file %s\n", databaseFilename.utf8().data());
+ }
+ }
+}
+
+void StorageAreaSync::scheduleSync()
+{
+ syncTimerFired();
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageAreaSynchfromrev177812trunkSourceWebCorestorageStorageAreaSynch"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageAreaSync.h (from rev 177812, trunk/Source/WebCore/storage/StorageAreaSync.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageAreaSync.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageAreaSync.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,106 @@
</span><ins>+/*
+ * Copyright (C) 2008, 2009, 2010 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 StorageAreaSync_h
+#define StorageAreaSync_h
+
+#include <WebCore/SQLiteDatabase.h>
+#include <WebCore/Timer.h>
+#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+class Frame;
+class StorageAreaImpl;
+class StorageSyncManager;
+
+class StorageAreaSync : public ThreadSafeRefCounted<StorageAreaSync> {
+public:
+ static Ref<StorageAreaSync> create(PassRefPtr<StorageSyncManager>, PassRefPtr<StorageAreaImpl>, const String& databaseIdentifier);
+ ~StorageAreaSync();
+
+ void scheduleFinalSync();
+ void blockUntilImportComplete();
+
+ void scheduleItemForSync(const String& key, const String& value);
+ void scheduleClear();
+ void scheduleCloseDatabase();
+
+ void scheduleSync();
+
+private:
+ StorageAreaSync(PassRefPtr<StorageSyncManager>, PassRefPtr<StorageAreaImpl>, const String& databaseIdentifier);
+
+ Timer m_syncTimer;
+ HashMap<String, String> m_changedItems;
+ bool m_itemsCleared;
+
+ bool m_finalSyncScheduled;
+
+ RefPtr<StorageAreaImpl> m_storageArea;
+ RefPtr<StorageSyncManager> m_syncManager;
+
+ // The database handle will only ever be opened and used on the background thread.
+ SQLiteDatabase m_database;
+
+ // The following members are subject to thread synchronization issues.
+public:
+ // Called from the background thread
+ void performImport();
+ void performSync();
+ void deleteEmptyDatabase();
+
+private:
+ enum OpenDatabaseParamType {
+ CreateIfNonExistent,
+ SkipIfNonExistent
+ };
+
+ void syncTimerFired();
+ void openDatabase(OpenDatabaseParamType openingStrategy);
+ void sync(bool clearItems, const HashMap<String, String>& items);
+
+ const String m_databaseIdentifier;
+
+ Mutex m_syncLock;
+ HashMap<String, String> m_itemsPendingSync;
+ bool m_clearItemsWhileSyncing;
+ bool m_syncScheduled;
+ bool m_syncInProgress;
+ bool m_databaseOpenFailed;
+
+ bool m_syncCloseDatabase;
+
+ mutable Mutex m_importLock;
+ ThreadCondition m_importCondition;
+ bool m_importComplete;
+ void markImported();
+ void migrateItemTableIfNeeded();
+};
+
+} // namespace WebCore
+
+#endif // StorageAreaSync_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageNamespaceImplcppfromrev177812trunkSourceWebCorestorageStorageNamespaceImplcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageNamespaceImpl.cpp (from rev 177812, trunk/Source/WebCore/storage/StorageNamespaceImpl.cpp) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageNamespaceImpl.cpp         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageNamespaceImpl.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 "StorageNamespaceImpl.h"
+
+#include "StorageAreaImpl.h"
+#include "StorageSyncManager.h"
+#include "StorageTracker.h"
+#include <WebCore/StorageMap.h>
+#include <wtf/MainThread.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+static HashMap<String, StorageNamespaceImpl*>& localStorageNamespaceMap()
+{
+ static NeverDestroyed<HashMap<String, StorageNamespaceImpl*>> localStorageNamespaceMap;
+
+ return localStorageNamespaceMap;
+}
+
+RefPtr<StorageNamespaceImpl> StorageNamespaceImpl::createSessionStorageNamespace(unsigned quota)
+{
+ return adoptRef(new StorageNamespaceImpl(SessionStorage, String(), quota));
+}
+
+RefPtr<StorageNamespaceImpl> StorageNamespaceImpl::getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota)
+{
+ ASSERT(!databasePath.isNull());
+
+ auto& slot = localStorageNamespaceMap().add(databasePath, nullptr).iterator->value;
+ if (slot)
+ return slot;
+
+ RefPtr<StorageNamespaceImpl> storageNamespace = adoptRef(new StorageNamespaceImpl(LocalStorage, databasePath, quota));
+ slot = storageNamespace.get();
+
+ return storageNamespace;
+}
+
+StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path, unsigned quota)
+ : m_storageType(storageType)
+ , m_path(path.isolatedCopy())
+ , m_syncManager(0)
+ , m_quota(quota)
+ , m_isShutdown(false)
+{
+ if (m_storageType == LocalStorage && !m_path.isEmpty())
+ m_syncManager = StorageSyncManager::create(m_path);
+}
+
+StorageNamespaceImpl::~StorageNamespaceImpl()
+{
+ ASSERT(isMainThread());
+
+ if (m_storageType == LocalStorage) {
+ ASSERT(localStorageNamespaceMap().get(m_path) == this);
+ localStorageNamespaceMap().remove(m_path);
+ }
+
+ if (!m_isShutdown)
+ close();
+}
+
+PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy(Page*)
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_isShutdown);
+ ASSERT(m_storageType == SessionStorage);
+
+ RefPtr<StorageNamespaceImpl> newNamespace = adoptRef(new StorageNamespaceImpl(m_storageType, m_path, m_quota));
+
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator i = m_storageAreaMap.begin(); i != end; ++i)
+ newNamespace->m_storageAreaMap.set(i->key, i->value->copy());
+ return newNamespace.release();
+}
+
+PassRefPtr<StorageArea> StorageNamespaceImpl::storageArea(PassRefPtr<SecurityOrigin> prpOrigin)
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_isShutdown);
+
+ RefPtr<SecurityOrigin> origin = prpOrigin;
+ RefPtr<StorageAreaImpl> storageArea;
+ if ((storageArea = m_storageAreaMap.get(origin)))
+ return storageArea.release();
+
+ storageArea = StorageAreaImpl::create(m_storageType, origin, m_syncManager, m_quota);
+ m_storageAreaMap.set(origin.release(), storageArea);
+ return storageArea.release();
+}
+
+void StorageNamespaceImpl::close()
+{
+ ASSERT(isMainThread());
+
+ if (m_isShutdown)
+ return;
+
+ // If we're session storage, we shouldn't need to do any work here.
+ if (m_storageType == SessionStorage) {
+ ASSERT(!m_syncManager);
+ return;
+ }
+
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
+ it->value->close();
+
+ if (m_syncManager)
+ m_syncManager->close();
+
+ m_isShutdown = true;
+}
+
+void StorageNamespaceImpl::clearOriginForDeletion(SecurityOrigin* origin)
+{
+ ASSERT(isMainThread());
+
+ RefPtr<StorageAreaImpl> storageArea = m_storageAreaMap.get(origin);
+ if (storageArea)
+ storageArea->clearForOriginDeletion();
+}
+
+void StorageNamespaceImpl::clearAllOriginsForDeletion()
+{
+ ASSERT(isMainThread());
+
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
+ it->value->clearForOriginDeletion();
+}
+
+void StorageNamespaceImpl::sync()
+{
+ ASSERT(isMainThread());
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
+ it->value->sync();
+}
+
+void StorageNamespaceImpl::closeIdleLocalStorageDatabases()
+{
+ ASSERT(isMainThread());
+ StorageAreaMap::iterator end = m_storageAreaMap.end();
+ for (StorageAreaMap::iterator it = m_storageAreaMap.begin(); it != end; ++it)
+ it->value->closeDatabaseIfIdle();
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageNamespaceImplhfromrev177812trunkSourceWebCorestorageStorageNamespaceImplh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageNamespaceImpl.h (from rev 177812, trunk/Source/WebCore/storage/StorageNamespaceImpl.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageNamespaceImpl.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageNamespaceImpl.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 StorageNamespaceImpl_h
+#define StorageNamespaceImpl_h
+
+#include <WebCore/SecurityOriginHash.h>
+#include <WebCore/StorageArea.h>
+#include <WebCore/StorageNamespace.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class StorageAreaImpl;
+
+class StorageNamespaceImpl : public StorageNamespace {
+public:
+ WEBCORE_EXPORT static RefPtr<StorageNamespaceImpl> createSessionStorageNamespace(unsigned quota);
+ WEBCORE_EXPORT static RefPtr<StorageNamespaceImpl> getOrCreateLocalStorageNamespace(const String& databasePath, unsigned quota);
+ virtual ~StorageNamespaceImpl();
+
+ virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) override;
+ virtual PassRefPtr<StorageNamespace> copy(Page* newPage) override;
+ virtual void close() override;
+
+ // Not removing the origin's StorageArea from m_storageAreaMap because
+ // we're just deleting the underlying db file. If an item is added immediately
+ // after file deletion, we want the same StorageArea to eventually trigger
+ // a sync and for StorageAreaSync to recreate the backing db file.
+ virtual void clearOriginForDeletion(SecurityOrigin*) override;
+ virtual void clearAllOriginsForDeletion() override;
+ virtual void sync() override;
+ virtual void closeIdleLocalStorageDatabases() override;
+
+private:
+ StorageNamespaceImpl(StorageType, const String& path, unsigned quota);
+
+ typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl>> StorageAreaMap;
+ StorageAreaMap m_storageAreaMap;
+
+ StorageType m_storageType;
+
+ // Only used if m_storageType == LocalStorage and the path was not "" in our constructor.
+ String m_path;
+ RefPtr<StorageSyncManager> m_syncManager;
+
+ // The default quota for each new storage area.
+ unsigned m_quota;
+
+ bool m_isShutdown;
+};
+
+} // namespace WebCore
+
+#endif // StorageNamespaceImpl_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageSyncManagercppfromrev177812trunkSourceWebCorestorageStorageSyncManagercpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageSyncManager.cpp (from rev 177812, trunk/Source/WebCore/storage/StorageSyncManager.cpp) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageSyncManager.cpp         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageSyncManager.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 "StorageSyncManager.h"
+
+#include "StorageThread.h"
+#include <WebCore/FileSystem.h>
+#include <wtf/MainThread.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+Ref<StorageSyncManager> StorageSyncManager::create(const String& path)
+{
+ return adoptRef(*new StorageSyncManager(path));
+}
+
+StorageSyncManager::StorageSyncManager(const String& path)
+ : m_thread(std::make_unique<StorageThread>())
+ , m_path(path.isolatedCopy())
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_path.isEmpty());
+ m_thread->start();
+}
+
+StorageSyncManager::~StorageSyncManager()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_thread);
+}
+
+// Called on a background thread.
+String StorageSyncManager::fullDatabaseFilename(const String& databaseIdentifier)
+{
+ if (!makeAllDirectories(m_path)) {
+ LOG_ERROR("Unabled to create LocalStorage database path %s", m_path.utf8().data());
+ return String();
+ }
+
+ return pathByAppendingComponent(m_path, databaseIdentifier + ".localstorage");
+}
+
+void StorageSyncManager::dispatch(const std::function<void ()>& function)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_thread);
+
+ if (m_thread)
+ m_thread->dispatch(function);
+}
+
+void StorageSyncManager::close()
+{
+ ASSERT(isMainThread());
+
+ if (m_thread) {
+ m_thread->terminate();
+ m_thread = nullptr;
+ }
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageSyncManagerhfromrev177812trunkSourceWebCorestorageStorageSyncManagerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageSyncManager.h (from rev 177812, trunk/Source/WebCore/storage/StorageSyncManager.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageSyncManager.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageSyncManager.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 StorageSyncManager_h
+#define StorageSyncManager_h
+
+#include <functional>
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class StorageThread;
+class StorageAreaSync;
+
+class StorageSyncManager : public RefCounted<StorageSyncManager> {
+public:
+ static Ref<StorageSyncManager> create(const String& path);
+ ~StorageSyncManager();
+
+ void dispatch(const std::function<void ()>&);
+ void close();
+
+private:
+ explicit StorageSyncManager(const String& path);
+
+ std::unique_ptr<StorageThread> m_thread;
+
+// The following members are subject to thread synchronization issues
+public:
+ // To be called from the background thread:
+ String fullDatabaseFilename(const String& databaseIdentifier);
+
+private:
+ String m_path;
+};
+
+} // namespace WebCore
+
+#endif // StorageSyncManager_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageThreadcppfromrev177812trunkSourceWebCorestorageStorageThreadcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageThread.cpp (from rev 177812, trunk/Source/WebCore/storage/StorageThread.cpp) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageThread.cpp         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageThread.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 "StorageThread.h"
+
+#include <wtf/AutodrainedPool.h>
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+
+static HashSet<StorageThread*>& activeStorageThreads()
+{
+ ASSERT(isMainThread());
+ DEPRECATED_DEFINE_STATIC_LOCAL(HashSet<StorageThread*>, threads, ());
+ return threads;
+}
+
+StorageThread::StorageThread()
+ : m_threadID(0)
+{
+ ASSERT(isMainThread());
+}
+
+StorageThread::~StorageThread()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_threadID);
+}
+
+bool StorageThread::start()
+{
+ ASSERT(isMainThread());
+ if (!m_threadID)
+ m_threadID = createThread(StorageThread::threadEntryPointCallback, this, "WebCore: LocalStorage");
+ activeStorageThreads().add(this);
+ return m_threadID;
+}
+
+void StorageThread::threadEntryPointCallback(void* thread)
+{
+ static_cast<StorageThread*>(thread)->threadEntryPoint();
+}
+
+void StorageThread::threadEntryPoint()
+{
+ ASSERT(!isMainThread());
+
+ while (auto function = m_queue.waitForMessage()) {
+ AutodrainedPool pool;
+ (*function)();
+ }
+}
+
+void StorageThread::dispatch(const std::function<void ()>& function)
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_queue.killed() && m_threadID);
+ m_queue.append(std::make_unique<std::function<void ()>>(function));
+}
+
+void StorageThread::terminate()
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_queue.killed() && m_threadID);
+ activeStorageThreads().remove(this);
+ // Even in weird, exceptional cases, don't wait on a nonexistent thread to terminate.
+ if (!m_threadID)
+ return;
+
+ m_queue.append(std::make_unique<std::function<void ()>>([this] {
+ performTerminate();
+ }));
+ waitForThreadCompletion(m_threadID);
+ ASSERT(m_queue.killed());
+ m_threadID = 0;
+}
+
+void StorageThread::performTerminate()
+{
+ ASSERT(!isMainThread());
+ m_queue.kill();
+}
+
+void StorageThread::releaseFastMallocFreeMemoryInAllThreads()
+{
+ HashSet<StorageThread*>& threads = activeStorageThreads();
+
+ for (HashSet<StorageThread*>::iterator it = threads.begin(), end = threads.end(); it != end; ++it)
+ (*it)->dispatch(WTF::releaseFastMallocFreeMemory);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageThreadhfromrev177812trunkSourceWebCorestorageStorageThreadh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageThread.h (from rev 177812, trunk/Source/WebCore/storage/StorageThread.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageThread.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageThread.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+/*
+ * Copyright (C) 2008 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 StorageThread_h
+#define StorageThread_h
+
+#include <functional>
+#include <wtf/HashSet.h>
+#include <wtf/MessageQueue.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+class StorageAreaSync;
+class StorageTask;
+
+class StorageThread {
+ WTF_MAKE_NONCOPYABLE(StorageThread); WTF_MAKE_FAST_ALLOCATED;
+public:
+ StorageThread();
+ ~StorageThread();
+
+ bool start();
+ void terminate();
+
+ void dispatch(const std::function<void()>&);
+
+ static void releaseFastMallocFreeMemoryInAllThreads();
+
+private:
+ // Called on background thread.
+ static void threadEntryPointCallback(void*);
+ void threadEntryPoint();
+
+ // Background thread part of the terminate procedure.
+ void performTerminate();
+
+ ThreadIdentifier m_threadID;
+ MessageQueue<std::function<void()>> m_queue;
+};
+
+} // namespace WebCore
+
+#endif // StorageThread_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageTrackercppfromrev177812trunkSourceWebCorestorageStorageTrackercpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageTracker.cpp (from rev 177812, trunk/Source/WebCore/storage/StorageTracker.cpp) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageTracker.cpp         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageTracker.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,659 @@
</span><ins>+/*
+ * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 "StorageTracker.h"
+
+#include "StorageThread.h"
+#include "StorageTrackerClient.h"
+#include <WebCore/FileSystem.h>
+#include <WebCore/PageGroup.h>
+#include <WebCore/SQLiteDatabaseTracker.h>
+#include <WebCore/SQLiteStatement.h>
+#include <WebCore/SecurityOrigin.h>
+#include <WebCore/TextEncoding.h>
+#include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
+
+#if PLATFORM(IOS)
+#include <sqlite3_private.h>
+#endif
+
+namespace WebCore {
+
+static StorageTracker* storageTracker = 0;
+
+// If there is no document referencing a storage database, close the underlying database
+// after it has been idle for m_StorageDatabaseIdleInterval seconds.
+static const double DefaultStorageDatabaseIdleInterval = 300;
+
+void StorageTracker::initializeTracker(const String& storagePath, StorageTrackerClient* client)
+{
+ ASSERT(isMainThread());
+ ASSERT(!storageTracker || !storageTracker->m_client);
+
+ if (!storageTracker)
+ storageTracker = new StorageTracker(storagePath);
+
+ storageTracker->m_client = client;
+ storageTracker->m_needsInitialization = true;
+}
+
+void StorageTracker::internalInitialize()
+{
+ m_needsInitialization = false;
+
+ ASSERT(isMainThread());
+
+ // Make sure text encoding maps have been built on the main thread, as the StorageTracker thread might try to do it there instead.
+ // FIXME (<rdar://problem/9127819>): Is there a more explicit way of doing this besides accessing the UTF8Encoding?
+ UTF8Encoding();
+
+ storageTracker->setIsActive(true);
+ storageTracker->m_thread->start();
+ storageTracker->importOriginIdentifiers();
+}
+
+StorageTracker& StorageTracker::tracker()
+{
+ if (!storageTracker)
+ storageTracker = new StorageTracker("");
+ if (storageTracker->m_needsInitialization)
+ storageTracker->internalInitialize();
+
+ return *storageTracker;
+}
+
+StorageTracker::StorageTracker(const String& storagePath)
+ : m_storageDirectoryPath(storagePath.isolatedCopy())
+ , m_client(0)
+ , m_thread(std::make_unique<StorageThread>())
+ , m_isActive(false)
+ , m_needsInitialization(false)
+ , m_StorageDatabaseIdleInterval(DefaultStorageDatabaseIdleInterval)
+{
+}
+
+void StorageTracker::setDatabaseDirectoryPath(const String& path)
+{
+ MutexLocker locker(m_databaseMutex);
+
+ if (m_database.isOpen())
+ m_database.close();
+
+ m_storageDirectoryPath = path.isolatedCopy();
+
+ {
+ MutexLocker locker(m_originSetMutex);
+ m_originSet.clear();
+ }
+
+ if (!m_isActive)
+ return;
+
+ importOriginIdentifiers();
+}
+
+String StorageTracker::databaseDirectoryPath() const
+{
+ return m_storageDirectoryPath.isolatedCopy();
+}
+
+String StorageTracker::trackerDatabasePath()
+{
+ ASSERT(!m_databaseMutex.tryLock());
+ return pathByAppendingComponent(m_storageDirectoryPath, "StorageTracker.db");
+}
+
+static bool ensureDatabaseFileExists(const String& fileName, bool createIfDoesNotExist)
+{
+ if (createIfDoesNotExist)
+ return makeAllDirectories(directoryName(fileName));
+
+ return fileExists(fileName);
+}
+
+void StorageTracker::openTrackerDatabase(bool createIfDoesNotExist)
+{
+ ASSERT(m_isActive);
+ ASSERT(!isMainThread());
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ ASSERT(!m_databaseMutex.tryLock());
+
+ if (m_database.isOpen())
+ return;
+
+ String databasePath = trackerDatabasePath();
+
+ if (!ensureDatabaseFileExists(databasePath, createIfDoesNotExist)) {
+ if (createIfDoesNotExist)
+ LOG_ERROR("Failed to create database file '%s'", databasePath.ascii().data());
+ return;
+ }
+
+ if (!m_database.open(databasePath)) {
+ LOG_ERROR("Failed to open databasePath %s.", databasePath.ascii().data());
+ return;
+ }
+
+ m_database.disableThreadingChecks();
+
+ if (!m_database.tableExists("Origins")) {
+ if (!m_database.executeCommand("CREATE TABLE Origins (origin TEXT UNIQUE ON CONFLICT REPLACE, path TEXT);"))
+ LOG_ERROR("Failed to create Origins table.");
+ }
+}
+
+void StorageTracker::importOriginIdentifiers()
+{
+ if (!m_isActive)
+ return;
+
+ ASSERT(isMainThread());
+ ASSERT(m_thread);
+
+ m_thread->dispatch([this] {
+ syncImportOriginIdentifiers();
+ });
+}
+
+void StorageTracker::finishedImportingOriginIdentifiers()
+{
+ MutexLocker locker(m_databaseMutex);
+ if (m_client)
+ m_client->didFinishLoadingOrigins();
+}
+
+void StorageTracker::syncImportOriginIdentifiers()
+{
+ ASSERT(m_isActive);
+
+ ASSERT(!isMainThread());
+
+ {
+ MutexLocker locker(m_databaseMutex);
+
+ // Don't force creation of StorageTracker's db just because a tracker
+ // was initialized. It will be created if local storage dbs are found
+ // by syncFileSystemAndTrackerDatabse() or the next time a local storage
+ // db is created by StorageAreaSync.
+ openTrackerDatabase(false);
+
+ if (m_database.isOpen()) {
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ SQLiteStatement statement(m_database, "SELECT origin FROM Origins");
+ if (statement.prepare() != SQLResultOk) {
+ LOG_ERROR("Failed to prepare statement.");
+ return;
+ }
+
+ int result;
+
+ {
+ MutexLocker lockOrigins(m_originSetMutex);
+ while ((result = statement.step()) == SQLResultRow)
+ m_originSet.add(statement.getColumnText(0).isolatedCopy());
+ }
+
+ if (result != SQLResultDone) {
+ LOG_ERROR("Failed to read in all origins from the database.");
+ return;
+ }
+ }
+ }
+
+ syncFileSystemAndTrackerDatabase();
+
+ {
+ MutexLocker locker(m_clientMutex);
+
+ if (m_client) {
+ MutexLocker locker(m_originSetMutex);
+ OriginSet::const_iterator end = m_originSet.end();
+ for (OriginSet::const_iterator it = m_originSet.begin(); it != end; ++it)
+ m_client->dispatchDidModifyOrigin(*it);
+ }
+ }
+
+ callOnMainThread([this] {
+ finishedImportingOriginIdentifiers();
+ });
+}
+
+void StorageTracker::syncFileSystemAndTrackerDatabase()
+{
+ ASSERT(!isMainThread());
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ ASSERT(m_isActive);
+
+ Vector<String> paths;
+ {
+ MutexLocker locker(m_databaseMutex);
+ paths = listDirectory(m_storageDirectoryPath, "*.localstorage");
+ }
+
+ // Use a copy of m_originSet to find expired entries and to schedule their
+ // deletions from disk and from m_originSet.
+ OriginSet originSetCopy;
+ {
+ MutexLocker locker(m_originSetMutex);
+ for (OriginSet::const_iterator it = m_originSet.begin(), end = m_originSet.end(); it != end; ++it)
+ originSetCopy.add((*it).isolatedCopy());
+ }
+
+ // Add missing StorageTracker records.
+ OriginSet foundOrigins;
+ String fileExtension = ASCIILiteral(".localstorage");
+
+ for (Vector<String>::const_iterator it = paths.begin(), end = paths.end(); it != end; ++it) {
+ const String& path = *it;
+
+ if (path.length() > fileExtension.length() && path.endsWith(fileExtension, true)) {
+ String file = pathGetFileName(path);
+ String originIdentifier = file.substring(0, file.length() - fileExtension.length());
+ if (!originSetCopy.contains(originIdentifier))
+ syncSetOriginDetails(originIdentifier, path);
+
+ foundOrigins.add(originIdentifier);
+ }
+ }
+
+ // Delete stale StorageTracker records.
+ for (OriginSet::const_iterator it = originSetCopy.begin(), end = originSetCopy.end(); it != end; ++it) {
+ const String& originIdentifier = *it;
+ if (foundOrigins.contains(originIdentifier))
+ continue;
+
+ String originIdentifierCopy = originIdentifier.isolatedCopy();
+ callOnMainThread([this, originIdentifierCopy] {
+ deleteOriginWithIdentifier(originIdentifierCopy);
+ });
+ }
+}
+
+void StorageTracker::setOriginDetails(const String& originIdentifier, const String& databaseFile)
+{
+ if (!m_isActive)
+ return;
+
+ {
+ MutexLocker locker(m_originSetMutex);
+
+ if (m_originSet.contains(originIdentifier))
+ return;
+
+ m_originSet.add(originIdentifier);
+ }
+
+ String originIdentifierCopy = originIdentifier.isolatedCopy();
+ String databaseFileCopy = databaseFile.isolatedCopy();
+ auto function = [this, originIdentifierCopy, databaseFileCopy] {
+ syncSetOriginDetails(originIdentifierCopy, databaseFileCopy);
+ };
+
+ if (isMainThread()) {
+ ASSERT(m_thread);
+ m_thread->dispatch(function);
+ } else {
+ // FIXME: This weird ping-ponging was done to fix a deadlock. We should figure out a cleaner way to avoid it instead.
+ callOnMainThread([this, function] {
+ m_thread->dispatch(function);
+ });
+ }
+}
+
+void StorageTracker::syncSetOriginDetails(const String& originIdentifier, const String& databaseFile)
+{
+ ASSERT(!isMainThread());
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ MutexLocker locker(m_databaseMutex);
+
+ openTrackerDatabase(true);
+
+ if (!m_database.isOpen())
+ return;
+
+ SQLiteStatement statement(m_database, "INSERT INTO Origins VALUES (?, ?)");
+ if (statement.prepare() != SQLResultOk) {
+ LOG_ERROR("Unable to establish origin '%s' in the tracker", originIdentifier.ascii().data());
+ return;
+ }
+
+ statement.bindText(1, originIdentifier);
+ statement.bindText(2, databaseFile);
+
+ if (statement.step() != SQLResultDone)
+ LOG_ERROR("Unable to establish origin '%s' in the tracker", originIdentifier.ascii().data());
+
+ {
+ MutexLocker locker(m_originSetMutex);
+ if (!m_originSet.contains(originIdentifier))
+ m_originSet.add(originIdentifier);
+ }
+
+ {
+ MutexLocker locker(m_clientMutex);
+ if (m_client)
+ m_client->dispatchDidModifyOrigin(originIdentifier);
+ }
+}
+
+void StorageTracker::origins(Vector<RefPtr<SecurityOrigin>>& result)
+{
+ ASSERT(m_isActive);
+
+ if (!m_isActive)
+ return;
+
+ MutexLocker locker(m_originSetMutex);
+
+ for (OriginSet::const_iterator it = m_originSet.begin(), end = m_originSet.end(); it != end; ++it)
+ result.append(SecurityOrigin::createFromDatabaseIdentifier(*it));
+}
+
+void StorageTracker::deleteAllOrigins()
+{
+ ASSERT(m_isActive);
+ ASSERT(isMainThread());
+ ASSERT(m_thread);
+
+ if (!m_isActive)
+ return;
+
+ {
+ MutexLocker locker(m_originSetMutex);
+ willDeleteAllOrigins();
+ m_originSet.clear();
+ }
+
+ PageGroup::clearLocalStorageForAllOrigins();
+
+ m_thread->dispatch([this] {
+ syncDeleteAllOrigins();
+ });
+}
+
+#if PLATFORM(IOS)
+static void truncateDatabaseFile(SQLiteDatabase& database)
+{
+ sqlite3_file_control(database.sqlite3Handle(), 0, SQLITE_TRUNCATE_DATABASE, 0);
+}
+#endif
+
+void StorageTracker::syncDeleteAllOrigins()
+{
+ ASSERT(!isMainThread());
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ MutexLocker locker(m_databaseMutex);
+
+ openTrackerDatabase(false);
+ if (!m_database.isOpen())
+ return;
+
+ SQLiteStatement statement(m_database, "SELECT origin, path FROM Origins");
+ if (statement.prepare() != SQLResultOk) {
+ LOG_ERROR("Failed to prepare statement.");
+ return;
+ }
+
+ int result;
+ while ((result = statement.step()) == SQLResultRow) {
+ if (!canDeleteOrigin(statement.getColumnText(0)))
+ continue;
+
+ deleteFile(statement.getColumnText(1));
+
+ {
+ MutexLocker locker(m_clientMutex);
+ if (m_client)
+ m_client->dispatchDidModifyOrigin(statement.getColumnText(0));
+ }
+ }
+
+ if (result != SQLResultDone)
+ LOG_ERROR("Failed to read in all origins from the database.");
+
+ if (m_database.isOpen()) {
+#if PLATFORM(IOS)
+ truncateDatabaseFile(m_database);
+#endif
+ m_database.close();
+ }
+
+#if !PLATFORM(IOS)
+ if (!deleteFile(trackerDatabasePath())) {
+ // In the case where it is not possible to delete the database file (e.g some other program
+ // like a virus scanner is accessing it), make sure to remove all entries.
+ openTrackerDatabase(false);
+ if (!m_database.isOpen())
+ return;
+ SQLiteStatement deleteStatement(m_database, "DELETE FROM Origins");
+ if (deleteStatement.prepare() != SQLResultOk) {
+ LOG_ERROR("Unable to prepare deletion of all origins");
+ return;
+ }
+ if (!deleteStatement.executeCommand()) {
+ LOG_ERROR("Unable to execute deletion of all origins");
+ return;
+ }
+ }
+ deleteEmptyDirectory(m_storageDirectoryPath);
+#endif
+}
+
+void StorageTracker::deleteOriginWithIdentifier(const String& originIdentifier)
+{
+ deleteOrigin(&SecurityOrigin::createFromDatabaseIdentifier(originIdentifier).get());
+}
+
+void StorageTracker::deleteOrigin(SecurityOrigin* origin)
+{
+ ASSERT(m_isActive);
+ ASSERT(isMainThread());
+ ASSERT(m_thread);
+
+ if (!m_isActive)
+ return;
+
+ // Before deleting database, we need to clear in-memory local storage data
+ // in StorageArea, and to close the StorageArea db. It's possible for an
+ // item to be added immediately after closing the db and cause StorageAreaSync
+ // to reopen the db before the db is deleted by a StorageTracker thread.
+ // In this case, reopening the db in StorageAreaSync will cancel a pending
+ // StorageTracker db deletion.
+ PageGroup::clearLocalStorageForOrigin(origin);
+
+ String originId = origin->databaseIdentifier();
+
+ {
+ MutexLocker locker(m_originSetMutex);
+ willDeleteOrigin(originId);
+ m_originSet.remove(originId);
+ }
+
+ String originIdCopy = originId.isolatedCopy();
+ m_thread->dispatch([this, originIdCopy] {
+ syncDeleteOrigin(originIdCopy);
+ });
+}
+
+void StorageTracker::syncDeleteOrigin(const String& originIdentifier)
+{
+ ASSERT(!isMainThread());
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ MutexLocker locker(m_databaseMutex);
+
+ if (!canDeleteOrigin(originIdentifier)) {
+ LOG_ERROR("Attempted to delete origin '%s' while it was being created\n", originIdentifier.ascii().data());
+ return;
+ }
+
+ openTrackerDatabase(false);
+ if (!m_database.isOpen())
+ return;
+
+ String path = databasePathForOrigin(originIdentifier);
+ if (path.isEmpty()) {
+ // It is possible to get a request from the API to delete the storage for an origin that
+ // has no such storage.
+ return;
+ }
+
+ SQLiteStatement deleteStatement(m_database, "DELETE FROM Origins where origin=?");
+ if (deleteStatement.prepare() != SQLResultOk) {
+ LOG_ERROR("Unable to prepare deletion of origin '%s'", originIdentifier.ascii().data());
+ return;
+ }
+ deleteStatement.bindText(1, originIdentifier);
+ if (!deleteStatement.executeCommand()) {
+ LOG_ERROR("Unable to execute deletion of origin '%s'", originIdentifier.ascii().data());
+ return;
+ }
+
+ deleteFile(path);
+
+ bool shouldDeleteTrackerFiles = false;
+ {
+ MutexLocker locker(m_originSetMutex);
+ m_originSet.remove(originIdentifier);
+ shouldDeleteTrackerFiles = m_originSet.isEmpty();
+ }
+
+ if (shouldDeleteTrackerFiles) {
+#if PLATFORM(IOS)
+ truncateDatabaseFile(m_database);
+#endif
+ m_database.close();
+#if !PLATFORM(IOS)
+ deleteFile(trackerDatabasePath());
+ deleteEmptyDirectory(m_storageDirectoryPath);
+#endif
+ }
+
+ {
+ MutexLocker locker(m_clientMutex);
+ if (m_client)
+ m_client->dispatchDidModifyOrigin(originIdentifier);
+ }
+}
+
+void StorageTracker::willDeleteAllOrigins()
+{
+ ASSERT(!m_originSetMutex.tryLock());
+
+ OriginSet::const_iterator end = m_originSet.end();
+ for (OriginSet::const_iterator it = m_originSet.begin(); it != end; ++it)
+ m_originsBeingDeleted.add((*it).isolatedCopy());
+}
+
+void StorageTracker::willDeleteOrigin(const String& originIdentifier)
+{
+ ASSERT(isMainThread());
+ ASSERT(!m_originSetMutex.tryLock());
+
+ m_originsBeingDeleted.add(originIdentifier);
+}
+
+bool StorageTracker::canDeleteOrigin(const String& originIdentifier)
+{
+ ASSERT(!m_databaseMutex.tryLock());
+ MutexLocker locker(m_originSetMutex);
+ return m_originsBeingDeleted.contains(originIdentifier);
+}
+
+void StorageTracker::cancelDeletingOrigin(const String& originIdentifier)
+{
+ if (!m_isActive)
+ return;
+
+ MutexLocker locker(m_databaseMutex);
+ {
+ MutexLocker locker(m_originSetMutex);
+ if (!m_originsBeingDeleted.isEmpty())
+ m_originsBeingDeleted.remove(originIdentifier);
+ }
+}
+
+bool StorageTracker::isActive()
+{
+ return m_isActive;
+}
+
+void StorageTracker::setIsActive(bool flag)
+{
+ m_isActive = flag;
+}
+
+String StorageTracker::databasePathForOrigin(const String& originIdentifier)
+{
+ ASSERT(!m_databaseMutex.tryLock());
+ ASSERT(m_isActive);
+
+ if (!m_database.isOpen())
+ return String();
+
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+ SQLiteStatement pathStatement(m_database, "SELECT path FROM Origins WHERE origin=?");
+ if (pathStatement.prepare() != SQLResultOk) {
+ LOG_ERROR("Unable to prepare selection of path for origin '%s'", originIdentifier.ascii().data());
+ return String();
+ }
+ pathStatement.bindText(1, originIdentifier);
+ int result = pathStatement.step();
+ if (result != SQLResultRow)
+ return String();
+
+ return pathStatement.getColumnText(0);
+}
+
+long long StorageTracker::diskUsageForOrigin(SecurityOrigin* origin)
+{
+ if (!m_isActive)
+ return 0;
+
+ MutexLocker locker(m_databaseMutex);
+
+ String path = databasePathForOrigin(origin->databaseIdentifier());
+ if (path.isEmpty())
+ return 0;
+
+ long long size;
+ return getFileSize(path, size) ? size : 0;
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageTrackerhfromrev177812trunkSourceWebCorestorageStorageTrackerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageTracker.h (from rev 177812, trunk/Source/WebCore/storage/StorageTracker.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageTracker.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageTracker.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,120 @@
</span><ins>+/*
+ * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 StorageTracker_h
+#define StorageTracker_h
+
+#include <WebCore/SQLiteDatabase.h>
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class StorageTask;
+class StorageThread;
+class SecurityOrigin;
+class StorageTrackerClient;
+
+class StorageTracker {
+ WTF_MAKE_NONCOPYABLE(StorageTracker);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ WEBCORE_EXPORT static void initializeTracker(const String& storagePath, StorageTrackerClient*);
+ WEBCORE_EXPORT static StorageTracker& tracker();
+
+ void setDatabaseDirectoryPath(const String&);
+ String databaseDirectoryPath() const;
+
+ void setOriginDetails(const String& originIdentifier, const String& databaseFile);
+
+ WEBCORE_EXPORT void deleteAllOrigins();
+ WEBCORE_EXPORT void deleteOrigin(SecurityOrigin*);
+ void deleteOriginWithIdentifier(const String& originIdentifier);
+ WEBCORE_EXPORT void origins(Vector<RefPtr<SecurityOrigin>>& result);
+ WEBCORE_EXPORT long long diskUsageForOrigin(SecurityOrigin*);
+
+ void cancelDeletingOrigin(const String& originIdentifier);
+
+ bool isActive();
+
+ double storageDatabaseIdleInterval() { return m_StorageDatabaseIdleInterval; }
+ void setStorageDatabaseIdleInterval(double interval) { m_StorageDatabaseIdleInterval = interval; }
+
+ WEBCORE_EXPORT void syncFileSystemAndTrackerDatabase();
+
+private:
+ explicit StorageTracker(const String& storagePath);
+
+ void internalInitialize();
+
+ String trackerDatabasePath();
+ void openTrackerDatabase(bool createIfDoesNotExist);
+
+ void importOriginIdentifiers();
+ void finishedImportingOriginIdentifiers();
+
+ void deleteTrackerFiles();
+ String databasePathForOrigin(const String& originIdentifier);
+
+ bool canDeleteOrigin(const String& originIdentifier);
+ void willDeleteOrigin(const String& originIdentifier);
+ void willDeleteAllOrigins();
+
+ void originFilePaths(Vector<String>& paths);
+
+ void setIsActive(bool);
+
+ // Sync to disk on background thread.
+ void syncDeleteAllOrigins();
+ void syncDeleteOrigin(const String& originIdentifier);
+ void syncSetOriginDetails(const String& originIdentifier, const String& databaseFile);
+ void syncImportOriginIdentifiers();
+
+ // Mutex for m_database and m_storageDirectoryPath.
+ Mutex m_databaseMutex;
+ SQLiteDatabase m_database;
+ String m_storageDirectoryPath;
+
+ Mutex m_clientMutex;
+ StorageTrackerClient* m_client;
+
+ // Guard for m_originSet and m_originsBeingDeleted.
+ Mutex m_originSetMutex;
+ typedef HashSet<String> OriginSet;
+ OriginSet m_originSet;
+ OriginSet m_originsBeingDeleted;
+
+ std::unique_ptr<StorageThread> m_thread;
+
+ bool m_isActive;
+ bool m_needsInitialization;
+ double m_StorageDatabaseIdleInterval;
+};
+
+} // namespace WebCore
+
+#endif // StorageTracker_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageStorageTrackerClienthfromrev177812trunkSourceWebCorestorageStorageTrackerClienth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Storage/StorageTrackerClient.h (from rev 177812, trunk/Source/WebCore/storage/StorageTrackerClient.h) (0 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/StorageTrackerClient.h         (rev 0)
+++ trunk/Source/WebKit/Storage/StorageTrackerClient.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+/*
+ * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 StorageTrackerClient_h
+#define StorageTrackerClient_h
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class StorageTrackerClient {
+public:
+ virtual ~StorageTrackerClient() { }
+ virtual void dispatchDidModifyOrigin(const String& originIdentifier) = 0;
+ virtual void didFinishLoadingOrigins() = 0;
+};
+
+} // namespace WebCore
+
+#endif // StorageTrackerClient_h
</ins></span></pre></div>
<a id="trunkSourceWebKitStorageWebStorageNamespaceProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Storage/WebStorageNamespaceProvider.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Storage/WebStorageNamespaceProvider.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/Storage/WebStorageNamespaceProvider.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #include "WebStorageNamespaceProvider.h"
</span><span class="cx">
</span><del>-#include <WebCore/StorageNamespaceImpl.h>
</del><ins>+#include "StorageNamespaceImpl.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojWebKitWebKitvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -285,6 +285,12 @@
</span><span class="cx"> </Link>
</span><span class="cx"> </ItemDefinitionGroup>
</span><span class="cx"> <ItemGroup>
</span><ins>+ <ClCompile Include="..\..\Storage\StorageAreaImpl.cpp" />
+ <ClCompile Include="..\..\Storage\StorageAreaSync.cpp" />
+ <ClCompile Include="..\..\Storage\StorageNamespaceImpl.cpp" />
+ <ClCompile Include="..\..\Storage\StorageSyncManager.cpp" />
+ <ClCompile Include="..\..\Storage\StorageThread.cpp" />
+ <ClCompile Include="..\..\Storage\StorageTracker.cpp" />
</ins><span class="cx"> <ClCompile Include="..\..\Storage\WebStorageNamespaceProvider.cpp" />
</span><span class="cx"> <ClCompile Include="..\..\cf\WebCoreSupport\WebInspectorClientCF.cpp" />
</span><span class="cx"> <ClCompile Include="..\..\win\AccessibleBase.cpp" />
</span><span class="lines">@@ -420,6 +426,13 @@
</span><span class="cx"> <ClCompile Include="..\..\win\WebWorkersPrivate.cpp" />
</span><span class="cx"> </ItemGroup>
</span><span class="cx"> <ItemGroup>
</span><ins>+ <ClInclude Include="..\..\Storage\StorageAreaImpl.h" />
+ <ClInclude Include="..\..\Storage\StorageAreaSync.h" />
+ <ClInclude Include="..\..\Storage\StorageNamespaceImpl.h" />
+ <ClInclude Include="..\..\Storage\StorageSyncManager.h" />
+ <ClInclude Include="..\..\Storage\StorageThread.h" />
+ <ClInclude Include="..\..\Storage\StorageTracker.h" />
+ <ClInclude Include="..\..\Storage\StorageTrackerClient.h" />
</ins><span class="cx"> <ClInclude Include="..\..\Storage\WebStorageNamespaceProvider.h" />
</span><span class="cx"> <ClInclude Include="..\..\win\AccessibleBase.h" />
</span><span class="cx"> <ClInclude Include="..\..\win\AccessibleDocument.h" />
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojWebKitWebKitvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj.filters (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj.filters        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj.filters        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -217,6 +217,24 @@
</span><span class="cx"> <ClCompile Include="..\..\win\WebSerializedJSValue.cpp">
</span><span class="cx"> <Filter>Sources</Filter>
</span><span class="cx"> </ClCompile>
</span><ins>+ <ClCompile Include="..\..\Storage\StorageAreaImpl.cpp">
+ <Filter>Sources</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\Storage\StorageAreaSync.cpp">
+ <Filter>Sources</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\Storage\StorageNamespaceImpl.cpp">
+ <Filter>Sources</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\Storage\StorageSyncManager.cpp">
+ <Filter>Sources</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\Storage\StorageThread.cpp">
+ <Filter>Sources</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\Storage\StorageTracker.cpp">
+ <Filter>Sources</Filter>
+ </ClCompile>
</ins><span class="cx"> <ClCompile Include="..\..\Storage\WebStorageNamespaceProvider.cpp">
</span><span class="cx"> <Filter>Sources</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -537,6 +555,27 @@
</span><span class="cx"> <ClInclude Include="..\..\win\WebCoreSupport\AcceleratedCompositingContext.h">
</span><span class="cx"> <Filter>WebCoreSupport</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\..\Storage\StorageAreaImpl.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Storage\StorageAreaSync.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Storage\StorageNamespaceImpl.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Storage\StorageSyncManager.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Storage\StorageThread.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Storage\StorageTracker.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Storage\StorageTrackerClient.h">
+ <Filter>Sources</Filter>
+ </ClInclude>
</ins><span class="cx"> <ClInclude Include="..\..\Storage\WebStorageNamespaceProvider.h">
</span><span class="cx"> <Filter>Header Files</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -33,6 +33,19 @@
</span><span class="cx">                 1A60519417502A5D00BC62F5 /* HistoryPropertyList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A60519017502A5D00BC62F5 /* HistoryPropertyList.h */; };
</span><span class="cx">                 1A6A208D1886154600E50F5F /* WebProgressTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A6A208B1886154600E50F5F /* WebProgressTrackerClient.mm */; };
</span><span class="cx">                 1A6A208E1886154600E50F5F /* WebProgressTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6A208C1886154600E50F5F /* WebProgressTrackerClient.h */; };
</span><ins>+                1A6B31311A51F3A900422975 /* StorageAreaImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B31241A51F3A900422975 /* StorageAreaImpl.cpp */; };
+                1A6B31321A51F3A900422975 /* StorageAreaImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B31251A51F3A900422975 /* StorageAreaImpl.h */; };
+                1A6B31331A51F3A900422975 /* StorageAreaSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B31261A51F3A900422975 /* StorageAreaSync.cpp */; };
+                1A6B31341A51F3A900422975 /* StorageAreaSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B31271A51F3A900422975 /* StorageAreaSync.h */; };
+                1A6B31351A51F3A900422975 /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B31281A51F3A900422975 /* StorageNamespaceImpl.cpp */; };
+                1A6B31361A51F3A900422975 /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B31291A51F3A900422975 /* StorageNamespaceImpl.h */; };
+                1A6B31371A51F3A900422975 /* StorageSyncManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B312A1A51F3A900422975 /* StorageSyncManager.cpp */; };
+                1A6B31381A51F3A900422975 /* StorageSyncManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B312B1A51F3A900422975 /* StorageSyncManager.h */; };
+                1A6B31391A51F3A900422975 /* StorageThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B312C1A51F3A900422975 /* StorageThread.cpp */; };
+                1A6B313A1A51F3A900422975 /* StorageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B312D1A51F3A900422975 /* StorageThread.h */; };
+                1A6B313B1A51F3A900422975 /* StorageTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6B312E1A51F3A900422975 /* StorageTracker.cpp */; };
+                1A6B313C1A51F3A900422975 /* StorageTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B312F1A51F3A900422975 /* StorageTracker.h */; };
+                1A6B313D1A51F3A900422975 /* StorageTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6B31301A51F3A900422975 /* StorageTrackerClient.h */; };
</ins><span class="cx">                 1A74A28E0F4F75400082E228 /* WebTextInputWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A74A28C0F4F75400082E228 /* WebTextInputWindowController.h */; };
</span><span class="cx">                 1A74A28F0F4F75400082E228 /* WebTextInputWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A74A28D0F4F75400082E228 /* WebTextInputWindowController.m */; };
</span><span class="cx">                 1A77B02E0EE7730500C8A1F9 /* WebPluginRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A77B02C0EE7730500C8A1F9 /* WebPluginRequest.h */; };
</span><span class="lines">@@ -483,6 +496,19 @@
</span><span class="cx">                 1A60519017502A5D00BC62F5 /* HistoryPropertyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryPropertyList.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A6A208B1886154600E50F5F /* WebProgressTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProgressTrackerClient.mm; sourceTree = "<group>"; };
</span><span class="cx">                 1A6A208C1886154600E50F5F /* WebProgressTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProgressTrackerClient.h; sourceTree = "<group>"; };
</span><ins>+                1A6B31241A51F3A900422975 /* StorageAreaImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageAreaImpl.cpp; path = Storage/StorageAreaImpl.cpp; sourceTree = SOURCE_ROOT; };
+                1A6B31251A51F3A900422975 /* StorageAreaImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageAreaImpl.h; path = Storage/StorageAreaImpl.h; sourceTree = SOURCE_ROOT; };
+                1A6B31261A51F3A900422975 /* StorageAreaSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageAreaSync.cpp; path = Storage/StorageAreaSync.cpp; sourceTree = SOURCE_ROOT; };
+                1A6B31271A51F3A900422975 /* StorageAreaSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageAreaSync.h; path = Storage/StorageAreaSync.h; sourceTree = SOURCE_ROOT; };
+                1A6B31281A51F3A900422975 /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageNamespaceImpl.cpp; path = Storage/StorageNamespaceImpl.cpp; sourceTree = SOURCE_ROOT; };
+                1A6B31291A51F3A900422975 /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageNamespaceImpl.h; path = Storage/StorageNamespaceImpl.h; sourceTree = SOURCE_ROOT; };
+                1A6B312A1A51F3A900422975 /* StorageSyncManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageSyncManager.cpp; path = Storage/StorageSyncManager.cpp; sourceTree = SOURCE_ROOT; };
+                1A6B312B1A51F3A900422975 /* StorageSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageSyncManager.h; path = Storage/StorageSyncManager.h; sourceTree = SOURCE_ROOT; };
+                1A6B312C1A51F3A900422975 /* StorageThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageThread.cpp; path = Storage/StorageThread.cpp; sourceTree = SOURCE_ROOT; };
+                1A6B312D1A51F3A900422975 /* StorageThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageThread.h; path = Storage/StorageThread.h; sourceTree = SOURCE_ROOT; };
+                1A6B312E1A51F3A900422975 /* StorageTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StorageTracker.cpp; path = Storage/StorageTracker.cpp; sourceTree = SOURCE_ROOT; };
+                1A6B312F1A51F3A900422975 /* StorageTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageTracker.h; path = Storage/StorageTracker.h; sourceTree = SOURCE_ROOT; };
+                1A6B31301A51F3A900422975 /* StorageTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StorageTrackerClient.h; path = Storage/StorageTrackerClient.h; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">                 1A74A28C0F4F75400082E228 /* WebTextInputWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTextInputWindowController.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A74A28D0F4F75400082E228 /* WebTextInputWindowController.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = WebTextInputWindowController.m; sourceTree = "<group>"; };
</span><span class="cx">                 1A77B02C0EE7730500C8A1F9 /* WebPluginRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginRequest.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -1195,6 +1221,19 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 A10C1D3F18202FDC0036883A /* ios */,
</span><ins>+                                1A6B31241A51F3A900422975 /* StorageAreaImpl.cpp */,
+                                1A6B31251A51F3A900422975 /* StorageAreaImpl.h */,
+                                1A6B31261A51F3A900422975 /* StorageAreaSync.cpp */,
+                                1A6B31271A51F3A900422975 /* StorageAreaSync.h */,
+                                1A6B31281A51F3A900422975 /* StorageNamespaceImpl.cpp */,
+                                1A6B31291A51F3A900422975 /* StorageNamespaceImpl.h */,
+                                1A6B312A1A51F3A900422975 /* StorageSyncManager.cpp */,
+                                1A6B312B1A51F3A900422975 /* StorageSyncManager.h */,
+                                1A6B312C1A51F3A900422975 /* StorageThread.cpp */,
+                                1A6B312D1A51F3A900422975 /* StorageThread.h */,
+                                1A6B312E1A51F3A900422975 /* StorageTracker.cpp */,
+                                1A6B312F1A51F3A900422975 /* StorageTracker.h */,
+                                1A6B31301A51F3A900422975 /* StorageTrackerClient.h */,
</ins><span class="cx">                                 511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
</span><span class="cx">                                 511F3FD30CECC88F00852565 /* WebDatabaseManagerClient.h */,
</span><span class="cx">                                 511F3FD40CECC88F00852565 /* WebDatabaseManagerClient.mm */,
</span><span class="lines">@@ -1691,6 +1730,7 @@
</span><span class="cx">                                 939810660824BF01008DF038 /* CarbonWindowContentView.h in Headers */,
</span><span class="cx">                                 939810670824BF01008DF038 /* CarbonWindowFrame.h in Headers */,
</span><span class="cx">                                 B82958D3132707D0000D0E79 /* CorrectionPanel.h in Headers */,
</span><ins>+                                1A6B313A1A51F3A900422975 /* StorageThread.h in Headers */,
</ins><span class="cx">                                 1A60519417502A5D00BC62F5 /* HistoryPropertyList.h in Headers */,
</span><span class="cx">                                 939810680824BF01008DF038 /* HIViewAdapter.h in Headers */,
</span><span class="cx">                                 1A6A208E1886154600E50F5F /* WebProgressTrackerClient.h in Headers */,
</span><span class="lines">@@ -1743,6 +1783,7 @@
</span><span class="cx">                                 939810760824BF01008DF038 /* WebDefaultUIDelegate.h in Headers */,
</span><span class="cx">                                 BC542C420FD7766F00D8AB5D /* WebDelegateImplementationCaching.h in Headers */,
</span><span class="cx">                                 598AD9201201CF0700ABAE4E /* WebDeviceOrientation.h in Headers */,
</span><ins>+                                1A6B31381A51F3A900422975 /* StorageSyncManager.h in Headers */,
</ins><span class="cx">                                 598AD91A1201CEC900ABAE4E /* WebDeviceOrientationClient.h in Headers */,
</span><span class="cx">                                 598AD9241201CF1900ABAE4E /* WebDeviceOrientationInternal.h in Headers */,
</span><span class="cx">                                 A17A11B1180DC84800E5498C /* WebPluginPackagePrivate.h in Headers */,
</span><span class="lines">@@ -1759,6 +1800,7 @@
</span><span class="cx">                                 939810770824BF01008DF038 /* WebDownload.h in Headers */,
</span><span class="cx">                                 ABDDF20D08EB0DDC001E1241 /* WebDownloadInternal.h in Headers */,
</span><span class="cx">                                 A70936AF0B5608DC00CDB48E /* WebDragClient.h in Headers */,
</span><ins>+                                1A6B313C1A51F3A900422975 /* StorageTracker.h in Headers */,
</ins><span class="cx">                                 939810510824BF01008DF038 /* WebDynamicScrollBarsView.h in Headers */,
</span><span class="cx">                                 934C11670D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h in Headers */,
</span><span class="cx">                                 9398109E0824BF01008DF038 /* WebEditingDelegate.h in Headers */,
</span><span class="lines">@@ -1768,6 +1810,7 @@
</span><span class="cx">                                 DD89682009AA87240097E7F0 /* WebElementDictionary.h in Headers */,
</span><span class="cx">                                 939810520824BF01008DF038 /* WebFormDelegate.h in Headers */,
</span><span class="cx">                                 939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */,
</span><ins>+                                1A6B31341A51F3A900422975 /* StorageAreaSync.h in Headers */,
</ins><span class="cx">                                 939810530824BF01008DF038 /* WebFrame.h in Headers */,
</span><span class="cx">                                 A10C1D1A18202F9C0036883A /* WebDefaultFrameLoadDelegate.h in Headers */,
</span><span class="cx">                                 9398109C0824BF01008DF038 /* WebFrameInternal.h in Headers */,
</span><span class="lines">@@ -1796,6 +1839,7 @@
</span><span class="cx">                                 939810550824BF01008DF038 /* WebHTMLRepresentation.h in Headers */,
</span><span class="cx">                                 939810560824BF01008DF038 /* WebHTMLRepresentationPrivate.h in Headers */,
</span><span class="cx">                                 939810570824BF01008DF038 /* WebHTMLView.h in Headers */,
</span><ins>+                                1A6B313D1A51F3A900422975 /* StorageTrackerClient.h in Headers */,
</ins><span class="cx">                                 939810A10824BF01008DF038 /* WebHTMLViewInternal.h in Headers */,
</span><span class="cx">                                 939810580824BF01008DF038 /* WebHTMLViewPrivate.h in Headers */,
</span><span class="cx">                                 939810180824BF01008DF038 /* WebIconDatabase.h in Headers */,
</span><span class="lines">@@ -1803,6 +1847,7 @@
</span><span class="cx">                                 51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */,
</span><span class="cx">                                 9304B3000B02341500F7850D /* WebIconDatabaseInternal.h in Headers */,
</span><span class="cx">                                 939810190824BF01008DF038 /* WebIconDatabasePrivate.h in Headers */,
</span><ins>+                                1A6B31321A51F3A900422975 /* StorageAreaImpl.h in Headers */,
</ins><span class="cx">                                 A10C1D641820300E0036883A /* WebChromeClientIOS.h in Headers */,
</span><span class="cx">                                 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */,
</span><span class="cx">                                 06693DDC0BFBA85200216072 /* WebInspectorClient.h in Headers */,
</span><span class="lines">@@ -1889,6 +1934,7 @@
</span><span class="cx">                                 939810B00824BF01008DF038 /* WebPluginContainerPrivate.h in Headers */,
</span><span class="cx">                                 1AC7176F1A26568A002E3115 /* WebVisitedLinkStore.h in Headers */,
</span><span class="cx">                                 939810370824BF01008DF038 /* WebPluginController.h in Headers */,
</span><ins>+                                1A6B31361A51F3A900422975 /* StorageNamespaceImpl.h in Headers */,
</ins><span class="cx">                                 7C1FB3C21846E8E1001A03D8 /* WebAllowDenyPolicyListener.h in Headers */,
</span><span class="cx">                                 939810380824BF01008DF038 /* WebPluginDatabase.h in Headers */,
</span><span class="cx">                                 939810390824BF01008DF038 /* WebPluginPackage.h in Headers */,
</span><span class="lines">@@ -2189,6 +2235,7 @@
</span><span class="cx">                                 9398110A0824BF01008DF038 /* WebDefaultUIDelegate.m in Sources */,
</span><span class="cx">                                 BC542C430FD7766F00D8AB5D /* WebDelegateImplementationCaching.mm in Sources */,
</span><span class="cx">                                 598AD9221201CF1000ABAE4E /* WebDeviceOrientation.mm in Sources */,
</span><ins>+                                1A6B31331A51F3A900422975 /* StorageAreaSync.cpp in Sources */,
</ins><span class="cx">                                 1A6A208D1886154600E50F5F /* WebProgressTrackerClient.mm in Sources */,
</span><span class="cx">                                 598AD91E1201CECF00ABAE4E /* WebDeviceOrientationClient.mm in Sources */,
</span><span class="cx">                                 598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */,
</span><span class="lines">@@ -2221,11 +2268,13 @@
</span><span class="cx">                                 51494CD70C7EBDE0004178C5 /* WebIconDatabaseClient.mm in Sources */,
</span><span class="cx">                                 5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */,
</span><span class="cx">                                 06693DDD0BFBA85200216072 /* WebInspectorClient.mm in Sources */,
</span><ins>+                                1A6B31311A51F3A900422975 /* StorageAreaImpl.cpp in Sources */,
</ins><span class="cx">                                 1C7B0C660EB2464D00A28502 /* WebInspectorClientCF.cpp in Sources */,
</span><span class="cx">                                 B80417701217A83100466BAE /* WebInspectorFrontend.mm in Sources */,
</span><span class="cx">                                 A10C1D1918202F9C0036883A /* WebDefaultFormDelegate.m in Sources */,
</span><span class="cx">                                 939810E40824BF01008DF038 /* WebJavaScriptTextInputPanel.m in Sources */,
</span><span class="cx">                                 A10C1D8B1820305E0036883A /* WebPDFViewIOS.mm in Sources */,
</span><ins>+                                1A6B31371A51F3A900422975 /* StorageSyncManager.cpp in Sources */,
</ins><span class="cx">                                 37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */,
</span><span class="cx">                                 939811170824BF01008DF038 /* WebKeyGenerator.mm in Sources */,
</span><span class="cx">                                 939811030824BF01008DF038 /* WebKitErrors.m in Sources */,
</span><span class="lines">@@ -2262,6 +2311,7 @@
</span><span class="cx">                                 312E2FE614E48182007CCA18 /* WebNotification.mm in Sources */,
</span><span class="cx">                                 31C11A6F1476552E0049A4CC /* WebNotificationClient.mm in Sources */,
</span><span class="cx">                                 EDE983810BCDF5FE00FDAE28 /* WebNSArrayExtras.m in Sources */,
</span><ins>+                                1A6B31391A51F3A900422975 /* StorageThread.cpp in Sources */,
</ins><span class="cx">                                 A560946714D8AD2600799A8A /* WebIndicateLayer.mm in Sources */,
</span><span class="cx">                                 939810C60824BF01008DF038 /* WebNSControlExtras.m in Sources */,
</span><span class="cx">                                 939811150824BF01008DF038 /* WebNSDataExtras.m in Sources */,
</span><span class="lines">@@ -2309,12 +2359,14 @@
</span><span class="cx">                                 936A2DE80FD2D08000D312DB /* WebTextCompletionController.mm in Sources */,
</span><span class="cx">                                 A10C1D3E18202FC50036883A /* WebUIKitSupport.mm in Sources */,
</span><span class="cx">                                 1A74A28F0F4F75400082E228 /* WebTextInputWindowController.m in Sources */,
</span><ins>+                                1A6B31351A51F3A900422975 /* StorageNamespaceImpl.cpp in Sources */,
</ins><span class="cx">                                 F834AAD80E64B1C700E2737C /* WebTextIterator.mm in Sources */,
</span><span class="cx">                                 A10C1D1D18202F9C0036883A /* WebDefaultResourceLoadDelegate.m in Sources */,
</span><span class="cx">                                 939810BE0824BF01008DF038 /* WebURLsWithTitles.m in Sources */,
</span><span class="cx">                                 C0C5B3EF1177A4A0002B0AEF /* WebUserContentURLPattern.mm in Sources */,
</span><span class="cx">                                 1AB1DAC118BC0232004B6A9F /* WebViewGroup.mm in Sources */,
</span><span class="cx">                                 939811070824BF01008DF038 /* WebView.mm in Sources */,
</span><ins>+                                1A6B313B1A51F3A900422975 /* StorageTracker.cpp in Sources */,
</ins><span class="cx">                                 BC2E464E0FD8A96800A9D9DE /* WebViewData.mm in Sources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-12-29 Anders Carlsson <andersca@apple.com>
+
+ Move storage code from WebCore to WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=139558
+
+ Reviewed by Darin Adler.
+
+ * Storage/WebStorageManager.mm:
+ * Storage/WebStorageTrackerClient.h:
+ * WebView/WebView.mm:
+
</ins><span class="cx"> 2014-12-26 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> <rdar://problem/19348208> REGRESSION (r177027): iOS builds use the wrong toolchain
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebStorageManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebStorageManager.mm (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebStorageManager.mm        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/mac/Storage/WebStorageManager.mm        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -23,14 +23,13 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#import "WebSecurityOriginInternal.h"
-#import "WebStorageManagerPrivate.h"
</del><span class="cx"> #import "WebStorageManagerInternal.h"
</span><del>-#import "WebStorageTrackerClient.h"
</del><span class="cx">
</span><ins>+#import "StorageTracker.h"
+#import "WebSecurityOriginInternal.h"
+#import "WebStorageTrackerClient.h"
</ins><span class="cx"> #import <WebCore/PageGroup.h>
</span><span class="cx"> #import <WebCore/SecurityOrigin.h>
</span><del>-#import <WebCore/StorageTracker.h>
</del><span class="cx"> #import <pthread.h>
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebStorageManagerInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebStorageManagerInternal.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebStorageManagerInternal.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/mac/Storage/WebStorageManagerInternal.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -22,5 +22,7 @@
</span><span class="cx"> * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><del>-
</del><ins>+
+#import "WebStorageManagerPrivate.h"
+
</ins><span class="cx"> void WebKitInitializeStorageIfNecessary();
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebStorageTrackerClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -23,8 +23,8 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#import "StorageTrackerClient.h"
</ins><span class="cx"> #import <WebCore/SecurityOrigin.h>
</span><del>-#import <WebCore/StorageTrackerClient.h>
</del><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import "DOMNodeInternal.h"
</span><span class="cx"> #import "DOMRangeInternal.h"
</span><span class="cx"> #import "DictionaryPopupInfo.h"
</span><ins>+#import "StorageThread.h"
</ins><span class="cx"> #import "WebAlternativeTextClient.h"
</span><span class="cx"> #import "WebApplicationCache.h"
</span><span class="cx"> #import "WebBackForwardListInternal.h"
</span><span class="lines">@@ -175,7 +176,6 @@
</span><span class="cx"> #import <WebCore/SecurityOrigin.h>
</span><span class="cx"> #import <WebCore/SecurityPolicy.h>
</span><span class="cx"> #import <WebCore/Settings.h>
</span><del>-#import <WebCore/StorageThread.h>
</del><span class="cx"> #import <WebCore/StyleProperties.h>
</span><span class="cx"> #import <WebCore/TextResourceDecoder.h>
</span><span class="cx"> #import <WebCore/ThreadCheck.h>
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-12-29 Anders Carlsson <andersca@apple.com>
+
+ Move storage code from WebCore to WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=139558
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/WebProcess.cpp:
+
</ins><span class="cx"> 2014-12-29 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Fixed the iOS build.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (177812 => 177813)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-12-29 20:16:11 UTC (rev 177812)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2014-12-29 21:12:28 UTC (rev 177813)
</span><span class="lines">@@ -85,7 +85,6 @@
</span><span class="cx"> #include <WebCore/SchemeRegistry.h>
</span><span class="cx"> #include <WebCore/SecurityOrigin.h>
</span><span class="cx"> #include <WebCore/Settings.h>
</span><del>-#include <WebCore/StorageTracker.h>
</del><span class="cx"> #include <unistd.h>
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> #include <wtf/HashCountedSet.h>
</span></span></pre>
</div>
</div>
</body>
</html>