| OLD | NEW |
| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 String name(database->stringIdentifier()); | 98 String name(database->stringIdentifier()); |
| 99 DatabaseSet* databaseSet = nameMap->get(name); | 99 DatabaseSet* databaseSet = nameMap->get(name); |
| 100 if (!databaseSet) { | 100 if (!databaseSet) { |
| 101 databaseSet = new DatabaseSet(); | 101 databaseSet = new DatabaseSet(); |
| 102 nameMap->set(name, databaseSet); | 102 nameMap->set(name, databaseSet); |
| 103 } | 103 } |
| 104 | 104 |
| 105 databaseSet->add(database); | 105 databaseSet->add(database); |
| 106 } | 106 } |
| 107 | 107 |
| 108 class NotifyDatabaseObserverOnCloseTask : public ExecutionContextTask { | 108 class NotifyDatabaseObserverOnCloseTask FINAL : public ExecutionContextTask { |
| 109 public: | 109 public: |
| 110 static PassOwnPtr<NotifyDatabaseObserverOnCloseTask> create(PassRefPtr<Datab
aseBackendBase> database) | 110 static PassOwnPtr<NotifyDatabaseObserverOnCloseTask> create(PassRefPtr<Datab
aseBackendBase> database) |
| 111 { | 111 { |
| 112 return adoptPtr(new NotifyDatabaseObserverOnCloseTask(database)); | 112 return adoptPtr(new NotifyDatabaseObserverOnCloseTask(database)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void performTask(ExecutionContext* context) | 115 virtual void performTask(ExecutionContext*) OVERRIDE |
| 116 { | 116 { |
| 117 databaseClosed(m_database.get()); | 117 databaseClosed(m_database.get()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 virtual bool isCleanupTask() const | 120 virtual bool isCleanupTask() const OVERRIDE |
| 121 { | 121 { |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 NotifyDatabaseObserverOnCloseTask(PassRefPtr<DatabaseBackendBase> database) | 126 NotifyDatabaseObserverOnCloseTask(PassRefPtr<DatabaseBackendBase> database) |
| 127 : m_database(database) | 127 : m_database(database) |
| 128 { | 128 { |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameM
apIt != dbNameMapEndIt; ++dbNameMapIt) { | 212 for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameM
apIt != dbNameMapEndIt; ++dbNameMapIt) { |
| 213 DatabaseSet* databaseSet = dbNameMapIt->value; | 213 DatabaseSet* databaseSet = dbNameMapIt->value; |
| 214 DatabaseSet::const_iterator end = databaseSet->end(); | 214 DatabaseSet::const_iterator end = databaseSet->end(); |
| 215 for (DatabaseSet::const_iterator it = databaseSet->begin(); it != end; +
+it) { | 215 for (DatabaseSet::const_iterator it = databaseSet->begin(); it != end; +
+it) { |
| 216 if ((*it)->databaseContext() == context) | 216 if ((*it)->databaseContext() == context) |
| 217 (*it)->interrupt(); | 217 (*it)->interrupt(); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 class DatabaseTracker::CloseOneDatabaseImmediatelyTask : public ExecutionContext
Task { | 222 class DatabaseTracker::CloseOneDatabaseImmediatelyTask FINAL : public ExecutionC
ontextTask { |
| 223 public: | 223 public: |
| 224 static PassOwnPtr<CloseOneDatabaseImmediatelyTask> create(const String& orig
inIdentifier, const String& name, DatabaseBackendBase* database) | 224 static PassOwnPtr<CloseOneDatabaseImmediatelyTask> create(const String& orig
inIdentifier, const String& name, DatabaseBackendBase* database) |
| 225 { | 225 { |
| 226 return adoptPtr(new CloseOneDatabaseImmediatelyTask(originIdentifier, na
me, database)); | 226 return adoptPtr(new CloseOneDatabaseImmediatelyTask(originIdentifier, na
me, database)); |
| 227 } | 227 } |
| 228 | 228 |
| 229 virtual void performTask(ExecutionContext* context) | 229 virtual void performTask(ExecutionContext*) OVERRIDE |
| 230 { | 230 { |
| 231 DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originIdentifie
r, m_name, m_database); | 231 DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originIdentifie
r, m_name, m_database); |
| 232 } | 232 } |
| 233 | 233 |
| 234 private: | 234 private: |
| 235 CloseOneDatabaseImmediatelyTask(const String& originIdentifier, const String
& name, DatabaseBackendBase* database) | 235 CloseOneDatabaseImmediatelyTask(const String& originIdentifier, const String
& name, DatabaseBackendBase* database) |
| 236 : m_originIdentifier(originIdentifier.isolatedCopy()) | 236 : m_originIdentifier(originIdentifier.isolatedCopy()) |
| 237 , m_name(name.isolatedCopy()) | 237 , m_name(name.isolatedCopy()) |
| 238 , m_database(database) | 238 , m_database(database) |
| 239 { | 239 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 DatabaseSet::iterator found = databaseSet->find(database); | 284 DatabaseSet::iterator found = databaseSet->find(database); |
| 285 if (found == databaseSet->end()) | 285 if (found == databaseSet->end()) |
| 286 return; | 286 return; |
| 287 } | 287 } |
| 288 | 288 |
| 289 // And we have to call closeImmediately() without our collection lock being
held. | 289 // And we have to call closeImmediately() without our collection lock being
held. |
| 290 database->closeImmediately(); | 290 database->closeImmediately(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } | 293 } |
| OLD | NEW |