| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void DatabaseThread::databaseThread() | 100 void DatabaseThread::databaseThread() |
| 101 { | 101 { |
| 102 { | 102 { |
| 103 // Wait for DatabaseThread::start() to complete. | 103 // Wait for DatabaseThread::start() to complete. |
| 104 MutexLocker lock(m_threadCreationMutex); | 104 MutexLocker lock(m_threadCreationMutex); |
| 105 LOG(StorageAPI, "Started DatabaseThread %p", this); | 105 LOG(StorageAPI, "Started DatabaseThread %p", this); |
| 106 } | 106 } |
| 107 | 107 |
| 108 AutodrainedPool pool; | 108 AutodrainedPool pool; |
| 109 while (OwnPtr<DatabaseTask> task = m_queue.waitForMessage()) { | 109 while (OwnPtr<DatabaseTask> task = m_queue.waitForMessage()) { |
| 110 task->performTask(); | 110 task->run(); |
| 111 pool.cycle(); | 111 pool.cycle(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Clean up the list of all pending transactions on this database thread | 114 // Clean up the list of all pending transactions on this database thread |
| 115 m_transactionCoordinator->shutdown(); | 115 m_transactionCoordinator->shutdown(); |
| 116 | 116 |
| 117 LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThre
ad %p, which currently has %i ref(s)", m_threadID, this, refCount()); | 117 LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThre
ad %p, which currently has %i ref(s)", m_threadID, this, refCount()); |
| 118 | 118 |
| 119 // Close the databases that we ran transactions on. This ensures that if any
transactions are still open, they are rolled back and we don't leave the databa
se in an | 119 // Close the databases that we ran transactions on. This ensures that if any
transactions are still open, they are rolled back and we don't leave the databa
se in an |
| 120 // inconsistent or locked state. | 120 // inconsistent or locked state. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 void DatabaseThread::unscheduleDatabaseTasks(DatabaseBackend* database) | 178 void DatabaseThread::unscheduleDatabaseTasks(DatabaseBackend* database) |
| 179 { | 179 { |
| 180 // Note that the thread loop is running, so some tasks for the database | 180 // Note that the thread loop is running, so some tasks for the database |
| 181 // may still be executed. This is unavoidable. | 181 // may still be executed. This is unavoidable. |
| 182 SameDatabasePredicate predicate(database); | 182 SameDatabasePredicate predicate(database); |
| 183 m_queue.removeIf(predicate); | 183 m_queue.removeIf(predicate); |
| 184 } | 184 } |
| 185 } // namespace WebCore | 185 } // namespace WebCore |
| OLD | NEW |