2011-02-22  Charlie Reis  <creis@chromium.org>

        Reviewed by Darin Fisher.

        Remove DatabasePolicy from FrameLoaderTypes
        https://bugs.webkit.org/show_bug.cgi?id=54968

        The DatabasePolicy enum is no longer needed now that we avoid stopping
        loaders on same-document navigations.

        Existing test: storage/hash-change-with-xhr.html

        * WebCore.exp.in:
        * loader/DocumentLoader.cpp:
        * loader/DocumentLoader.h:
        * loader/FrameLoader.cpp:
        * loader/FrameLoader.h:
        * loader/FrameLoaderTypes.h:
        * workers/WorkerThread.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index e8a7c41..9ff10ad 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -209,7 +209,7 @@
 // one document at a time, but one document may have many related resources. 
 // stopLoading will stop all loads initiated by the data source, 
 // but not loads initiated by child frames' data sources -- that's the WebFrame's job.
-void DocumentLoader::stopLoading(DatabasePolicy databasePolicy)
+void DocumentLoader::stopLoading()
 {
     // In some rare cases, calling FrameLoader::stopLoading could set m_loading to false.
     // (This can happen when there's a single XMLHttpRequest currently loading and stopLoading causes it
@@ -222,7 +222,7 @@
         Document* doc = m_frame->document();
         
         if (loading || doc->parsing())
-            m_frame->loader()->stopLoading(UnloadEventPolicyNone, databasePolicy);
+            m_frame->loader()->stopLoading(UnloadEventPolicyNone);
     }
 
     // Always cancel multipart loaders
diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h
index b92b384..8e9ab8f 100644
--- a/Source/WebCore/loader/DocumentLoader.h
+++ b/Source/WebCore/loader/DocumentLoader.h
@@ -100,7 +100,7 @@
         
         void replaceRequestURLForSameDocumentNavigation(const KURL&);
         bool isStopping() const { return m_isStopping; }
-        void stopLoading(DatabasePolicy = DatabasePolicyStop);
+        void stopLoading();
         void setCommitted(bool committed) { m_committed = committed; }
         bool isCommitted() const { return m_committed; }
         bool isLoading() const { return m_loading; }
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index c9fca8d..2065675 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -362,7 +362,7 @@
     targetFrame->navigationScheduler()->scheduleFormSubmission(submission);
 }
 
-void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolicy databasePolicy)
+void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy)
 {
     if (m_frame->document() && m_frame->document()->parser())
         m_frame->document()->parser()->stopParsing();
@@ -429,10 +429,7 @@
             cachedResourceLoader->cancelRequests();
 
 #if ENABLE(DATABASE)
-        if (databasePolicy == DatabasePolicyStop)
-            doc->stopDatabases(0);
-#else
-    UNUSED_PARAM(databasePolicy);
+        doc->stopDatabases(0);
 #endif
     }
 
@@ -1688,13 +1685,13 @@
     return false;
 }
 
-void FrameLoader::stopLoadingSubframes(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy)
+void FrameLoader::stopLoadingSubframes(ClearProvisionalItemPolicy clearProvisionalItemPolicy)
 {
     for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->loader()->stopAllLoaders(databasePolicy, clearProvisionalItemPolicy);
+        child->loader()->stopAllLoaders(clearProvisionalItemPolicy);
 }
 
-void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy)
+void FrameLoader::stopAllLoaders(ClearProvisionalItemPolicy clearProvisionalItemPolicy)
 {
     ASSERT(!m_frame->document() || !m_frame->document()->inPageCache());
     if (m_pageDismissalEventBeingDispatched)
@@ -1713,11 +1710,11 @@
     if (clearProvisionalItemPolicy == ShouldClearProvisionalItem)
         history()->setProvisionalItem(0);
 
-    stopLoadingSubframes(databasePolicy, clearProvisionalItemPolicy);
+    stopLoadingSubframes(clearProvisionalItemPolicy);
     if (m_provisionalDocumentLoader)
-        m_provisionalDocumentLoader->stopLoading(databasePolicy);
+        m_provisionalDocumentLoader->stopLoading();
     if (m_documentLoader)
-        m_documentLoader->stopLoading(databasePolicy);
+        m_documentLoader->stopLoading();
 
     setProvisionalDocumentLoader(0);
     
@@ -2379,7 +2376,7 @@
                 // FIXME: can stopping loading here possibly have any effect, if isLoading is false,
                 // which it must be to be in this branch of the if? And is it OK to just do a full-on
                 // stopAllLoaders instead of stopLoadingSubframes?
-                stopLoadingSubframes(DatabasePolicyStop, ShouldNotClearProvisionalItem);
+                stopLoadingSubframes(ShouldNotClearProvisionalItem);
                 pdl->stopLoading();
 
                 // If we're in the middle of loading multipart data, we need to restore the document loader.
@@ -2984,7 +2981,7 @@
 
     FrameLoadType type = policyChecker()->loadType();
     // A new navigation is in progress, so don't clear the history's provisional item.
-    stopAllLoaders(DatabasePolicyStop, ShouldNotClearProvisionalItem);
+    stopAllLoaders(ShouldNotClearProvisionalItem);
     
     // <rdar://problem/6250856> - In certain circumstances on pages with multiple frames, stopAllLoaders()
     // might detach the current FrameLoader, in which case we should bail on this newly defunct load. 
diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h
index a9e24c4..d59eb16 100644
--- a/Source/WebCore/loader/FrameLoader.h
+++ b/Source/WebCore/loader/FrameLoader.h
@@ -128,8 +128,7 @@
     bool canHandleRequest(const ResourceRequest&);
 
     // Also not cool.
-    // FIXME: We no longer need DatabasePolicy, since we always stop databases now.
-    void stopAllLoaders(DatabasePolicy = DatabasePolicyStop, ClearProvisionalItemPolicy = ShouldClearProvisionalItem);
+    void stopAllLoaders(ClearProvisionalItemPolicy = ShouldClearProvisionalItem);
     void stopForUserCancel(bool deferCheckLoadComplete = false);
 
     bool isLoadingMainResource() const { return m_isLoadingMainResource; }
@@ -222,7 +221,7 @@
     void submitForm(PassRefPtr<FormSubmission>);
 
     void stop();
-    void stopLoading(UnloadEventPolicy, DatabasePolicy = DatabasePolicyStop);
+    void stopLoading(UnloadEventPolicy);
     bool closeURL();
 
     void didExplicitOpen();
@@ -353,7 +352,7 @@
     void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType loadType, bool isMainResource, bool cookiePolicyURLFromRequest);
 
     // Also not cool.
-    void stopLoadingSubframes(DatabasePolicy, ClearProvisionalItemPolicy);
+    void stopLoadingSubframes(ClearProvisionalItemPolicy);
 
     void clearProvisionalLoad();
     void markLoadComplete();
diff --git a/Source/WebCore/loader/FrameLoaderTypes.h b/Source/WebCore/loader/FrameLoaderTypes.h
index 9f63c44..79c05dc 100644
--- a/Source/WebCore/loader/FrameLoaderTypes.h
+++ b/Source/WebCore/loader/FrameLoaderTypes.h
@@ -69,11 +69,6 @@
         NavigationTypeOther
     };
 
-    enum DatabasePolicy {
-        DatabasePolicyStop,    // The database thread should be stopped and database connections closed.
-        DatabasePolicyContinue
-    };
-    
     enum ClearProvisionalItemPolicy {
         ShouldClearProvisionalItem,
         ShouldNotClearProvisionalItem