Modified: trunk/Source/WebCore/ChangeLog (161028 => 161029)
--- trunk/Source/WebCore/ChangeLog 2013-12-23 23:25:31 UTC (rev 161028)
+++ trunk/Source/WebCore/ChangeLog 2013-12-23 23:28:53 UTC (rev 161029)
@@ -1,5 +1,24 @@
2013-12-23 Daniel Bates <[email protected]>
+ [iOS] Upstream WebCore/storage changes
+ https://bugs.webkit.org/show_bug.cgi?id=125913
+
+ Reviewed by David Kilzer.
+
+ * storage/StorageAreaSync.cpp:
+ (WebCore::StorageAreaSync::openDatabase): Added iOS-specific code.
+ (WebCore::StorageAreaSync::sync): Ditto.
+ * storage/StorageTracker.cpp:
+ (WebCore::StorageTracker::openTrackerDatabase): Ditto.
+ (WebCore::StorageTracker::syncImportOriginIdentifiers): Ditto.
+ (WebCore::StorageTracker::syncFileSystemAndTrackerDatabase): Ditto.
+ (WebCore::StorageTracker::syncSetOriginDetails): Ditto.
+ (WebCore::StorageTracker::syncDeleteAllOrigins): Ditto.
+ (WebCore::StorageTracker::syncDeleteOrigin): Ditto.
+ (WebCore::StorageTracker::databasePathForOrigin): Ditto.
+
+2013-12-23 Daniel Bates <[email protected]>
+
Fix the iOS build following <http://trac.webkit.org/changeset/160236>
(https://bugs.webkit.org/show_bug.cgi?id=125239)
Modified: trunk/Source/WebCore/storage/StorageAreaSync.cpp (161028 => 161029)
--- trunk/Source/WebCore/storage/StorageAreaSync.cpp 2013-12-23 23:25:31 UTC (rev 161028)
+++ trunk/Source/WebCore/storage/StorageAreaSync.cpp 2013-12-23 23:28:53 UTC (rev 161029)
@@ -41,6 +41,10 @@
#include <wtf/MainThread.h>
#include <wtf/text/CString.h>
+#if PLATFORM(IOS)
+#include "SQLiteDatabaseTracker.h"
+#endif
+
namespace WebCore {
// If the StorageArea undergoes rapid changes, don't sync each change to disk.
@@ -232,6 +236,9 @@
ASSERT(!m_database.isOpen());
ASSERT(!m_databaseOpenFailed);
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
String databaseFilename = m_syncManager->fullDatabaseFilename(m_databaseIdentifier);
if (!fileExists(databaseFilename) && openingStrategy == SkipIfNonExistent)
@@ -403,6 +410,9 @@
return;
}
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
// 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");
Modified: trunk/Source/WebCore/storage/StorageTracker.cpp (161028 => 161029)
--- trunk/Source/WebCore/storage/StorageTracker.cpp 2013-12-23 23:25:31 UTC (rev 161028)
+++ trunk/Source/WebCore/storage/StorageTracker.cpp 2013-12-23 23:28:53 UTC (rev 161029)
@@ -42,6 +42,10 @@
#include <wtf/Vector.h>
#include <wtf/text/CString.h>
+#if PLATFORM(IOS)
+#include "SQLiteDatabaseTracker.h"
+#endif
+
namespace WebCore {
static StorageTracker* storageTracker = 0;
@@ -132,6 +136,9 @@
{
ASSERT(m_isActive);
ASSERT(!isMainThread());
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
ASSERT(!m_databaseMutex.tryLock());
if (m_database.isOpen())
@@ -192,6 +199,9 @@
openTrackerDatabase(false);
if (m_database.isOpen()) {
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
SQLiteStatement statement(m_database, "SELECT origin FROM Origins");
if (statement.prepare() != SQLResultOk) {
LOG_ERROR("Failed to prepare statement.");
@@ -232,6 +242,9 @@
void StorageTracker::syncFileSystemAndTrackerDatabase()
{
ASSERT(!isMainThread());
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
ASSERT(m_isActive);
Vector<String> paths;
@@ -304,6 +317,9 @@
void StorageTracker::syncSetOriginDetails(const String& originIdentifier, const String& databaseFile)
{
ASSERT(!isMainThread());
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
MutexLocker locker(m_databaseMutex);
@@ -373,6 +389,9 @@
void StorageTracker::syncDeleteAllOrigins()
{
ASSERT(!isMainThread());
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
MutexLocker locker(m_databaseMutex);
@@ -402,10 +421,15 @@
if (result != SQLResultDone)
LOG_ERROR("Failed to read in all origins from the database.");
-
- if (m_database.isOpen())
+
+ if (m_database.isOpen()) {
+#if PLATFORM(IOS)
+ SQLiteFileSystem::truncateDatabaseFile(m_database.sqlite3Handle());
+#endif
m_database.close();
-
+ }
+
+#if !PLATFORM(IOS)
if (!SQLiteFileSystem::deleteDatabaseFile(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.
@@ -423,6 +447,7 @@
}
}
SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_storageDirectoryPath);
+#endif
}
void StorageTracker::deleteOriginWithIdentifier(const String& originIdentifier)
@@ -461,6 +486,9 @@
void StorageTracker::syncDeleteOrigin(const String& originIdentifier)
{
ASSERT(!isMainThread());
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
MutexLocker locker(m_databaseMutex);
@@ -501,9 +529,14 @@
}
if (shouldDeleteTrackerFiles) {
+#if PLATFORM(IOS)
+ SQLiteFileSystem::truncateDatabaseFile(m_database.sqlite3Handle());
+#endif
m_database.close();
+#if !PLATFORM(IOS)
SQLiteFileSystem::deleteDatabaseFile(trackerDatabasePath());
SQLiteFileSystem::deleteEmptyDatabaseDirectory(m_storageDirectoryPath);
+#endif
}
{
@@ -567,7 +600,11 @@
if (!m_database.isOpen())
return String();
-
+
+#if PLATFORM(IOS)
+ SQLiteTransactionInProgressAutoCounter transactionCounter;
+#endif
+
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());