[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 16:07:19 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e2b562fc09ddaa3291518a6178c6c19b33604d21
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 18 20:06:49 2010 +0000
Keep the web process alive if there are active downloads
https://bugs.webkit.org/show_bug.cgi?id=49755
Reviewed by Sam Weinig.
Make sure that Download objects are destroyed when the download finishes or fails.
Don't close the web process if there are live Download objects.
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::didFail):
Add stub.
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Downloads/DownloadProxy.messages.in:
Add DidFail message.
* WebProcess/Downloads/Download.cpp:
(WebKit::Download::didFinish):
Call DownloadManager::downloadFinished.
(WebKit::Download::didFail):
Send DidFail message and call DownloadManager::downloadFinished.
* WebProcess/Downloads/Download.h:
(WebKit::Download::destinationID):
Call downloadID().
(WebKit::Download::downloadID):
Return the download ID.
* WebProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::downloadFinished):
Delete the Download object and call WebProcess::shutdownIfPossible.
* WebProcess/Downloads/DownloadManager.h:
(WebKit::DownloadManager::isDownloading):
Return whether the download manager has any active downloads.
* WebProcess/Downloads/mac/DownloadMac.mm:
(-[WKDownloadAsDelegate download:didFailWithError:]):
Call Download::didFail.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::removeWebPage):
Call shutdownIfPossible.
(WebKit::WebProcess::shutdownIfPossible):
New function. Don't shutdown if there are live pages or active downloads.
* WebProcess/WebProcess.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 01af19f..2e3861c 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,56 @@
+2010-11-18 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Keep the web process alive if there are active downloads
+ https://bugs.webkit.org/show_bug.cgi?id=49755
+
+ Make sure that Download objects are destroyed when the download finishes or fails.
+ Don't close the web process if there are live Download objects.
+
+ * UIProcess/Downloads/DownloadProxy.cpp:
+ (WebKit::DownloadProxy::didFail):
+ Add stub.
+
+ * UIProcess/Downloads/DownloadProxy.h:
+ * UIProcess/Downloads/DownloadProxy.messages.in:
+ Add DidFail message.
+
+ * WebProcess/Downloads/Download.cpp:
+ (WebKit::Download::didFinish):
+ Call DownloadManager::downloadFinished.
+
+ (WebKit::Download::didFail):
+ Send DidFail message and call DownloadManager::downloadFinished.
+
+ * WebProcess/Downloads/Download.h:
+ (WebKit::Download::destinationID):
+ Call downloadID().
+
+ (WebKit::Download::downloadID):
+ Return the download ID.
+
+ * WebProcess/Downloads/DownloadManager.cpp:
+ (WebKit::DownloadManager::downloadFinished):
+ Delete the Download object and call WebProcess::shutdownIfPossible.
+
+ * WebProcess/Downloads/DownloadManager.h:
+ (WebKit::DownloadManager::isDownloading):
+ Return whether the download manager has any active downloads.
+
+ * WebProcess/Downloads/mac/DownloadMac.mm:
+ (-[WKDownloadAsDelegate download:didFailWithError:]):
+ Call Download::didFail.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::removeWebPage):
+ Call shutdownIfPossible.
+
+ (WebKit::WebProcess::shutdownIfPossible):
+ New function. Don't shutdown if there are live pages or active downloads.
+
+ * WebProcess/WebProcess.h:
+
2010-11-18 Steve Falkenburg <sfalken at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
index b3c6efc..265b535 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.cpp
@@ -119,5 +119,10 @@ void DownloadProxy::didFinish()
m_webContext->downloadClient().didFinish(m_webContext, this);
}
+void DownloadProxy::didFail(const ResourceError&)
+{
+ // FIXME: Implement.
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.h b/WebKit2/UIProcess/Downloads/DownloadProxy.h
index a7a5511..762d808 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.h
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.h
@@ -33,6 +33,7 @@
#include <wtf/PassRefPtr.h>
namespace WebCore {
+ class ResourceError;
class ResourceResponse;
}
@@ -68,6 +69,7 @@ private:
void decideDestinationWithSuggestedFilename(const String& filename, String& destination, bool& allowOverwrite);
void didCreateDestination(const String& path);
void didFinish();
+ void didFail(const WebCore::ResourceError&);
WebContext* m_webContext;
uint64_t m_downloadID;
diff --git a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
index 9ccf4d0..d29a090 100644
--- a/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
+++ b/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in
@@ -28,4 +28,5 @@ messages -> DownloadProxy {
DecideDestinationWithSuggestedFilename(String filename) -> (String destination, bool allowOverwrite)
DidCreateDestination(WTF::String path)
DidFinish()
+ DidFail(WebCore::ResourceError error)
}
diff --git a/WebKit2/WebProcess/Downloads/Download.cpp b/WebKit2/WebProcess/Downloads/Download.cpp
index 62f106f..129e295 100644
--- a/WebKit2/WebProcess/Downloads/Download.cpp
+++ b/WebKit2/WebProcess/Downloads/Download.cpp
@@ -27,6 +27,7 @@
#include "Connection.h"
#include "DownloadProxyMessages.h"
+#include "DownloadManager.h"
#include "WebCoreArgumentCoders.h"
#include "WebProcess.h"
@@ -97,6 +98,15 @@ void Download::didCreateDestination(const String& path)
void Download::didFinish()
{
send(Messages::DownloadProxy::DidFinish());
+
+ DownloadManager::shared().downloadFinished(this);
+}
+
+void Download::didFail(const WebCore::ResourceError& error)
+{
+ send(Messages::DownloadProxy::DidFail(error));
+
+ DownloadManager::shared().downloadFinished(this);
}
} // namespace WebKit
diff --git a/WebKit2/WebProcess/Downloads/Download.h b/WebKit2/WebProcess/Downloads/Download.h
index 3474b8f..c31dd3b 100644
--- a/WebKit2/WebProcess/Downloads/Download.h
+++ b/WebKit2/WebProcess/Downloads/Download.h
@@ -43,6 +43,7 @@ class WKDownloadAsDelegate;
#endif
namespace WebCore {
+ class ResourceError;
class ResourceHandle;
class ResourceResponse;
}
@@ -60,11 +61,13 @@ public:
// Used by MessageSender.
CoreIPC::Connection* connection() const;
- uint64_t destinationID() const { return m_downloadID; }
+ uint64_t destinationID() const { return downloadID(); }
void start(WebPage* initiatingWebPage);
void startWithHandle(WebPage* initiatingPage, WebCore::ResourceHandle*, const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&);
+ uint64_t downloadID() const { return m_downloadID; }
+
void didStart();
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
@@ -72,6 +75,7 @@ public:
String decideDestinationWithSuggestedFilename(const String& filename, bool& allowOverwrite);
void didCreateDestination(const String& path);
void didFinish();
+ void didFail(const WebCore::ResourceError&);
private:
Download(uint64_t downloadID, const WebCore::ResourceRequest&);
diff --git a/WebKit2/WebProcess/Downloads/DownloadManager.cpp b/WebKit2/WebProcess/Downloads/DownloadManager.cpp
index f0488fb..b3acad5 100644
--- a/WebKit2/WebProcess/Downloads/DownloadManager.cpp
+++ b/WebKit2/WebProcess/Downloads/DownloadManager.cpp
@@ -26,7 +26,7 @@
#include "DownloadManager.h"
#include "Download.h"
-#include "NotImplemented.h"
+#include "WebProcess.h"
#include <wtf/StdLibExtras.h>
using namespace WebCore;
@@ -61,4 +61,14 @@ void DownloadManager::convertHandleToDownload(uint64_t downloadID, WebPage* init
m_downloads.set(downloadID, download.leakPtr());
}
+void DownloadManager::downloadFinished(Download* download)
+{
+ ASSERT(m_downloads.contains(download->downloadID()));
+ m_downloads.remove(download->downloadID());
+
+ delete download;
+
+ WebProcess::shared().shutdownIfPossible();
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/Downloads/DownloadManager.h b/WebKit2/WebProcess/Downloads/DownloadManager.h
index 19bbe8c..0245bb6 100644
--- a/WebKit2/WebProcess/Downloads/DownloadManager.h
+++ b/WebKit2/WebProcess/Downloads/DownloadManager.h
@@ -49,6 +49,9 @@ public:
void startDownload(uint64_t downloadID, WebPage* initiatingPage, const WebCore::ResourceRequest&);
void convertHandleToDownload(uint64_t downloadID, WebPage* initiatingPage, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest& initialRequest, const WebCore::ResourceResponse&);
+ void downloadFinished(Download*);
+ bool isDownloading() const { return !m_downloads.isEmpty(); }
+
private:
DownloadManager();
diff --git a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
index e943848..099470a 100644
--- a/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
+++ b/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
@@ -262,8 +262,8 @@ void Download::platformInvalidate()
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
{
- // FIXME: Implement.
- notImplemented();
+ if (_download)
+ _download->didFail(error);
}
@end
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index 5ffa301..ef858c5 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -25,6 +25,7 @@
#include "WebProcess.h"
+#include "DownloadManager.h"
#include "InjectedBundle.h"
#include "InjectedBundleMessageKinds.h"
#include "InjectedBundleUserMessageCoders.h"
@@ -410,9 +411,7 @@ void WebProcess::removeWebPage(uint64_t pageID)
{
m_pageMap.remove(pageID);
- // If we don't have any pages left, shut down.
- if (m_pageMap.isEmpty() && !m_inDidClose)
- shutdown();
+ shutdownIfPossible();
}
bool WebProcess::isSeparateProcess() const
@@ -421,12 +420,23 @@ bool WebProcess::isSeparateProcess() const
return m_runLoop == RunLoop::main();
}
-void WebProcess::shutdown()
+void WebProcess::shutdownIfPossible()
{
+ if (!m_pageMap.isEmpty())
+ return;
+
+ if (m_inDidClose)
+ return;
+
+ if (DownloadManager::shared().isDownloading())
+ return;
+
// Keep running forever if we're running in the same process.
if (!isSeparateProcess())
return;
+ // Actually shut down the process.
+
#ifndef NDEBUG
gcController().garbageCollectNow();
cache()->setDisabled(true);
diff --git a/WebKit2/WebProcess/WebProcess.h b/WebKit2/WebProcess/WebProcess.h
index efccdfc..2e54659 100644
--- a/WebKit2/WebProcess/WebProcess.h
+++ b/WebKit2/WebProcess/WebProcess.h
@@ -83,9 +83,11 @@ public:
static WebCore::PageGroup* sharedPageGroup();
+ // Will shut down the web process if there are no live pages or downloads.
+ void shutdownIfPossible();
+
private:
WebProcess();
- void shutdown();
void initializeWebProcess(const WebProcessCreationParameters&, CoreIPC::ArgumentDecoder*);
void setShouldTrackVisitedLinks(bool);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list