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

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

Issue 561093003: Remove worker support of Web SQL Database. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 unsigned long long DatabaseTracker::getMaxSizeForDatabase(const DatabaseBackendB ase* database) 190 unsigned long long DatabaseTracker::getMaxSizeForDatabase(const DatabaseBackendB ase* database)
191 { 191 {
192 unsigned long long spaceAvailable = 0; 192 unsigned long long spaceAvailable = 0;
193 unsigned long long databaseSize = 0; 193 unsigned long long databaseSize = 0;
194 QuotaTracker::instance().getDatabaseSizeAndSpaceAvailableToOrigin( 194 QuotaTracker::instance().getDatabaseSizeAndSpaceAvailableToOrigin(
195 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin()), 195 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin()),
196 database->stringIdentifier(), &databaseSize, &spaceAvailable); 196 database->stringIdentifier(), &databaseSize, &spaceAvailable);
197 return databaseSize + spaceAvailable; 197 return databaseSize + spaceAvailable;
198 } 198 }
199 199
200 void DatabaseTracker::interruptAllDatabasesForContext(const DatabaseContext* con text)
201 {
202 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
203
204 if (!m_openDatabaseMap)
205 return;
206
207 DatabaseNameMap* nameMap = m_openDatabaseMap->get(createDatabaseIdentifierFr omSecurityOrigin(context->securityOrigin()));
208 if (!nameMap)
209 return;
210
211 DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end();
212 for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameM apIt != dbNameMapEndIt; ++dbNameMapIt) {
213 DatabaseSet* databaseSet = dbNameMapIt->value;
214 DatabaseSet::const_iterator end = databaseSet->end();
215 for (DatabaseSet::const_iterator it = databaseSet->begin(); it != end; + +it) {
216 if ((*it)->databaseContext() == context)
217 (*it)->interrupt();
218 }
219 }
220 }
221
222 class DatabaseTracker::CloseOneDatabaseImmediatelyTask FINAL : public ExecutionC ontextTask { 200 class DatabaseTracker::CloseOneDatabaseImmediatelyTask FINAL : public ExecutionC ontextTask {
223 public: 201 public:
224 static PassOwnPtr<CloseOneDatabaseImmediatelyTask> create(const String& orig inIdentifier, const String& name, DatabaseBackendBase* database) 202 static PassOwnPtr<CloseOneDatabaseImmediatelyTask> create(const String& orig inIdentifier, const String& name, DatabaseBackendBase* database)
225 { 203 {
226 return adoptPtr(new CloseOneDatabaseImmediatelyTask(originIdentifier, na me, database)); 204 return adoptPtr(new CloseOneDatabaseImmediatelyTask(originIdentifier, na me, database));
227 } 205 }
228 206
229 virtual void performTask(ExecutionContext*) OVERRIDE 207 virtual void performTask(ExecutionContext*) OVERRIDE
230 { 208 {
231 DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originIdentifie r, m_name, m_database); 209 DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originIdentifie r, m_name, m_database);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 DatabaseSet::iterator found = databaseSet->find(database); 262 DatabaseSet::iterator found = databaseSet->find(database);
285 if (found == databaseSet->end()) 263 if (found == databaseSet->end())
286 return; 264 return;
287 } 265 }
288 266
289 // And we have to call closeImmediately() without our collection lock being held. 267 // And we have to call closeImmediately() without our collection lock being held.
290 database->closeImmediately(); 268 database->closeImmediately();
291 } 269 }
292 270
293 } // namespace blink 271 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/DatabaseTracker.h ('k') | Source/modules/webdatabase/SQLStatementBackend.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698