WebKit should adopt journal_mode=wal for all SQLite databases.
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2016 20:10:36 +0000 (20:10 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2016 20:10:36 +0000 (20:10 +0000)
commit91cb7ce70b6fdb765b31a4bcb79e0f098e33dda3
tree7ba944b136d1dafb59372e4898d6c7aa6e26284e
parent6f266d5abc1ec3edca3b8d9288e1ce1ed66e8235
WebKit should adopt journal_mode=wal for all SQLite databases.
https://bugs.webkit.org/show_bug.cgi?id=133496

Reviewed by Darin Adler.

Source/WebCore:

The statement intended to enable WAL mode is always failing because it is missing a
prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
was in error (we were only getting these because stepping the unprepared statement
returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
database - this will improve perfomance when the database is accessed via an AFP
mount.

This exposed a bug, that deleteAllDatabases does not actually delete the databases on
iOS, for testing to reset back to a known state between tests it should be doing so.

* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::deleteAllDatabases):
    - force databases to actually be deleted on iOS.
      This method is only used from testing code (DumpRenderTree / WebKitTestRunner).
(WebCore::DatabaseTracker::deleteOrigin):
    - added IOSDeletionMode.
(WebCore::DatabaseTracker::deleteDatabaseFile):
    - added IOSDeletionMode, modified to actually delete if this is set.
* Modules/webdatabase/DatabaseTracker.h:
    - added IOSDeletionMode.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
    - call prepareAndStep(), only check for SQLITE_ROW result.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::openDatabase):
    - should set SQLITE_OPEN_AUTOPROXY flag when opening database.

Source/WebKit/mac:

* Storage/WebDatabaseManagerPrivate.h:
    - renamed deleteAllDatabases -> deleteAllDatabasesImmediately.

Source/WebKit/win:

* WebDatabaseManager.cpp:
(WebDatabaseManager::deleteAllDatabases):
    - renamed deleteAllDatabases -> deleteAllDatabasesImmediately.

Source/WebKit2:

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleClearAllDatabases):
    - renamed deleteAllDatabases -> deleteAllDatabasesImmediately.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
Source/WebCore/Modules/webdatabase/DatabaseManager.h
Source/WebCore/Modules/webdatabase/DatabaseServer.cpp
Source/WebCore/Modules/webdatabase/DatabaseServer.h
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
Source/WebCore/Modules/webdatabase/DatabaseTracker.h
Source/WebCore/platform/sql/SQLiteDatabase.cpp
Source/WebCore/platform/sql/SQLiteFileSystem.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Storage/WebDatabaseManager.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebDatabaseManager.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp