Title: [107784] trunk
Revision
107784
Author
[email protected]
Date
2012-02-14 23:03:43 -0800 (Tue, 14 Feb 2012)

Log Message

Cleanup pending transaction queue in Database.
https://bugs.webkit.org/show_bug.cgi?id=75048

Patch by Hao Zheng <[email protected]> on 2012-02-14
Reviewed by David Levin.

Source/WebCore:

Each SQLTransaction has 3 SQLCallbackWrappers, and each of them
holds a ref to WorkerContext. As a result, if the worker thread is
stopped before all SQLTransactions are finished, the ASSERT of
m_workerContext->hasOneRef() in WorkerThread::workerThread() would fail.

No new tests.
REGRESSION(r103429) fast/workers/storage/use-same-database-in-page-and-workers.html asserts

* storage/Database.cpp:
(WebCore::Database::close): Cleanup pending transaction queue in close().
* storage/SQLCallbackWrapper.h:
(WebCore::SQLCallbackWrapper::clear):
(SafeReleaseTask): Make SafeReleaseTask a cleanup task, which is
necessary because at the time of SafeReleaseTask is performed,
WorkerRunLoop has been terminated and only runs cleanup tasks.
(WebCore::SQLCallbackWrapper::SafeReleaseTask::create):
(WebCore::SQLCallbackWrapper::SafeReleaseTask::performTask):
(WebCore::SQLCallbackWrapper::SafeReleaseTask::isCleanupTask):
(WebCore::SQLCallbackWrapper::SafeReleaseTask::SafeReleaseTask):

LayoutTests:

As crash is fixed, trun BUGWK75048 into BUGWK75111, so that we can
close 75048 and fix the timeout in 75111 for both DEBUG and RELEASE.

REGRESSION(r103429) fast/workers/storage/use-same-database-in-page-and-workers.html asserts

* platform/chromium/test_expectations.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107783 => 107784)


--- trunk/LayoutTests/ChangeLog	2012-02-15 06:58:59 UTC (rev 107783)
+++ trunk/LayoutTests/ChangeLog	2012-02-15 07:03:43 UTC (rev 107784)
@@ -1,3 +1,17 @@
+2012-02-14  Hao Zheng  <[email protected]>
+
+        Cleanup pending transaction queue in Database.
+        https://bugs.webkit.org/show_bug.cgi?id=75048
+
+        Reviewed by David Levin.
+
+        As crash is fixed, trun BUGWK75048 into BUGWK75111, so that we can
+        close 75048 and fix the timeout in 75111 for both DEBUG and RELEASE.
+
+        REGRESSION(r103429) fast/workers/storage/use-same-database-in-page-and-workers.html asserts
+
+        * platform/chromium/test_expectations.txt:
+
 2012-02-14  Kent Tamura  <[email protected]>
 
         Stop using script-tests in LayoutTests/fast/forms

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (107783 => 107784)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-02-15 06:58:59 UTC (rev 107783)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-02-15 07:03:43 UTC (rev 107784)
@@ -3649,7 +3649,7 @@
 
 BUGWK74881 : fast/overflow/unreachable-overflow-rtl-bug.html = IMAGE
 
-BUGWK75048 DEBUG : fast/workers/storage/use-same-database-in-page-and-workers.html = CRASH TIMEOUT
+BUGWK75111 DEBUG : fast/workers/storage/use-same-database-in-page-and-workers.html = PASS TIMEOUT
 BUGWK75111 RELEASE : fast/workers/storage/use-same-database-in-page-and-workers.html = PASS TIMEOUT
 BUGWK77136 DEBUG : fast/workers/storage/interrupt-database.html = PASS CRASH
 BUGWK77136 WIN RELEASE : fast/workers/storage/interrupt-database.html = PASS TIMEOUT

Modified: trunk/Source/WebCore/ChangeLog (107783 => 107784)


