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

Side by Side Diff: WebCore/storage/DatabaseThread.cpp

Issue 596028: Make the DatabaseTracker thread-safe. (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « WebCore/storage/DatabaseTask.cpp ('k') | WebCore/storage/DatabaseTracker.h » ('j') | 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThre ad %p, which currently has %i ref(s)", m_threadID, this, refCount()); 106 LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThre ad %p, which currently has %i ref(s)", m_threadID, this, refCount());
107 107
108 // 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 // 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
109 // inconsistent or locked state. 109 // inconsistent or locked state.
110 if (m_openDatabaseSet.size() > 0) { 110 if (m_openDatabaseSet.size() > 0) {
111 // As the call to close will modify the original set, we must take a cop y to iterate over. 111 // As the call to close will modify the original set, we must take a cop y to iterate over.
112 DatabaseSet openSetCopy; 112 DatabaseSet openSetCopy;
113 openSetCopy.swap(m_openDatabaseSet); 113 openSetCopy.swap(m_openDatabaseSet);
114 DatabaseSet::iterator end = openSetCopy.end(); 114 DatabaseSet::iterator end = openSetCopy.end();
115 for (DatabaseSet::iterator it = openSetCopy.begin(); it != end; ++it) 115 for (DatabaseSet::iterator it = openSetCopy.begin(); it != end; ++it)
116 (*it)->close(); 116 (*it)->close(true);
117 } 117 }
118 118
119 // Detach the thread so its resources are no longer of any concern to anyone else 119 // Detach the thread so its resources are no longer of any concern to anyone else
120 detachThread(m_threadID); 120 detachThread(m_threadID);
121 121
122 DatabaseTaskSynchronizer* cleanupSync = m_cleanupSync; 122 DatabaseTaskSynchronizer* cleanupSync = m_cleanupSync;
123 123
124 // Clear the self refptr, possibly resulting in deletion 124 // Clear the self refptr, possibly resulting in deletion
125 m_selfRef = 0; 125 m_selfRef = 0;
126 126
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 void DatabaseThread::unscheduleDatabaseTasks(Database* database) 167 void DatabaseThread::unscheduleDatabaseTasks(Database* database)
168 { 168 {
169 // Note that the thread loop is running, so some tasks for the database 169 // Note that the thread loop is running, so some tasks for the database
170 // may still be executed. This is unavoidable. 170 // may still be executed. This is unavoidable.
171 SameDatabasePredicate predicate(database); 171 SameDatabasePredicate predicate(database);
172 m_queue.removeIf(predicate); 172 m_queue.removeIf(predicate);
173 } 173 }
174 } // namespace WebCore 174 } // namespace WebCore
175 #endif 175 #endif
OLDNEW
« no previous file with comments | « WebCore/storage/DatabaseTask.cpp ('k') | WebCore/storage/DatabaseTracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698