Add types for DownloadID and TaskIdentifier
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Dec 2015 08:10:53 +0000 (08:10 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Dec 2015 08:10:53 +0000 (08:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152401

Reviewed by Brady Eidson.

DownloadID and TaskIdentifier used to both be just uint64_t's.
It is confusing to distinguish between them, so now they both have names.
We need a HashMap<TaskIdentifier, DownloadID> instead of a HashMap<uint64_t, uint64_t>.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::storageSession):
(WebKit::NetworkConnectionToWebProcess::startDownload):
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::downloadRequest):
(WebKit::NetworkProcess::resumeDownload):
(WebKit::NetworkProcess::cancelDownload):
(WebKit::NetworkProcess::getNetworkProcessStatistics):
(WebKit::NetworkProcess::logDiagnosticMessage):
(WebKit::NetworkProcess::logDiagnosticMessageWithResult):
(WebKit::NetworkProcess::logDiagnosticMessageWithValue):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSession::createDataTaskWithRequest):
(WebKit::NetworkSession::dataTaskForIdentifier):
(WebKit::NetworkDataTask::resume):
(WebKit::NetworkDataTask::taskIdentifier): Deleted.
* Shared/Downloads/Download.cpp:
(WebKit::Download::Download):
(WebKit::Download::messageSenderDestinationID):
* Shared/Downloads/Download.h:
(WebKit::Download::downloadID):
* Shared/Downloads/DownloadID.h: Added.
(WebKit::DownloadID::DownloadID):
(WebKit::DownloadID::operator==):
(WebKit::DownloadID::downloadID):
(IPC::ArgumentCoder<WebKit::DownloadID>::encode):
(IPC::ArgumentCoder<WebKit::DownloadID>::decode):
(WTF::DownloadIDHash::hash):
(WTF::DownloadIDHash::equal):
(WTF::HashTraits<WebKit::DownloadID>::emptyValue):
(WTF::HashTraits<WebKit::DownloadID>::constructDeletedValue):
(WTF::HashTraits<WebKit::DownloadID>::isDeletedValue):
* Shared/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::DownloadManager):
(WebKit::DownloadManager::startDownload):
(WebKit::DownloadManager::convertHandleToDownload):
(WebKit::DownloadManager::resumeDownload):
(WebKit::DownloadManager::cancelDownload):
* Shared/Downloads/DownloadManager.h:
(WebKit::DownloadManager::isDownloading):
* UIProcess/API/C/WKDownload.cpp:
(WKDownloadGetID):
(WKDownloadCopyRequest):
* UIProcess/Downloads/DownloadProxy.h:
(WebKit::DownloadProxy::downloadID):
(WebKit::DownloadProxy::request):
(WebKit::DownloadProxy::resumeData):
* UIProcess/Downloads/DownloadProxyMap.cpp:
(WebKit::DownloadProxyMap::createDownloadProxy):
(WebKit::DownloadProxyMap::downloadFinished):
(WebKit::DownloadProxyMap::processDidClose):
* UIProcess/Downloads/DownloadProxyMap.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::frameDidBecomeFrameSet):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseSync):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::invalidatePolicyListener):
(WebKit::WebFrame::didReceivePolicyDecision):
(WebKit::WebFrame::startDownload):
(WebKit::WebFrame::convertMainResourceLoadToDownload):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setSessionID):
(WebKit::WebPage::didReceivePolicyDecision):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

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

