WebCore:
authorbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2007 23:02:02 +0000 (23:02 +0000)
committerbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2007 23:02:02 +0000 (23:02 +0000)
        Reviewed by Anders

        <rdar://5554130> DatabaseTracker.o has a global initializer

        Since DatabaseTracker is a singleton, it makes much more sense to keep the database path as a member variable.
        Now constructing the shared DatabaseTracker no longer implicitly opens it - It is only opened when the databases
        path is set.

        * WebCore.vcproj/WebCore.vcproj: Copy WebCore/storage headers for WebKit build

        * storage/Database.cpp:
        (WebCore::Database::~Database): Remove bogus assertion

        * storage/DatabaseTracker.cpp:
        (WebCore::DatabaseTracker::DatabaseTracker): Does nothing now!  Move this code to openTrackerDatabase
        (WebCore::DatabaseTracker::setDatabasePath): Set the member variable, also closing/opening the database if needed
        (WebCore::DatabaseTracker::databasePath):
        (WebCore::DatabaseTracker::openTrackerDatabase): To open and validate the Databases db, moved from the c'tor
        (WebCore::DatabaseTracker::fullPathForDatabase): Return the member variable
        * storage/DatabaseTracker.h:

WebKit/win:
        Reviewed by Anders

        Windows portion of <rdar://5554130>

        Slowly introduce Windows WebKit portion of the Database API that sets the
        on-disk location for databases

        * WebDatabaseManager.cpp: Added.
        (WebKitSetWebDatabasesPathIfNecessary):
        * WebDatabaseManager.h: Added.

        * WebKit.vcproj/WebKit.vcproj:

        * WebView.cpp:
        (WebView::initWithFrame): Call WebKitSetWebDatabasesPathIfNecessary()

WebKit:
        Reviewed by Anders

        <rdar://problem/5554130> DatabaseTracker.o has a global initializer

        * Misc/WebDatabaseManager.mm:
        (WebKitSetWebDatabasesPathIfNecessary): Call the member function instead of a static one

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

12 files changed:
WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/storage/Database.cpp
WebCore/storage/DatabaseTracker.cpp
WebCore/storage/DatabaseTracker.h
WebKit/ChangeLog
WebKit/Misc/WebDatabaseManager.mm
WebKit/win/ChangeLog
WebKit/win/WebDatabaseManager.cpp [new file with mode: 0644]
WebKit/win/WebDatabaseManager.h [new file with mode: 0644]
WebKit/win/WebKit.vcproj/WebKit.vcproj
WebKit/win/WebView.cpp

index 7db974a7c858a0b33877946632c9ecda64830d61..11873cb5bde8c00e4dc5855d556801a411965d5a 100644 (file)
@@ -1,3 +1,26 @@
+2007-10-24  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Anders
+
+        <rdar://5554130> DatabaseTracker.o has a global initializer
+
+        Since DatabaseTracker is a singleton, it makes much more sense to keep the database path as a member variable.
+        Now constructing the shared DatabaseTracker no longer implicitly opens it - It is only opened when the databases 
+        path is set.
+        
+        * WebCore.vcproj/WebCore.vcproj: Copy WebCore/storage headers for WebKit build
+        
+        * storage/Database.cpp:
+        (WebCore::Database::~Database): Remove bogus assertion
+        
+        * storage/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::DatabaseTracker): Does nothing now!  Move this code to openTrackerDatabase
+        (WebCore::DatabaseTracker::setDatabasePath): Set the member variable, also closing/opening the database if needed
+        (WebCore::DatabaseTracker::databasePath):
+        (WebCore::DatabaseTracker::openTrackerDatabase): To open and validate the Databases db, moved from the c'tor
+        (WebCore::DatabaseTracker::fullPathForDatabase): Return the member variable
+        * storage/DatabaseTracker.h:
+
 2007-10-24  David Hyatt  <hyatt@apple.com>
 
         Don't try to gap fill transformed selections.  Fix the invalidation of selection to use the clip to visible content
index 06c0399bb019e1454936a414d00795665032bf0a..6100fc0e1eee861f9c4aa94d246e0a68bded3598 100644 (file)
                        />\r
                        <Tool\r
                                Name="VCPostBuildEventTool"\r
-                               CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\bridge\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\events\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\misc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\scripts\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\kjs\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\page\inspector\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;"\r
+                               CommandLine="mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\config.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\loader\icon\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\history\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\html\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\graphics\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\platform\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\cf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\platform\network\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\platform\sql\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\platform\cairo\cairo\src\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bindings\js\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\bridge\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y &quot;$(ProjectDir)..\bridge\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\page\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\plugins\win\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\rendering\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\editing\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\dom\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\xml\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\css\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\events\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\misc\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\scripts\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\ksvg2\svg\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)..\storage\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\bindings\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\kjs\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\kjs&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\pcre\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode&quot;&#x0D;&#x0A;xcopy /y /d &quot;$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h&quot; &quot;$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;xcopy /y /d /s /exclude:xcopy.excludes &quot;$(ProjectDir)\..\page\inspector\*&quot; &quot;$(WebKitOutputDir)\bin\WebKit.resources\inspector&quot;&#x0D;&#x0A;"\r
                        />\r
                </Configuration>\r
        </Configurations>\r
