| 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 FINAL : public ExecutionContextTask { | 108 class NotifyDatabaseObserverOnCloseTask final : public ExecutionContextTask { |
| 109 public: | 109 public: |
| 110 static PassOwnPtr<NotifyDatabaseObserverOnCloseTask> create(Database* databa
se) | 110 static PassOwnPtr<NotifyDatabaseObserverOnCloseTask> create(Database* databa
se) |
| 111 { | 111 { |
| 112 return adoptPtr(new NotifyDatabaseObserverOnCloseTask(database)); | 112 return adoptPtr(new NotifyDatabaseObserverOnCloseTask(database)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void performTask(ExecutionContext*) OVERRIDE | 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 OVERRIDE | 120 virtual bool isCleanupTask() const override |
| 121 { | 121 { |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 explicit NotifyDatabaseObserverOnCloseTask(Database* database) | 126 explicit NotifyDatabaseObserverOnCloseTask(Database* database) |
| 127 : m_database(database) | 127 : m_database(database) |
| 128 { | 128 { |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // FIXME: This can be removed by createCrossThreadTask(). | 200 // FIXME: This can be removed by createCrossThreadTask(). |
| 201 class DatabaseTracker::CloseOneDatabaseImmediatelyTask FINAL : public ExecutionC
ontextTask { | 201 class DatabaseTracker::CloseOneDatabaseImmediatelyTask final : public ExecutionC
ontextTask { |
| 202 public: | 202 public: |
| 203 static PassOwnPtr<CloseOneDatabaseImmediatelyTask> create(const String& orig
inIdentifier, const String& name, Database* database) | 203 static PassOwnPtr<CloseOneDatabaseImmediatelyTask> create(const String& orig
inIdentifier, const String& name, Database* database) |
| 204 { | 204 { |
| 205 return adoptPtr(new CloseOneDatabaseImmediatelyTask(originIdentifier, na
me, database)); | 205 return adoptPtr(new CloseOneDatabaseImmediatelyTask(originIdentifier, na
me, database)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 virtual void performTask(ExecutionContext*) OVERRIDE | 208 virtual void performTask(ExecutionContext*) override |
| 209 { | 209 { |
| 210 DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originIdentifie
r, m_name, m_database); | 210 DatabaseTracker::tracker().closeOneDatabaseImmediately(m_originIdentifie
r, m_name, m_database); |
| 211 } | 211 } |
| 212 | 212 |
| 213 private: | 213 private: |
| 214 CloseOneDatabaseImmediatelyTask(const String& originIdentifier, const String
& name, Database* database) | 214 CloseOneDatabaseImmediatelyTask(const String& originIdentifier, const String
& name, Database* database) |
| 215 : m_originIdentifier(originIdentifier.isolatedCopy()) | 215 : m_originIdentifier(originIdentifier.isolatedCopy()) |
| 216 , m_name(name.isolatedCopy()) | 216 , m_name(name.isolatedCopy()) |
| 217 , m_database(database) | 217 , m_database(database) |
| 218 { | 218 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 DatabaseSet::iterator found = databaseSet->find(database); | 261 DatabaseSet::iterator found = databaseSet->find(database); |
| 262 if (found == databaseSet->end()) | 262 if (found == databaseSet->end()) |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 | 265 |
| 266 // And we have to call closeImmediately() without our collection lock being
held. | 266 // And we have to call closeImmediately() without our collection lock being
held. |
| 267 database->closeImmediately(); | 267 database->closeImmediately(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace blink | 270 } // namespace blink |
| OLD | NEW |