Title: [143282] trunk/Source/WebCore
Revision
143282
Author
[email protected]
Date
2013-02-18 17:55:58 -0800 (Mon, 18 Feb 2013)

Log Message

Small follow up to r143271: Fix SQLTransaction leak.
https://bugs.webkit.org/show_bug.cgi?id=110052.

Reviewed by Geoffrey Garen.

Applied Geoff's suggestion nullify m_frontend sooner for greater
code clarity. Also added some comments about m_frontend.

No new tests.

* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::doCleanup):
* Modules/webdatabase/SQLTransactionBackend.h:
(SQLTransactionBackend):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143281 => 143282)


--- trunk/Source/WebCore/ChangeLog	2013-02-19 01:51:15 UTC (rev 143281)
+++ trunk/Source/WebCore/ChangeLog	2013-02-19 01:55:58 UTC (rev 143282)
@@ -1,3 +1,20 @@
+2013-02-18  Mark Lam  <[email protected]>
+
+        Small follow up to r143271: Fix SQLTransaction leak.
+        https://bugs.webkit.org/show_bug.cgi?id=110052.
+
+        Reviewed by Geoffrey Garen.
+
+        Applied Geoff's suggestion nullify m_frontend sooner for greater
+        code clarity. Also added some comments about m_frontend.
+
+        No new tests.
+
+        * Modules/webdatabase/SQLTransactionBackend.cpp:
+        (WebCore::SQLTransactionBackend::doCleanup):
+        * Modules/webdatabase/SQLTransactionBackend.h:
+        (SQLTransactionBackend):
+
 2013-02-18  Geoffrey Garen  <[email protected]>
 
         Shrank the SourceProvider cache

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp (143281 => 143282)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp	2013-02-19 01:51:15 UTC (rev 143281)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp	2013-02-19 01:55:58 UTC (rev 143282)
@@ -242,9 +242,11 @@
 //
 //     Note: there's a circular reference between the SQLTransaction front-end and
 //     back-end. This circular reference is established in the constructor of the
-//     SQLTransactionBackend. The circular reference will only be broken at the end
-//     of the transaction's clean up state i.e. when the transaction should no
-//     longer be in use thereafter.
+//     SQLTransactionBackend. The circular reference will be broken by calling
+//     doCleanup() to nullify m_frontend. This is done at the end of the transaction's
+//     clean up state (i.e. when the transaction should no longer be in use thereafter),
+//     or if the database was interrupted. See comments on "What happens if a transaction
+//     is interrupted?" below for details.
 //
 //     After scheduling the transaction with the DatabaseThread (DatabaseBackendAsync::scheduleTransaction()):
 //     ======================================================================================================
@@ -380,6 +382,7 @@
 {
     if (!m_frontend)
         return;
+    m_frontend = 0; // Break the reference cycle. See comment about the life-cycle above.
 
     ASSERT(currentThread() == database()->databaseContext()->databaseThread()->getThreadID());
 
@@ -399,10 +402,6 @@
     if (m_lockAcquired)
         m_database->transactionCoordinator()->releaseLock(this);
 
-    // Now that we're done, break the reference cycle that keeps us alive.
-    // See comment about the life-cycle above.
-    m_frontend = 0;
-
     // Do some aggresive clean up here except for m_database.
     //
     // We can't clear m_database here because the frontend may asynchronously

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h (143281 => 143282)


--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h	2013-02-19 01:51:15 UTC (rev 143281)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h	2013-02-19 01:55:58 UTC (rev 143282)
@@ -109,7 +109,7 @@
 
     void getNextStatement();
 
-    RefPtr<SQLTransaction> m_frontend;
+    RefPtr<SQLTransaction> m_frontend; // Has a reference cycle, and will break in doCleanup().
     RefPtr<SQLStatementBackend> m_currentStatementBackend;
 
     RefPtr<DatabaseBackendAsync> m_database;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to