JavaScriptCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2007 21:05:38 +0000 (21:05 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Oct 2007 21:05:38 +0000 (21:05 +0000)
        Reviewed by Oliver.

        * wtf/Platform.h:
        #define USE_PTHREADS on Mac.

WebCore:

        Reviewed by Oliver.

        * WebCore.xcodeproj/project.pbxproj:
        * WebCore.vcproj/WebCore.vcproj:

        * config.h:
        #define USE_PTHREADS on Windows.

        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::getOrCreateIconRecord):
        (WebCore::IconDatabase::getOrCreatePageURLRecord):
        Update for mutex changes.

        * platform/Threading.h:
        (WebCore::):
        (WebCore::ThreadSafeShared::ThreadSafeShared):
        (WebCore::ThreadSafeShared::ref):
        (WebCore::ThreadSafeShared::deref):
        (WebCore::ThreadSafeShared::hasOneRef):
        (WebCore::ThreadSafeShared::refCount):
        (WebCore::ThreadSafeShared::isThreadSafe):
        Add a new Shared base class that uses a mutex to manage its refcount.

        (WebCore::createThread):
        (WebCore::waitForThreadCompletion):
        (WebCore::detachThread):
        New functions for thread creation.

        (WebCore::Mutex::Mutex):
        (WebCore::Mutex::~Mutex):
        (WebCore::Mutex::lock):
        (WebCore::Mutex::tryLock):
        (WebCore::Mutex::unlock):
        Move the definitions to ThreadingPthreads.cpp

        (WebCore::ThreadCondition::ThreadCondition):
        (WebCore::ThreadCondition::~ThreadCondition):
        (WebCore::ThreadCondition::wait):
        (WebCore::ThreadCondition::signal):
        (WebCore::ThreadCondition::broadcast):
        Move the definitions to ThreadingPthreads.cpp

        * platform/pthreads: Added.
        * platform/pthreads/ThreadingPthreads.cpp: Added.
        Add pthread specific implementation of the thread creation functions, Mutex and ThreadCondition.

win:

        Update for locking primitive changes.

        * WebIconDatabase.cpp:
        (WebIconDatabase::scheduleNotificationDelivery):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@26716 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/wtf/Platform.h
WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/config.h
WebCore/loader/icon/IconDatabase.cpp
WebCore/platform/Threading.h
WebCore/platform/pthreads/ThreadingPthreads.cpp [new file with mode: 0644]
WebKit/win/ChangeLog
WebKit/win/WebIconDatabase.cpp

index 7074a0ad3be38d4a15da25fea753e7d60aa00f09..3dbf3ebe8eed38affde7df326a8471107eef85ff 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-17  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Oliver.
+
+        * wtf/Platform.h:
+        #define USE_PTHREADS on Mac.
+
 2007-10-17  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin Adler.
@@ -32,6 +39,7 @@
         (FuncDeclNode::processFuncDecl):
         (FuncExprNode::evaluate):
 
+>>>>>>> .r26715
 2007-10-17  Adam Roben  <aroben@apple.com>
 
         Windows build fix part 2.
index 92a2aa07134254a5e791e52f3a7e56151ad26754..2247ec383dc48c81d1789e6ffb2802819ec26142 100644 (file)
 
 #if PLATFORM(MAC)
 #define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
 #endif
 
 #if PLATFORM(WIN)
