Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2416)

Unified Diff: Source/modules/webdatabase/SQLTransactionBackendSync.cpp

Issue 198793003: Oilpan: Prepare to move SQLTransactionBackendSync and SQLTransactionSync to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: DatabaseSync owns observers. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/webdatabase/SQLTransactionBackendSync.cpp
diff --git a/Source/modules/webdatabase/SQLTransactionBackendSync.cpp b/Source/modules/webdatabase/SQLTransactionBackendSync.cpp
index b1e298be8ddb8194391ae1e64617d2c66d9ec234..ffe0f4038e160e543a8d35bee1b27a667405b100 100644
--- a/Source/modules/webdatabase/SQLTransactionBackendSync.cpp
+++ b/Source/modules/webdatabase/SQLTransactionBackendSync.cpp
@@ -62,13 +62,27 @@ SQLTransactionBackendSync::SQLTransactionBackendSync(DatabaseSync* db, PassOwnPt
ASSERT(m_database->executionContext()->isContextThread());
}
-SQLTransactionBackendSync::~SQLTransactionBackendSync()
+void SQLTransactionBackendSync::rollbackIfInProgress()
{
- ASSERT(m_database->executionContext()->isContextThread());
+ ASSERT(!m_database->executionContext() || m_database->executionContext()->isContextThread());
if (m_sqliteTransaction && m_sqliteTransaction->inProgress())
rollback();
}
+SQLTransactionBackendSync::~SQLTransactionBackendSync()
+{
+#if ENABLE(OILPAN)
+ ASSERT(!m_sqliteTransaction || !m_sqliteTransaction->inProgress());
+#else
+ rollbackIfInProgress();
+#endif
+}
+
+void SQLTransactionBackendSync::trace(Visitor* visitor)
+{
+ visitor->trace(m_database);
+}
+
PassRefPtr<SQLResultSet> SQLTransactionBackendSync::executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, ExceptionState& exceptionState)
{
ASSERT(m_database->executionContext()->isContextThread());
@@ -229,9 +243,10 @@ void SQLTransactionBackendSync::commit(ExceptionState& exceptionState)
m_database->reportCommitTransactionResult(0, -1, 0); // OK
}
+// This can be called during GC. Do not allocate new on-heap objects.
Vyacheslav Egorov (Google) 2014/03/18 07:54:55 I don't think comments like this scale as long you
void SQLTransactionBackendSync::rollback()
{
- ASSERT(m_database->executionContext()->isContextThread());
+ ASSERT(!m_database->executionContext() || m_database->executionContext()->isContextThread());
m_database->disableAuthorizer();
if (m_sqliteTransaction) {
Vyacheslav Egorov (Google) 2014/03/18 07:54:55 from my reading of the code this whole if can be j
m_sqliteTransaction->rollback();

Powered by Google App Engine
This is Rietveld 408576698