[webkit-reviews] review requested: [Bug 31206] Database tries to deref Document on the Database thread : [Attachment 42753] patch with improved comment

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 9 08:08:28 PST 2009


Kevin Watters <kevinwatters at gmail.com> has asked  for review:
Bug 31206: Database tries to deref Document on the Database thread
https://bugs.webkit.org/show_bug.cgi?id=31206

Attachment 42753: patch with improved comment
https://bugs.webkit.org/attachment.cgi?id=42753&action=review

------- Additional Comments from Kevin Watters <kevinwatters at gmail.com>
I attached a patch fixing the comment and flagged it for the commit queue.

Eric: as for creating a new RefPtr subclass that handles destruction on a
specific thread--I wasn't confident enough that I could subclass RefPtr 100%
correctly. Luckily the other RefPtr members in Database (m_securityOrigin and
m_databaseAuthorizer) point to ThreadSafeShared subclasses, so I think
m_document is the only member that had this problem.

Maybe a good interim solution would be a convenience function in MainThread.h
like the following:

template <typename T>
static void deref(void* obj)
{
    static_cast<T*>(obj)->deref();
}

template <typename T>
static void derefOnMainThread(RefPtr<T>& ref)
{
    callOnMainThread(deref<T>, ref.release().releaseRef());
}

Then we could just "derefOnMainThread(m_document)" from ~Database. Let me know
if I should create a patch for this.


More information about the webkit-reviews mailing list