index 676583221100be30a0de8d0310bd9d65478077fb..1e7f8f6b4569e82eee1065b7e5120f3379bac422 100644 (file)
@@ -1,3 +1,51 @@
+2007-10-17  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Oliver.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * WebCore.vcproj/WebCore.vcproj:
+        
+        * config.h:
+        #define USE_PTHREADS on Windows.
+        
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::IconDatabase::getOrCreateIconRecord):
+        (WebCore::IconDatabase::getOrCreatePageURLRecord):
+        Update for mutex changes.
+        
+        * platform/Threading.h:
+        (WebCore::):
+        (WebCore::ThreadSafeShared::ThreadSafeShared):
+        (WebCore::ThreadSafeShared::ref):
+        (WebCore::ThreadSafeShared::deref):
+        (WebCore::ThreadSafeShared::hasOneRef):
+        (WebCore::ThreadSafeShared::refCount):
+        (WebCore::ThreadSafeShared::isThreadSafe):
+        Add a new Shared base class that uses a mutex to manage its refcount.
+        
+        (WebCore::createThread):
+        (WebCore::waitForThreadCompletion):
+        (WebCore::detachThread):
+        New functions for thread creation.
+        
+        (WebCore::Mutex::Mutex):
+        (WebCore::Mutex::~Mutex):
+        (WebCore::Mutex::lock):
+        (WebCore::Mutex::tryLock):
+        (WebCore::Mutex::unlock):
+        Move the definitions to ThreadingPthreads.cpp
+        
+        (WebCore::ThreadCondition::ThreadCondition):
+        (WebCore::ThreadCondition::~ThreadCondition):
+        (WebCore::ThreadCondition::wait):
+        (WebCore::ThreadCondition::signal):
+        (WebCore::ThreadCondition::broadcast):
+        Move the definitions to ThreadingPthreads.cpp
+        
+        * platform/pthreads: Added.
+        * platform/pthreads/ThreadingPthreads.cpp: Added.
+        Add pthread specific implementation of the thread creation functions, Mutex and ThreadCondition.
+
 2007-10-17  David Hyatt  <hyatt@apple.com>
 
         Add support for creating a layer when a transform is in effect.  Add support to RenderStyle for
         * loader/DocLoader.cpp:
         (WebCore::DocLoader::setAutoLoadImages): Don't start a load if the CachedImage is already loading.
 
+>>>>>>> .r26704
 2007-10-17  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Harrison.
index 5ca5092863c045bd6823939f783c843f06e93748..2789447e022f0badabb6fb5d9fd9946b22b3e83e 100644 (file)
                                        </File>\r
                                </Filter>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="pthreads"\r
+                               >\r
+                               <File\r
+                                       RelativePath="..\platform\pthreads\ThreadingPthreads.cpp"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="css"\r
                                RelativePath="..\css\CSSStyleSheet.h"\r
                                >\r
                        </File>\r
-                        <File\r
+                       <File\r
                                RelativePath="..\css\CSSTransformValue.cpp"\r
                                >\r
                        </File>\r
