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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 { | 101 { |
102 WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this); | 102 WTF_LOG(StorageAPI, "Cleaning up DatabaseThread %p", this); |
103 | 103 |
104 // Clean up the list of all pending transactions on this database thread | 104 // Clean up the list of all pending transactions on this database thread |
105 m_transactionCoordinator->shutdown(); | 105 m_transactionCoordinator->shutdown(); |
106 | 106 |
107 // 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 | 107 // 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 |
108 // inconsistent or locked state. | 108 // inconsistent or locked state. |
109 if (m_openDatabaseSet.size() > 0) { | 109 if (m_openDatabaseSet.size() > 0) { |
110 // As the call to close will modify the original set, we must take a cop
y to iterate over. | 110 // As the call to close will modify the original set, we must take a cop
y to iterate over. |
111 HeapHashSet<Member<Database> > openSetCopy; | 111 HeapHashSet<Member<Database>> openSetCopy; |
112 openSetCopy.swap(m_openDatabaseSet); | 112 openSetCopy.swap(m_openDatabaseSet); |
113 HeapHashSet<Member<Database> >::iterator end = openSetCopy.end(); | 113 HeapHashSet<Member<Database>>::iterator end = openSetCopy.end(); |
114 for (HeapHashSet<Member<Database> >::iterator it = openSetCopy.begin();
it != end; ++it) | 114 for (HeapHashSet<Member<Database>>::iterator it = openSetCopy.begin(); i
t != end; ++it) |
115 (*it)->close(); | 115 (*it)->close(); |
116 } | 116 } |
117 m_openDatabaseSet.clear(); | 117 m_openDatabaseSet.clear(); |
118 | 118 |
119 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
Completed, this))); | 119 m_thread->postTask(new Task(WTF::bind(&DatabaseThread::cleanupDatabaseThread
Completed, this))); |
120 } | 120 } |
121 | 121 |
122 void DatabaseThread::cleanupDatabaseThreadCompleted() | 122 void DatabaseThread::cleanupDatabaseThreadCompleted() |
123 { | 123 { |
124 m_thread->detachGC(); | 124 m_thread->detachGC(); |
(...skipping 29 matching lines...) Expand all Loading... |
154 | 154 |
155 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 155 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
156 { | 156 { |
157 ASSERT(m_thread); | 157 ASSERT(m_thread); |
158 ASSERT(!terminationRequested()); | 158 ASSERT(!terminationRequested()); |
159 // WebThread takes ownership of the task. | 159 // WebThread takes ownership of the task. |
160 m_thread->postTask(task.leakPtr()); | 160 m_thread->postTask(task.leakPtr()); |
161 } | 161 } |
162 | 162 |
163 } // namespace blink | 163 } // namespace blink |
OLD | NEW |