Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (92253 => 92254)
--- trunk/Source/_javascript_Core/ChangeLog 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-08-03 02:28:33 UTC (rev 92254)
@@ -1,3 +1,38 @@
+2011-08-01 David Levin <[email protected]>
+
+ Add asserts to RefCounted to make sure ref/deref happens on the right thread.
+ https://bugs.webkit.org/show_bug.cgi?id=31639
+
+ Reviewed by Dmitry Titov.
+
+ * GNUmakefile.list.am: Added new files to the build.
+ * _javascript_Core.gypi: Ditto.
+ * _javascript_Core.vcproj/WTF/WTF.vcproj: Ditto.
+ * _javascript_Core.xcodeproj/project.pbxproj: Ditto.
+ * jit/ExecutableAllocator.h:
+ (JSC::ExecutablePool::ExecutablePool): Turned off checks for this
+ due to not being able to figure out what was guarding it (bug 58091).
+ * parser/SourceProvider.h:
+ (JSC::SourceProvider::SourceProvider): Ditto.
+ * wtf/CMakeLists.txt: Added new files to the build.
+ * wtf/ThreadRestrictionVerifier.h: Added.
+ Everything is done in the header to avoid the issue with exports
+ that are only useful in debug but still needing to export them.
+ * wtf/RefCounted.h:
+ (WTF::RefCountedBase::ref): Added checks using the non thread safe verifier.
+ and filed bug 58171 about making it stricter.
+ (WTF::RefCountedBase::hasOneRef): Ditto.
+ (WTF::RefCountedBase::refCount): Ditto.
+ (WTF::RefCountedBase::setMutexForVerifier): Expose a way to change the checks to be based
+ on a mutex. This is in the header to avoid adding more exports from _javascript_Core.
+ (WTF::RefCountedBase::deprecatedTurnOffVerifier): Temporary way to turn off verification.
+ Filed bug 58174 to remove this method.
+ (WTF::RefCountedBase::derefBase):
+ * wtf/SizeLimits.cpp: Adjusted the debug size check for RefCounted.
+ * wtf/text/CString.h:
+ (WTF::CStringBuffer::CStringBuffer): Turned off checks for this while a fix is being
+ done in Chromium (bug 58093).
+
2011-08-02 Filip Pizlo <[email protected]>
JSC GC may not be able to reuse partially-free blocks after a
Modified: trunk/Source/_javascript_Core/GNUmakefile.list.am (92253 => 92254)
--- trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/GNUmakefile.list.am 2011-08-03 02:28:33 UTC (rev 92254)
@@ -578,6 +578,7 @@
Source/_javascript_Core/wtf/text/WTFString.h \
Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp \
Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h \
+ Source/_javascript_Core/wtf/ThreadRestrictionVerifier.h \
Source/_javascript_Core/wtf/Threading.cpp \
Source/_javascript_Core/wtf/Threading.h \
Source/_javascript_Core/wtf/ThreadingPrimitives.h \
Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (92253 => 92254)
--- trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi 2011-08-03 02:28:33 UTC (rev 92254)
@@ -205,6 +205,7 @@
'wtf/StringHasher.h',
'wtf/ThreadSafeRefCounted.h',
'wtf/ThreadSpecific.h',
+ 'wtf/ThreadRestrictionVerifier.h',
'wtf/Threading.h',
'wtf/ThreadingPrimitives.h',
'wtf/TypeTraits.h',
Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj (92253 => 92254)
--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj 2011-08-03 02:28:33 UTC (rev 92254)
@@ -1009,6 +1009,10 @@
>
</File>
<File
+ RelativePath="..\..\wtf\ThreadRestrictionVerifier.h"
+ >
+ </File>
+ <File
RelativePath="..\..\wtf\ThreadSafeRefCounted.h"
>
</File>
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (92253 => 92254)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2011-08-03 02:28:33 UTC (rev 92254)
@@ -44,6 +44,7 @@
08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */; };
0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0B330C260F38C62300692DE3 /* TypeTraits.cpp */; };
0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0BAC94A01338728400CF135B /* ThreadRestrictionVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BDFFAE00FC6192900D69EF4 /* CrossThreadRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
0BF28A2911A33DC300638F84 /* SizeLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BF28A2811A33DC300638F84 /* SizeLimits.cpp */; };
@@ -722,6 +723,7 @@
08E279E80EF83B10007DB523 /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
0B330C260F38C62300692DE3 /* TypeTraits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeTraits.cpp; sourceTree = "<group>"; };
0B4D7E620F319AC800AD7E58 /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
+ 0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadRestrictionVerifier.h; sourceTree = "<group>"; };
0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnFastMallocPtr.h; sourceTree = "<group>"; };
0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossThreadRefCounted.h; sourceTree = "<group>"; };
0BF28A2811A33DC300638F84 /* SizeLimits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SizeLimits.cpp; sourceTree = "<group>"; };
@@ -1650,8 +1652,6 @@
children = (
A1D764511354448B00C5C7C0 /* Alignment.h */,
A7C40C07130B057D00D002A1 /* BlockStack.h */,
- A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */,
- A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */,
5135FAD512D26856003C083B /* Decoder.h */,
5135FAD612D26856003C083B /* Encoder.h */,
93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
@@ -1750,6 +1750,8 @@
969A07290ED1CE6900F1F681 /* SegmentedVector.h */,
76FB9F1012E851960051A2EB /* SHA1.cpp */,
76FB9F0E12E851860051A2EB /* SHA1.h */,
+ A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */,
+ A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */,
0BF28A2811A33DC300638F84 /* SizeLimits.cpp */,
86D87DA512BC4B14008E73A1 /* StackBounds.cpp */,
86D87DA612BC4B14008E73A1 /* StackBounds.h */,
@@ -1771,6 +1773,7 @@
E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */,
BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */,
E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */,
+ 0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */,
0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
0B4D7E620F319AC800AD7E58 /* TypeTraits.h */,
E195678D09E7CF1200B89D13 /* unicode */,
@@ -2519,6 +2522,7 @@
18BAB55410DAE066000D945B /* ThreadIdentifierDataPthreads.h in Headers */,
BC18C4700E16F5CD00B34460 /* Threading.h in Headers */,
BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */,
+ 0BAC94A01338728400CF135B /* ThreadRestrictionVerifier.h in Headers */,
BC5F7BC011823B590052C02C /* ThreadSafeRefCounted.h in Headers */,
BC18C4710E16F5CD00B34460 /* ThreadSpecific.h in Headers */,
A7386556118697B400540279 /* ThunkGenerators.h in Headers */,
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.h (92253 => 92254)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -352,6 +352,7 @@
if (!m_freePtr)
CRASH(); // Failed to allocate
m_end = m_freePtr + allocSize;
+ deprecatedTurnOffVerifier();
}
inline void* ExecutablePool::poolAllocate(JSGlobalData& globalData, size_t n)
Modified: trunk/Source/_javascript_Core/parser/SourceProvider.h (92253 => 92254)
--- trunk/Source/_javascript_Core/parser/SourceProvider.h 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/parser/SourceProvider.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -46,6 +46,7 @@
, m_cache(cache ? cache : new SourceProviderCache)
, m_cacheOwned(!cache)
{
+ deprecatedTurnOffVerifier();
}
virtual ~SourceProvider()
{
Modified: trunk/Source/_javascript_Core/wtf/CMakeLists.txt (92253 => 92254)
--- trunk/Source/_javascript_Core/wtf/CMakeLists.txt 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/wtf/CMakeLists.txt 2011-08-03 02:28:33 UTC (rev 92254)
@@ -42,6 +42,7 @@
MathExtras.h
MessageQueue.h
NonCopyingSort.h
+ ThreadRestrictionVerifier.h
Noncopyable.h
NotFound.h
NullPtr.h
Modified: trunk/Source/_javascript_Core/wtf/RefCounted.h (92253 => 92254)
--- trunk/Source/_javascript_Core/wtf/RefCounted.h 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/wtf/RefCounted.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -23,7 +23,10 @@
#include "Assertions.h"
#include "FastAllocBase.h"
+#include "ThreadRestrictionVerifier.h"
#include "Noncopyable.h"
+#include "OwnPtr.h"
+#include "UnusedParam.h"
namespace WTF {
@@ -34,6 +37,20 @@
public:
void ref()
{
+#ifndef NDEBUG
+ // Start thread verification as soon as the ref count gets to 2. This
+ // heuristic reflects the fact that items are often created on one thread
+ // and then given to another thread to be used.
+ // FIXME: Make this restriction tigher. Especially as we move to more
+ // common methods for sharing items across threads like CrossThreadCopier.h
+ // We should be able to add a "detachFromThread" method to make this explicit.
+ if (m_refCount == 1)
+ m_verifier.setShared(true);
+#endif
+ // If this assert fires, it either indicates a thread safety issue or
+ // that the verification needs to change. See ThreadRestrictionVerifier for
+ // the different modes.
+ ASSERT(m_verifier.isSafeToUse());
ASSERT(!m_deletionHasBegun);
ASSERT(!m_adoptionIsRequired);
++m_refCount;
@@ -41,15 +58,29 @@
bool hasOneRef() const
{
+ ASSERT(m_verifier.isSafeToUse());
ASSERT(!m_deletionHasBegun);
return m_refCount == 1;
}
int refCount() const
{
+ ASSERT(m_verifier.isSafeToUse());
return m_refCount;
}
+ void setMutexForVerifier(Mutex&);
+
+ // Turns off verification. Use of this method is discouraged (instead extend
+ // ThreadRestrictionVerifier to verify your case).
+ // FIXME: remove this method.
+ void deprecatedTurnOffVerifier()
+ {
+#ifndef NDEBUG
+ m_verifier.turnOffVerification();
+#endif
+ }
+
void relaxAdoptionRequirement()
{
#ifndef NDEBUG
@@ -84,6 +115,7 @@
// Returns whether the pointer should be freed or not.
bool derefBase()
{
+ ASSERT(m_verifier.isSafeToUse());
ASSERT(!m_deletionHasBegun);
ASSERT(!m_adoptionIsRequired);
@@ -96,6 +128,12 @@
}
--m_refCount;
+#ifndef NDEBUG
+ // Stop thread verification when the ref goes to 1 because it
+ // is safe to be passed to another thread at this point.
+ if (m_refCount == 1)
+ m_verifier.setShared(false);
+#endif
return false;
}
@@ -117,6 +155,7 @@
#ifndef NDEBUG
bool m_deletionHasBegun;
bool m_adoptionIsRequired;
+ ThreadRestrictionVerifier m_verifier;
#endif
};
@@ -164,6 +203,15 @@
}
};
+#ifdef NDEBUG
+inline void RefCountedBase::setMutexForVerifier(Mutex&) { }
+#else
+inline void RefCountedBase::setMutexForVerifier(Mutex& mutex)
+{
+ m_verifier.setMutexMode(mutex);
+}
+#endif
+
} // namespace WTF
using WTF::RefCounted;
Modified: trunk/Source/_javascript_Core/wtf/SizeLimits.cpp (92253 => 92254)
--- trunk/Source/_javascript_Core/wtf/SizeLimits.cpp 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/wtf/SizeLimits.cpp 2011-08-03 02:28:33 UTC (rev 92254)
@@ -36,21 +36,30 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+#include <wtf/ThreadRestrictionVerifier.h>
#include <wtf/Vector.h>
namespace WTF {
#ifndef NDEBUG
-struct StructWithIntAndTwoBools { int a; bool b; bool c; };
-static const size_t refCountedExtraDebugSize = sizeof(StructWithIntAndTwoBools) - sizeof(int);
+struct SameSizeAsRefCounted {
+ int a;
+ bool b;
+ bool c;
+ ThreadRestrictionVerifier d;
+ // The debug version may get bigger.
+};
#else
-static const size_t refCountedExtraDebugSize = 0;
+struct SameSizeAsRefCounted {
+ int a;
+ // Don't add anything here because this should stay small.
+};
#endif
COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small);
COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_should_stay_small);
-COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(int) + refCountedExtraDebugSize, RefCounted_should_stay_small);
-COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(int) + refCountedExtraDebugSize, RefCountedCustomAllocated_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), RefCounted_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(SameSizeAsRefCounted), RefCountedCustomAllocated_should_stay_small);
COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_stay_small);
COMPILE_ASSERT(sizeof(Vector<int>) == 3 * sizeof(int*), Vector_should_stay_small);
Added: trunk/Source/_javascript_Core/wtf/ThreadRestrictionVerifier.h (0 => 92254)
--- trunk/Source/_javascript_Core/wtf/ThreadRestrictionVerifier.h (rev 0)
+++ trunk/Source/_javascript_Core/wtf/ThreadRestrictionVerifier.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2011 Google 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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.
+ */
+
+#ifndef ThreadRestrictionVerifier_h
+#define ThreadRestrictionVerifier_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Threading.h>
+#include <wtf/ThreadingPrimitives.h>
+
+#ifndef NDEBUG
+
+namespace WTF {
+
+// Verifies that a class is used in a way that respects its lack of thread-safety.
+// The default mode is to verify that the object will only be used on a single thread. The
+// thread gets captured when setShared(true) is called.
+// The mode may be changed by calling useMutexMode (or turnOffVerification).
+class ThreadRestrictionVerifier {
+public:
+ ThreadRestrictionVerifier()
+ : m_mode(SingleThreadVerificationMode)
+ , m_shared(false)
+ , m_owningThread(0)
+ , m_mutex(0)
+ {
+ }
+
+ void setMutexMode(Mutex& mutex)
+ {
+ ASSERT(m_mode == SingleThreadVerificationMode || (m_mode == MutexVerificationMode && &mutex == m_mutex));
+ m_mode = MutexVerificationMode;
+ m_mutex = &mutex;
+ }
+
+ void turnOffVerification()
+ {
+ ASSERT(m_mode == SingleThreadVerificationMode);
+ m_mode = NoVerificationMode;
+ }
+
+ // Indicates that the object may (or may not) be owned by more than one place.
+ void setShared(bool shared)
+ {
+ bool previouslyShared = m_shared;
+ m_shared = shared;
+
+ if (!m_shared)
+ return;
+
+ switch (m_mode) {
+ case SingleThreadVerificationMode:
+ ASSERT(shared != previouslyShared);
+ // Capture the current thread to verify that subsequent ref/deref happen on this thread.
+ m_owningThread = currentThread();
+ return;
+
+ case MutexVerificationMode:
+ case NoVerificationMode:
+ return;
+ }
+ ASSERT_NOT_REACHED();
+ }
+
+ // Is it OK to use the object at this moment on the current thread?
+ bool isSafeToUse() const
+ {
+ if (!m_shared)
+ return true;
+
+ switch (m_mode) {
+ case SingleThreadVerificationMode:
+ return m_owningThread == currentThread();
+
+ case MutexVerificationMode:
+ if (!m_mutex->tryLock())
+ return true;
+ m_mutex->unlock();
+ return false;
+
+ case NoVerificationMode:
+ return true;
+ }
+ ASSERT_NOT_REACHED();
+ return true;
+ }
+
+private:
+ enum VerificationMode {
+ SingleThreadVerificationMode,
+ MutexVerificationMode,
+ NoVerificationMode
+ };
+
+ VerificationMode m_mode;
+ bool m_shared;
+
+ // Used by SingleThreadVerificationMode
+ ThreadIdentifier m_owningThread;
+
+ // Used by MutexVerificationMode.
+ Mutex* m_mutex;
+};
+
+}
+
+#endif
+#endif
Property changes on: trunk/Source/_javascript_Core/wtf/ThreadRestrictionVerifier.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/_javascript_Core/wtf/text/CString.h (92253 => 92254)
--- trunk/Source/_javascript_Core/wtf/text/CString.h 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Core/wtf/text/CString.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -41,7 +41,14 @@
friend class CString;
static PassRefPtr<CStringBuffer> create(size_t length) { return adoptRef(new CStringBuffer(length)); }
- CStringBuffer(size_t length) : m_vector(length) { }
+ CStringBuffer(size_t length) : m_vector(length)
+ {
+#if PLATFORM(CHROMIUM)
+ // FIXME: Need to fix some start-up code in Chromium Linux and some test code for
+ // Chromium OS X in order to remove this.
+ deprecatedTurnOffVerifier();
+#endif
+ }
char* mutableData() { return m_vector.data(); }
Vector<char> m_vector;
Modified: trunk/Source/_javascript_Glue/ChangeLog (92253 => 92254)
--- trunk/Source/_javascript_Glue/ChangeLog 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/_javascript_Glue/ChangeLog 2011-08-03 02:28:33 UTC (rev 92254)
@@ -1,3 +1,12 @@
+2011-08-01 David Levin <[email protected]>
+
+ Add asserts to RefCounted to make sure ref/deref happens on the right thread.
+ https://bugs.webkit.org/show_bug.cgi?id=31639
+
+ Reviewed by Dmitry Titov.
+
+ * ForwardingHeaders/wtf/ThreadRestrictionVerifier.h: Added.
+
2011-07-27 Mark Hahnenberg <[email protected]>
Remove operator new from JSCell
Added: trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h (0 => 92254)
--- trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h (rev 0)
+++ trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -0,0 +1 @@
+#include <_javascript_Core/ThreadRestrictionVerifier.h>
Property changes on: trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (92253 => 92254)
--- trunk/Source/WebCore/ChangeLog 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/WebCore/ChangeLog 2011-08-03 02:28:33 UTC (rev 92254)
@@ -1,3 +1,20 @@
+2011-08-01 David Levin <[email protected]>
+
+ Add asserts to RefCounted to make sure ref/deref happens on the right thread.
+ https://bugs.webkit.org/show_bug.cgi?id=31639
+
+ Reviewed by Dmitry Titov.
+
+ No new functionality exposed so no new tests. (The change is basically adding
+ more testing.)
+
+ * ForwardingHeaders/wtf/ThreadRestrictionVerifier.h: Added.
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::defaultIcon): Set the mutex which does the guarding of the variable.
+ (WebCore::IconDatabase::setIconDataForIconURL): Ditto.
+ (WebCore::IconDatabase::getOrCreateIconRecord): Ditto.
+ (WebCore::IconDatabase::readFromDatabase): Ditto.
+
2011-08-02 Luke Macpherson <[email protected]>
Clean up value clampling in CSSStyleSelector and CSSPrimitiveValue.
Added: trunk/Source/WebCore/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h (0 => 92254)
--- trunk/Source/WebCore/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h 2011-08-03 02:28:33 UTC (rev 92254)
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_ThreadRestrictionVerifier_h
+#define WebCore_FWD_ThreadRestrictionVerifier_h
+#include <_javascript_Core/ThreadRestrictionVerifier.h>
+#endif
Property changes on: trunk/Source/WebCore/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/loader/icon/IconDatabase.cpp (92253 => 92254)
--- trunk/Source/WebCore/loader/icon/IconDatabase.cpp 2011-08-03 02:11:09 UTC (rev 92253)
+++ trunk/Source/WebCore/loader/icon/IconDatabase.cpp 2011-08-03 02:28:33 UTC (rev 92254)
@@ -387,6 +387,7 @@
if (!m_defaultIconRecord) {
m_defaultIconRecord = IconRecord::create("urlIcon");
+ m_defaultIconRecord->setMutexForVerifier(m_urlAndIconLock);
loadDefaultIconRecord(m_defaultIconRecord.get());
}
@@ -517,6 +518,8 @@
return;
RefPtr<SharedBuffer> data = "" ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0);
+ if (data)
+ data->setMutexForVerifier(m_urlAndIconLock);
String iconURL = iconURLOriginal.crossThreadString();
Vector<String> pageURLs;
@@ -878,6 +881,7 @@
return icon;
RefPtr<IconRecord> newIcon = IconRecord::create(iconURL);
+ newIcon->setMutexForVerifier(m_urlAndIconLock);
m_iconURLToRecordMap.set(iconURL, newIcon.get());
return newIcon.release();
@@ -1479,6 +1483,7 @@
for (unsigned i = 0; i < icons.size(); ++i) {
didAnyWork = true;
RefPtr<SharedBuffer> imageData = getImageDataForIconURLFromSQLDatabase(icons[i]->iconURL());
+ imageData->setMutexForVerifier(m_urlAndIconLock);
// Verify this icon still wants to be read from disk
{