Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / webdatabase / DatabaseThread.cpp
index 8ebb4c0..80574b6 100644 (file)
@@ -42,7 +42,7 @@ namespace blink {
 
 DatabaseThread::DatabaseThread()
     : m_transactionClient(adoptPtr(new SQLTransactionClient()))
-    , m_transactionCoordinator(adoptPtrWillBeNoop(new SQLTransactionCoordinator()))
+    , m_transactionCoordinator(new SQLTransactionCoordinator())
     , m_cleanupSync(0)
     , m_terminationRequested(false)
 {
@@ -56,10 +56,8 @@ DatabaseThread::~DatabaseThread()
 
 void DatabaseThread::trace(Visitor* visitor)
 {
-#if ENABLE(OILPAN)
     visitor->trace(m_openDatabaseSet);
     visitor->trace(m_transactionCoordinator);
-#endif
 }
 
 void DatabaseThread::start()
@@ -110,12 +108,13 @@ void DatabaseThread::cleanupDatabaseThread()
     // inconsistent or locked state.
     if (m_openDatabaseSet.size() > 0) {
         // As the call to close will modify the original set, we must take a copy to iterate over.
-        WillBeHeapHashSet<RefPtrWillBeMember<Database> > openSetCopy;
+        HeapHashSet<Member<Database> > openSetCopy;
         openSetCopy.swap(m_openDatabaseSet);
-        WillBeHeapHashSet<RefPtrWillBeMember<Database> >::iterator end = openSetCopy.end();
-        for (WillBeHeapHashSet<RefPtrWillBeMember<Database> >::iterator it = openSetCopy.begin(); it != end; ++it)
+        HeapHashSet<Member<Database> >::iterator end = openSetCopy.end();
+        for (HeapHashSet<Member<Database> >::iterator it = openSetCopy.begin(); it != end; ++it)
             (*it)->close();
     }
+    m_openDatabaseSet.clear();
 
     m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThreadCompleted, this)));
 }
@@ -132,7 +131,9 @@ void DatabaseThread::recordDatabaseOpen(Database* database)
     ASSERT(isDatabaseThread());
     ASSERT(database);
     ASSERT(!m_openDatabaseSet.contains(database));
-    m_openDatabaseSet.add(database);
+    MutexLocker lock(m_terminationRequestedMutex);
+    if (!m_terminationRequested)
+        m_openDatabaseSet.add(database);
 }
 
 void DatabaseThread::recordDatabaseClosed(Database* database)