Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: Source/modules/webdatabase/DatabaseThread.cpp

Issue 183093002: Ensure that scheduled tasks are executed during db thread shutdown (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (m_openDatabaseSet.size() > 0) { 98 if (m_openDatabaseSet.size() > 0) {
99 // As the call to close will modify the original set, we must take a cop y to iterate over. 99 // As the call to close will modify the original set, we must take a cop y to iterate over.
100 DatabaseSet openSetCopy; 100 DatabaseSet openSetCopy;
101 openSetCopy.swap(m_openDatabaseSet); 101 openSetCopy.swap(m_openDatabaseSet);
102 DatabaseSet::iterator end = openSetCopy.end(); 102 DatabaseSet::iterator end = openSetCopy.end();
103 for (DatabaseSet::iterator it = openSetCopy.begin(); it != end; ++it) 103 for (DatabaseSet::iterator it = openSetCopy.begin(); it != end; ++it)
104 (*it).get()->close(); 104 (*it).get()->close();
105 } 105 }
106 106
107 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up. 107 if (m_cleanupSync) // Someone wanted to know when we were done cleaning up.
108 m_cleanupSync->taskCompleted(); 108 m_thread->postTask(new Task(WTF::bind(&DatabaseTaskSynchronizer::taskCom pleted, m_cleanupSync)));
109 } 109 }
110 110
111 void DatabaseThread::recordDatabaseOpen(DatabaseBackend* database) 111 void DatabaseThread::recordDatabaseOpen(DatabaseBackend* database)
112 { 112 {
113 ASSERT(isDatabaseThread()); 113 ASSERT(isDatabaseThread());
114 ASSERT(database); 114 ASSERT(database);
115 ASSERT(!m_openDatabaseSet.contains(database)); 115 ASSERT(!m_openDatabaseSet.contains(database));
116 m_openDatabaseSet.add(database); 116 m_openDatabaseSet.add(database);
117 } 117 }
118 118
(...skipping 18 matching lines...) Expand all
137 137
138 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) 138 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task)
139 { 139 {
140 ASSERT(m_thread); 140 ASSERT(m_thread);
141 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination()); 141 ASSERT(!task->hasSynchronizer() || task->hasCheckedForTermination());
142 // WebThread takes ownership of the task. 142 // WebThread takes ownership of the task.
143 m_thread->postTask(task.leakPtr()); 143 m_thread->postTask(task.leakPtr());
144 } 144 }
145 145
146 } // namespace WebCore 146 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698