Changeset 202379 in webkit


Ignore:
Timestamp:
Jun 23, 2016 9:03:18 AM (8 years ago)
Author:
Chris Dumez
Message:

Only call sqlite3_initialize() when a SQLite database is actually being opened
https://bugs.webkit.org/show_bug.cgi?id=159033

Reviewed by Brady Eidson.

Only call sqlite3_initialize() when a SQLite database is actually being opened
instead of doing it unconditionally. sqlite3_initialize() was previously called
in the SQLiteDatabase constructor which gets called on WebContent process
initialization because a DatabaseTracker is constructed on initialization and
DatabaseTracker has a SQLiteDatabase data member.

  • platform/sql/SQLiteDatabase.cpp:

(WebCore::initializeSQLiteIfNecessary):
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::SQLiteDatabase): Deleted.

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202378 r202379  
     12016-06-23  Chris Dumez  <cdumez@apple.com>
     2
     3        Only call sqlite3_initialize() when a SQLite database is actually being opened
     4        https://bugs.webkit.org/show_bug.cgi?id=159033
     5
     6        Reviewed by Brady Eidson.
     7
     8        Only call sqlite3_initialize() when a SQLite database is actually being opened
     9        instead of doing it unconditionally. sqlite3_initialize() was previously called
     10        in the SQLiteDatabase constructor which gets called on WebContent process
     11        initialization because a DatabaseTracker is constructed on initialization and
     12        DatabaseTracker has a SQLiteDatabase data member.
     13
     14        * platform/sql/SQLiteDatabase.cpp:
     15        (WebCore::initializeSQLiteIfNecessary):
     16        (WebCore::SQLiteDatabase::open):
     17        (WebCore::SQLiteDatabase::SQLiteDatabase): Deleted.
     18        * platform/sql/SQLiteDatabase.h:
     19
    1202016-06-23  Adam Bergkvist  <adam.bergkvist@ericsson.com>
    221
  • trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp

    r200322 r202379  
    5050}
    5151
    52 SQLiteDatabase::SQLiteDatabase()
    53     : m_db(0)
    54     , m_pageSize(-1)
    55     , m_transactionInProgress(false)
    56     , m_sharable(false)
    57     , m_openingThread(0)
    58     , m_openError(SQLITE_ERROR)
    59     , m_openErrorMessage()
    60     , m_lastChangesCount(0)
     52static void initializeSQLiteIfNecessary()
    6153{
    6254    static std::once_flag flag;
     
    7870}
    7971
     72SQLiteDatabase::SQLiteDatabase() = default;
     73
    8074SQLiteDatabase::~SQLiteDatabase()
    8175{
     
    8579bool SQLiteDatabase::open(const String& filename, bool forWebSQLDatabase)
    8680{
     81    initializeSQLiteIfNecessary();
     82
    8783    close();
    8884
  • trunk/Source/WebCore/platform/sql/SQLiteDatabase.h

    r200322 r202379  
    146146    void overrideUnauthorizedFunctions();
    147147
    148     sqlite3* m_db;
    149     int m_pageSize;
     148    sqlite3* m_db { nullptr };
     149    int m_pageSize { -1 };
    150150   
    151     bool m_transactionInProgress;
    152     bool m_sharable;
     151    bool m_transactionInProgress { false };
     152    bool m_sharable { false };
    153153   
    154154    Lock m_authorizerLock;
     
    156156
    157157    Lock m_lockingMutex;
    158     ThreadIdentifier m_openingThread;
     158    ThreadIdentifier m_openingThread { 0 };
    159159
    160160    Lock m_databaseClosingMutex;
    161161
    162     int m_openError;
     162    int m_openError { SQLITE_ERROR };
    163163    CString m_openErrorMessage;
    164164
    165     int m_lastChangesCount;
     165    int m_lastChangesCount { 0 };
    166166};
    167167
Note: See TracChangeset for help on using the changeset viewer.