Chromium Code Reviews| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 if (m_openDatabaseSet.size() > 0) { | 107 if (m_openDatabaseSet.size() > 0) { |
| 108 // As the call to close will modify the original set, we must take a cop y to iterate over. | 108 // As the call to close will modify the original set, we must take a cop y to iterate over. |
| 109 HashSet<CrossThreadPersistent<Database>> openSetCopy; | 109 HashSet<CrossThreadPersistent<Database>> openSetCopy; |
| 110 openSetCopy.swap(m_openDatabaseSet); | 110 openSetCopy.swap(m_openDatabaseSet); |
| 111 HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end (); | 111 HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end (); |
| 112 for (HashSet<CrossThreadPersistent<Database>>::iterator it = openSetCopy .begin(); it != end; ++it) | 112 for (HashSet<CrossThreadPersistent<Database>>::iterator it = openSetCopy .begin(); it != end; ++it) |
| 113 (*it)->close(); | 113 (*it)->close(); |
| 114 } | 114 } |
| 115 m_openDatabaseSet.clear(); | 115 m_openDatabaseSet.clear(); |
| 116 | 116 |
| 117 m_thread->postTask(BLINK_FROM_HERE, WTF::bind(&DatabaseThread::cleanupDataba seThreadCompleted, this)); | 117 m_thread->postTask(BLINK_FROM_HERE, WTF::bind(&DatabaseThread::cleanupDataba seThreadCompleted, wrapCrossThreadPersistent(this))); |
|
sof
2016/06/22 09:39:22
Isn't this happening on the same thread?
tzik
2016/06/22 10:16:01
Yes, this task is posted to the same thread.
Howev
sof
2016/06/22 13:24:27
A Persistent<> is allowed to contain a reference t
tzik
2016/06/22 13:56:51
That's true on other threads than DatabaseThread.
sof
2016/06/22 14:06:50
If that's the case, how would |this| be discovered
| |
| 118 } | 118 } |
| 119 | 119 |
| 120 void DatabaseThread::cleanupDatabaseThreadCompleted() | 120 void DatabaseThread::cleanupDatabaseThreadCompleted() |
| 121 { | 121 { |
| 122 m_thread->shutdown(); | 122 m_thread->shutdown(); |
| 123 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up. | 123 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up. |
| 124 m_cleanupSync->taskCompleted(); | 124 m_cleanupSync->taskCompleted(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void DatabaseThread::recordDatabaseOpen(Database* database) | 127 void DatabaseThread::recordDatabaseOpen(Database* database) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 { | 169 { |
| 170 MutexLocker lock(m_terminationRequestedMutex); | 170 MutexLocker lock(m_terminationRequestedMutex); |
| 171 ASSERT(!m_terminationRequested); | 171 ASSERT(!m_terminationRequested); |
| 172 } | 172 } |
| 173 #endif | 173 #endif |
| 174 // WebThread takes ownership of the task. | 174 // WebThread takes ownership of the task. |
| 175 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseTask::run, std:: move(task))); | 175 m_thread->postTask(BLINK_FROM_HERE, threadSafeBind(&DatabaseTask::run, std:: move(task))); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |