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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void DatabaseThread::start() | 64 void DatabaseThread::start() |
65 { | 65 { |
66 if (m_thread) | 66 if (m_thread) |
67 return; | 67 return; |
68 m_thread = WebThreadSupportingGC::create("WebCore: Database"); | 68 m_thread = WebThreadSupportingGC::create("WebCore: Database"); |
69 m_thread->postTask(FROM_HERE, new Task(threadSafeBind(&DatabaseThread::setup
DatabaseThread, this))); | 69 m_thread->postTask(FROM_HERE, new Task(threadSafeBind(&DatabaseThread::setup
DatabaseThread, this))); |
70 } | 70 } |
71 | 71 |
72 void DatabaseThread::setupDatabaseThread() | 72 void DatabaseThread::setupDatabaseThread() |
73 { | 73 { |
74 m_thread->initialize(); | 74 m_thread->attachGC(); |
75 } | 75 } |
76 | 76 |
77 void DatabaseThread::terminate() | 77 void DatabaseThread::terminate() |
78 { | 78 { |
79 TaskSynchronizer sync; | 79 TaskSynchronizer sync; |
80 { | 80 { |
81 MutexLocker lock(m_terminationRequestedMutex); | 81 MutexLocker lock(m_terminationRequestedMutex); |
82 ASSERT(!m_terminationRequested); | 82 ASSERT(!m_terminationRequested); |
83 m_terminationRequested = true; | 83 m_terminationRequested = true; |
84 m_cleanupSync = &sync; | 84 m_cleanupSync = &sync; |
(...skipping 30 matching lines...) Expand all Loading... |
115 for (HeapHashSet<Member<Database>>::iterator it = openSetCopy.begin(); i
t != end; ++it) | 115 for (HeapHashSet<Member<Database>>::iterator it = openSetCopy.begin(); i
t != end; ++it) |
116 (*it)->close(); | 116 (*it)->close(); |
117 } | 117 } |
118 m_openDatabaseSet.clear(); | 118 m_openDatabaseSet.clear(); |
119 | 119 |
120 m_thread->postTask(FROM_HERE, new Task(WTF::bind(&DatabaseThread::cleanupDat
abaseThreadCompleted, this))); | 120 m_thread->postTask(FROM_HERE, new Task(WTF::bind(&DatabaseThread::cleanupDat
abaseThreadCompleted, this))); |
121 } | 121 } |
122 | 122 |
123 void DatabaseThread::cleanupDatabaseThreadCompleted() | 123 void DatabaseThread::cleanupDatabaseThreadCompleted() |
124 { | 124 { |
125 m_thread->shutdown(); | 125 m_thread->detachGC(); |
126 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up. | 126 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up. |
127 m_cleanupSync->taskCompleted(); | 127 m_cleanupSync->taskCompleted(); |
128 } | 128 } |
129 | 129 |
130 void DatabaseThread::recordDatabaseOpen(Database* database) | 130 void DatabaseThread::recordDatabaseOpen(Database* database) |
131 { | 131 { |
132 ASSERT(isDatabaseThread()); | 132 ASSERT(isDatabaseThread()); |
133 ASSERT(database); | 133 ASSERT(database); |
134 ASSERT(!m_openDatabaseSet.contains(database)); | 134 ASSERT(!m_openDatabaseSet.contains(database)); |
135 MutexLocker lock(m_terminationRequestedMutex); | 135 MutexLocker lock(m_terminationRequestedMutex); |
(...skipping 19 matching lines...) Expand all Loading... |
155 | 155 |
156 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) | 156 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) |
157 { | 157 { |
158 ASSERT(m_thread); | 158 ASSERT(m_thread); |
159 ASSERT(!terminationRequested()); | 159 ASSERT(!terminationRequested()); |
160 // WebThread takes ownership of the task. | 160 // WebThread takes ownership of the task. |
161 m_thread->postTask(FROM_HERE, new Task(threadSafeBind(&DatabaseTask::run, ta
sk))); | 161 m_thread->postTask(FROM_HERE, new Task(threadSafeBind(&DatabaseTask::run, ta
sk))); |
162 } | 162 } |
163 | 163 |
164 } // namespace blink | 164 } // namespace blink |
OLD | NEW |