Make one able to set the local storage (tracker) database dir's path
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 23:32:37 +0000 (23:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 23:32:37 +0000 (23:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77006

Patch by Gustavo Lima Chaves <glima@profusion.mobi> on 2012-02-01
Reviewed by Darin Adler.

There are no behavior changes with the diff, so no need for new tests.

* storage/StorageTracker.cpp:
(WebCore::StorageTracker::setDatabaseDirectoryPath):
(WebCore):
(WebCore::StorageTracker::databaseDirectoryPath):
* storage/StorageTracker.h:
(StorageTracker):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106506 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/storage/StorageTracker.cpp
Source/WebCore/storage/StorageTracker.h

index 2743af3..5c00a7c 100644 (file)
@@ -1,3 +1,19 @@
+2012-02-01  Gustavo Lima Chaves  <glima@profusion.mobi>
+
+        Make one able to set the local storage (tracker) database dir's path
+        https://bugs.webkit.org/show_bug.cgi?id=77006
+
+        Reviewed by Darin Adler.
+
+        There are no behavior changes with the diff, so no need for new tests.
+
+        * storage/StorageTracker.cpp:
+        (WebCore::StorageTracker::setDatabaseDirectoryPath):
+        (WebCore):
+        (WebCore::StorageTracker::databaseDirectoryPath):
+        * storage/StorageTracker.h:
+        (StorageTracker):
+
 2012-02-01  Anders Carlsson  <andersca@apple.com>
 
         Fix Window build.
index 4e5c105..f981e6b 100644 (file)
@@ -94,6 +94,31 @@ StorageTracker::StorageTracker(const String& storagePath)
 {
 }
 
+void StorageTracker::setDatabaseDirectoryPath(const String& path)
+{
+    MutexLocker lockStorage(m_databaseGuard);
+
+    if (m_database.isOpen())
+        m_database.close();
+
+    m_storageDirectoryPath = path.isolatedCopy();
+
+    {
+        MutexLocker lockOrigins(m_originSetGuard);
+        m_originSet.clear();
+    }
+
+    if (!m_isActive)
+        return;
+
+    importOriginIdentifiers();
+}
+
+String StorageTracker::databaseDirectoryPath() const
+{
+    return m_storageDirectoryPath.isolatedCopy();
+}
+
 String StorageTracker::trackerDatabasePath()
 {
     ASSERT(!m_databaseGuard.tryLock());
index c8e2175..d7cb824 100644 (file)
@@ -47,6 +47,9 @@ public:
     static void initializeTracker(const String& storagePath, StorageTrackerClient*);
     static StorageTracker& tracker();
 
+    void setDatabaseDirectoryPath(const String&);
+    String databaseDirectoryPath() const;
+
     void setOriginDetails(const String& originIdentifier, const String& databaseFile);
     
     void deleteAllOrigins();