| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "modules/webdatabase/DatabaseTask.h" | 35 #include "modules/webdatabase/DatabaseTask.h" |
| 36 #include "modules/webdatabase/SQLTransactionClient.h" | 36 #include "modules/webdatabase/SQLTransactionClient.h" |
| 37 #include "modules/webdatabase/SQLTransactionCoordinator.h" | 37 #include "modules/webdatabase/SQLTransactionCoordinator.h" |
| 38 #include "platform/Logging.h" | 38 #include "platform/Logging.h" |
| 39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 DatabaseThread::DatabaseThread() | 43 DatabaseThread::DatabaseThread() |
| 44 : m_transactionClient(adoptPtr(new SQLTransactionClient())) | 44 : m_transactionClient(adoptPtr(new SQLTransactionClient())) |
| 45 , m_transactionCoordinator(adoptPtr(new SQLTransactionCoordinator())) | 45 , m_transactionCoordinator(adoptPtrWillBeNoop(new SQLTransactionCoordinator(
))) |
| 46 , m_cleanupSync(0) | 46 , m_cleanupSync(0) |
| 47 , m_terminationRequested(false) | 47 , m_terminationRequested(false) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 DatabaseThread::~DatabaseThread() | 51 DatabaseThread::~DatabaseThread() |
| 52 { | 52 { |
| 53 ASSERT(m_openDatabaseSet.isEmpty()); | 53 ASSERT(m_openDatabaseSet.isEmpty()); |
| 54 // Oilpan: The database thread must have finished its cleanup tasks before | 54 // Oilpan: The database thread must have finished its cleanup tasks before |
| 55 // the following clear(). Otherwise, WebThread destructor blocks the caller | 55 // the following clear(). Otherwise, WebThread destructor blocks the caller |
| 56 // thread, and causes a deadlock with ThreadState cleanup. | 56 // thread, and causes a deadlock with ThreadState cleanup. |
| 57 // DatabaseContext::stop() asks the database thread to close all of | 57 // DatabaseContext::stop() asks the database thread to close all of |
| 58 // databases, and wait until GC heap cleanup of the database thread. So we | 58 // databases, and wait until GC heap cleanup of the database thread. So we |
| 59 // can safely destruct WebThread here. | 59 // can safely destruct WebThread here. |
| 60 m_thread.clear(); | 60 m_thread.clear(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void DatabaseThread::trace(Visitor* visitor) |
| 64 { |
| 65 visitor->trace(m_openDatabaseSet); |
| 66 visitor->trace(m_transactionCoordinator); |
| 67 } |
| 68 |
| 63 void DatabaseThread::start() | 69 void DatabaseThread::start() |
| 64 { | 70 { |
| 65 if (m_thread) | 71 if (m_thread) |
| 66 return; | 72 return; |
| 67 m_thread = adoptPtr(blink::Platform::current()->createThread("WebCore: Datab
ase")); | 73 m_thread = adoptPtr(blink::Platform::current()->createThread("WebCore: Datab
ase")); |
| 68 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::setupDatabaseThread,
this))); | 74 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::setupDatabaseThread,
this))); |
| 69 } | 75 } |
| 70 | 76 |
| 71 void DatabaseThread::setupDatabaseThread() | 77 void DatabaseThread::setupDatabaseThread() |
| 72 { | 78 { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 166 |
| 161 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 167 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
| 162 { | 168 { |
| 163 ASSERT(m_thread); | 169 ASSERT(m_thread); |
| 164 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); | 170 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); |
| 165 // WebThread takes ownership of the task. | 171 // WebThread takes ownership of the task. |
| 166 m_thread->postTask(task.leakPtr()); | 172 m_thread->postTask(task.leakPtr()); |
| 167 } | 173 } |
| 168 | 174 |
| 169 } // namespace WebCore | 175 } // namespace WebCore |
| OLD | NEW |