| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ASSERT(!m_terminationRequested); | 82 ASSERT(!m_terminationRequested); |
| 83 m_terminationRequested = true; | 83 m_terminationRequested = true; |
| 84 m_cleanupSync = &sync; | 84 m_cleanupSync = &sync; |
| 85 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); | 85 WTF_LOG(StorageAPI, "DatabaseThread %p was asked to terminate\n", this); |
| 86 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseThread::clea
nupDatabaseThread, wrapCrossThreadPersistent(this))); | 86 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseThread::clea
nupDatabaseThread, wrapCrossThreadPersistent(this))); |
| 87 } | 87 } |
| 88 sync.waitForTaskCompletion(); | 88 sync.waitForTaskCompletion(); |
| 89 // The WebThread destructor blocks until all the tasks of the database | 89 // The WebThread destructor blocks until all the tasks of the database |
| 90 // thread are processed. However, it shouldn't block at all because | 90 // thread are processed. However, it shouldn't block at all because |
| 91 // the database thread has already finished processing the cleanup task. | 91 // the database thread has already finished processing the cleanup task. |
| 92 m_thread.clear(); | 92 m_thread.reset(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void DatabaseThread::cleanupDatabaseThread() | 95 void DatabaseThread::cleanupDatabaseThread() |
| 96 { | 96 { |
| 97 WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this); | 97 WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this); |
| 98 | 98 |
| 99 // Clean up the list of all pending transactions on this database thread | 99 // Clean up the list of all pending transactions on this database thread |
| 100 m_transactionCoordinator->shutdown(); | 100 m_transactionCoordinator->shutdown(); |
| 101 | 101 |
| 102 // 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 | 102 // 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 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 { | 166 { |
| 167 MutexLocker lock(m_terminationRequestedMutex); | 167 MutexLocker lock(m_terminationRequestedMutex); |
| 168 ASSERT(!m_terminationRequested); | 168 ASSERT(!m_terminationRequested); |
| 169 } | 169 } |
| 170 #endif | 170 #endif |
| 171 // WebThread takes ownership of the task. | 171 // WebThread takes ownership of the task. |
| 172 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseTask::run, std::
move(task))); | 172 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseTask::run, std::
move(task))); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace blink | 175 } // namespace blink |
| OLD | NEW |