28 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcess.h
Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
Source/WebKit2/NetworkProcess/NetworkSession.h
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit2/Shared/Downloads/Download.cpp
Source/WebKit2/Shared/Downloads/Download.h
Source/WebKit2/Shared/Downloads/DownloadID.h [new file with mode: 0644]
Source/WebKit2/Shared/Downloads/DownloadManager.cpp
Source/WebKit2/Shared/Downloads/DownloadManager.h
Source/WebKit2/UIProcess/API/C/WKDownload.cpp
Source/WebKit2/UIProcess/Downloads/DownloadProxy.h
Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.cpp
Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 975a353..73045a6 100644 (file)
@@ -1,3 +1,97 @@
+2015-12-18  Alex Christensen  <achristensen@webkit.org>
+
+        Add types for DownloadID and TaskIdentifier
+        https://bugs.webkit.org/show_bug.cgi?id=152401
+
+        Reviewed by Brady Eidson.
+
+        DownloadID and TaskIdentifier used to both be just uint64_t's.
+        It is confusing to distinguish between them, so now they both have names.
+        We need a HashMap<TaskIdentifier, DownloadID> instead of a HashMap<uint64_t, uint64_t>.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::storageSession):
+        (WebKit::NetworkConnectionToWebProcess::startDownload):
+        (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
+        (WebKit::NetworkProcess::downloadRequest):
+        (WebKit::NetworkProcess::resumeDownload):
+        (WebKit::NetworkProcess::cancelDownload):
+        (WebKit::NetworkProcess::getNetworkProcessStatistics):
+        (WebKit::NetworkProcess::logDiagnosticMessage):
+        (WebKit::NetworkProcess::logDiagnosticMessageWithResult):
+        (WebKit::NetworkProcess::logDiagnosticMessageWithValue):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/NetworkSession.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSession::createDataTaskWithRequest):
+        (WebKit::NetworkSession::dataTaskForIdentifier):
+        (WebKit::NetworkDataTask::resume):
+        (WebKit::NetworkDataTask::taskIdentifier): Deleted.
+        * Shared/Downloads/Download.cpp:
+        (WebKit::Download::Download):
+        (WebKit::Download::messageSenderDestinationID):
+        * Shared/Downloads/Download.h:
+        (WebKit::Download::downloadID):
+        * Shared/Downloads/DownloadID.h: Added.
+        (WebKit::DownloadID::DownloadID):
+        (WebKit::DownloadID::operator==):
+        (WebKit::DownloadID::downloadID):
+        (IPC::ArgumentCoder<WebKit::DownloadID>::encode):
+        (IPC::ArgumentCoder<WebKit::DownloadID>::decode):
+        (WTF::DownloadIDHash::hash):
+        (WTF::DownloadIDHash::equal):
+        (WTF::HashTraits<WebKit::DownloadID>::emptyValue):
+        (WTF::HashTraits<WebKit::DownloadID>::constructDeletedValue):
+        (WTF::HashTraits<WebKit::DownloadID>::isDeletedValue):
+        * Shared/Downloads/DownloadManager.cpp:
+        (WebKit::DownloadManager::DownloadManager):
+        (WebKit::DownloadManager::startDownload):
+        (WebKit::DownloadManager::convertHandleToDownload):
+        (WebKit::DownloadManager::resumeDownload):
+        (WebKit::DownloadManager::cancelDownload):
+        * Shared/Downloads/DownloadManager.h:
+        (WebKit::DownloadManager::isDownloading):
+        * UIProcess/API/C/WKDownload.cpp:
+        (WKDownloadGetID):
+        (WKDownloadCopyRequest):
+        * UIProcess/Downloads/DownloadProxy.h:
+        (WebKit::DownloadProxy::downloadID):
+        (WebKit::DownloadProxy::request):
+        (WebKit::DownloadProxy::resumeData):
+        * UIProcess/Downloads/DownloadProxyMap.cpp:
+        (WebKit::DownloadProxyMap::createDownloadProxy):
+        (WebKit::DownloadProxyMap::downloadFinished):
+        (WebKit::DownloadProxyMap::processDidClose):
+        * UIProcess/Downloads/DownloadProxyMap.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::receivedPolicyDecision):
+        (WebKit::WebPageProxy::frameDidBecomeFrameSet):
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+        (WebKit::WebPageProxy::decidePolicyForResponse):
+        (WebKit::WebPageProxy::decidePolicyForResponseSync):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::invalidatePolicyListener):
+        (WebKit::WebFrame::didReceivePolicyDecision):
+        (WebKit::WebFrame::startDownload):
+        (WebKit::WebFrame::convertMainResourceLoadToDownload):
+        * WebProcess/WebPage/WebFrame.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setSessionID):
+        (WebKit::WebPage::didReceivePolicyDecision):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2015-12-17  Dan Bernstein  <mitz@apple.com>
 
         Fixed a typo from r194022.
index 8f61c1a..7dacae1 100644 (file)
@@ -177,12 +177,12 @@ static NetworkStorageSession& storageSession(SessionID sessionID)
     return NetworkStorageSession::defaultStorageSession();
 }
 
-void NetworkConnectionToWebProcess::startDownload(SessionID sessionID, uint64_t downloadID, const ResourceRequest& request)
+void NetworkConnectionToWebProcess::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request)
 {
     NetworkProcess::singleton().downloadManager().startDownload(sessionID, downloadID, request);
 }
 
