Changeset 88358 in webkit
- Timestamp:
- Jun 8, 2011 10:50:29 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r88356 r88358 1 2011-06-08 Greg Simon <gregsimon@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Test migration from sqlite to leveldb for IndexedDB 6 backend. 7 https://bugs.webkit.org/show_bug.cgi?id=61000 8 9 * storage/indexeddb/migrate-basics-expected.txt: Added. 10 * storage/indexeddb/migrate-basics.html: Added. 11 1 12 2011-06-08 James Simonsen <simonjam@chromium.org> 2 13 -
trunk/Source/WebCore/ChangeLog
r88357 r88358 1 2011-06-08 Greg Simon <gregsimon@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Control Indexeddb backends from LayoutTestController 6 https://bugs.webkit.org/show_bug.cgi?id=61000 7 8 Test: storage/indexeddb/migrate-basics.html 9 10 * storage/IDBBackingStore.h: 11 * storage/IDBFactoryBackendImpl.cpp: 12 (WebCore::IDBFactoryBackendImpl::open): 13 (WebCore::IDBFactoryBackendImpl::migrate): 14 * storage/IDBFactoryBackendImpl.h: 15 * storage/IDBFactoryBackendInterface.h: 16 * storage/IDBLevelDBBackingStore.cpp: 17 (WebCore::IDBLevelDBBackingStore::backingStoreExists): 18 * storage/IDBLevelDBBackingStore.h: 19 (WebCore::IDBLevelDBBackingStore::backingStoreType): 20 * storage/IDBSQLiteBackingStore.cpp: 21 (WebCore::IDBSQLiteBackingStore::backingStoreExists): 22 * storage/IDBSQLiteBackingStore.h: 23 (WebCore::IDBSQLiteBackingStore::backingStoreType): 24 1 25 2011-06-08 Dmitry Lomov <dslomov@google.com> 2 26 -
trunk/Source/WebCore/storage/IDBBackingStore.h
r88103 r88358 30 30 31 31 #include "IDBCursor.h" 32 #include "IDBFactoryBackendInterface.h" 32 33 #include "SQLiteDatabase.h" 33 34 #include <wtf/PassRefPtr.h> … … 38 39 namespace WebCore { 39 40 40 class IDBFactoryBackendImpl;41 41 class IDBKey; 42 42 class IDBKeyRange; … … 108 108 }; 109 109 virtual PassRefPtr<Transaction> createTransaction() = 0; 110 virtual IDBFactoryBackendInterface::BackingStoreType backingStoreType() const = 0; 110 111 }; 111 112 -
trunk/Source/WebCore/storage/IDBFactoryBackendImpl.cpp
r87313 r88358 73 73 void IDBFactoryBackendImpl::open(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDir, int64_t maximumSize, BackingStoreType backingStoreType) 74 74 { 75 String fileIdentifier = securityOrigin->databaseIdentifier(); 76 String uniqueIdentifier = fileIdentifier + "@" + name; 75 String uniqueIdentifier = securityOrigin->databaseIdentifier() + "@" + name + String::format("@%d", (int)backingStoreType); 77 76 IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentifier); 78 77 if (it != m_databaseBackendMap.end()) { … … 84 83 85 84 RefPtr<IDBBackingStore> backingStore; 86 IDBBackingStoreMap::iterator it2 = m_backingStoreMap.find( fileIdentifier);87 if (it2 != m_backingStoreMap.end() )85 IDBBackingStoreMap::iterator it2 = m_backingStoreMap.find(uniqueIdentifier); 86 if (it2 != m_backingStoreMap.end() && (backingStoreType == it2->second->backingStoreType())) 88 87 backingStore = it2->second; 89 88 else { 90 if (backingStoreType == DefaultBackingStore) 91 backingStore = IDBSQLiteBackingStore::open(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this); 89 #if ENABLE(LEVELDB) 90 // Should we migrate this backing store? 91 bool hasSQLBackingStore = IDBSQLiteBackingStore::backingStoreExists(securityOrigin.get(), dataDir); 92 bool hasLevelDBBackingStore = IDBLevelDBBackingStore::backingStoreExists(securityOrigin.get(), dataDir); 93 94 if (hasSQLBackingStore && hasLevelDBBackingStore) 95 backingStoreType = LevelDBBackingStore; 96 97 // Migration: if the database exists and is SQLite we want to migrate it to LevelDB. 98 if (hasSQLBackingStore && !hasLevelDBBackingStore) { 99 if (migrate(name, securityOrigin.get(), dataDir, maximumSize)) 100 backingStoreType = LevelDBBackingStore; 101 } 102 #endif 103 104 if (backingStoreType == DefaultBackingStore || backingStoreType == SQLiteBackingStore) 105 backingStore = IDBSQLiteBackingStore::open(securityOrigin.get(), dataDir, maximumSize, uniqueIdentifier, this); 92 106 #if ENABLE(LEVELDB) 93 107 else if (backingStoreType == LevelDBBackingStore) 94 backingStore = IDBLevelDBBackingStore::open(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this);108 backingStore = IDBLevelDBBackingStore::open(securityOrigin.get(), dataDir, maximumSize, uniqueIdentifier, this); 95 109 #endif 96 110 if (!backingStore) { … … 105 119 } 106 120 121 bool IDBFactoryBackendImpl::migrate(const String& name, SecurityOrigin* securityOrigin, const String& dataDir, int64_t maximumSize) 122 { 123 return false; 124 } 125 107 126 } // namespace WebCore 108 127 -
trunk/Source/WebCore/storage/IDBFactoryBackendImpl.h
r87313 r88358 60 60 private: 61 61 IDBFactoryBackendImpl(); 62 bool migrate(const String& name, SecurityOrigin*, const String& dataDir, int64_t maximumSize); 62 63 63 64 typedef HashMap<String, IDBDatabaseBackendImpl*> IDBDatabaseBackendMap; -
trunk/Source/WebCore/storage/IDBFactoryBackendInterface.h
r87313 r88358 54 54 enum BackingStoreType { 55 55 DefaultBackingStore, 56 LevelDBBackingStore 56 LevelDBBackingStore, 57 SQLiteBackingStore 57 58 }; 58 59 -
trunk/Source/WebCore/storage/IDBLevelDBBackingStore.cpp
r88146 r88358 1305 1305 } 1306 1306 1307 bool IDBLevelDBBackingStore::backingStoreExists(SecurityOrigin* securityOrigin, const String& pathBaseArg) 1308 { 1309 String pathBase = pathBaseArg; 1310 1311 if (pathBase.isEmpty()) 1312 return false; 1313 1314 // FIXME: We should eventually use the same LevelDB database for all origins. 1315 String path = pathByAppendingComponent(pathBase, securityOrigin->databaseIdentifier() + ".indexeddb.leveldb"); 1316 1317 // FIXME: It would be more thorough to open the database here but also more expensive. 1318 if (fileExists(path+"/CURRENT")) 1319 return true; 1320 1321 return false; 1322 } 1323 1307 1324 // FIXME: deleteDatabase should be part of IDBBackingStore. 1308 1325 -
trunk/Source/WebCore/storage/IDBLevelDBBackingStore.h
r87370 r88358 38 38 class LevelDBDatabase; 39 39 class LevelDBTransaction; 40 class IDBFactoryBackendImpl; 40 41 41 42 class IDBLevelDBBackingStore : public IDBBackingStore { … … 74 75 75 76 virtual PassRefPtr<Transaction> createTransaction(); 77 virtual IDBFactoryBackendInterface::BackingStoreType backingStoreType() const { return IDBFactoryBackendInterface::LevelDBBackingStore; } 78 79 static bool backingStoreExists(SecurityOrigin*, const String& pathBase); 76 80 77 81 private: -
trunk/Source/WebCore/storage/IDBSQLiteBackingStore.cpp
r87313 r88358 992 992 } 993 993 994 bool IDBSQLiteBackingStore::backingStoreExists(SecurityOrigin* securityOrigin, const String& pathBase) 995 { 996 String path = pathByAppendingComponent(pathBase, securityOrigin->databaseIdentifier() + ".indexeddb"); 997 998 SQLiteDatabase db; 999 if (!db.open(path)) 1000 return false; 1001 1002 db.close(); 1003 return true; 1004 } 1005 994 1006 namespace { 995 1007 -
trunk/Source/WebCore/storage/IDBSQLiteBackingStore.h
r87313 r88358 32 32 33 33 namespace WebCore { 34 35 class IDBFactoryBackendImpl; 34 36 35 37 class IDBSQLiteBackingStore : public IDBBackingStore { … … 68 70 69 71 virtual PassRefPtr<Transaction> createTransaction(); 72 virtual IDBFactoryBackendInterface::BackingStoreType backingStoreType() const { return IDBFactoryBackendInterface::SQLiteBackingStore; } 73 74 static bool backingStoreExists(SecurityOrigin*, const String& pathBase); 70 75 71 76 private: -
trunk/Source/WebKit/chromium/ChangeLog
r88351 r88358 1 2011-06-08 Greg Simon <gregsimon@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Control Indexeddb backends from LayoutTestController 6 https://bugs.webkit.org/show_bug.cgi?id=61000 7 8 * public/WebIDBFactory.h: 9 * src/AssertMatchingEnums.cpp: 10 * src/WebIDBFactoryImpl.cpp: 11 (WebKit::WebIDBFactory::setOverrideBackingStoreType): 12 (WebKit::WebIDBFactory::setTemporaryDatabaseFolder): 13 (WebKit::WebIDBFactoryImpl::open): 14 1 15 2011-06-08 Dominic Mazzoni <dmazzoni@google.com> 2 16 -
trunk/Source/WebKit/chromium/public/WebIDBFactory.h
r87313 r88358 54 54 enum BackingStoreType { 55 55 DefaultBackingStore, 56 LevelDBBackingStore 56 LevelDBBackingStore, 57 SQLiteBackingStore 57 58 }; 58 59 … … 61 62 62 63 virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } 64 65 // Used for DumpRenderTree tests. 66 WEBKIT_API static void setOverrideBackingStoreType(BackingStoreType); 67 WEBKIT_API static void setTemporaryDatabaseFolder(const WebString& path); 63 68 }; 64 69 -
trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
r88174 r88358 400 400 COMPILE_ASSERT_MATCHING_ENUM(WebIDBFactory::DefaultBackingStore, IDBFactoryBackendInterface::DefaultBackingStore); 401 401 COMPILE_ASSERT_MATCHING_ENUM(WebIDBFactory::LevelDBBackingStore, IDBFactoryBackendInterface::LevelDBBackingStore); 402 COMPILE_ASSERT_MATCHING_ENUM(WebIDBFactory::SQLiteBackingStore, IDBFactoryBackendInterface::SQLiteBackingStore); 402 403 403 404 #if ENABLE(FILE_SYSTEM) -
trunk/Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp
r87313 r88358 45 45 namespace WebKit { 46 46 47 static WebIDBFactory::BackingStoreType overriddenBackingStoreType = WebIDBFactory::DefaultBackingStore; 48 static WebString tempDatabaseFolder; 49 47 50 WebIDBFactory* WebIDBFactory::create() 48 51 { 49 52 return new WebIDBFactoryImpl(); 53 } 54 55 void WebIDBFactory::setOverrideBackingStoreType(BackingStoreType type) 56 { 57 overriddenBackingStoreType = type; 58 } 59 60 void WebIDBFactory::setTemporaryDatabaseFolder(const WebString& path) 61 { 62 tempDatabaseFolder = path; 50 63 } 51 64 … … 61 74 void WebIDBFactoryImpl::open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame*, const WebString& dataDir, unsigned long long maximumSize, BackingStoreType backingStoreType) 62 75 { 63 m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)), origin, 0, dataDir, maximumSize, static_cast<IDBFactoryBackendInterface::BackingStoreType>(backingStoreType)); 76 WebString path = dataDir; 77 if (overriddenBackingStoreType != DefaultBackingStore) { 78 backingStoreType = overriddenBackingStoreType; 79 80 // The dataDir is empty for two reasons: LevelDB in icognito mode or 81 // LevelDB from DumpRenderTree. The first case is taken care of inside 82 // IDBFactoryBackendImpl.cpp by forcing SQLITE backend for incognito. 83 // For the DumpRenderTree case we need to keep track of the location 84 // so we can wipe it out when we're done with the test. 85 if (dataDir.isEmpty() && backingStoreType == LevelDBBackingStore) 86 path = tempDatabaseFolder; 87 } 88 m_idbFactoryBackend->open(name, IDBCallbacksProxy::create(adoptPtr(callbacks)), origin, 0, path, maximumSize, static_cast<IDBFactoryBackendInterface::BackingStoreType>(backingStoreType)); 64 89 } 65 90 -
trunk/Tools/ChangeLog
r88353 r88358 1 2011-06-08 Greg Simon <gregsimon@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Control Indexeddb backends from LayoutTestController 6 https://bugs.webkit.org/show_bug.cgi?id=61000 7 8 * DumpRenderTree/chromium/LayoutTestController.cpp: 9 (LayoutTestController::LayoutTestController): 10 (LayoutTestController::setOverrideIndexedDBBackingStore): 11 (LayoutTestController::clearAllDatabases): 12 * DumpRenderTree/chromium/LayoutTestController.h: 13 1 14 2011-06-08 Andreas Kling <kling@webkit.org> 2 15 -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
r88174 r88358 45 45 #include "WebFrame.h" 46 46 #include "WebGeolocationClientMock.h" 47 #include "WebIDBFactory.h" 47 48 #include "WebInputElement.h" 48 49 #include "WebKit.h" … … 84 85 // by CppBoundClass, the parent to LayoutTestController). 85 86 bindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteboardOnDrag); 87 bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult); 86 88 bindMethod("addOriginAccessWhitelistEntry", &LayoutTestController::addOriginAccessWhitelistEntry); 87 89 bindMethod("addUserScript", &LayoutTestController::addUserScript); … … 163 165 bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError); 164 166 bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition); 165 bindMethod(" addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult);167 bindMethod("setOverrideIndexedDBBackingStore", &LayoutTestController::setOverrideIndexedDBBackingStore); 166 168 bindMethod("setPageVisibility", &LayoutTestController::setPageVisibility); 167 169 bindMethod("setPluginsEnabled", &LayoutTestController::setPluginsEnabled); … … 1146 1148 // We don't use the WebKit icon database. 1147 1149 result->setNull(); 1150 } 1151 1152 void LayoutTestController::setOverrideIndexedDBBackingStore(const CppArgumentList& arguments, CppVariant* result) 1153 { 1154 result->setNull(); 1155 #if ENABLE(INDEXED_DATABASE) 1156 if (arguments.size() < 1 || !arguments[0].isString()) 1157 return; 1158 string name = arguments[0].toString(); 1159 if (name == "default") 1160 WebIDBFactory::setOverrideBackingStoreType(WebIDBFactory::DefaultBackingStore); 1161 else if (name == "sqlite") 1162 WebIDBFactory::setOverrideBackingStoreType(WebIDBFactory::SQLiteBackingStore); 1163 else if (name == "leveldb") { 1164 WebIDBFactory::setOverrideBackingStoreType(WebIDBFactory::LevelDBBackingStore); 1165 1166 m_tempFolder = adoptPtr(webkit_support::CreateScopedTempDirectory()); 1167 if (m_tempFolder) { 1168 if (m_tempFolder->CreateUniqueTempDir()) 1169 WebIDBFactory::setTemporaryDatabaseFolder(WebString::fromUTF8(m_tempFolder->path().c_str())); 1170 } 1171 } 1172 #endif 1148 1173 } 1149 1174 … … 1525 1550 result->setNull(); 1526 1551 webkit_support::ClearAllDatabases(); 1552 m_tempFolder.clear(); 1527 1553 } 1528 1554 -
trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h
r88010 r88358 57 57 } 58 58 59 namespace webkit_support { 60 class ScopedTempDirectory; 61 } 62 59 63 class TestShell; 60 64 … … 307 311 // Sets the default quota for all origins 308 312 void setDatabaseQuota(const CppArgumentList&, CppVariant*); 313 // Overrides the backend for IndexedDB 314 void setOverrideIndexedDBBackingStore(const CppArgumentList&, CppVariant*); 309 315 310 316 // Calls setlocale(LC_ALL, ...) for a specified locale. … … 600 606 CppVariant m_globalFlag; 601 607 608 // Used to create and destroy temporary folders. 609 OwnPtr<webkit_support::ScopedTempDirectory> m_tempFolder; 610 602 611 // Bound variable counting the number of top URLs visited. 603 612 CppVariant m_webHistoryItemCount;
Note: See TracChangeset
for help on using the changeset viewer.