| 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 | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks,
PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const Strin
g& dataDirectory) | 82 void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks,
PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const Strin
g& dataDirectory) |
| 83 { | 83 { |
| 84 IDB_TRACE("IDBFactoryBackendImpl::getDatabaseNames"); | 84 IDB_TRACE("IDBFactoryBackendImpl::getDatabaseNames"); |
| 85 RefPtr<IDBBackingStore> backingStore = openBackingStore(securityOrigin, data
Directory); | 85 RefPtr<IDBBackingStore> backingStore = openBackingStore(securityOrigin, data
Directory); |
| 86 if (!backingStore) { | 86 if (!backingStore) { |
| 87 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Unknow
nError, "Internal error opening backing store for indexedDB.webkitGetDatabaseNam
es.")); | 87 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Unknow
nError, "Internal error opening backing store for indexedDB.webkitGetDatabaseNam
es.")); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 RefPtr<DOMStringList> databaseNames = DOMStringList::create(); | 91 callbacks->onSuccess(backingStore->getDatabaseNames()); |
| 92 | |
| 93 Vector<String> foundNames = backingStore->getDatabaseNames(); | |
| 94 for (Vector<String>::const_iterator it = foundNames.begin(); it != foundName
s.end(); ++it) | |
| 95 databaseNames->append(*it); | |
| 96 | |
| 97 callbacks->onSuccess(databaseNames.release()); | |
| 98 } | 92 } |
| 99 | 93 |
| 100 void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCal
lbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionCon
text*, const String& dataDirectory) | 94 void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCal
lbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionCon
text*, const String& dataDirectory) |
| 101 { | 95 { |
| 102 IDB_TRACE("IDBFactoryBackendImpl::deleteDatabase"); | 96 IDB_TRACE("IDBFactoryBackendImpl::deleteDatabase"); |
| 103 const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin
.get()); | 97 const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin
.get()); |
| 104 | 98 |
| 105 IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentif
ier); | 99 IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentif
ier); |
| 106 if (it != m_databaseBackendMap.end()) { | 100 if (it != m_databaseBackendMap.end()) { |
| 107 // If there are any connections to the database, directly delete the | 101 // If there are any connections to the database, directly delete the |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Un
knownError, "Internal error creating database backend for indexeddb.open.")); | 173 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Un
knownError, "Internal error creating database backend for indexeddb.open.")); |
| 180 return; | 174 return; |
| 181 } | 175 } |
| 182 } else | 176 } else |
| 183 databaseBackend = it->value; | 177 databaseBackend = it->value; |
| 184 | 178 |
| 185 databaseBackend->openConnection(callbacks, databaseCallbacks, transactionId,
version); | 179 databaseBackend->openConnection(callbacks, databaseCallbacks, transactionId,
version); |
| 186 } | 180 } |
| 187 | 181 |
| 188 } // namespace WebCore | 182 } // namespace WebCore |
| OLD | NEW |