-void NetworkConnectionToWebProcess::convertMainResourceLoadToDownload(WebCore::SessionID sessionID, uint64_t mainResourceLoadIdentifier, uint64_t downloadID, const ResourceRequest& request, const ResourceResponse& response)
+void NetworkConnectionToWebProcess::convertMainResourceLoadToDownload(SessionID sessionID, uint64_t mainResourceLoadIdentifier, DownloadID downloadID, const ResourceRequest& request, const ResourceResponse& response)
 {
     auto& networkProcess = NetworkProcess::singleton();
     if (!mainResourceLoadIdentifier) {
index e455bc7..c80f08a 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "BlockingResponseMap.h"
 #include "Connection.h"
+#include "DownloadID.h"
 #include "NetworkConnectionToWebProcessMessages.h"
 #include <WebCore/ResourceLoadPriority.h>
 #include <wtf/HashSet.h>
@@ -76,8 +77,8 @@ private:
     void removeLoadIdentifier(ResourceLoadIdentifier);
     void setDefersLoading(ResourceLoadIdentifier, bool);
     void crossOriginRedirectReceived(ResourceLoadIdentifier, const WebCore::URL& redirectURL);
-    void startDownload(WebCore::SessionID, uint64_t downloadID, const WebCore::ResourceRequest&);
-    void convertMainResourceLoadToDownload(WebCore::SessionID, uint64_t mainResourceLoadIdentifier, uint64_t downloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
+    void startDownload(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
+    void convertMainResourceLoadToDownload(WebCore::SessionID, uint64_t mainResourceLoadIdentifier, DownloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
 
     void cookiesForDOM(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&, String& result);
     void setCookiesFromDOM(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&, const String&);
index ac770d2..03fdd92 100644 (file)
@@ -29,8 +29,8 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver {
     SetDefersLoading(uint64_t resourceLoadIdentifier, bool defers)
     PrefetchDNS(String hostname)
 
-    StartDownload(WebCore::SessionID sessionID, uint64_t downloadID, WebCore::ResourceRequest request)
-    ConvertMainResourceLoadToDownload(WebCore::SessionID sessionID, uint64_t mainResourceLoadIdentifier, uint64_t downloadID, WebCore::ResourceRequest request, WebCore::ResourceResponse response)
+    StartDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
+    ConvertMainResourceLoadToDownload(WebCore::SessionID sessionID, uint64_t mainResourceLoadIdentifier, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, WebCore::ResourceResponse response)
 
     CookiesForDOM(WebCore::SessionID sessionID, WebCore::URL firstParty, WebCore::URL url) -> (String result)
     SetCookiesFromDOM(WebCore::SessionID sessionID, WebCore::URL firstParty, WebCore::URL url, String cookieString)
index 19abc9a..6968015 100644 (file)
@@ -432,17 +432,17 @@ void NetworkProcess::deleteWebsiteDataForOrigins(SessionID sessionID, uint64_t w
     completionHandler();
 }
 
-void NetworkProcess::downloadRequest(SessionID sessionID, uint64_t downloadID, const ResourceRequest& request)
+void NetworkProcess::downloadRequest(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request)
 {
     downloadManager().startDownload(sessionID, downloadID, request);
 }
 
-void NetworkProcess::resumeDownload(SessionID sessionID, uint64_t downloadID, const IPC::DataReference& resumeData, const String& path, const WebKit::SandboxExtension::Handle& sandboxExtensionHandle)
+void NetworkProcess::resumeDownload(SessionID sessionID, DownloadID downloadID, const IPC::DataReference& resumeData, const String& path, const WebKit::SandboxExtension::Handle& sandboxExtensionHandle)
 {
     downloadManager().resumeDownload(sessionID, downloadID, resumeData, path, sandboxExtensionHandle);
 }
 
-void NetworkProcess::cancelDownload(uint64_t downloadID)
+void NetworkProcess::cancelDownload(DownloadID downloadID)
 {
     downloadManager().cancelDownload(downloadID);
 }
@@ -474,7 +474,7 @@ void NetworkProcess::getNetworkProcessStatistics(uint64_t callbackID)
     parentProcessConnection()->send(Messages::WebProcessPool::DidGetStatistics(data, callbackID), 0);
 }
 
-void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String& message, const String& description, WebCore::ShouldSample shouldSample)
+void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String& message, const String& description, ShouldSample shouldSample)
 {
     if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
         return;
@@ -482,7 +482,7 @@ void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String& mess
     parentProcessConnection()->send(Messages::NetworkProcessProxy::LogSampledDiagnosticMessage(webPageID, message, description), 0);
 }
 
-void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const String& message, const String& description, WebCore::DiagnosticLoggingResultType result, WebCore::ShouldSample shouldSample)
+void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const String& message, const String& description, DiagnosticLoggingResultType result, ShouldSample shouldSample)
 {
     if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
         return;
@@ -490,7 +490,7 @@ void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const St
     parentProcessConnection()->send(Messages::NetworkProcessProxy::LogSampledDiagnosticMessageWithResult(webPageID, message, description, result), 0);
 }
 
-void NetworkProcess::logDiagnosticMessageWithValue(uint64_t webPageID, const String& message, const String& description, const String& value, WebCore::ShouldSample shouldSample)
+void NetworkProcess::logDiagnosticMessageWithValue(uint64_t webPageID, const String& message, const String& description, const String& value, ShouldSample shouldSample)
 {
     if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
         return;
index 543187a..c06f8a5 100644 (file)
@@ -149,9 +149,9 @@ private:
     // FIXME: This should take a session ID so we can identify which disk cache to delete.
     void clearDiskCache(std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler);
 
-    void downloadRequest(WebCore::SessionID, uint64_t downloadID, const WebCore::ResourceRequest&);
-    void resumeDownload(WebCore::SessionID, uint64_t downloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
-    void cancelDownload(uint64_t downloadID);
+    void downloadRequest(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
+    void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
+    void cancelDownload(DownloadID);
     void setCacheModel(uint32_t);
     void allowSpecificHTTPSCertificateForHost(const WebCore::CertificateInfo&, const String& host);
     void setCanHandleHTTPSServerTrustEvaluation(bool);
index 76a13f0..5c55893 100644 (file)
@@ -39,9 +39,9 @@ messages -> NetworkProcess LegacyReceiver {
     DeleteWebsiteData(WebCore::SessionID sessionID, uint64_t websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
     DeleteWebsiteDataForOrigins(WebCore::SessionID sessionID, uint64_t websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, Vector<String> cookieHostNames, uint64_t callbackID)
 
-    DownloadRequest(WebCore::SessionID sessionID, uint64_t downloadID, WebCore::ResourceRequest request)
-    ResumeDownload(WebCore::SessionID sessionID, uint64_t downloadID, IPC::DataReference resumeData, String path, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
-    CancelDownload(uint64_t downloadID)
+    DownloadRequest(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
+    ResumeDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, IPC::DataReference resumeData, String path, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
+    CancelDownload(WebKit::DownloadID downloadID)
 
     SetProcessSuppressionEnabled(bool flag)
 #if PLATFORM(COCOA)
index 86d4246..9992dde 100644 (file)
 #ifndef NetworkSession_h
 #define NetworkSession_h
 
+#if PLATFORM(COCOA)
 OBJC_CLASS NSURLSession;
 OBJC_CLASS NSURLSessionDataTask;
 OBJC_CLASS NSOperationQueue;
 OBJC_CLASS WKNetworkSessionDelegate;
+#endif
 
+#include "DownloadID.h"
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/SessionID.h>
 #include <wtf/HashMap.h>
@@ -80,7 +83,8 @@ public:
     void cancel();
     void resume();
 
-    uint64_t taskIdentifier();
+    typedef uint64_t TaskIdentifier;
+    TaskIdentifier taskIdentifier();
 
     ~NetworkDataTask();
 
@@ -112,11 +116,12 @@ public:
     
     Ref<NetworkDataTask> createDataTaskWithRequest(const WebCore::ResourceRequest&, NetworkSessionTaskClient&);
 
-    NetworkDataTask* dataTaskForIdentifier(uint64_t);
+    NetworkDataTask* dataTaskForIdentifier(NetworkDataTask::TaskIdentifier);
 
 private:
     WebCore::SessionID m_sessionID;
-    HashMap<uint64_t, NetworkDataTask*> m_dataTaskMap;
+    HashMap<NetworkDataTask::TaskIdentifier, NetworkDataTask*> m_dataTaskMap;
+    HashMap<NetworkDataTask::TaskIdentifier, DownloadID> m_downloadMap;
 #if PLATFORM(COCOA)
     RetainPtr<NSURLSession> m_session;
     RetainPtr<WKNetworkSessionDelegate> m_sessionDelegate;
index f527cbb..4cf302c 100644 (file)
@@ -240,7 +240,7 @@ Ref<NetworkDataTask> NetworkSession::createDataTaskWithRequest(const WebCore::Re
     return adoptRef(*new NetworkDataTask(*this, client, [m_session dataTaskWithRequest:request.nsURLRequest(WebCore::UpdateHTTPBody)]));
 }
 
-NetworkDataTask* NetworkSession::dataTaskForIdentifier(uint64_t taskIdentifier)
+NetworkDataTask* NetworkSession::dataTaskForIdentifier(NetworkDataTask::TaskIdentifier taskIdentifier)
 {
     ASSERT(isMainThread());
     return m_dataTaskMap.get(taskIdentifier);
@@ -274,7 +274,7 @@ void NetworkDataTask::resume()
     [m_task resume];
 }
 
-uint64_t NetworkDataTask::taskIdentifier()
+auto NetworkDataTask::taskIdentifier() -> TaskIdentifier
 {
     return [m_task taskIdentifier];
 }
index 5fde385..5bf6af2 100644 (file)
@@ -44,9 +44,9 @@ using namespace WebCore;
 namespace WebKit {
 
 #if USE(NETWORK_SESSION)
-Download::Download(DownloadManager& downloadManager, const NetworkSession& session, uint64_t downloadID, const ResourceRequest& request)
+Download::Download(DownloadManager& downloadManager, const NetworkSession& session, DownloadID downloadID, const ResourceRequest& request)
 #else
-Download::Download(DownloadManager& downloadManager, uint64_t downloadID, const ResourceRequest& request)
+Download::Download(DownloadManager& downloadManager, DownloadID downloadID, const ResourceRequest& request)
 #endif
     : m_downloadManager(downloadManager)
     , m_downloadID(downloadID)
@@ -55,7 +55,7 @@ Download::Download(DownloadManager& downloadManager, uint64_t downloadID, const
     , m_session(session)
 #endif
 {
-    ASSERT(m_downloadID);
+    ASSERT(m_downloadID.downloadID());
 
     m_downloadManager.didCreateDownload();
 }
@@ -162,7 +162,7 @@ IPC::Connection* Download::messageSenderConnection()
 
 uint64_t Download::messageSenderDestinationID()
 {
-    return m_downloadID;
+    return m_downloadID.downloadID();
 }
 
 } // namespace WebKit
index 630580f..14ee42a 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef Download_h
 #define Download_h
 
+#include "DownloadID.h"
 #include "MessageSender.h"
 #include "SandboxExtension.h"
 #include <WebCore/ResourceRequest.h>
@@ -76,9 +77,9 @@ class Download : public IPC::MessageSender {
     WTF_MAKE_NONCOPYABLE(Download);
 public:
 #if USE(NETWORK_SESSION)
-    Download(DownloadManager&, const NetworkSession&, uint64_t downloadID, const WebCore::ResourceRequest&);
+    Download(DownloadManager&, const NetworkSession&, DownloadID, const WebCore::ResourceRequest&);
 #else
-    Download(DownloadManager&, uint64_t downloadID, const WebCore::ResourceRequest&);
+    Download(DownloadManager&, DownloadID, const WebCore::ResourceRequest&);
 #endif
     ~Download();
 
@@ -91,7 +92,7 @@ public:
     void resume(const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
     void cancel();
 
-    uint64_t downloadID() const { return m_downloadID; }
+    DownloadID downloadID() const { return m_downloadID; }
 
     void didStart();
     void didReceiveAuthenticationChallenge(const WebCore::AuthenticationChallenge&);
@@ -128,7 +129,7 @@ private:
     void platformInvalidate();
 
     DownloadManager& m_downloadManager;
-    uint64_t m_downloadID;
+    DownloadID m_downloadID;
     WebCore::ResourceRequest m_request;
 
     RefPtr<SandboxExtension> m_sandboxExtension;
diff --git a/Source/WebKit2/Shared/Downloads/DownloadID.h b/Source/WebKit2/Shared/Downloads/DownloadID.h
new file mode 100644 (file)
index 0000000..24d06b3
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DownloadID_h
+#define DownloadID_h
+
+#include "ArgumentCoder.h"
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include <wtf/HashTraits.h>
+
+namespace WebKit {
+
+class DownloadID {
+public:
+    DownloadID()
+    {
+    }
+
+    explicit DownloadID(uint64_t downloadID)
+        : m_downloadID(downloadID)
+    {
+    }
+
+    bool operator==(DownloadID other) const { return m_downloadID == other.m_downloadID; }
+
+    uint64_t downloadID() const { return m_downloadID; }
+private:
+    uint64_t m_downloadID { 0 };
+};
+
+}
+
+namespace IPC {
+    
+template<> struct ArgumentCoder<WebKit::DownloadID> {
+    static void encode(ArgumentEncoder& encoder, const WebKit::DownloadID& downloadID)
+    {
+        encoder << downloadID.downloadID();
+    }
+    static bool decode(ArgumentDecoder& decoder, WebKit::DownloadID& downloadID)
+    {
+        uint64_t id;
+        if (!decoder.decode(id))
+            return false;
+
+        downloadID = WebKit::DownloadID(id);
+        
+        return true;
+    }
+};
+
+}
+
+namespace WTF {
+    
+struct DownloadIDHash {
+    static unsigned hash(const WebKit::DownloadID& d) { return intHash(d.downloadID()); }
+    static bool equal(const WebKit::DownloadID& a, const WebKit::DownloadID& b) { return a.downloadID() == b.downloadID(); }
+    static const bool safeToCompareToEmptyOrDeleted = true;
+};
+template<> struct HashTraits<WebKit::DownloadID> : GenericHashTraits<WebKit::DownloadID> {
+    static WebKit::DownloadID emptyValue() { return { }; }
+    
+    static void constructDeletedValue(WebKit::DownloadID& slot) { slot = WebKit::DownloadID(std::numeric_limits<uint64_t>::max()); }
+    static bool isDeletedValue(const WebKit::DownloadID& slot) { return slot.downloadID() == std::numeric_limits<uint64_t>::max(); }
+};
+template<> struct DefaultHash<WebKit::DownloadID> {
+    typedef DownloadIDHash Hash;
+};
+
+}
+#endif /* DownloadID_h */
index c385139..41f49dc 100644 (file)
@@ -41,7 +41,7 @@ DownloadManager::DownloadManager(Client* client)
 {
 }
 
-void DownloadManager::startDownload(SessionID sessionID, uint64_t downloadID, const ResourceRequest& request)
+void DownloadManager::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request)
 {
 #if USE(NETWORK_SESSION)
     auto* networkSession = SessionTracker::networkSession(sessionID);
@@ -58,7 +58,7 @@ void DownloadManager::startDownload(SessionID sessionID, uint64_t downloadID, co
 }
 
 #if !USE(NETWORK_SESSION)
-void DownloadManager::convertHandleToDownload(uint64_t downloadID, ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response)
+void DownloadManager::convertHandleToDownload(DownloadID downloadID, ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response)
 {
     auto download = std::make_unique<Download>(*this, downloadID, request);
 
@@ -68,7 +68,7 @@ void DownloadManager::convertHandleToDownload(uint64_t downloadID, ResourceHandl
 }
 #endif
 
-void DownloadManager::resumeDownload(WebCore::SessionID, uint64_t downloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle& sandboxExtensionHandle)
+void DownloadManager::resumeDownload(SessionID, DownloadID downloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle& sandboxExtensionHandle)
 {
 #if USE(NETWORK_SESSION)
     notImplemented();
@@ -82,7 +82,7 @@ void DownloadManager::resumeDownload(WebCore::SessionID, uint64_t downloadID, co
 #endif
 }
 
-void DownloadManager::cancelDownload(uint64_t downloadID)
+void DownloadManager::cancelDownload(DownloadID downloadID)
 {
     Download* download = m_downloads.get(downloadID);
     if (!download)
index d4f8504..9d7f3f8 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef DownloadManager_h
 #define DownloadManager_h
 
+#include "Download.h"
 #include "SandboxExtension.h"
 #include <WebCore/NotImplemented.h>
 #include <wtf/Forward.h>
@@ -69,14 +70,14 @@ public:
 
     explicit DownloadManager(Client*);
 
-    void startDownload(WebCore::SessionID, uint64_t downloadID, const WebCore::ResourceRequest&);
+    void startDownload(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
 #if !USE(NETWORK_SESSION)
-    void convertHandleToDownload(uint64_t downloadID, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
+    void convertHandleToDownload(DownloadID, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
 #endif
 
-    void resumeDownload(WebCore::SessionID, uint64_t downloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
+    void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
 
-    void cancelDownload(uint64_t downloadID);
+    void cancelDownload(DownloadID);
 
     void downloadFinished(Download*);
     bool isDownloading() const { return !m_downloads.isEmpty(); }
@@ -90,7 +91,7 @@ public:
 
 private:
     Client* m_client;
-    HashMap<uint64_t, std::unique_ptr<Download>> m_downloads;
+    HashMap<DownloadID, std::unique_ptr<Download>> m_downloads;
 };
 
 } // namespace WebKit
index 705cff0..abf93f1 100644 (file)
@@ -40,7 +40,7 @@ WKTypeID WKDownloadGetTypeID()
 
 uint64_t WKDownloadGetID(WKDownloadRef download)
 {
-    return toImpl(download)->downloadID();
+    return toImpl(download)->downloadID().downloadID();
 }
 
 WKURLRequestRef WKDownloadCopyRequest(WKDownloadRef download)
index 84dc0df..42b1e9d 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "APIObject.h"
 #include "Connection.h"
+#include "DownloadID.h"
 #include "SandboxExtension.h"
 #include <WebCore/ResourceRequest.h>
 #include <wtf/Forward.h>
@@ -54,7 +55,7 @@ public:
     static PassRefPtr<DownloadProxy> create(DownloadProxyMap&, WebProcessPool&, const WebCore::ResourceRequest&);
     ~DownloadProxy();
 
-    uint64_t downloadID() const { return m_downloadID; }
+    DownloadID downloadID() const { return m_downloadID; }
     const WebCore::ResourceRequest& request() const { return m_request; }
     API::Data* resumeData() const { return m_resumeData.get(); }
 
@@ -87,7 +88,7 @@ private:
 
     DownloadProxyMap& m_downloadProxyMap;
     RefPtr<WebProcessPool> m_processPool;
-    uint64_t m_downloadID;
+    DownloadID m_downloadID;
 
     RefPtr<API::Data> m_resumeData;
     WebCore::ResourceRequest m_request;
index a0bbaf0..b07c8d6 100644 (file)
@@ -49,18 +49,18 @@ DownloadProxy* DownloadProxyMap::createDownloadProxy(WebProcessPool& processPool
     RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(*this, processPool, resourceRequest);
     m_downloads.set(downloadProxy->downloadID(), downloadProxy);
 
-    m_process->addMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadProxy->downloadID(), *downloadProxy);
+    m_process->addMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadProxy->downloadID().downloadID(), *downloadProxy);
 
     return downloadProxy.get();
 }
 
 void DownloadProxyMap::downloadFinished(DownloadProxy* downloadProxy)
 {
-    uint64_t downloadID = downloadProxy->downloadID();
+    auto downloadID = downloadProxy->downloadID();
 
     ASSERT(m_downloads.contains(downloadID));
 
-    m_process->removeMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadID);
+    m_process->removeMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadID.downloadID());
     downloadProxy->invalidate();
     m_downloads.remove(downloadID);
 }
@@ -68,7 +68,7 @@ void DownloadProxyMap::downloadFinished(DownloadProxy* downloadProxy)
 void DownloadProxyMap::processDidClose()
 {
     // Invalidate all outstanding downloads.
-    for (HashMap<uint64_t, RefPtr<DownloadProxy>>::iterator::Values it = m_downloads.begin().values(), end = m_downloads.end().values(); it != end; ++it) {
+    for (auto it = m_downloads.begin().values(), end = m_downloads.end().values(); it != end; ++it) {
         (*it)->processDidClose();
         (*it)->invalidate();
     }
index 9fd5267..d60e5a8 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef DownloadProxyMap_h
 #define DownloadProxyMap_h
 
+#include "DownloadID.h"
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/PassRefPtr.h>
@@ -56,7 +57,7 @@ public:
 
 private:
     ChildProcessProxy* m_process;
-    HashMap<uint64_t, RefPtr<DownloadProxy>> m_downloads;
+    HashMap<DownloadID, RefPtr<DownloadProxy>> m_downloads;
 };
 
 } // namespace WebKit
index b2190c2..592aa11 100644 (file)
@@ -2015,7 +2015,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr
     if (action == PolicyIgnore)
         m_pageLoadState.clearPendingAPIRequestURL(transaction);
 
-    uint64_t downloadID = 0;
+    DownloadID downloadID = { };
     if (action == PolicyDownload) {
         // Create a download proxy.
         // FIXME: We should ensure that the downloadRequest is never empty.
@@ -3250,7 +3250,7 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
         m_frameSetLargestFrame = value ? m_mainFrame : 0;
 }
 
-void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const NavigationActionData& navigationActionData, uint64_t originatingFrameID, const SecurityOriginData& originatingFrameSecurityOrigin, const WebCore::ResourceRequest& originalRequest, const ResourceRequest& request, uint64_t listenerID, const UserData& userData, bool& receivedPolicyAction, uint64_t& newNavigationID, uint64_t& policyAction, uint64_t& downloadID)
+void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const NavigationActionData& navigationActionData, uint64_t originatingFrameID, const SecurityOriginData& originatingFrameSecurityOrigin, const WebCore::ResourceRequest& originalRequest, const ResourceRequest& request, uint64_t listenerID, const UserData& userData, bool& receivedPolicyAction, uint64_t& newNavigationID, uint64_t& policyAction, DownloadID& downloadID)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3359,7 +3359,7 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const SecurityOrigi
         m_policyClient->decidePolicyForResponse(*this, *frame, response, request, canShowMIMEType, WTF::move(listener), m_process->transformHandlesToObjects(userData.object()).get());
 }
 
-void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, const UserData& userData, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
+void WebPageProxy::decidePolicyForResponseSync(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, const ResourceResponse& response, const ResourceRequest& request, bool canShowMIMEType, uint64_t listenerID, const UserData& userData, bool& receivedPolicyAction, uint64_t& policyAction, DownloadID& downloadID)
 {
     PageClientProtector protector(m_pageClient);
 
index 78e505e..564841a 100644 (file)
@@ -32,6 +32,7 @@
 #include "AutoCorrectionCallback.h"
 #include "Connection.h"
 #include "ContextMenuContextData.h"
+#include "DownloadID.h"
 #include "DragControllerAction.h"
 #include "DrawingAreaProxy.h"
 #include "EditingRange.h"
@@ -1133,10 +1134,10 @@ private:
 
     void didDestroyNavigation(uint64_t navigationID);
 
-    void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const NavigationActionData&, uint64_t originatingFrameID, const WebCore::SecurityOriginData& originatingFrameSecurityOrigin, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, uint64_t& policyAction, uint64_t& downloadID);
+    void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const NavigationActionData&, uint64_t originatingFrameID, const WebCore::SecurityOriginData& originatingFrameSecurityOrigin, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, uint64_t& policyAction, DownloadID&);
     void decidePolicyForNewWindowAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, const NavigationActionData&, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, const UserData&);
     void decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&);
-    void decidePolicyForResponseSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
+    void decidePolicyForResponseSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& policyAction, DownloadID&);
     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&);
 
     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&);
@@ -1616,12 +1617,12 @@ private:
     const WebCore::ResourceRequest* m_decidePolicyForResponseRequest;
     bool m_syncMimeTypePolicyActionIsValid;
     WebCore::PolicyAction m_syncMimeTypePolicyAction;
-    uint64_t m_syncMimeTypePolicyDownloadID;
+    DownloadID m_syncMimeTypePolicyDownloadID;
 
     bool m_inDecidePolicyForNavigationAction;
     bool m_syncNavigationActionPolicyActionIsValid;
     WebCore::PolicyAction m_syncNavigationActionPolicyAction;
-    uint64_t m_syncNavigationActionPolicyDownloadID;
+    DownloadID m_syncNavigationActionPolicyDownloadID;
     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
 
     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
index ecddffb..2235c43 100644 (file)
@@ -105,8 +105,8 @@ messages -> WebPageProxy {
 #endif
 
     # Policy messages
-    DecidePolicyForResponseSync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, uint64_t policyAction, uint64_t downloadID)
-    DecidePolicyForNavigationAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, uint64_t originatingFrameID, struct WebCore::SecurityOriginData originatingFrameSecurityOrigin, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, uint64_t newNavigationID, uint64_t policyAction, uint64_t downloadID)
+    DecidePolicyForResponseSync(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, WebCore::ResourceResponse response, WebCore::ResourceRequest request, bool canShowMIMEType, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, uint64_t policyAction, WebKit::DownloadID downloadID)
+    DecidePolicyForNavigationAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, struct WebKit::NavigationActionData navigationActionData, uint64_t originatingFrameID, struct WebCore::SecurityOriginData originatingFrameSecurityOrigin, WebCore::ResourceRequest originalRequest, WebCore::ResourceRequest request, uint64_t listenerID, WebKit::UserData userData) -> (bool receivedPolicyAction, uint64_t newNavigationID, uint64_t policyAction, WebKit::DownloadID downloadID)
     DecidePolicyForNewWindowAction(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, struct WebKit::NavigationActionData navigationActionData, WebCore::ResourceRequest request, String frameName, uint64_t listenerID, WebKit::UserData userData)
     UnableToImplementPolicy(uint64_t frameID, WebCore::ResourceError error, WebKit::UserData userData)
 
index ccc0b6c..48eeb7f 100644 (file)
                5272B28A1406985D0096A5D0 /* StatisticsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5272B2881406985D0096A5D0 /* StatisticsData.cpp */; };
                5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5272B2891406985D0096A5D0 /* StatisticsData.h */; };
                528C37C1195CBB1A00D8B9CC /* WKBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               5C1426E11C23F50B00D41183 /* DownloadID.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C0932061C236011007AAA7C /* DownloadID.h */; };
                5C20CB9D1BB0DCFA00895BB1 /* NetworkSessionCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C20CB9B1BB0DCD200895BB1 /* NetworkSessionCocoa.mm */; };
                5C20CBA01BB1ECD800895BB1 /* NetworkSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */; };
                5C9B86131C223EAF00110F36 /* DownloadCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C9B86111C223E7900110F36 /* DownloadCocoa.mm */; };
                51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoader.h; path = NetworkProcess/NetworkResourceLoader.h; sourceTree = "<group>"; };
                5272B2881406985D0096A5D0 /* StatisticsData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatisticsData.cpp; sourceTree = "<group>"; };
                5272B2891406985D0096A5D0 /* StatisticsData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatisticsData.h; sourceTree = "<group>"; };
+               5C0932061C236011007AAA7C /* DownloadID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DownloadID.h; path = Downloads/DownloadID.h; sourceTree = "<group>"; };
                5C20CB9B1BB0DCD200895BB1 /* NetworkSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkSessionCocoa.mm; path = NetworkProcess/cocoa/NetworkSessionCocoa.mm; sourceTree = "<group>"; };
                5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSession.h; path = NetworkProcess/NetworkSession.h; sourceTree = "<group>"; };
                5C9B86111C223E7900110F36 /* DownloadCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadCocoa.mm; path = Downloads/cocoa/DownloadCocoa.mm; sourceTree = "<group>"; };
                518E8EF216B208F800E91429 /* Downloads */ = {
                        isa = PBXGroup;
                        children = (
+                               5C0932061C236011007AAA7C /* DownloadID.h */,
                                5C9B860E1C223E5400110F36 /* cocoa */,
                                2DA944A51884E93C00ED86DB /* ios */,
                                518E8F0416B2093700E91429 /* mac */,
                                BCB9F6A51123DD0D00A137E0 /* WKFramePolicyListener.h in Headers */,
                                E1AEA22F14687BDB00804569 /* WKFullKeyboardAccessWatcher.h in Headers */,
                                CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */,
+                               5C1426E11C23F50B00D41183 /* DownloadID.h in Headers */,
                                BC54CC1212D674EE005C67B0 /* WKGeolocationManager.h in Headers */,
                                BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */,
                                BC0E619812D6CD120012A72A /* WKGeolocationPosition.h in Headers */,
index a12b905..253be86 100644 (file)
@@ -694,7 +694,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceRespons
     uint64_t listenerID = m_frame->setUpPolicyListener(WTF::move(function));
     bool receivedPolicyAction;
     uint64_t policyAction;
-    uint64_t downloadID;
+    DownloadID downloadID;
 
     unsigned syncSendFlags = IPC::InformPlatformProcessWillSuspend;
     if (WebPage::synchronousMessagesShouldSpinRunLoop())
@@ -702,7 +702,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceRespons
 
     WebCore::Frame* coreFrame = m_frame ? m_frame->coreFrame() : nullptr;
     if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForResponseSync(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), response, request, canShowMIMEType, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForResponseSync::Reply(receivedPolicyAction, policyAction, downloadID), std::chrono::milliseconds::max(), syncSendFlags)) {
-        m_frame->didReceivePolicyDecision(listenerID, PolicyIgnore, 0, 0);
+        m_frame->didReceivePolicyDecision(listenerID, PolicyIgnore, 0, { });
         return;
     }
 