index 761777200ae40b8827266cd8a1a40b025e6f3709..6d821bbdea9ad8c8caf216b29d5195c43579e096 100644 (file)
@@ -89,6 +89,7 @@
                1A1D13810A5325520064BF5F /* DOMXPath.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1D137F0A5325520064BF5F /* DOMXPath.mm */; };
                1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A68210B5BEDE70002A480 /* ProgressTracker.cpp */; };
                1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2A68220B5BEDE70002A480 /* ProgressTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               1A2E6FA40CC5795D004A2062 /* ThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2E6FA30CC5795D004A2062 /* ThreadingPthreads.cpp */; };
                1A3178930B20A81600316987 /* SubresourceLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3178920B20A81600316987 /* SubresourceLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1A494BFA0A122F4400FDAFC1 /* JSHTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A494BF80A122F4400FDAFC1 /* JSHTMLElement.cpp */; };
                1A494BFB0A122F4400FDAFC1 /* JSHTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A494BF90A122F4400FDAFC1 /* JSHTMLElement.h */; };
                1A1D137F0A5325520064BF5F /* DOMXPath.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMXPath.mm; sourceTree = "<group>"; };
                1A2A68210B5BEDE70002A480 /* ProgressTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProgressTracker.cpp; sourceTree = "<group>"; };
                1A2A68220B5BEDE70002A480 /* ProgressTracker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProgressTracker.h; sourceTree = "<group>"; };
+               1A2E6FA30CC5795D004A2062 /* ThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadingPthreads.cpp; path = pthreads/ThreadingPthreads.cpp; sourceTree = "<group>"; };
                1A3178920B20A81600316987 /* SubresourceLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubresourceLoaderClient.h; sourceTree = "<group>"; };
                1A494BBB0A122DCD00FDAFC1 /* HTMLElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLElement.idl; sourceTree = "<group>"; };
                1A494BF80A122F4400FDAFC1 /* JSHTMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElement.cpp; sourceTree = "<group>"; };
                        path = icon;
                        sourceTree = "<group>";
                };
+               5154498E0CAA35F600194B2D /* pthreads */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1A2E6FA30CC5795D004A2062 /* ThreadingPthreads.cpp */,
+                       );
+                       name = pthreads;
+                       sourceTree = "<group>";
+               };
                5160F4920B0AA71500C1D2AF /* mac */ = {
                        isa = PBXGroup;
                        children = (
                                B2A015910AF6CD53006BCE0E /* graphics */,
                                6582A14809999D6C00BEEB6D /* mac */,
                                656B84D70AEA1CE900A095B4 /* network */,
+                               5154498E0CAA35F600194B2D /* pthreads */,
                                BCFB2F74097A2E1A00BA703D /* Arena.cpp */,
                                BCFB2F75097A2E1A00BA703D /* Arena.h */,
                                BCB16B890979B01400467741 /* ArrayImpl.cpp */,
                                A84EC1390CB9FDBC00079609 /* SVGCSSComputedStyleDeclaration.cpp in Sources */,
                                A8A909AD0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp in Sources */,
                                BC9ADD800CC4092200098C4C /* CSSTransformValue.cpp in Sources */,
+                               1A2E6FA40CC5795D004A2062 /* ThreadingPthreads.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index e83670e04bb7181fe8cf2c39344083be34ed2119..82e051e9e5f7600d8669c943368af7af3c205118 100644 (file)
@@ -82,6 +82,7 @@
 #define WTF_USE_CFNETWORK 1
 #undef WTF_USE_WININET
 #define WTF_PLATFORM_CF 1
+#define WTF_USE_PTHREADS 1
 #endif
 
 #if PLATFORM(MAC)
index 3f2b65cdd264c2b7107bfe9a2e391d8b3af035e0..d89090eee0effd57038a41fb61f35f5b851a875b 100644 (file)
@@ -878,7 +878,7 @@ String IconDatabase::defaultDatabaseFilename()
 IconRecord* IconDatabase::getOrCreateIconRecord(const String& iconURL)
 {
     // Clients of getOrCreateIconRecord() are required to acquire the m_urlAndIconLock before calling this method
-    ASSERT(m_urlAndIconLock.tryLock() == EBUSY);
+    ASSERT(!m_urlAndIconLock.tryLock());
 
     if (IconRecord* icon = m_iconURLToRecordMap.get(iconURL))
         return icon;
@@ -893,7 +893,7 @@ IconRecord* IconDatabase::getOrCreateIconRecord(const String& iconURL)
 PageURLRecord* IconDatabase::getOrCreatePageURLRecord(const String& pageURL)
 {
     // Clients of getOrCreatePageURLRecord() are required to acquire the m_urlAndIconLock before calling this method
-    ASSERT(m_urlAndIconLock.tryLock() == EBUSY);
+    ASSERT(!m_urlAndIconLock.tryLock());
 
     if (pageURL.isEmpty())
         return 0;
index a25efc07197f8d976c472be1ac4aa8d3bd232c16..07c6477500d90a4a1ef0f9e14ae7185abe7c1cd1 100644 (file)
 #ifndef Threading_h
 #define Threading_h
 
+#include <wtf/Assertions.h>
 #include <wtf/Noncopyable.h>
+
+#if USE(PTHREADS)
 #include <pthread.h>
+#endif
 
 namespace WebCore {
 
-class ThreadCondition;
+typedef uint32_t ThreadIdentifier;
+typedef void* (*ThreadFunction)(void* argument);
 
+// Returns 0 if thread creation failed
+ThreadIdentifier createThread(ThreadFunction, void*);
+int waitForThreadCompletion(ThreadIdentifier, void**);
+void detachThread(ThreadIdentifier);
+    
 class Mutex : Noncopyable {
 friend class ThreadCondition;
 public:
-    Mutex() { pthread_mutex_init(&m_mutex, NULL); }
-    ~Mutex() { pthread_mutex_destroy(&m_mutex); }
+    Mutex();
+    ~Mutex();
 
-    int lock() { return pthread_mutex_lock(&m_mutex);}
-    int tryLock() { return pthread_mutex_trylock(&m_mutex); }
-    int unlock() { return pthread_mutex_unlock(&m_mutex); }
+    void lock();
+    bool tryLock();
+    void unlock();
     
 private:
+#if USE(PTHREADS)
     pthread_mutex_t m_mutex;
+#endif
 };
 
 class MutexLocker : Noncopyable {
 public:
     MutexLocker(Mutex& mutex) : m_mutex(mutex) { m_mutex.lock(); }
     ~MutexLocker() { m_mutex.unlock(); }
+
 private:
     Mutex& m_mutex;
 };
 
 class ThreadCondition : Noncopyable {
 public:
-    ThreadCondition() { pthread_cond_init(&m_condition, NULL); }
-    ~ThreadCondition() { pthread_cond_destroy(&m_condition); }
+    ThreadCondition();
+    ~ThreadCondition();
     
-    int wait(Mutex& mutex) { return pthread_cond_wait(&m_condition, &mutex.m_mutex); }
-    int signal() { return pthread_cond_signal(&m_condition); }
-    int broadcast() { return pthread_cond_broadcast(&m_condition); }
+    void wait(Mutex& mutex);
+    void signal();
+    void broadcast();
     
 private:
+#if USE(PTHREADS)
     pthread_cond_t m_condition;
+#endif
+};
+    
+template<class T> class ThreadSafeShared : Noncopyable {
+public:
+    ThreadSafeShared()
+        : m_refCount(0)
+#ifndef NDEBUG
+        , m_inDestructor(0)
+#endif
+    {
+    }
+
+    void ref()
+    {
+        MutexLocker locker(m_mutex);
+        ASSERT(!m_inDestructor);
+        ++m_refCount;
+    }
+
+    void deref()
+    {
+        {
+            MutexLocker locker(m_mutex);
+            ASSERT(!m_inDestructor);
+            --m_refCount;
+        }
+        
+        if (m_refCount <= 0) {
+#ifndef NDEBUG
+            m_inDestructor = true;
+#endif
+            delete static_cast<T*>(this);
+        }
+    }
+
+    bool hasOneRef()
+    {
+        MutexLocker locker(m_mutex);
+        ASSERT(!m_inDestructor);
+        return m_refCount == 1;
+    }
+
+    int refCount() const
+    {
+        MutexLocker locker(m_mutex);
+        return m_refCount;
+    }
+
+    bool isThreadSafe() { return true; }
+    
+private:
+    mutable Mutex m_mutex;
+    int m_refCount;
+#ifndef NDEBUG
+    bool m_inDestructor;
+#endif
 };
 
 void callOnMainThread(void (*)());
@@ -81,6 +152,24 @@ inline void initializeThreading()
 }
 #endif
 
+#if !USE(PTHREADS)
+ThreadIdentifier createThread(ThreadFunction, void*) { return 0; }
+int waitForThreadCompletion(ThreadIdentifier, void**) { return 0; }
+void detachThread(ThreadIdentifier) { }
+
+Mutex::Mutex() {}
+Mutex::~Mutex() {}
+void Mutex::lock() {}
+bool Mutex::tryLock() { return false; }
+void Mutex::unlock() {};
+
+ThreadCondition::ThreadCondition() {}
+ThreadCondition::~ThreadCondition() {}
+void ThreadCondition::wait(Mutex& mutex) {}
+void ThreadCondition::signal() {}
+void ThreadCondition::broadcast() {}
+#endif
+
 } // namespace WebCore
 
 #endif // Threading_h
diff --git a/WebCore/platform/pthreads/ThreadingPthreads.cpp b/WebCore/platform/pthreads/ThreadingPthreads.cpp
new file mode 100644 (file)
index 0000000..a711e4d
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "config.h"
+#include "Threading.h"
+
+#include "Logging.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+static Mutex& threadMapMutex()
+{
+    static Mutex mutex;
+    return mutex;
+}
+
+static HashMap<ThreadIdentifier, pthread_t>& threadMap()
+{
+    static HashMap<ThreadIdentifier, pthread_t> map;
+    return map;
+}
+
+static ThreadIdentifier establishIdentifierForPthreadHandle(pthread_t& pthreadHandle)
+{
+    MutexLocker locker(threadMapMutex());
+
+    static ThreadIdentifier identifierCount = 1;
+
+    threadMap().add(identifierCount, pthreadHandle);
+    
+    return identifierCount++;
+}
+
+static pthread_t pthreadHandleForIdentifier(ThreadIdentifier id)
+{
+    MutexLocker locker(threadMapMutex());
+    
+    return threadMap().get(id);
+}
+
+static void clearPthreadHandleForIdentifier(ThreadIdentifier id)
+{
+    MutexLocker locker(threadMapMutex());
+
+    ASSERT(threadMap().contains(id));
+    
+    threadMap().remove(id);
+}
+
+ThreadIdentifier createThread(ThreadFunction entryPoint, void* data)
+{
+    pthread_t threadHandle;
+    if (pthread_create(&threadHandle, NULL, entryPoint, data)) {
+        LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data);
+        return 0;
+    }
+
+    ThreadIdentifier threadID = establishIdentifierForPthreadHandle(threadHandle);
+    LOG(Threading, "Created thread with thread id %u", threadID);
+    return threadID;
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID, void** result)
+{
+    ASSERT(threadID);
+    
+    pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID);
+    int joinResult = pthread_join(pthreadHandle, result);
+    if (joinResult == EDEADLK)
+        LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
+        
+    clearPthreadHandleForIdentifier(threadID);
+    return joinResult;
+}
+
+void detachThread(ThreadIdentifier threadID)
+{
+    ASSERT(threadID);
+    
+    pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID);
+    
+    pthread_detach(pthreadHandle);
+    
+    clearPthreadHandleForIdentifier(threadID);
+}
+
+Mutex::Mutex()
+{
+    pthread_mutex_init(&m_mutex, NULL);
+}
+
+Mutex::~Mutex()
+{
+    pthread_mutex_destroy(&m_mutex);
+}
+
+void Mutex::lock()
+{
+    if (pthread_mutex_lock(&m_mutex) != 0)
+        ASSERT(false);
+}
+    
+bool Mutex::tryLock()
+{
+    int result = pthread_mutex_trylock(&m_mutex);
+    
+    if (result == 0)
+        return true;
+    else if (result == EBUSY)
+        return false;
+
+    ASSERT(false);
+    return false;
+}
+
+void Mutex::unlock()
+{
+    if (pthread_mutex_unlock(&m_mutex) != 0)
+        ASSERT(false);
+}
+                
+ThreadCondition::ThreadCondition()
+{ 
+    pthread_cond_init(&m_condition, NULL);
+}
+
+ThreadCondition::~ThreadCondition()
+{
+    pthread_cond_destroy(&m_condition);
+}
+    
+void ThreadCondition::wait(Mutex& mutex)
+{
+    if (pthread_cond_wait(&m_condition, &mutex.m_mutex) != 0)
+        ASSERT(false);
+}
+    
+void ThreadCondition::signal()
+{
+    if (pthread_cond_signal(&m_condition) != 0)
+        ASSERT(false);
+}
+
+void ThreadCondition::broadcast()
+{
+    if (pthread_cond_broadcast(&m_condition) != 0)
+        ASSERT(false);
+}
+    
+} // namespace WebCore
index a20db7a14435cb05094ba1e04bf669feb622bd19..5389d7a54c419718783dedcd2f8b3ea692be4dd9 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-17  Anders Carlsson  <andersca@apple.com>
+
+        Update for locking primitive changes.
+
+        * WebIconDatabase.cpp:
+        (WebIconDatabase::scheduleNotificationDelivery):
+
 2007-10-16  Adam Roben  <aroben@apple.com>
 
         Remove WebKitInitializer
index 67f9583d7f4651705a5e1c35d8871641fca9ecf7..7ff05f986818e49189734b0ea9411f2e81add362 100644 (file)
@@ -319,7 +319,7 @@ void WebIconDatabase::dispatchDidAddIconForPageURL(const String& pageURL)
 void WebIconDatabase::scheduleNotificationDelivery()
 {
     // Caller of this method must hold the m_notificationQueue lock
-    ASSERT(m_notificationMutex.tryLock() == EBUSY);
+    ASSERT(!m_notificationMutex.tryLock());
 
     if (!m_deliveryRequested) {
         m_deliveryRequested = true;