index c80e2bc060ad83ee7f961f8363990f6488639f82..27099b2f0a5afc52cc6f3f777b87437b5207830a 100644 (file)
@@ -161,7 +161,6 @@ Database::~Database()
     if (hashSet->isEmpty()) {
         guidToDatabaseMap().remove(m_guid);
         delete hashSet;
-        ASSERT(guidToVersionMap().contains(m_guid));
         guidToVersionMap().remove(m_guid);
     }
 }
index 89c5ec1d5750cc9c3e4d41e5958cdee4fa5e6a1d..025179616d62bb5944a26356ee76121775fdda2b 100644 (file)
 
 namespace WebCore {
 
-String DatabaseTracker::s_databasePath;
-
-void DatabaseTracker::setDatabasePath(const String& path)
+DatabaseTracker& DatabaseTracker::tracker()
 {
-    s_databasePath = path;
+    static DatabaseTracker tracker;
+
+    return tracker;
 }
 
-const String& DatabaseTracker::databasePath()
+DatabaseTracker::DatabaseTracker()
 {
-    return s_databasePath;
 }
 
-DatabaseTracker& DatabaseTracker::tracker()
-{
-    static DatabaseTracker tracker;
+void DatabaseTracker::setDatabasePath(const String& path)
+{        
+    m_databasePath = path;
+    openTrackerDatabase();
+}
 
-    return tracker;
+const String& DatabaseTracker::databasePath()
+{
+    return m_databasePath;
 }
 
-DatabaseTracker::DatabaseTracker()
+void DatabaseTracker::openTrackerDatabase()
 {
-    String databasePath = DatabaseTracker::databasePath();
-    makeAllDirectories(databasePath);
-    databasePath = pathByAppendingComponent(databasePath, "Databases.db");
+    ASSERT(!m_database.isOpen());
+    
+    makeAllDirectories(m_databasePath);
+    String databasePath = pathByAppendingComponent(m_databasePath, "Databases.db");
 
     if (!m_database.open(databasePath)) {
         // FIXME: What do do here?
@@ -76,10 +80,9 @@ DatabaseTracker::DatabaseTracker()
         }
     }
 }
-
+    
 String DatabaseTracker::fullPathForDatabase(const String& origin, const String& name)
 {
-    String databasePath = DatabaseTracker::databasePath();
     SQLStatement statement(m_database, "SELECT path FROM Databases WHERE origin=? AND name=?;");
 
     if (statement.prepare() != SQLResultOk)
@@ -91,7 +94,7 @@ String DatabaseTracker::fullPathForDatabase(const String& origin, const String&
     int result = statement.step();
 
     if (result == SQLResultRow)
-        return pathByAppendingComponent(databasePath, statement.getColumnText16(0));
+        return pathByAppendingComponent(m_databasePath, statement.getColumnText16(0));
     if (result != SQLResultDone) {
         LOG_ERROR("Failed to retrieve filename from Database Tracker for origin %s, name %s", origin.ascii().data(), name.ascii().data());
         return "";
@@ -115,7 +118,7 @@ String DatabaseTracker::fullPathForDatabase(const String& origin, const String&
     String filename;
     do {
         ++seq;
-        filename = pathByAppendingComponent(databasePath, String::format("%016llx.db", seq));
+        filename = pathByAppendingComponent(m_databasePath, String::format("%016llx.db", seq));
     } while (fileExists(filename));
 
     sequenceStatement.finalize();
index d758cf71013e6979bddb9ecf50913e2fc0892885..ff46891a3d15fb70b1afe68c3982623c7ebf1af4 100644 (file)
@@ -39,8 +39,8 @@ namespace WebCore {
 
 class DatabaseTracker {
 public:
-    static void setDatabasePath(const String&);
-    static const String& databasePath();
+    void setDatabasePath(const String&);
+    const String& databasePath();
 
     String fullPathForDatabase(const String& origin, const String& name);
 
@@ -55,13 +55,15 @@ public:
 private:
     DatabaseTracker();
 
+    void openTrackerDatabase();
+    
     bool addDatabase(const String& origin, const String& name, const String& path);
     void populateOrigins();
 
     SQLDatabase m_database;
     mutable OwnPtr<HashSet<String> > m_origins;
 
-    static String s_databasePath;
+    String m_databasePath;
 };
 
 } // namespace WebCore
index 13651ea995c6ddd86504bb662d822fad49ae3a3f..a99275292fe1392dfa13aadfccb95d91ea78be75 100644 (file)
@@ -1,3 +1,12 @@
+2007-10-24  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Anders
+
+        <rdar://problem/5554130> DatabaseTracker.o has a global initializer
+
+        * Misc/WebDatabaseManager.mm:
+        (WebKitSetWebDatabasesPathIfNecessary): Call the member function instead of a static one
+
 2007-10-23  Mark Rowe  <mrowe@apple.com>
 
         Build fix for Eric's build fix in r26916.
index e3fa5bb2cf436292af9c90d078e2b0db8760ac14..b5bb9b08938f858e23a38fd645e7abd89173149e 100644 (file)
@@ -96,7 +96,7 @@ void WebKitSetWebDatabasesPathIfNecessary()
     if (!databasesDirectory)
         databasesDirectory = @"~/Library/WebKit/Databases";
 
-    DatabaseTracker::setDatabasePath([databasesDirectory stringByStandardizingPath]);
+    DatabaseTracker::tracker().setDatabasePath([databasesDirectory stringByStandardizingPath]);
 
     pathSet = YES;
 }
index bfa7a68130118e18aa0ff2e4d2a1b031723d3872..5296903758aaf2f445e67b4086c62685bf6651f5 100644 (file)
@@ -1,3 +1,21 @@
+2007-10-24  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Anders
+
+        Windows portion of <rdar://5554130> 
+        
+        Slowly introduce Windows WebKit portion of the Database API that sets the 
+        on-disk location for databases
+        
+        * WebDatabaseManager.cpp: Added.
+        (WebKitSetWebDatabasesPathIfNecessary):
+        * WebDatabaseManager.h: Added.
+        
+        * WebKit.vcproj/WebKit.vcproj:
+        
+        * WebView.cpp:
+        (WebView::initWithFrame): Call WebKitSetWebDatabasesPathIfNecessary()
+
 2007-10-24  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Sam, Steve and Darin.
diff --git a/WebKit/win/WebDatabaseManager.cpp b/WebKit/win/WebDatabaseManager.cpp
new file mode 100644 (file)
index 0000000..76674d2
--- /dev/null
@@ -0,0 +1,45 @@
+/*\r
+ * Copyright (C) 2007 Apple Inc. All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * 1.  Redistributions of source code must retain the above copyright\r
+ *     notice, this list of conditions and the following disclaimer.\r
+ * 2.  Redistributions in binary form must reproduce the above copyright\r
+ *     notice, this list of conditions and the following disclaimer in the\r
+ *     documentation and/or other materials provided with the distribution.\r
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of\r
+ *     its contributors may be used to endorse or promote products derived\r
+ *     from this software without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY\r
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ */\r
+#include "config.h"\r
+#include "WebDatabaseManager.h"\r
+\r
+#include <WebCore/DatabaseTracker.h>\r
+#include <WebCore/FileSystem.h>\r
+\r
+void WebKitSetWebDatabasesPathIfNecessary()\r
+{\r
+    static bool pathSet = false;\r
+    if (pathSet)\r
+        return;\r
+\r
+    WebCore::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");\r
+    WebCore::DatabaseTracker::tracker().setDatabasePath(databasesDirectory);\r
+\r
+    pathSet = true;\r
+}\r
+\r
diff --git a/WebKit/win/WebDatabaseManager.h b/WebKit/win/WebDatabaseManager.h
new file mode 100644 (file)
index 0000000..ee95a18
--- /dev/null
@@ -0,0 +1,32 @@
+/*\r
+ * Copyright (C) 2007 Apple Inc. All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ *\r
+ * 1.  Redistributions of source code must retain the above copyright\r
+ *     notice, this list of conditions and the following disclaimer.\r
+ * 2.  Redistributions in binary form must reproduce the above copyright\r
+ *     notice, this list of conditions and the following disclaimer in the\r
+ *     documentation and/or other materials provided with the distribution.\r
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of\r
+ *     its contributors may be used to endorse or promote products derived\r
+ *     from this software without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY\r
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ */\r
+#ifndef WebDatabaseManager_h\r
+#define WebDatabaseManager_h\r
+void WebKitSetWebDatabasesPathIfNecessary();\r
+\r
+#endif\r
index 6c9b7cef1285ffce99f1d13366d8d9516d404ac2..a8a8279240eb772c2f2f893b3afe46a737172c69 100644 (file)
                                RelativePath="..\WebContextMenuClient.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\WebDatabaseManager.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\WebDataSource.h"\r
                                >\r
                                RelativePath="..\WebContextMenuClient.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\WebDatabaseManager.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\WebDataSource.cpp"\r
                                >\r
index f37899cdb0340babdf23bf3140837c9c6f628bf4..3ed71581ce72f1d0d7115b5747d6a19ccfbad5b7 100644 (file)
@@ -30,6 +30,7 @@
 #include "CFDictionaryPropertyBag.h"
 #include "DOMCoreClasses.h"
 #include "IWebNotification.h"
+#include "WebDatabaseManager.h"
 #include "WebDebugProgram.h"
 #include "WebDocumentLoader.h"
 #include "WebEditorClient.h"
@@ -1814,6 +1815,8 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
 
     m_groupName = String(groupName, SysStringLen(groupName));
 
+    WebKitSetWebDatabasesPathIfNecessary();
+
     m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this));
     // FIXME: 4931464 - When we do cache pages on Windows this needs to be removed so the "should I cache this page?" check
     // in FrameLoader::provisionalLoadStarted() doesn't always fail