| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 void DatabaseThread::cleanupDatabaseThread() { | 95 void DatabaseThread::cleanupDatabaseThread() { |
| 96 DCHECK(isDatabaseThread()); | 96 DCHECK(isDatabaseThread()); |
| 97 | 97 |
| 98 STORAGE_DVLOG(1) << "Cleaning up DatabaseThread " << this; | 98 STORAGE_DVLOG(1) << "Cleaning up DatabaseThread " << this; |
| 99 | 99 |
| 100 // Clean up the list of all pending transactions on this database thread | 100 // Clean up the list of all pending transactions on this database thread |
| 101 m_transactionCoordinator->shutdown(); | 101 m_transactionCoordinator->shutdown(); |
| 102 | 102 |
| 103 // Close the databases that we ran transactions on. This ensures that if any t
ransactions are still open, they are rolled back and we don't leave the database
in an | 103 // Close the databases that we ran transactions on. This ensures that if any |
| 104 // inconsistent or locked state. | 104 // transactions are still open, they are rolled back and we don't leave the |
| 105 // database in an inconsistent or locked state. |
| 105 if (m_openDatabaseSet.size() > 0) { | 106 if (m_openDatabaseSet.size() > 0) { |
| 106 // As the call to close will modify the original set, we must take a copy to
iterate over. | 107 // As the call to close will modify the original set, we must take a copy to |
| 108 // iterate over. |
| 107 HashSet<CrossThreadPersistent<Database>> openSetCopy; | 109 HashSet<CrossThreadPersistent<Database>> openSetCopy; |
| 108 openSetCopy.swap(m_openDatabaseSet); | 110 openSetCopy.swap(m_openDatabaseSet); |
| 109 HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end(); | 111 HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end(); |
| 110 for (HashSet<CrossThreadPersistent<Database>>::iterator it = | 112 for (HashSet<CrossThreadPersistent<Database>>::iterator it = |
| 111 openSetCopy.begin(); | 113 openSetCopy.begin(); |
| 112 it != end; ++it) | 114 it != end; ++it) |
| 113 (*it)->close(); | 115 (*it)->close(); |
| 114 } | 116 } |
| 115 m_openDatabaseSet.clear(); | 117 m_openDatabaseSet.clear(); |
| 116 | 118 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 MutexLocker lock(m_terminationRequestedMutex); | 168 MutexLocker lock(m_terminationRequestedMutex); |
| 167 ASSERT(!m_terminationRequested); | 169 ASSERT(!m_terminationRequested); |
| 168 } | 170 } |
| 169 #endif | 171 #endif |
| 170 // WebThread takes ownership of the task. | 172 // WebThread takes ownership of the task. |
| 171 m_thread->postTask(BLINK_FROM_HERE, | 173 m_thread->postTask(BLINK_FROM_HERE, |
| 172 crossThreadBind(&DatabaseTask::run, std::move(task))); | 174 crossThreadBind(&DatabaseTask::run, std::move(task))); |
| 173 } | 175 } |
| 174 | 176 |
| 175 } // namespace blink | 177 } // namespace blink |
| OLD | NEW |