--- trunk/Source/WebCore/ChangeLog	2012-02-15 06:58:59 UTC (rev 107783)
+++ trunk/Source/WebCore/ChangeLog	2012-02-15 07:03:43 UTC (rev 107784)
@@ -1,3 +1,30 @@
+2012-02-14  Hao Zheng  <[email protected]>
+
+        Cleanup pending transaction queue in Database.
+        https://bugs.webkit.org/show_bug.cgi?id=75048
+
+        Reviewed by David Levin.
+
+        Each SQLTransaction has 3 SQLCallbackWrappers, and each of them
+        holds a ref to WorkerContext. As a result, if the worker thread is
+        stopped before all SQLTransactions are finished, the ASSERT of
+        m_workerContext->hasOneRef() in WorkerThread::workerThread() would fail.
+
+        No new tests.
+        REGRESSION(r103429) fast/workers/storage/use-same-database-in-page-and-workers.html asserts
+
+        * storage/Database.cpp:
+        (WebCore::Database::close): Cleanup pending transaction queue in close().
+        * storage/SQLCallbackWrapper.h:
+        (WebCore::SQLCallbackWrapper::clear):
+        (SafeReleaseTask): Make SafeReleaseTask a cleanup task, which is
+        necessary because at the time of SafeReleaseTask is performed,
+        WorkerRunLoop has been terminated and only runs cleanup tasks.
+        (WebCore::SQLCallbackWrapper::SafeReleaseTask::create):
+        (WebCore::SQLCallbackWrapper::SafeReleaseTask::performTask):
+        (WebCore::SQLCallbackWrapper::SafeReleaseTask::isCleanupTask):
+        (WebCore::SQLCallbackWrapper::SafeReleaseTask::SafeReleaseTask):
+
 2012-02-14  Antti Koivisto  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=78662

Modified: trunk/Source/WebCore/storage/Database.cpp (107783 => 107784)


--- trunk/Source/WebCore/storage/Database.cpp	2012-02-15 06:58:59 UTC (rev 107783)
+++ trunk/Source/WebCore/storage/Database.cpp	2012-02-15 07:03:43 UTC (rev 107784)
@@ -216,6 +216,7 @@
         MutexLocker locker(m_transactionInProgressMutex);
         m_isTransactionQueueEnabled = false;
         m_transactionInProgress = false;
+        m_transactionQueue.clear();
     }
 
     closeDatabase();

Modified: trunk/Source/WebCore/storage/SQLCallbackWrapper.h (107783 => 107784)


--- trunk/Source/WebCore/storage/SQLCallbackWrapper.h	2012-02-15 06:58:59 UTC (rev 107783)
+++ trunk/Source/WebCore/storage/SQLCallbackWrapper.h	2012-02-15 07:03:43 UTC (rev 107784)
@@ -30,7 +30,6 @@
 
 #if ENABLE(SQL_DATABASE)
 
-#include "CrossThreadTask.h"
 #include "ScriptExecutionContext.h"
 #include <wtf/ThreadingPrimitives.h>
 
@@ -74,7 +73,7 @@
             context = m_scriptExecutionContext.release().leakRef();
             callback = m_callback.release().leakRef();
         }
-        context->postTask(createCallbackTask(&safeRelease, AllowAccessLater(callback)));
+        context->postTask(SafeReleaseTask::create(callback));
     }
 
     PassRefPtr<T> unwrap()
@@ -89,13 +88,31 @@
     bool hasCallback() const { return m_callback; }
 
 private:
-    static void safeRelease(ScriptExecutionContext* context, T* callback)
-    {
-        ASSERT(callback && context && context->isContextThread());
-        callback->deref();
-        context->deref();
-    }
+    class SafeReleaseTask : public ScriptExecutionContext::Task {
+    public:
+        static PassOwnPtr<SafeReleaseTask> create(T* callbackToRelease)
+        {
+            return adoptPtr(new SafeReleaseTask(callbackToRelease));
+        }
 
+        virtual void performTask(ScriptExecutionContext* context)
+        {
+            ASSERT(m_callbackToRelease && context && context->isContextThread());
+            m_callbackToRelease->deref();
+            context->deref();
+        }
+
+        virtual bool isCleanupTask() const { return true; }
+
+    private:
+        SafeReleaseTask(T* callbackToRelease)
+            : m_callbackToRelease(callbackToRelease)
+        {
+        }
+
+        T* m_callbackToRelease;
+    };
+
     Mutex m_mutex;
     RefPtr<T> m_callback;
     RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to