| 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 18 matching lines...) Expand all Loading... |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "modules/webdatabase/DatabaseThread.h" | 30 #include "modules/webdatabase/DatabaseThread.h" |
| 31 | 31 |
| 32 #include "modules/webdatabase/Database.h" | 32 #include "modules/webdatabase/Database.h" |
| 33 #include "modules/webdatabase/DatabaseTask.h" | 33 #include "modules/webdatabase/DatabaseTask.h" |
| 34 #include "modules/webdatabase/SQLTransactionClient.h" | 34 #include "modules/webdatabase/SQLTransactionClient.h" |
| 35 #include "modules/webdatabase/SQLTransactionCoordinator.h" | 35 #include "modules/webdatabase/SQLTransactionCoordinator.h" |
| 36 #include "platform/Logging.h" | 36 #include "platform/Logging.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "wtf/AutodrainedPool.h" | 38 #include "wtf/AutodrainedPool.h" |
| 39 #include "wtf/UnusedParam.h" | |
| 40 | 39 |
| 41 namespace WebCore { | 40 namespace WebCore { |
| 42 | 41 |
| 43 DatabaseThread::DatabaseThread() | 42 DatabaseThread::DatabaseThread() |
| 44 : m_transactionClient(adoptPtr(new SQLTransactionClient())) | 43 : m_transactionClient(adoptPtr(new SQLTransactionClient())) |
| 45 , m_transactionCoordinator(adoptPtr(new SQLTransactionCoordinator())) | 44 , m_transactionCoordinator(adoptPtr(new SQLTransactionCoordinator())) |
| 46 , m_cleanupSync(0) | 45 , m_cleanupSync(0) |
| 47 , m_terminationRequested(false) | 46 , m_terminationRequested(false) |
| 48 { | 47 { |
| 49 } | 48 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 m_cleanupSync = cleanupSync; | 68 m_cleanupSync = cleanupSync; |
| 70 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); | 69 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); |
| 71 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
, this))); | 70 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
, this))); |
| 72 } | 71 } |
| 73 | 72 |
| 74 bool DatabaseThread::terminationRequested(DatabaseTaskSynchronizer* taskSynchron
izer) const | 73 bool DatabaseThread::terminationRequested(DatabaseTaskSynchronizer* taskSynchron
izer) const |
| 75 { | 74 { |
| 76 #ifndef NDEBUG | 75 #ifndef NDEBUG |
| 77 if (taskSynchronizer) | 76 if (taskSynchronizer) |
| 78 taskSynchronizer->setHasCheckedForTermination(); | 77 taskSynchronizer->setHasCheckedForTermination(); |
| 79 #else | |
| 80 UNUSED_PARAM(taskSynchronizer); | |
| 81 #endif | 78 #endif |
| 82 | 79 |
| 83 return m_terminationRequested; | 80 return m_terminationRequested; |
| 84 } | 81 } |
| 85 | 82 |
| 86 void DatabaseThread::cleanupDatabaseThread() | 83 void DatabaseThread::cleanupDatabaseThread() |
| 87 { | 84 { |
| 88 WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this); | 85 WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this); |
| 89 | 86 |
| 90 // Clean up the list of all pending transactions on this database thread | 87 // Clean up the list of all pending transactions on this database thread |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 127 |
| 131 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 128 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
| 132 { | 129 { |
| 133 ASSERT(m_thread); | 130 ASSERT(m_thread); |
| 134 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); | 131 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); |
| 135 // WebThread takes ownership of the task. | 132 // WebThread takes ownership of the task. |
| 136 m_thread->postTask(task.leakPtr()); | 133 m_thread->postTask(task.leakPtr()); |
| 137 } | 134 } |
| 138 | 135 |
| 139 } // namespace WebCore | 136 } // namespace WebCore |
| OLD | NEW |