PageConfiguration::progressTrackerClient should use a smart pointer
https://bugs.webkit.org/show_bug.cgi?id=204854
Reviewed by Alex Christensen.
Source/WebCore:
* loader/EmptyClients.cpp:
(WebCore::pageConfigurationWithEmptyClients):
* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::ProgressTracker):
(WebCore::ProgressTracker::progressStarted):
(WebCore::ProgressTracker::progressCompleted):
(WebCore::ProgressTracker::finalProgressComplete):
(WebCore::ProgressTracker::incrementProgress):
(WebCore::ProgressTracker::~ProgressTracker): Deleted.
* loader/ProgressTracker.h:
(WebCore::ProgressTracker::client):
* loader/ProgressTrackerClient.h:
(WebCore::ProgressTrackerClient::progressTrackerDestroyed): Deleted.
* page/Page.cpp:
(WebCore::Page::Page):
* page/PageConfiguration.cpp:
(WebCore::PageConfiguration::PageConfiguration):
* page/PageConfiguration.h:
Source/WebKit:
* WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
(WebKit::WebProgressTrackerClient::progressTrackerDestroyed): Deleted.
* WebProcess/WebCoreSupport/WebProgressTrackerClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_overriddenMediaType):
Source/WebKitLegacy:
* PlatformWin.cmake:
Source/WebKitLegacy/mac:
* WebCoreSupport/WebProgressTrackerClient.h:
* WebCoreSupport/WebProgressTrackerClient.mm:
(WebProgressTrackerClient::progressTrackerDestroyed): Deleted.
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
Source/WebKitLegacy/win:
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::progressStarted): Deleted.
(WebFrameLoaderClient::progressEstimateChanged): Deleted.
(WebFrameLoaderClient::progressFinished): Deleted.
* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebProgressTrackerClient.cpp: Added.
(WebProgressTrackerClient::progressStarted):
(WebProgressTrackerClient::progressEstimateChanged):
(WebProgressTrackerClient::progressFinished):
* WebCoreSupport/WebProgressTrackerClient.h: Added.
* WebView.cpp:
(WebView::initWithFrame):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253135 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9675ad6..bbeed6d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2019-12-04 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::progressTrackerClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204854
+
+ Reviewed by Alex Christensen.
+
+ * loader/EmptyClients.cpp:
+ (WebCore::pageConfigurationWithEmptyClients):
+ * loader/ProgressTracker.cpp:
+ (WebCore::ProgressTracker::ProgressTracker):
+ (WebCore::ProgressTracker::progressStarted):
+ (WebCore::ProgressTracker::progressCompleted):
+ (WebCore::ProgressTracker::finalProgressComplete):
+ (WebCore::ProgressTracker::incrementProgress):
+ (WebCore::ProgressTracker::~ProgressTracker): Deleted.
+ * loader/ProgressTracker.h:
+ (WebCore::ProgressTracker::client):
+ * loader/ProgressTrackerClient.h:
+ (WebCore::ProgressTrackerClient::progressTrackerDestroyed): Deleted.
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/PageConfiguration.cpp:
+ (WebCore::PageConfiguration::PageConfiguration):
+ * page/PageConfiguration.h:
+
2019-12-04 Eric Carlson <eric.carlson@apple.com>
Make MediaPlayer::client() private
diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp
index 5ce9e11..600ef7b 100644
--- a/Source/WebCore/loader/EmptyClients.cpp
+++ b/Source/WebCore/loader/EmptyClients.cpp
@@ -553,7 +553,8 @@
LibWebRTCProvider::create(),
CacheStorageProvider::create(),
adoptRef(*new EmptyBackForwardClient),
- CookieJar::create(adoptRef(*new EmptyStorageSessionProvider))
+ CookieJar::create(adoptRef(*new EmptyStorageSessionProvider)),
+ makeUniqueRef<EmptyProgressTrackerClient>()
};
static NeverDestroyed<EmptyChromeClient> dummyChromeClient;
@@ -580,9 +581,6 @@
static NeverDestroyed<EmptyFrameLoaderClient> dummyFrameLoaderClient;
pageConfiguration.loaderClientForMainFrame = &dummyFrameLoaderClient.get();
- static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient;
- pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get();
-
pageConfiguration.diagnosticLoggingClient = makeUnique<EmptyDiagnosticLoggingClient>();
pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create({ }, { });
diff --git a/Source/WebCore/loader/ProgressTracker.cpp b/Source/WebCore/loader/ProgressTracker.cpp
index 2817a76..e24fded 100644
--- a/Source/WebCore/loader/ProgressTracker.cpp
+++ b/Source/WebCore/loader/ProgressTracker.cpp
@@ -77,16 +77,13 @@
unsigned long ProgressTracker::s_uniqueIdentifier = 0;
-ProgressTracker::ProgressTracker(ProgressTrackerClient& client)
- : m_client(client)
+ProgressTracker::ProgressTracker(UniqueRef<ProgressTrackerClient>&& client)
+ : m_client(WTFMove(client))
, m_progressHeartbeatTimer(*this, &ProgressTracker::progressHeartbeatTimerFired)
{
}
-ProgressTracker::~ProgressTracker()
-{
- m_client.progressTrackerDestroyed();
-}
+ProgressTracker::~ProgressTracker() = default;
double ProgressTracker::estimatedProgress() const
{
@@ -117,7 +114,7 @@
{
LOG(Progress, "Progress started (%p) - frame %p(\"%s\"), value %f, tracked frames %d, originating frame %p", this, &frame, frame.tree().uniqueName().string().utf8().data(), m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get());
- m_client.willChangeEstimatedProgress();
+ m_client->willChangeEstimatedProgress();
if (!m_numProgressTrackedFrames || m_originatingProgressFrame == &frame) {
reset();
@@ -133,13 +130,13 @@
static const auto subframePartOfMainLoadThreshold = 1_s;
m_isMainLoad = isMainFrame || elapsedTimeSinceMainLoadComplete < subframePartOfMainLoadThreshold;
- m_client.progressStarted(*m_originatingProgressFrame);
+ m_client->progressStarted(*m_originatingProgressFrame);
}
m_numProgressTrackedFrames++;
RELEASE_LOG_IF_ALLOWED("progressStarted: frame %p, value %f, tracked frames %d, originating frame %p, isMainLoad %d", &frame, m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get(), m_isMainLoad);
- m_client.didChangeEstimatedProgress();
+ m_client->didChangeEstimatedProgress();
InspectorInstrumentation::frameStartedLoading(frame);
}
@@ -151,13 +148,13 @@
if (m_numProgressTrackedFrames <= 0)
return;
- m_client.willChangeEstimatedProgress();
+ m_client->willChangeEstimatedProgress();
m_numProgressTrackedFrames--;
if (!m_numProgressTrackedFrames || m_originatingProgressFrame == &frame)
finalProgressComplete();
- m_client.didChangeEstimatedProgress();
+ m_client->didChangeEstimatedProgress();
}
void ProgressTracker::finalProgressComplete()
@@ -171,7 +168,7 @@
// with final progress value.
if (!m_finalProgressChangedSent) {
m_progressValue = 1;
- m_client.progressEstimateChanged(*frame);
+ m_client->progressEstimateChanged(*frame);
}
reset();
@@ -180,7 +177,7 @@
m_mainLoadCompletionTime = MonotonicTime::now();
frame->loader().client().setMainFrameDocumentReady(true);
- m_client.progressFinished(*frame);
+ m_client->progressFinished(*frame);
frame->loader().loadProgressingStatusChanged();
InspectorInstrumentation::frameStoppedLoading(*frame);
@@ -219,7 +216,7 @@
RefPtr<Frame> frame = m_originatingProgressFrame;
- m_client.willChangeEstimatedProgress();
+ m_client->willChangeEstimatedProgress();
double increment, percentOfRemainingBytes;
long long remainingBytes, estimatedBytesForPendingRequests;
@@ -259,14 +256,14 @@
if (m_progressValue == 1)
m_finalProgressChangedSent = true;
- m_client.progressEstimateChanged(*frame);
+ m_client->progressEstimateChanged(*frame);
m_lastNotifiedProgressValue = m_progressValue;
m_lastNotifiedProgressTime = now;
}
}
- m_client.didChangeEstimatedProgress();
+ m_client->didChangeEstimatedProgress();
}
void ProgressTracker::completeProgress(unsigned long identifier)
diff --git a/Source/WebCore/loader/ProgressTracker.h b/Source/WebCore/loader/ProgressTracker.h
index 4454051..433c8d9 100644
--- a/Source/WebCore/loader/ProgressTracker.h
+++ b/Source/WebCore/loader/ProgressTracker.h
@@ -39,11 +39,14 @@
struct ProgressItem;
class ProgressTracker {
- WTF_MAKE_NONCOPYABLE(ProgressTracker); WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(ProgressTracker);
+ WTF_MAKE_FAST_ALLOCATED;
public:
- explicit ProgressTracker(ProgressTrackerClient&);
+ explicit ProgressTracker(UniqueRef<ProgressTrackerClient>&&);
~ProgressTracker();
+ ProgressTrackerClient& client() { return m_client.get(); }
+
static unsigned long createUniqueIdentifier();
WEBCORE_EXPORT double estimatedProgress() const;
@@ -69,7 +72,7 @@
static unsigned long s_uniqueIdentifier;
- ProgressTrackerClient& m_client;
+ UniqueRef<ProgressTrackerClient> m_client;
RefPtr<Frame> m_originatingProgressFrame;
HashMap<unsigned long, std::unique_ptr<ProgressItem>> m_progressItems;
Timer m_progressHeartbeatTimer;
diff --git a/Source/WebCore/loader/ProgressTrackerClient.h b/Source/WebCore/loader/ProgressTrackerClient.h
index 30de265..362fcc4 100644
--- a/Source/WebCore/loader/ProgressTrackerClient.h
+++ b/Source/WebCore/loader/ProgressTrackerClient.h
@@ -30,11 +30,9 @@
class Frame;
class ProgressTrackerClient {
-protected:
- virtual ~ProgressTrackerClient() = default;
-
+ WTF_MAKE_FAST_ALLOCATED;
public:
- virtual void progressTrackerDestroyed() { }
+ virtual ~ProgressTrackerClient() = default;
virtual void willChangeEstimatedProgress() { }
virtual void didChangeEstimatedProgress() { }
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index db0b5fb..7f0e00d 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -233,7 +233,7 @@
, m_pointerLockController(makeUnique<PointerLockController>(*this))
#endif
, m_settings(Settings::create(this))
- , m_progress(makeUnique<ProgressTracker>(*pageConfiguration.progressTrackerClient))
+ , m_progress(makeUnique<ProgressTracker>(WTFMove(pageConfiguration.progressTrackerClient)))
, m_backForwardController(makeUnique<BackForwardController>(*this, WTFMove(pageConfiguration.backForwardClient)))
, m_mainFrame(Frame::create(this, nullptr, pageConfiguration.loaderClientForMainFrame))
, m_editorClient(WTFMove(pageConfiguration.editorClient))
diff --git a/Source/WebCore/page/PageConfiguration.cpp b/Source/WebCore/page/PageConfiguration.cpp
index 2d33d76..a698dae 100644
--- a/Source/WebCore/page/PageConfiguration.cpp
+++ b/Source/WebCore/page/PageConfiguration.cpp
@@ -36,6 +36,7 @@
#include "LibWebRTCProvider.h"
#include "PerformanceLoggingClient.h"
#include "PluginInfoProvider.h"
+#include "ProgressTrackerClient.h"
#include "SocketProvider.h"
#include "SpeechSynthesisClient.h"
#include "StorageNamespaceProvider.h"
@@ -51,11 +52,12 @@
namespace WebCore {
-PageConfiguration::PageConfiguration(PAL::SessionID sessionID, UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider, Ref<BackForwardClient>&& backForwardClient, Ref<CookieJar>&& cookieJar)
+PageConfiguration::PageConfiguration(PAL::SessionID sessionID, UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider, Ref<BackForwardClient>&& backForwardClient, Ref<CookieJar>&& cookieJar, UniqueRef<ProgressTrackerClient>&& progressTrackerClient)
: sessionID(sessionID)
, editorClient(WTFMove(editorClient))
, socketProvider(WTFMove(socketProvider))
, libWebRTCProvider(WTFMove(libWebRTCProvider))
+ , progressTrackerClient(WTFMove(progressTrackerClient))
, backForwardClient(WTFMove(backForwardClient))
, cookieJar(WTFMove(cookieJar))
, cacheStorageProvider(WTFMove(cacheStorageProvider))
diff --git a/Source/WebCore/page/PageConfiguration.h b/Source/WebCore/page/PageConfiguration.h
index 606d638..0928c3c 100644
--- a/Source/WebCore/page/PageConfiguration.h
+++ b/Source/WebCore/page/PageConfiguration.h
@@ -68,7 +68,7 @@
class PageConfiguration {
WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED;
public:
- WEBCORE_EXPORT PageConfiguration(PAL::SessionID, UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&, Ref<BackForwardClient>&&, Ref<CookieJar>&&);
+ WEBCORE_EXPORT PageConfiguration(PAL::SessionID, UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&, Ref<BackForwardClient>&&, Ref<CookieJar>&&, UniqueRef<ProgressTrackerClient>&&);
WEBCORE_EXPORT ~PageConfiguration();
PageConfiguration(PageConfiguration&&);
@@ -97,7 +97,7 @@
UniqueRef<LibWebRTCProvider> libWebRTCProvider;
std::unique_ptr<PlugInClient> plugInClient;
- ProgressTrackerClient* progressTrackerClient { nullptr };
+ UniqueRef<ProgressTrackerClient> progressTrackerClient;
Ref<BackForwardClient> backForwardClient;
Ref<CookieJar> cookieJar;
std::unique_ptr<ValidationMessageClient> validationMessageClient;
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index fb02a02..a10d796 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2019-12-04 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::progressTrackerClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204854
+
+ Reviewed by Alex Christensen.
+
+ * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
+ (WebKit::WebProgressTrackerClient::progressTrackerDestroyed): Deleted.
+ * WebProcess/WebCoreSupport/WebProgressTrackerClient.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_overriddenMediaType):
+
2019-12-04 Tim Horton <timothy_horton@apple.com>
Fix the iOS build
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
index af92b6d..b8277a6 100644
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp
@@ -39,12 +39,7 @@
: m_webPage(webPage)
{
}
-
-void WebProgressTrackerClient::progressTrackerDestroyed()
-{
- delete this;
-}
-
+
void WebProgressTrackerClient::progressStarted(Frame& originatingProgressFrame)
{
if (!originatingProgressFrame.isMainFrame())
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.h
index 63d774e..11482ee 100644
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.h
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebProgressTrackerClient.h
@@ -38,8 +38,6 @@
explicit WebProgressTrackerClient(WebPage&);
private:
- void progressTrackerDestroyed() override;
-
void progressStarted(WebCore::Frame& originatingProgressFrame) override;
void progressEstimateChanged(WebCore::Frame& originatingProgressFrame) override;
void progressFinished(WebCore::Frame& originatingProgressFrame) override;
diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
index 6ef8e45..35cdf49 100644
--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
@@ -449,7 +449,8 @@
makeUniqueRef<WebKit::LibWebRTCProvider>(),
WebProcess::singleton().cacheStorageProvider(),
WebBackForwardListProxy::create(*this),
- WebCookieJar::create()
+ WebCookieJar::create(),
+ makeUniqueRef<WebProgressTrackerClient>(*this)
);
pageConfiguration.chromeClient = new WebChromeClient(*this);
#if ENABLE(CONTEXT_MENUS)
@@ -465,7 +466,6 @@
pageConfiguration.plugInClient = makeUnique<WebPlugInClient>(*this);
pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
- pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
pageConfiguration.diagnosticLoggingClient = makeUnique<WebDiagnosticLoggingClient>(*this);
pageConfiguration.performanceLoggingClient = makeUnique<WebPerformanceLoggingClient>(*this);
diff --git a/Source/WebKitLegacy/ChangeLog b/Source/WebKitLegacy/ChangeLog
index 1ec5b2d..df9835b 100644
--- a/Source/WebKitLegacy/ChangeLog
+++ b/Source/WebKitLegacy/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-04 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::progressTrackerClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204854
+
+ Reviewed by Alex Christensen.
+
+ * PlatformWin.cmake:
+
2019-12-02 Fujii Hironori <Hironori.Fujii@sony.com>
[AppleWin] WebKitQuartzCoreAdditions.dll isn't compiled since r248444
diff --git a/Source/WebKitLegacy/PlatformWin.cmake b/Source/WebKitLegacy/PlatformWin.cmake
index 5fa0e76..1338c85 100644
--- a/Source/WebKitLegacy/PlatformWin.cmake
+++ b/Source/WebKitLegacy/PlatformWin.cmake
@@ -231,6 +231,8 @@
win/WebCoreSupport/WebPlatformStrategies.h
win/WebCoreSupport/WebPluginInfoProvider.cpp
win/WebCoreSupport/WebPluginInfoProvider.h
+ win/WebCoreSupport/WebProgressTrackerClient.cpp
+ win/WebCoreSupport/WebProgressTrackerClient.h
win/WebCoreSupport/WebVisitedLinkStore.cpp
win/WebCoreSupport/WebVisitedLinkStore.h
)
diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog
index a8c7723..42496c6 100644
--- a/Source/WebKitLegacy/mac/ChangeLog
+++ b/Source/WebKitLegacy/mac/ChangeLog
@@ -1,3 +1,17 @@
+2019-12-04 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::progressTrackerClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204854
+
+ Reviewed by Alex Christensen.
+
+ * WebCoreSupport/WebProgressTrackerClient.h:
+ * WebCoreSupport/WebProgressTrackerClient.mm:
+ (WebProgressTrackerClient::progressTrackerDestroyed): Deleted.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
2019-12-04 Tim Horton <timothy_horton@apple.com>
Introduce a GPU process
diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.h
index c38b460..2311e39 100644
--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.h
+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.h
@@ -35,8 +35,6 @@
explicit WebProgressTrackerClient(WebView*);
private:
- void progressTrackerDestroyed() override;
-
#if !PLATFORM(IOS_FAMILY)
void willChangeEstimatedProgress() override;
void didChangeEstimatedProgress() override;
diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.mm
index e237473..cc38ef1 100644
--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.mm
+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebProgressTrackerClient.mm
@@ -39,11 +39,6 @@
{
}
-void WebProgressTrackerClient::progressTrackerDestroyed()
-{
- delete this;
-}
-
#if !PLATFORM(IOS_FAMILY)
void WebProgressTrackerClient::willChangeEstimatedProgress()
{
diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm
index bdd6f0d..e2a71b1 100644
--- a/Source/WebKitLegacy/mac/WebView/WebView.mm
+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm
@@ -1437,7 +1437,8 @@
WebCore::LibWebRTCProvider::create(),
WebCore::CacheStorageProvider::create(),
BackForwardList::create(self),
- WebCore::CookieJar::create(storageProvider.copyRef())
+ WebCore::CookieJar::create(storageProvider.copyRef()),
+ makeUniqueRef<WebProgressTrackerClient>(self)
);
#if !PLATFORM(IOS_FAMILY)
pageConfiguration.chromeClient = new WebChromeClient(self);
@@ -1460,7 +1461,6 @@
pageConfiguration.alternativeTextClient = makeUnique<WebAlternativeTextClient>(self);
pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
- pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
pageConfiguration.applicationCacheStorage = &webApplicationCacheStorage();
pageConfiguration.databaseProvider = &WebDatabaseProvider::singleton();
pageConfiguration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
@@ -1706,7 +1706,8 @@
WebCore::LibWebRTCProvider::create(),
WebCore::CacheStorageProvider::create(),
BackForwardList::create(self),
- WebCore::CookieJar::create(storageProvider.copyRef())
+ WebCore::CookieJar::create(storageProvider.copyRef()),
+ makeUniqueRef<WebProgressTrackerClient>(self)
);
pageConfiguration.chromeClient = new WebChromeClientIOS(self);
#if ENABLE(DRAG_SUPPORT)
@@ -1719,7 +1720,6 @@
pageConfiguration.inspectorClient = new WebInspectorClient(self);
pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
- pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
pageConfiguration.applicationCacheStorage = &webApplicationCacheStorage();
pageConfiguration.databaseProvider = &WebDatabaseProvider::singleton();
pageConfiguration.storageNamespaceProvider = &_private->group->storageNamespaceProvider();
diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog
index 9a5a02a..dd296eb 100644
--- a/Source/WebKitLegacy/win/ChangeLog
+++ b/Source/WebKitLegacy/win/ChangeLog
@@ -1,3 +1,23 @@
+2019-12-04 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::progressTrackerClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204854
+
+ Reviewed by Alex Christensen.
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::progressStarted): Deleted.
+ (WebFrameLoaderClient::progressEstimateChanged): Deleted.
+ (WebFrameLoaderClient::progressFinished): Deleted.
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebProgressTrackerClient.cpp: Added.
+ (WebProgressTrackerClient::progressStarted):
+ (WebProgressTrackerClient::progressEstimateChanged):
+ (WebProgressTrackerClient::progressFinished):
+ * WebCoreSupport/WebProgressTrackerClient.h: Added.
+ * WebView.cpp:
+ (WebView::initWithFrame):
+
2019-12-03 Antoine Quint <graouts@apple.com>
[Web Animations] Add a runtime flag for Web Animations composite operations
diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
index b587cf9..eeae741 100644
--- a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -643,27 +643,6 @@
m_hasSentResponseToPlugin = false;
}
-void WebFrameLoaderClient::progressStarted(WebCore::Frame&)
-{
- static BSTR progressStartedName = SysAllocString(WebViewProgressStartedNotification);
- IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
- notifyCenter->postNotificationName(progressStartedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
-}
-
-void WebFrameLoaderClient::progressEstimateChanged(WebCore::Frame&)
-{
- static BSTR progressEstimateChangedName = SysAllocString(WebViewProgressEstimateChangedNotification);
- IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
- notifyCenter->postNotificationName(progressEstimateChangedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
-}
-
-void WebFrameLoaderClient::progressFinished(WebCore::Frame&)
-{
- static BSTR progressFinishedName = SysAllocString(WebViewProgressFinishedNotification);
- IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
- notifyCenter->postNotificationName(progressFinishedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
-}
-
void WebFrameLoaderClient::startDownload(const ResourceRequest& request, const String& /* suggestedName */)
{
m_webFrame->webView()->downloadURL(request.url());
diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h
index 676a8d6..cc86932 100644
--- a/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.h
@@ -41,9 +41,9 @@
class WebFramePolicyListener;
class WebHistory;
-class WebFrameLoaderClient : public WebCore::FrameLoaderClient, public WebCore::ProgressTrackerClient {
+class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
public:
- WebFrameLoaderClient(WebFrame* = 0);
+ WebFrameLoaderClient(WebFrame* = nullptr);
~WebFrameLoaderClient();
void setWebFrame(WebFrame* webFrame) { m_webFrame = webFrame; }
@@ -120,10 +120,6 @@
void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = String()) override;
- void progressStarted(WebCore::Frame&) override;
- void progressEstimateChanged(WebCore::Frame&) override;
- void progressFinished(WebCore::Frame&) override;
-
void committedLoad(WebCore::DocumentLoader*, const char*, int) override;
void finishedLoading(WebCore::DocumentLoader*) override;
diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebProgressTrackerClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebProgressTrackerClient.cpp
new file mode 100644
index 0000000..47f4acc
--- /dev/null
+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebProgressTrackerClient.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2006-2019 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.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "WebProgressTrackerClient.h"
+
+#include "WebNotificationCenter.h"
+#include "WebView.h"
+
+void WebProgressTrackerClient::progressStarted(WebCore::Frame&)
+{
+ static BSTR progressStartedName = SysAllocString(WebViewProgressStartedNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(progressStartedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
+}
+
+void WebProgressTrackerClient::progressEstimateChanged(WebCore::Frame&)
+{
+ static BSTR progressEstimateChangedName = SysAllocString(WebViewProgressEstimateChangedNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(progressEstimateChangedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
+}
+
+void WebProgressTrackerClient::progressFinished(WebCore::Frame&)
+{
+ static BSTR progressFinishedName = SysAllocString(WebViewProgressFinishedNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(progressFinishedName, static_cast<IWebView*>(m_webFrame->webView()), 0);
+}
diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebProgressTrackerClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebProgressTrackerClient.h
new file mode 100644
index 0000000..5e01cfb
--- /dev/null
+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebProgressTrackerClient.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2006-2019 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.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#pragma once
+
+#include <WebCore/ProgressTrackerClient.h>
+
+namespace WebCore {
+class Frame;
+}
+
+class WebFrame;
+
+class WebProgressTrackerClient final : public WebCore::ProgressTrackerClient {
+public:
+ void setWebFrame(WebFrame* webFrame) { m_webFrame = webFrame; }
+
+ void progressStarted(WebCore::Frame&) final;
+ void progressEstimateChanged(WebCore::Frame&) final;
+ void progressFinished(WebCore::Frame&) final;
+
+private:
+ WebFrame* m_webFrame { nullptr };
+};
diff --git a/Source/WebKitLegacy/win/WebView.cpp b/Source/WebKitLegacy/win/WebView.cpp
index 7ec4ff1..6014481 100644
--- a/Source/WebKitLegacy/win/WebView.cpp
+++ b/Source/WebKitLegacy/win/WebView.cpp
@@ -64,6 +64,7 @@
#include "WebPlatformStrategies.h"
#include "WebPluginInfoProvider.h"
#include "WebPreferences.h"
+#include "WebProgressTrackerClient.h"
#include "WebResourceLoadScheduler.h"
#include "WebScriptWorld.h"
#include "WebStorageNamespaceProvider.h"
@@ -3119,7 +3120,8 @@
makeUniqueRef<LibWebRTCProvider>(),
WebCore::CacheStorageProvider::create(),
BackForwardList::create(),
- CookieJar::create(storageProvider.copyRef())
+ CookieJar::create(storageProvider.copyRef()),
+ makeUniqueRef<WebProgressTrackerClient>()
);
configuration.chromeClient = new WebChromeClient(this);
configuration.contextMenuClient = new WebContextMenuClient(this);
@@ -3129,7 +3131,6 @@
configuration.applicationCacheStorage = &WebApplicationCache::storage();
configuration.databaseProvider = &WebDatabaseProvider::singleton();
configuration.storageNamespaceProvider = &m_webViewGroup->storageNamespaceProvider();
- configuration.progressTrackerClient = static_cast<WebFrameLoaderClient*>(configuration.loaderClientForMainFrame);
configuration.userContentProvider = &m_webViewGroup->userContentController();
configuration.visitedLinkStore = &m_webViewGroup->visitedLinkStore();
configuration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
@@ -3149,6 +3150,7 @@
WebFrame* webFrame = WebFrame::createInstance();
webFrame->initWithWebView(this, m_page);
static_cast<WebFrameLoaderClient&>(m_page->mainFrame().loader().client()).setWebFrame(webFrame);
+ static_cast<WebProgressTrackerClient&>(m_page->progress().client()).setWebFrame(webFrame);
m_mainFrame = webFrame;
webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.