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

Side by Side Diff: Source/modules/indexeddb/IDBFactoryBackendImpl.cpp

Issue 78053006: [oilpan] Move IDBDatabase, IDBDatabaseCallbacks, IDBDatabaseBackendInterface and other related clas… (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years 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 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return; 102 return;
103 } 103 }
104 104
105 // FIXME: Everything from now on should be done on another thread. 105 // FIXME: Everything from now on should be done on another thread.
106 RefPtr<IDBBackingStore> backingStore = openBackingStore(databaseIdentifier, dataDirectory); 106 RefPtr<IDBBackingStore> backingStore = openBackingStore(databaseIdentifier, dataDirectory);
107 if (!backingStore) { 107 if (!backingStore) {
108 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Unknow nError, "Internal error opening backing store for indexedDB.deleteDatabase.")); 108 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Unknow nError, "Internal error opening backing store for indexedDB.deleteDatabase."));
109 return; 109 return;
110 } 110 }
111 111
112 RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::cre ate(name, backingStore.get(), this, uniqueIdentifier); 112 IDBDatabaseBackendImpl* databaseBackend = IDBDatabaseBackendImpl::create(nam e, backingStore.get(), this, uniqueIdentifier);
113 if (databaseBackend) { 113 if (databaseBackend) {
114 m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get()); 114 m_databaseBackendMap.set(uniqueIdentifier, databaseBackend);
115 databaseBackend->deleteDatabase(callbacks); 115 databaseBackend->deleteDatabase(callbacks);
116 m_databaseBackendMap.remove(uniqueIdentifier); 116 m_databaseBackendMap.remove(uniqueIdentifier);
117 } else 117 } else
118 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Unknow nError, "Internal error creating database backend for indexedDB.deleteDatabase." )); 118 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Unknow nError, "Internal error creating database backend for indexedDB.deleteDatabase." ));
119 } 119 }
120 120
121 PassRefPtr<IDBBackingStore> IDBFactoryBackendImpl::openBackingStore(const String & databaseIdentifier, const String& dataDirectory) 121 PassRefPtr<IDBBackingStore> IDBFactoryBackendImpl::openBackingStore(const String & databaseIdentifier, const String& dataDirectory)
122 { 122 {
123 const String fileIdentifier = computeFileIdentifier(databaseIdentifier); 123 const String fileIdentifier = computeFileIdentifier(databaseIdentifier);
124 const bool openInMemory = dataDirectory.isEmpty(); 124 const bool openInMemory = dataDirectory.isEmpty();
(...skipping 17 matching lines...) Expand all
142 142
143 // All backing stores associated with this factory should be of the same type. 143 // All backing stores associated with this factory should be of the same type.
144 ASSERT(m_sessionOnlyBackingStores.isEmpty() || openInMemory); 144 ASSERT(m_sessionOnlyBackingStores.isEmpty() || openInMemory);
145 145
146 return backingStore.release(); 146 return backingStore.release();
147 } 147 }
148 148
149 return 0; 149 return 0;
150 } 150 }
151 151
152 void IDBFactoryBackendImpl::open(const String& name, int64_t version, int64_t tr ansactionId, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks > databaseCallbacks, const String& databaseIdentifier, ScriptExecutionContext*, const String& dataDirectory) 152 void IDBFactoryBackendImpl::open(const String& name, int64_t version, int64_t tr ansactionId, PassRefPtr<IDBCallbacks> callbacks, IDBDatabaseCallbacks* databaseC allbacks, const String& databaseIdentifier, ScriptExecutionContext*, const Strin g& dataDirectory)
153 { 153 {
154 IDB_TRACE("IDBFactoryBackendImpl::open"); 154 IDB_TRACE("IDBFactoryBackendImpl::open");
155 const String uniqueIdentifier = computeUniqueIdentifier(name, databaseIdenti fier); 155 const String uniqueIdentifier = computeUniqueIdentifier(name, databaseIdenti fier);
156 156
157 RefPtr<IDBDatabaseBackendImpl> databaseBackend; 157 IDBDatabaseBackendImpl* databaseBackend;
158 IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentif ier); 158 IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentif ier);
159 if (it == m_databaseBackendMap.end()) { 159 if (it == m_databaseBackendMap.end()) {
160 RefPtr<IDBBackingStore> backingStore = openBackingStore(databaseIdentifi er, dataDirectory); 160 RefPtr<IDBBackingStore> backingStore = openBackingStore(databaseIdentifi er, dataDirectory);
161 if (!backingStore) { 161 if (!backingStore) {
162 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Un knownError, "Internal error opening backing store for indexedDB.open.")); 162 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Un knownError, "Internal error opening backing store for indexedDB.open."));
163 return; 163 return;
164 } 164 }
165 165
166 databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get( ), this, uniqueIdentifier); 166 databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get( ), this, uniqueIdentifier);
167 if (databaseBackend) 167 if (databaseBackend)
168 m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get()); 168 m_databaseBackendMap.set(uniqueIdentifier, databaseBackend);
169 else { 169 else {
170 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Un knownError, "Internal error creating database backend for indexeddb.open.")); 170 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::Un knownError, "Internal error creating database backend for indexeddb.open."));
171 return; 171 return;
172 } 172 }
173 } else 173 } else
174 databaseBackend = it->value; 174 databaseBackend = it->value;
175 175
176 databaseBackend->openConnection(callbacks, databaseCallbacks, transactionId, version); 176 databaseBackend->openConnection(callbacks, databaseCallbacks, transactionId, version);
177 } 177 }
178 178
179 } // namespace WebCore 179 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698