Changeset 125992 in webkit
- Timestamp:
- Aug 19, 2012 9:03:24 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r125991 r125992 1 2012-08-19 Benjamin Poulain <benjamin@webkit.org> 2 3 Do not allocate SQLiteDatabase's m_openErrorMessage until its needed 4 https://bugs.webkit.org/show_bug.cgi?id=94434 5 6 Reviewed by Andreas Kling. 7 8 Previously, m_openErrorMessage was initialized from a static literal string whenever 9 the database is not open. 10 11 This patch changes the way we use m_openErrorMessage to only allocate a string in the 12 few cases where we need it. If there is no error message, we fallback to the previous 13 default string. 14 15 The goal is to prevent allocating the string unless needed. That saves initialization time 16 and memory. 17 18 * platform/sql/SQLiteDatabase.cpp: 19 (WebCore::SQLiteDatabase::SQLiteDatabase): 20 (WebCore::SQLiteDatabase::close): 21 (WebCore::SQLiteDatabase::lastErrorMsg): 22 1 23 2012-08-19 Benjamin Poulain <benjamin@webkit.org> 2 24 -
trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp
r108015 r125992 57 57 , m_interrupted(false) 58 58 , m_openError(SQLITE_ERROR) 59 , m_openErrorMessage( notOpenErrorMessage)59 , m_openErrorMessage() 60 60 { 61 61 } … … 115 115 m_openingThread = 0; 116 116 m_openError = SQLITE_ERROR; 117 m_openErrorMessage = notOpenErrorMessage;117 m_openErrorMessage = CString(); 118 118 } 119 119 … … 334 334 335 335 const char* SQLiteDatabase::lastErrorMsg() 336 { 337 return m_db ? sqlite3_errmsg(m_db) : m_openErrorMessage.data(); 336 { 337 if (m_db) 338 return sqlite3_errmsg(m_db); 339 return m_openErrorMessage.isNull() ? notOpenErrorMessage : m_openErrorMessage.data(); 338 340 } 339 341
Note: See TracChangeset
for help on using the changeset viewer.