@@ -775,7 +775,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat
     bool receivedPolicyAction;
     uint64_t newNavigationID;
     uint64_t policyAction;
-    uint64_t downloadID;
+    DownloadID downloadID;
 
     RefPtr<WebFrame> originatingFrame;
     switch (action->navigationType()) {
@@ -814,7 +814,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat
     // Notify the UIProcess.
     WebCore::Frame* originatingCoreFrame = originatingFrame ? originatingFrame->coreFrame() : nullptr;
     if (!webPage->sendSync(Messages::WebPageProxy::DecidePolicyForNavigationAction(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), documentLoader->navigationID(), navigationActionData, originatingFrame ? originatingFrame->frameID() : 0, SecurityOriginData::fromFrame(originatingCoreFrame), navigationAction.resourceRequest(), request, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())), Messages::WebPageProxy::DecidePolicyForNavigationAction::Reply(receivedPolicyAction, newNavigationID, policyAction, downloadID))) {
-        m_frame->didReceivePolicyDecision(listenerID, PolicyIgnore, 0, 0);
+        m_frame->didReceivePolicyDecision(listenerID, PolicyIgnore, 0, { });
         return;
     }
 
index c37a7f9..ec05baa 100644 (file)
@@ -215,12 +215,12 @@ void WebFrame::invalidatePolicyListener()
     if (!m_policyListenerID)
         return;
 
