Skip to content

Commit d1189f6

Browse files
committed
fix to normalize with the old version
1 parent 61edb60 commit d1189f6

12 files changed

Lines changed: 163 additions & 503 deletions

Source/WebCore/PlatformQt.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
9090
platform/qt/QStyleFacade.h
9191
platform/qt/QStyleHelpers.h
9292
platform/qt/QWebPageClient.h
93-
platform/qt/ResourceLoadTrackerQt.h
9493
platform/qt/RenderThemeQt.h
9594
platform/qt/RenderThemeQStyle.h
9695
platform/qt/ScrollbarThemeQStyle.h
@@ -207,7 +206,6 @@ list(APPEND WebCore_SOURCES
207206
platform/qt/RenderThemeQStyle.cpp
208207
platform/qt/RenderThemeQt.cpp
209208
platform/qt/RenderThemeQtMobile.cpp
210-
platform/qt/ResourceLoadTrackerQt.cpp
211209
platform/qt/ScrollViewQt.cpp
212210
platform/qt/ScrollbarThemeQStyle.cpp
213211
platform/qt/ScrollbarThemeQt.cpp
@@ -239,7 +237,6 @@ QTWEBKIT_GENERATE_MOC_FILES_H(WebCore
239237
platform/network/qt/QNetworkReplyHandler.h
240238
platform/network/qt/QtMIMETypeSniffer.h
241239
platform/network/qt/SharedCookieJarQt.h
242-
platform/qt/ResourceLoadTrackerQt.h
243240
)
244241

245242
QTWEBKIT_GENERATE_MOC_FILE_H(WebCore platform/network/qt/NetworkStateNotifierPrivate.h platform/network/qt/NetworkStateNotifierQt.cpp)

Source/WebCore/loader/DocumentThreadableLoader.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,12 @@ void DocumentThreadableLoader::notifyFinished(CachedResource& resource, const Ne
474474
ASSERT(m_client);
475475
ASSERT_UNUSED(resource, &resource == m_resource);
476476

477+
#if PLATFORM(QT)
478+
LocalFrame* localFrame = document().frame();
479+
if (localFrame)
480+
localFrame->loader().client().dispatchDidFinishResourceLoad(resource);
481+
#endif
482+
477483
if (m_resource->errorOccurred())
478484
didFail(m_resource->resourceLoaderIdentifier(), m_resource->resourceError());
479485
else
@@ -595,6 +601,13 @@ void DocumentThreadableLoader::loadRequest(ResourceRequest&& request, SecurityCh
595601

596602
auto cachedResource = m_document->protectedCachedResourceLoader()->requestRawResource(WTFMove(newRequest));
597603
m_resource = cachedResource.value_or(nullptr);
604+
605+
#if PLATFORM(QT)
606+
LocalFrame* localFrame = document().frame();
607+
if (localFrame && m_resource.get())
608+
localFrame->loader().client().dispatchDidStartResourceLoad(*m_resource.get());
609+
#endif
610+
598611
if (CachedResourceHandle resource = m_resource)
599612
resource->addClient(*this);
600613
else

Source/WebCore/loader/ImageLoader.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ void ImageLoader::notifyFinished(CachedResource& resource, const NetworkLoadMetr
469469
{
470470
LOG_WITH_STREAM(LazyLoading, stream << "ImageLoader " << this << " notifyFinished - hasPendingLoadEvent " << m_hasPendingLoadEvent);
471471

472+
#if PLATFORM(QT)
473+
LocalFrame* localFrame = element().document().frame();
474+
if (localFrame)
475+
localFrame->loader().client().dispatchDidFinishResourceLoad(resource);
476+
#endif
477+
472478
ASSERT(m_failedLoadURL.isEmpty());
473479
ASSERT_UNUSED(resource, &resource == m_image.get());
474480

@@ -690,6 +696,12 @@ void ImageLoader::dispatchPendingBeforeLoadEvent()
690696
return;
691697
if (!element().document().hasLivingRenderTree())
692698
return;
699+
#if PLATFORM(QT)
700+
LocalFrame* localFrame = element().document().frame();
701+
if (localFrame)
702+
localFrame->loader().client().dispatchDidStartResourceLoad(*m_image.get());
703+
#endif
704+
693705
m_hasPendingBeforeLoadEvent = false;
694706
if (!element().isConnected())
695707
return;

Source/WebCore/loader/LocalFrameLoaderClient.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
#include <wtf/WeakRef.h>
4242
#include <wtf/text/WTFString.h>
4343

44+
#if PLATFORM(QT)
45+
#include "CachedResource.h"
46+
#endif
47+
4448
#if ENABLE(APPLICATION_MANIFEST)
4549
#include "ApplicationManifest.h"
4650
#endif
@@ -160,6 +164,10 @@ class WEBCORE_EXPORT LocalFrameLoaderClient : public FrameLoaderClient {
160164
virtual void dispatchDidFinishLoading(DocumentLoader*, IsMainResourceLoad, ResourceLoaderIdentifier) = 0;
161165
virtual void dispatchDidFailLoading(DocumentLoader*, IsMainResourceLoad, ResourceLoaderIdentifier, const ResourceError&) = 0;
162166
virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) = 0;
167+
#if PLATFORM(QT)
168+
virtual void dispatchDidStartResourceLoad(const CachedResource&) { }
169+
virtual void dispatchDidFinishResourceLoad(const CachedResource&) { }
170+
#endif
163171

164172
virtual void dispatchDidDispatchOnloadEvents() = 0;
165173
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;

Source/WebCore/loader/cache/CachedResourceLoader.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@
9393
#include <wtf/text/MakeString.h>
9494
#include <wtf/text/WTFString.h>
9595

96-
#if PLATFORM(QT)
97-
#include "ResourceLoadTrackerQt.h"
98-
#endif
9996

10097
#if ENABLE(APPLICATION_MANIFEST)
10198
#include "CachedApplicationManifest.h"
@@ -1126,10 +1123,6 @@ ResourceErrorOr<CachedResourceHandle<CachedResource>> CachedResourceLoader::requ
11261123

11271124
LOG(ResourceLoading, "CachedResourceLoader::requestResource '%.255s', charset '%s', priority=%d, forPreload=%u", url.stringCenterEllipsizedToLength().latin1().data(), request.charset().latin1().data(), request.priority() ? static_cast<int>(request.priority().value()) : -1, forPreload == ForPreload::Yes);
11281125

1129-
#if PLATFORM(QT)
1130-
ResourceLoadTrackerQt::instance().trackRequestStarted(url, type, request, frame.ptr());
1131-
#endif
1132-
11331126
request.setDestinationIfNotSet(destinationForType(type, frame));
11341127

11351128
// Entry point to https://fetch.spec.whatwg.org/#main-fetch.
@@ -1350,9 +1343,6 @@ ResourceErrorOr<CachedResourceHandle<CachedResource>> CachedResourceLoader::requ
13501343
if (auto metricsFromResource = resource->takeNetworkLoadMetrics(); metricsFromResource && documentLoader && metricsFromResource->redirectStart >= documentLoader->timing().timeOrigin())
13511344
metrics = WTFMove(metricsFromResource);
13521345
auto resourceTiming = ResourceTiming::fromMemoryCache(url, request.initiatorType(), loadTiming, resource->response(), metrics ? *metrics : NetworkLoadMetrics::emptyMetrics(), *request.protectedOrigin());
1353-
#if PLATFORM(QT)
1354-
ResourceLoadTrackerQt::instance().trackMemoryCacheHit(url, resource->encodedSize(), metrics ? *metrics : NetworkLoadMetrics::emptyMetrics(), frame.ptr());
1355-
#endif
13561346
if (initiatorContext == InitiatorContext::Worker)
13571347
downcast<CachedRawResource>(resource.get())->finishedTimingForWorkerLoad(WTFMove(resourceTiming));
13581348
else {
@@ -1805,10 +1795,6 @@ void CachedResourceLoader::decrementRequestCount(const CachedResource& resource)
18051795

18061796
--m_requestCount;
18071797
ASSERT(m_requestCount > -1);
1808-
1809-
#if PLATFORM(QT)
1810-
ResourceLoadTrackerQt::instance().trackRequestFinished(resource, frame());
1811-
#endif
18121798
}
18131799

18141800
void CachedResourceLoader::notifyFinished(const CachedResource& resource)

0 commit comments

Comments
 (0)