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

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

Issue 183093002: Ensure that scheduled tasks are executed during db thread shutdown (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google, Inc. All Rights Reserved. 3 * Copyright (C) 2011 Google, Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ASSERT(isContextThread()); 191 ASSERT(isContextThread());
192 Vector<DatabaseBackendBase*> syncDatabases; 192 Vector<DatabaseBackendBase*> syncDatabases;
193 copyToVector(m_openSyncDatabases, syncDatabases); 193 copyToVector(m_openSyncDatabases, syncDatabases);
194 m_openSyncDatabases.clear(); 194 m_openSyncDatabases.clear();
195 for (size_t i = 0; i < syncDatabases.size(); ++i) 195 for (size_t i = 0; i < syncDatabases.size(); ++i)
196 syncDatabases[i]->closeImmediately(); 196 syncDatabases[i]->closeImmediately();
197 } 197 }
198 198
199 bool DatabaseContext::stopDatabases(DatabaseTaskSynchronizer* cleanupSync) 199 bool DatabaseContext::stopDatabases(DatabaseTaskSynchronizer* cleanupSync)
200 { 200 {
201 DatabaseManager::manager().interruptAllDatabasesForContext(executionContext( ));
202
201 stopSyncDatabases(); 203 stopSyncDatabases();
202 if (m_isRegistered) { 204 if (m_isRegistered) {
203 DatabaseManager::manager().unregisterDatabaseContext(this); 205 DatabaseManager::manager().unregisterDatabaseContext(this);
204 m_isRegistered = false; 206 m_isRegistered = false;
205 } 207 }
206 208
207 // Though we initiate termination of the DatabaseThread here in 209 // Though we initiate termination of the DatabaseThread here in
208 // stopDatabases(), we can't clear the m_databaseThread ref till we get to 210 // stopDatabases(), we can't clear the m_databaseThread ref till we get to
209 // the destructor. This is because the Databases that are managed by 211 // the destructor. This is because the Databases that are managed by
210 // DatabaseThread still rely on this ref between the context and the thread 212 // DatabaseThread still rely on this ref between the context and the thread
(...skipping 24 matching lines...) Expand all
235 { 237 {
236 return executionContext()->securityOrigin(); 238 return executionContext()->securityOrigin();
237 } 239 }
238 240
239 bool DatabaseContext::isContextThread() const 241 bool DatabaseContext::isContextThread() const
240 { 242 {
241 return executionContext()->isContextThread(); 243 return executionContext()->isContextThread();
242 } 244 }
243 245
244 } // namespace WebCore 246 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698