⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242983 in webkit


Ignore:
Timestamp:
Mar 14, 2019, 6:54:22 PM (7 years ago)
Author:
sihui_liu@apple.com
Message:

Web process is put to suspended when holding locked WebSQL files
https://bugs.webkit.org/show_bug.cgi?id=195768

Reviewed by Geoffrey Garen.

We need to keep processes active during database close, because SQLite database may run a checkpoint operation
and lock database files.

  • platform/sql/SQLiteDatabase.cpp:

(WebCore::SQLiteDatabase::useWALJournalMode):
(WebCore::SQLiteDatabase::close):

  • platform/sql/SQLiteDatabase.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242981 r242983  
     12019-03-14  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Web process is put to suspended when holding locked WebSQL files
     4        https://bugs.webkit.org/show_bug.cgi?id=195768
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        We need to keep processes active during database close, because SQLite database may run a checkpoint operation
     9        and lock database files.
     10
     11        * platform/sql/SQLiteDatabase.cpp:
     12        (WebCore::SQLiteDatabase::useWALJournalMode):
     13        (WebCore::SQLiteDatabase::close):
     14        * platform/sql/SQLiteDatabase.h:
     15
    1162019-03-14  Brent Fulgham  <bfulgham@apple.com>
    217
  • trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp

    r242307 r242983  
    3131#include "Logging.h"
    3232#include "MemoryRelease.h"
     33#include "SQLiteDatabaseTracker.h"
    3334#include "SQLiteFileSystem.h"
    3435#include "SQLiteStatement.h"
     
    134135void SQLiteDatabase::useWALJournalMode()
    135136{
     137    m_useWAL = true;
    136138    {
    137139        SQLiteStatement walStatement(*this, "PRAGMA journal_mode=WAL;"_s);
     
    147149
    148150    {
     151        SQLiteTransactionInProgressAutoCounter transactionCounter;
    149152        SQLiteStatement checkpointStatement(*this, "PRAGMA wal_checkpoint(TRUNCATE)"_s);
    150153        if (checkpointStatement.prepareAndStep() == SQLITE_ROW) {
     
    166169            m_db = 0;
    167170        }
    168         sqlite3_close(db);
     171        if (m_useWAL) {
     172            SQLiteTransactionInProgressAutoCounter transactionCounter;
     173            sqlite3_close(db);
     174        } else
     175            sqlite3_close(db);
    169176    }
    170177
  • trunk/Source/WebCore/platform/sql/SQLiteDatabase.h

    r242406 r242983  
    156156    bool m_sharable { false };
    157157#endif
    158    
     158
     159    bool m_useWAL { false };
     160
    159161    Lock m_authorizerLock;
    160162    RefPtr<DatabaseAuthorizer> m_authorizer;
Note: See TracChangeset for help on using the changeset viewer.