-    m_policyDownloadID = 0;
+    m_policyDownloadID = { };
     m_policyListenerID = 0;
     m_policyFunction = 0;
 }
 
-void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action, uint64_t navigationID, uint64_t downloadID)
+void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action, uint64_t navigationID, DownloadID downloadID)
 {
     if (!m_coreFrame)
         return;
@@ -248,10 +248,10 @@ void WebFrame::didReceivePolicyDecision(uint64_t listenerID, PolicyAction action
 
 void WebFrame::startDownload(const WebCore::ResourceRequest& request)
 {
-    ASSERT(m_policyDownloadID);
+    ASSERT(m_policyDownloadID.downloadID());
 
-    uint64_t policyDownloadID = m_policyDownloadID;
-    m_policyDownloadID = 0;
+    auto policyDownloadID = m_policyDownloadID;
+    m_policyDownloadID = { };
 
     auto& webProcess = WebProcess::singleton();
     SessionID sessionID = page() ? page()->sessionID() : SessionID::defaultSessionID();
@@ -260,10 +260,10 @@ void WebFrame::startDownload(const WebCore::ResourceRequest& request)
 
 void WebFrame::convertMainResourceLoadToDownload(DocumentLoader* documentLoader, SessionID sessionID, const ResourceRequest& request, const ResourceResponse& response)
 {
-    ASSERT(m_policyDownloadID);
+    ASSERT(m_policyDownloadID.downloadID());
 
-    uint64_t policyDownloadID = m_policyDownloadID;
-    m_policyDownloadID = 0;
+    auto policyDownloadID = m_policyDownloadID;
+    m_policyDownloadID = { };
 
     SubresourceLoader* mainResourceLoader = documentLoader->mainResourceLoader();
 
index 9fb1984..4e3a0b7 100644 (file)
@@ -27,6 +27,7 @@
 #define WebFrame_h
 
 #include "APIObject.h"
+#include "DownloadID.h"
 #include "ShareableBitmap.h"
 #include "WKBase.h"
 #include "WebFrameLoaderClient.h"
@@ -80,7 +81,7 @@ public:
 
     uint64_t setUpPolicyListener(WebCore::FramePolicyFunction);
     void invalidatePolicyListener();
-    void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, uint64_t downloadID);
+    void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, DownloadID);
 
     void startDownload(const WebCore::ResourceRequest&);
     void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, WebCore::SessionID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
@@ -170,7 +171,7 @@ private:
 
     uint64_t m_policyListenerID;
     WebCore::FramePolicyFunction m_policyFunction;
-    uint64_t m_policyDownloadID;
+    DownloadID m_policyDownloadID;
 
     std::unique_ptr<WebFrameLoaderClient> m_frameLoaderClient;
     LoadListener* m_loadListener;
index c268f07..8fe67d1 100644 (file)
@@ -2408,7 +2408,7 @@ void WebPage::setSessionID(SessionID sessionID)
     m_page->setSessionID(sessionID);
 }
 
-void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID)
+void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, DownloadID downloadID)
 {
     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     if (!frame)
index e058c69..51d5353 100644 (file)
@@ -30,6 +30,7 @@
 #include "APIInjectedBundlePageContextMenuClient.h"
 #include "APIInjectedBundlePageUIClient.h"
 #include "APIObject.h"
+#include "Download.h"
 #include "FindController.h"
 #include "GeolocationPermissionRequestManager.h"
 #include "ImageOptions.h"
@@ -1043,7 +1044,7 @@ private:
     void platformPreferencesDidChange(const WebPreferencesStore&);
     void updatePreferences(const WebPreferencesStore&);
 
-    void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID);
+    void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, DownloadID);
     void setUserAgent(const String&);
     void setCustomTextEncodingName(const String&);
     void suspendActiveDOMObjectsAndAnimations();
index 38180e5..4889de6 100644 (file)
@@ -141,7 +141,7 @@ messages -> WebPage LegacyReceiver {
 
     DidRemoveBackForwardItem(uint64_t backForwardItemID)
 
-    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID)
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, WebKit::DownloadID downloadID)
 
     ClearSelection()
     RestoreSelectionInFocusedEditableElement()