Changeset 27717 in webkit
- Timestamp:
- Nov 12, 2007 10:34:45 AM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r27716 r27717 1 2007-11-12 Justin Haygood <jhaygood@reaktix.com> 2 3 Reviewed by Brady. 4 5 http://bugs.webkit.org/show_bug.cgi?id=15955 6 Reimplement threading functions in IconDatabase and SQLiteDatabase in terms of the threading abstractions 7 8 * loader/icon/IconDatabase.cpp: 9 (WebCore::IconDatabase::open): 10 (WebCore::IconDatabase::close): 11 * loader/icon/IconDatabase.h: 12 * platform/sql/SQLiteDatabase.cpp: 13 (WebCore::SQLiteDatabase::SQLiteDatabase): 14 (WebCore::SQLiteDatabase::open): 15 (WebCore::SQLiteDatabase::close): 16 * platform/sql/SQLiteDatabase.h: 17 1 18 2007-11-12 Adam Roben <aroben@apple.com> 2 19 -
trunk/WebCore/loader/icon/IconDatabase.cpp
r27054 r27717 1 1 /* 2 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 50 51 #endif 51 52 53 #if PLATFORM(DARWIN) 54 #include <pthread.h> 55 #endif 56 52 57 #include <errno.h> 53 58 … … 56 61 57 62 // For methods that are meant to support the sync thread ONLY 58 #define IS_ICON_SYNC_THREAD() pthread_equal(pthread_self(), m_syncThread)63 #define IS_ICON_SYNC_THREAD() m_syncThread == currentThread() 59 64 #define ASSERT_ICON_SYNC_THREAD() ASSERT(IS_ICON_SYNC_THREAD()) 60 65 … … 137 142 m_completeDatabasePath = pathByAppendingComponent(m_databaseDirectory, defaultDatabaseFilename()); 138 143 139 // Lock here as well as first thing in the thread so the t read doesn't actually commence until the pthread_create() call144 // Lock here as well as first thing in the thread so the thread doesn't actually commence until the createThread() call 140 145 // completes and m_syncThreadRunning is properly set 141 146 m_syncLock.lock(); 142 m_syncThread Running = !pthread_create(&m_syncThread, NULL,IconDatabase::iconDatabaseSyncThreadStart, this);143 m_syncLock.unlock();144 145 return m_syncThreadRunning;147 m_syncThread = createThread(IconDatabase::iconDatabaseSyncThreadStart, this); 148 if (!m_syncThread) 149 return false; 150 return true; 146 151 } 147 152 … … 158 163 159 164 // Wait for the sync thread to terminate 160 if (pthread_join(m_syncThread, NULL) == EDEADLK) 161 LOG_ERROR("m_syncThread was found to be deadlocked trying to quit"); 165 waitForThreadCompletion(m_syncThread, 0); 162 166 } 163 167 -
trunk/WebCore/loader/icon/IconDatabase.h
r27054 r27717 1 1 /* 2 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 121 122 void syncTimerFired(Timer<IconDatabase>*); 122 123 123 pthread_tm_syncThread;124 ThreadIdentifier m_syncThread; 124 125 bool m_syncThreadRunning; 125 126 -
trunk/WebCore/platform/sql/SQLiteDatabase.cpp
r27054 r27717 1 1 /* 2 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 45 46 : m_db(0) 46 47 , m_transactionInProgress(false) 47 { 48 #ifndef NDEBUG 49 memset(&m_openingThread, 0, sizeof(pthread_t)); 50 #endif 48 , m_openingThread(0) 49 { 51 50 } 52 51 … … 72 71 } 73 72 74 #ifndef NDEBUG75 73 if (isOpen()) 76 m_openingThread = pthread_self(); 77 #endif 74 m_openingThread = currentThread(); 78 75 79 76 if (!SQLiteStatement(*this, "PRAGMA temp_store = MEMORY;").executeCommand()) … … 90 87 m_db = 0; 91 88 } 92 #ifndef NDEBUG 93 memset(&m_openingThread, 0, sizeof(pthread_t)); 94 #endif 89 90 m_openingThread = 0; 95 91 } 96 92 … … 297 293 298 294 } // namespace WebCore 299 300 -
trunk/WebCore/platform/sql/SQLiteDatabase.h
r27054 r27717 1 1 /* 2 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 31 32 #include <wtf/Noncopyable.h> 32 33 #include <wtf/Vector.h> 33 34 #ifndef NDEBUG35 #include <pthread.h>36 #endif37 34 38 35 #if COMPILER(MSVC) … … 98 95 99 96 sqlite3* sqlite3Handle() const { 100 ASSERT( pthread_equal(m_openingThread, pthread_self()));97 ASSERT(currentThread() == m_openingThread); 101 98 return m_db; 102 99 } … … 120 117 121 118 Mutex m_lockingMutex; 122 #ifndef NDEBUG 123 pthread_t m_openingThread; 124 #endif 119 ThreadIdentifier m_openingThread; 125 120 126 121 }; // class SQLiteDatabase
Note: See TracChangeset
for help on using the changeset viewer.