Title: [247896] trunk/Tools
Revision
247896
Author
[email protected]
Date
2019-07-28 19:03:32 -0700 (Sun, 28 Jul 2019)

Log Message

[Win][MiniBrowser] Remove PageLoadTestClient
https://bugs.webkit.org/show_bug.cgi?id=200155

Reviewed by Brent Fulgham.

It is not used nowadays.

* MiniBrowser/win/CMakeLists.txt:
* MiniBrowser/win/Common.cpp:
(parseCommandLine):
* MiniBrowser/win/Common.h:
* MiniBrowser/win/MainWindow.cpp:
(MainWindow::init):
* MiniBrowser/win/MainWindow.h:
* MiniBrowser/win/MiniBrowserWebHost.cpp:
(MiniBrowserWebHost::updateAddressBar):
(MiniBrowserWebHost::didFinishLoadForFrame):
(MiniBrowserWebHost::didStartProvisionalLoadForFrame):
(MiniBrowserWebHost::didFailLoadWithError):
(MiniBrowserWebHost::didHandleOnloadEventsForFrame):
(MiniBrowserWebHost::didFirstLayoutInFrame):
* MiniBrowser/win/PageLoadTestClient.cpp: Removed.
* MiniBrowser/win/PageLoadTestClient.h: Removed.
* MiniBrowser/win/ResourceLoadDelegate.cpp:
(ResourceLoadDelegate::identifierForInitialRequest):
(ResourceLoadDelegate::willSendRequest):
(ResourceLoadDelegate::didFinishLoadingFromDataSource):
(ResourceLoadDelegate::didFailLoadingWithError):
* MiniBrowser/win/WebKitBrowserWindow.cpp:
(WebKitBrowserWindow::create):
(WebKitBrowserWindow::createNewPage):
* MiniBrowser/win/WebKitBrowserWindow.h:
* MiniBrowser/win/WebKitLegacyBrowserWindow.cpp:
(WebKitLegacyBrowserWindow::create):
(WebKitLegacyBrowserWindow::WebKitLegacyBrowserWindow):
(WebKitLegacyBrowserWindow::exitProgram): Deleted.
* MiniBrowser/win/WebKitLegacyBrowserWindow.h:
(WebKitLegacyBrowserWindow::pageLoadTestClient): Deleted.
* MiniBrowser/win/WinMain.cpp:
(wWinMain):

Modified Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (247895 => 247896)


--- trunk/Tools/ChangeLog	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/ChangeLog	2019-07-29 02:03:32 UTC (rev 247896)
@@ -1,3 +1,46 @@
+2019-07-28  Fujii Hironori  <[email protected]>
+
+        [Win][MiniBrowser] Remove PageLoadTestClient
+        https://bugs.webkit.org/show_bug.cgi?id=200155
+
+        Reviewed by Brent Fulgham.
+
+        It is not used nowadays.
+
+        * MiniBrowser/win/CMakeLists.txt:
+        * MiniBrowser/win/Common.cpp:
+        (parseCommandLine):
+        * MiniBrowser/win/Common.h:
+        * MiniBrowser/win/MainWindow.cpp:
+        (MainWindow::init):
+        * MiniBrowser/win/MainWindow.h:
+        * MiniBrowser/win/MiniBrowserWebHost.cpp:
+        (MiniBrowserWebHost::updateAddressBar):
+        (MiniBrowserWebHost::didFinishLoadForFrame):
+        (MiniBrowserWebHost::didStartProvisionalLoadForFrame):
+        (MiniBrowserWebHost::didFailLoadWithError):
+        (MiniBrowserWebHost::didHandleOnloadEventsForFrame):
+        (MiniBrowserWebHost::didFirstLayoutInFrame):
+        * MiniBrowser/win/PageLoadTestClient.cpp: Removed.
+        * MiniBrowser/win/PageLoadTestClient.h: Removed.
+        * MiniBrowser/win/ResourceLoadDelegate.cpp:
+        (ResourceLoadDelegate::identifierForInitialRequest):
+        (ResourceLoadDelegate::willSendRequest):
+        (ResourceLoadDelegate::didFinishLoadingFromDataSource):
+        (ResourceLoadDelegate::didFailLoadingWithError):
+        * MiniBrowser/win/WebKitBrowserWindow.cpp:
+        (WebKitBrowserWindow::create):
+        (WebKitBrowserWindow::createNewPage):
+        * MiniBrowser/win/WebKitBrowserWindow.h:
+        * MiniBrowser/win/WebKitLegacyBrowserWindow.cpp:
+        (WebKitLegacyBrowserWindow::create):
+        (WebKitLegacyBrowserWindow::WebKitLegacyBrowserWindow):
+        (WebKitLegacyBrowserWindow::exitProgram): Deleted.
+        * MiniBrowser/win/WebKitLegacyBrowserWindow.h:
+        (WebKitLegacyBrowserWindow::pageLoadTestClient): Deleted.
+        * MiniBrowser/win/WinMain.cpp:
+        (wWinMain):
+
 2019-07-26  Jiewen Tan  <[email protected]>
 
         NavigationSOAuthorizationSession should check the active URL of the responding page after waking up from waiting

Modified: trunk/Tools/MiniBrowser/win/CMakeLists.txt (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/CMakeLists.txt	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/CMakeLists.txt	2019-07-29 02:03:32 UTC (rev 247896)
@@ -12,7 +12,6 @@
     Common.cpp
     DOMDefaultImpl.cpp
     MainWindow.cpp
-    PageLoadTestClient.cpp
     PrintWebUIDelegate.cpp
     ResourceLoadDelegate.cpp
     WebDownloadDelegate.cpp

Modified: trunk/Tools/MiniBrowser/win/Common.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/Common.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/Common.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -34,6 +34,7 @@
 #include "MiniBrowserReplace.h"
 #include <dbghelp.h>
 #include <shlobj.h>
+#include <wtf/Optional.h>
 #include <wtf/StdLibExtras.h>
 
 // Global Variables:
@@ -270,8 +271,6 @@
             options.usesLayeredWebView = true;
         else if (!wcsicmp(argv[i], L"--desktop"))
             options.useFullDesktop = true;
-        else if (!wcsicmp(argv[i], L"--performance"))
-            options.pageLoadTesting = true;
         else if (!wcsicmp(argv[i], L"--wk1") || !wcsicmp(argv[i], L"--legacy"))
             options.windowType = BrowserWindowType::WebKitLegacy;
 #if ENABLE(WEBKIT)

Modified: trunk/Tools/MiniBrowser/win/Common.h (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/Common.h	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/Common.h	2019-07-29 02:03:32 UTC (rev 247896)
@@ -37,7 +37,6 @@
 struct CommandLineOptions {
     bool usesLayeredWebView { };
     bool useFullDesktop { };
-    bool pageLoadTesting { };
     BrowserWindowType windowType;
     _bstr_t requestedURL;
 

Modified: trunk/Tools/MiniBrowser/win/MainWindow.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/MainWindow.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/MainWindow.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -29,6 +29,7 @@
 #include "Common.h"
 #include "MiniBrowserLibResource.h"
 #include "WebKitLegacyBrowserWindow.h"
+#include <CoreFoundation/CoreFoundation.h>
 
 #if ENABLE(WEBKIT)
 #include "WebKitBrowserWindow.h"
@@ -98,7 +99,7 @@
     return adoptRef(*new MainWindow());
 }
 
-bool MainWindow::init(BrowserWindowFactory factory, HINSTANCE hInstance, bool usesLayeredWebView, bool pageLoadTesting)
+bool MainWindow::init(BrowserWindowFactory factory, HINSTANCE hInstance, bool usesLayeredWebView)
 {
     registerClass(hInstance);
 
@@ -122,7 +123,7 @@
     DefEditProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC));
     SetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(EditProc));
 
-    m_browserWindow = factory(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting);
+    m_browserWindow = factory(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView);
     if (!m_browserWindow)
         return false;
     HRESULT hr = m_browserWindow->init();

Modified: trunk/Tools/MiniBrowser/win/MainWindow.h (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/MainWindow.h	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/MainWindow.h	2019-07-29 02:03:32 UTC (rev 247896)
@@ -33,12 +33,12 @@
 
 class MainWindow : public RefCounted<MainWindow> {
 public:
-    using BrowserWindowFactory = std::function<Ref<BrowserWindow>(HWND mainWnd, HWND urlBarWnd, bool usesLayeredWebView, bool pageLoadTesting)>;
+    using BrowserWindowFactory = std::function<Ref<BrowserWindow>(HWND mainWnd, HWND urlBarWnd, bool usesLayeredWebView)>;
 
     static Ref<MainWindow> create();
 
     ~MainWindow();
-    bool init(BrowserWindowFactory, HINSTANCE hInstance, bool usesLayeredWebView = false, bool pageLoadTesting = false);
+    bool init(BrowserWindowFactory, HINSTANCE hInstance, bool usesLayeredWebView = false);
 
     void resizeSubViews();
     HWND hwnd() const { return m_hMainWnd; }

Modified: trunk/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -29,7 +29,6 @@
 #include "stdafx.h"
 #include "MiniBrowserWebHost.h"
 
-#include "PageLoadTestClient.h"
 #include "WebKitLegacyBrowserWindow.h"
 #include <WebKitLegacy/WebKit.h>
 
@@ -60,11 +59,6 @@
     if (FAILED(hr))
         return hr;
 
-    if (frameURL.length()) {
-        m_client->pageLoadTestClient().setPageURL(frameURL);
-        m_client->pageLoadTestClient().didCommitLoad();
-    }
-
     loadURL(frameURL);
 
     return S_OK;
@@ -123,15 +117,6 @@
     if (!frame || !webView)
         return E_POINTER;
 
-    IWebFrame2Ptr frame2;
-    if (SUCCEEDED(frame->QueryInterface(&frame2.GetInterfacePtr()))) {
-        BOOL mainFrame = FALSE;
-        if (frame2 && SUCCEEDED(frame2->isMainFrame(&mainFrame))) {
-            if (mainFrame)
-                m_client->pageLoadTestClient().didFinishLoad();
-        }
-    }
-
     if (m_client)
         m_client->showLastVisitedSites(*webView);
 
@@ -140,16 +125,11 @@
 
 HRESULT MiniBrowserWebHost::didStartProvisionalLoadForFrame(_In_opt_ IWebView*, _In_opt_ IWebFrame* frame)
 {
-    if (!frame)
-        return E_FAIL;
-
-    m_client->pageLoadTestClient().didStartProvisionalLoad(*frame);
     return S_OK;
 }
 
 HRESULT MiniBrowserWebHost::didFailLoadWithError(_In_opt_ IWebView*, _In_opt_ IWebError*, _In_opt_ IWebFrame*)
 {
-    m_client->pageLoadTestClient().didFailLoad();
     return S_OK;
 }
 
@@ -172,9 +152,6 @@
     if (FAILED(hr))
         return hr;
 
-    if (frameURL.length())
-        m_client->pageLoadTestClient().didHandleOnLoadEvents();
-
     return S_OK;
 }
 
@@ -187,11 +164,5 @@
     if (FAILED(frame->QueryInterface(&frame2.GetInterfacePtr())))
         return S_OK;
 
-    BOOL mainFrame;
-    if (frame2 && SUCCEEDED(frame2->isMainFrame(&mainFrame))) {
-        if (mainFrame)
-            m_client->pageLoadTestClient().didFirstLayoutForMainFrame();
-    }
-
     return S_OK;
 }

Deleted: trunk/Tools/MiniBrowser/win/PageLoadTestClient.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/PageLoadTestClient.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/PageLoadTestClient.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -1,228 +0,0 @@
-/*
-* Copyright (C) 2014-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. ``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
-* 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 "stdafx.h"
-#include "PageLoadTestClient.h"
-
-#include "WebKitLegacyBrowserWindow.h"
-#include <WebCore/PlatformExportMacros.h>
-#include <cmath>
-#include <wtf/Assertions.h>
-#include <wtf/FilePrintStream.h>
-#include <wtf/ProcessID.h>
-
-static const CFTimeInterval waitForNewResourceLoadDuration = 0.1;
-
-PageLoadTestClient::PageLoadTestClient(WebKitLegacyBrowserWindow* host, bool pageLoadTesting)
-    : m_host(host)
-    , m_waitForLoadToReallyEnd(this, &PageLoadTestClient::endPageLoad)
-    , m_repetitions(pageLoadTesting ? 20 : 1)
-    , m_pageLoadTesting(pageLoadTesting)
-{
-}
-
-void PageLoadTestClient::pageLoadStartedAtTime(CFAbsoluteTime startTime)
-{
-    m_startTimes.append(startTime);
-}
-
-void PageLoadTestClient::didStartProvisionalLoad(IWebFrame& frame)
-{
-    _com_ptr_t<_com_IIID<IWebFrame2, &__uuidof(IWebFrame2)>> frame2;
-    if (FAILED(frame.QueryInterface(&frame2.GetInterfacePtr())))
-        return;
-
-    BOOL mainFrame = FALSE;
-    if (frame2 && FAILED(frame2->isMainFrame(&mainFrame)))
-        return;
-
-    if (mainFrame) {
-        clearPageLoadState();
-        pageLoadStartedAtTime(CFAbsoluteTimeGetCurrent());
-    }
-}
-
-void PageLoadTestClient::didCommitLoad()
-{
-    ++m_frames;
-}
-
-void PageLoadTestClient::didFirstLayoutForMainFrame()
-{
-    // Nothing to do
-}
-
-void PageLoadTestClient::didHandleOnLoadEvents()
-{
-    ++m_onLoadEvents;
-    maybeEndPageLoadSoon();
-}
-
-void PageLoadTestClient::didFinishLoad()
-{
-    m_currentPageLoadFinished = true;
-    maybeEndPageLoadSoon();
-}
-
-void PageLoadTestClient::didFailLoad()
-{
-    --m_frames;
-}
-
-void PageLoadTestClient::didInitiateResourceLoad(uint64_t resourceIdentifier)
-{
-    if (!resourceIdentifier) {
-        WTFLogAlways("Saw resourceIdentifier=0. This must be a bug in the loader code. The results may be invalid.");
-        return;
-    }
-    m_loadingSubresources.add(resourceIdentifier);
-}
-
-void PageLoadTestClient::didEndResourceLoad(uint64_t resourceIdentifier)
-{
-    if (!resourceIdentifier) {
-        WTFLogAlways("Saw resourceIdentifier=0. This must be a bug in the loader code. The results may be invalid.");
-        return;
-    }
-    auto found = m_loadingSubresources.find(resourceIdentifier);
-    if (found == m_loadingSubresources.end())
-        return;
-    m_loadingSubresources.remove(found);
-    maybeEndPageLoadSoon();
-}
-
-void PageLoadTestClient::pageLoadEndedAtTime(CFAbsoluteTime endTime)
-{
-    ASSERT(!m_pageLoadTesting || m_endTimes.size() == m_currentRepetition);
-    m_endTimes.append(endTime);
-
-    if (m_currentRepetition) {
-        CFTimeInterval pageLoadTime = (m_endTimes[m_currentRepetition] - m_startTimes[m_currentRepetition]);
-        if (pageLoadTime > m_longestTime)
-            m_longestTime = pageLoadTime;
-
-        m_totalTime += pageLoadTime;
-        m_totalSquareRootsOfTime += std::sqrt(pageLoadTime);
-        m_pagesTimed++;
-        m_geometricMeanProductSum *= pageLoadTime;
-    }
-
-    if (m_pageLoadTesting) {
-        ++m_currentRepetition;
-        if (m_currentRepetition != m_repetitions)
-            m_host->loadURL(m_url);
-        else {
-            dumpRunStatistics();
-            m_host->exitProgram();
-        }
-    }
-}
-
-void PageLoadTestClient::endPageLoad(Timer<PageLoadTestClient>* timer)
-{
-    ASSERT_UNUSED(timer, timer == &m_waitForLoadToReallyEnd);
-
-    if (!shouldConsiderPageLoadEnded())
-        return;
-    pageLoadEndedAtTime(m_pageLoadEndTime);
-    clearPageLoadState();
-}
-
-void PageLoadTestClient::clearPageLoadState()
-{
-    m_currentPageLoadFinished = false;
-    m_frames = 0;
-    m_onLoadEvents = 0;
-    m_pageLoadEndTime = 0;
-    m_loadingSubresources.clear();
-    m_waitForLoadToReallyEnd.invalidate();
-}
-
-bool PageLoadTestClient::shouldConsiderPageLoadEnded() const
-{
-    return m_currentPageLoadFinished && m_onLoadEvents == m_frames && m_loadingSubresources.isEmpty();
-}
-
-void PageLoadTestClient::maybeEndPageLoadSoon()
-{
-    if (!shouldConsiderPageLoadEnded())
-        return;
-    m_pageLoadEndTime = CFAbsoluteTimeGetCurrent();
-    if (m_waitForLoadToReallyEnd.isValid())
-        m_waitForLoadToReallyEnd.invalidate();
-    m_waitForLoadToReallyEnd.schedule(waitForNewResourceLoadDuration, false);
-}
-
-#if OS(WINDOWS)
-void PageLoadTestClient::setPageURL(const _bstr_t& pageURL)
-{
-    m_url = pageURL;
-}
-#endif
-
-void PageLoadTestClient::dumpRunStatistics()
-{
-    const long maxPathLength = 1024;
-
-    char filenameSuffix[maxPathLength + 1];
-
-    snprintf(filenameSuffix, sizeof(filenameSuffix), ".%d.txt", getCurrentProcessID());
-
-    const char* filename = "webkit_performance_log";
-    char actualFilename[maxPathLength + 1];
-
-    snprintf(actualFilename, sizeof(actualFilename), "%s%s", filename, filenameSuffix);
-
-    std::unique_ptr<WTF::FilePrintStream> file = WTF::FilePrintStream::open(actualFilename, "w");
-    if (!file) {
-        WTFLogAlways("Warning: Could not open page load performance data file %s for writing.\n", actualFilename);
-        return;
-    }
-
-    WTFLogAlways("*** Page load performance data output to \"%s\" ***\n", actualFilename);
-
-    file->print("INDIVIDUAL URL LOAD TIMES:\n");
-
-    CFTimeInterval pageLoadTime = m_endTimes.last() - m_startTimes.last();
-    file->printf("Load Time = %.1f ms\t%s\n", pageLoadTime * 1000.0, static_cast<const char*>(m_url));
-
-    double meanTime = 0;
-    double squareMeanRootTime = 0;
-    double geometricMeanTime = 0;
-    if (m_pagesTimed) {
-        meanTime = m_totalTime / m_pagesTimed;
-        squareMeanRootTime = (m_totalSquareRootsOfTime / m_pagesTimed) * (m_totalSquareRootsOfTime / m_pagesTimed);
-        geometricMeanTime = pow(m_geometricMeanProductSum, (1.0 / m_pagesTimed));
-    }
-
-    file->printf("FINISHED:    Total Time = %.1f ms\n", m_totalTime * 1000.0);
-    file->printf("           Longest Time = %.1f ms\n", m_longestTime * 1000.0);
-    file->printf("              Mean Time = %.1f ms\n", meanTime * 1000.0);
-    file->printf("  Square-Mean-Root Time = %.1f ms\n", squareMeanRootTime * 1000.0);
-    file->printf("    Geometric Mean Time = %.1f ms\n", geometricMeanTime * 1000.0);
-    file->printf("---------------------------------------------------------------------------------------------------\n");
-
-    file->flush();
-}

Deleted: trunk/Tools/MiniBrowser/win/PageLoadTestClient.h (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/PageLoadTestClient.h	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/PageLoadTestClient.h	2019-07-29 02:03:32 UTC (rev 247896)
@@ -1,157 +0,0 @@
-/*
-* Copyright (C) 2014 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. ``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
-* 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 PageLoadTestClient_h
-#define PageLoadTestClient_h
-
-#include <CoreFoundation/CFDate.h>
-#include <WebKitLegacy/WebKit.h>
-#include <wtf/Assertions.h>
-#include <wtf/HashSet.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/text/CString.h>
-
-template <class TimerFiredClass>
-class Timer {
-    WTF_MAKE_NONCOPYABLE(Timer);
-public:
-    typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*);
-
-    Timer(TimerFiredClass* object, TimerFiredFunction function)
-        : m_object(object)
-        , m_function(function)
-    {
-        ASSERT_ARG(object, object);
-        ASSERT_ARG(function, function);
-    }
-
-    ~Timer() { invalidate(); }
-
-    void invalidate()
-    {
-        if (!isValid())
-            return;
-
-        CFRunLoopTimerInvalidate(m_timer.get());
-        m_timer = nullptr;
-    }
-
-    bool isValid() const
-    {
-        return m_timer && CFRunLoopTimerIsValid(m_timer.get());
-    }
-
-    void schedule(CFTimeInterval interval, bool repeating)
-    {
-        ASSERT(!isValid());
-
-        CFTimeInterval repeatInterval = repeating ? interval : 0;
-        CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
-        m_timer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, repeatInterval, 0, 0, runLoopTimerFired, &context));
-
-        CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_timer.get(), kCFRunLoopCommonModes);
-    }
-
-private:
-    void fire() { (m_object->*m_function)(this); }
-
-    static void runLoopTimerFired(CFRunLoopTimerRef timerRef, void* info)
-    {
-        Timer* timer = static_cast<Timer*>(info);
-        ASSERT_ARG(timerRef, timer->m_timer == timerRef);
-
-        if (!CFRunLoopTimerDoesRepeat(timerRef))
-            CFRunLoopTimerInvalidate(timerRef);
-
-#ifdef __OBJC__
-        @autoreleasepool
-#endif
-        {
-            timer->fire();
-        }
-    }
-
-    TimerFiredClass* m_object;
-    TimerFiredFunction m_function;
-
-    RetainPtr<CFRunLoopTimerRef> m_timer;
-};
-
-class WebKitLegacyBrowserWindow;
-
-class PageLoadTestClient {
-    WTF_MAKE_NONCOPYABLE(PageLoadTestClient);
-public:
-    PageLoadTestClient(WebKitLegacyBrowserWindow* host, bool pageLoadTesting = false);
-
-#if OS(WINDOWS)
-    void setPageURL(const _bstr_t&);
-#endif
-
-    void didStartProvisionalLoad(IWebFrame&);
-    void didCommitLoad();
-    void didFirstLayoutForMainFrame();
-    void didHandleOnLoadEvents();
-    void didFinishLoad();
-    void didFailLoad();
-    void didInitiateResourceLoad(uint64_t);
-    void didEndResourceLoad(uint64_t);
-
-private:
-    void endPageLoad(Timer<PageLoadTestClient>*);
-    void maybeEndPageLoadSoon();
-    void clearPageLoadState();
-    bool shouldConsiderPageLoadEnded() const;
-
-    void pageLoadStartedAtTime(CFAbsoluteTime);
-    void pageLoadEndedAtTime(CFAbsoluteTime);
-    void dumpRunStatistics();
-
-    WebKitLegacyBrowserWindow* m_host;
-    CFAbsoluteTime m_pageLoadEndTime { 0 };
-    CFTimeInterval m_totalTime { 0 };
-    CFTimeInterval m_totalSquareRootsOfTime { 0 };
-    CFTimeInterval m_longestTime { 0 };
-    Vector<CFAbsoluteTime> m_startTimes;
-    Vector<CFAbsoluteTime> m_endTimes;
-    HashSet<uint64_t> m_loadingSubresources;
-    Timer<PageLoadTestClient> m_waitForLoadToReallyEnd;
-#if OS(WINDOWS)
-    _bstr_t m_url;
-#endif
-    double m_geometricMeanProductSum { 1.0 };
-    unsigned m_frames { 0 };
-    unsigned m_onLoadEvents { 0 };
-    unsigned m_currentRepetition { 0 };
-    unsigned m_pagesTimed { 0 };
-    unsigned m_repetitions;
-
-    bool m_currentPageLoadFinished { false };
-    bool m_pageLoadTesting;
-};
-
-#endif // PageLoadTestClient_h

Modified: trunk/Tools/MiniBrowser/win/ResourceLoadDelegate.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/ResourceLoadDelegate.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/ResourceLoadDelegate.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -26,7 +26,6 @@
 #include "ResourceLoadDelegate.h"
 
 #include "Common.h"
-#include "PageLoadTestClient.h"
 #include "WebKitLegacyBrowserWindow.h"
 #include <WebCore/COMPtr.h>
 #include <WebKitLegacy/WebKitCOMAPI.h>
@@ -66,19 +65,11 @@
 
 HRESULT ResourceLoadDelegate::identifierForInitialRequest(_In_opt_ IWebView*, _In_opt_ IWebURLRequest*, _In_opt_ IWebDataSource*, unsigned long identifier)
 {
-    if (!m_client)
-        return E_FAIL;
-
-    m_client->pageLoadTestClient().didInitiateResourceLoad(identifier);
-
-    return S_OK;
+    return E_NOTIMPL;
 }
 
 HRESULT ResourceLoadDelegate::willSendRequest(_In_opt_ IWebView*, unsigned long, _In_opt_ IWebURLRequest*, _In_opt_ IWebURLResponse*, _In_opt_ IWebDataSource*, _COM_Outptr_opt_ IWebURLRequest** result)
 {
-    if (!result)
-        return E_POINTER;
-    *result = nullptr;
     return E_NOTIMPL;
 }
 
@@ -126,22 +117,12 @@
 
 HRESULT ResourceLoadDelegate::didFinishLoadingFromDataSource(_In_opt_ IWebView*, unsigned long identifier, _In_opt_ IWebDataSource*)
 {
-    if (!m_client)
-        return E_FAIL;
-
-    m_client->pageLoadTestClient().didEndResourceLoad(identifier);
-
-    return S_OK;
+    return E_NOTIMPL;
 }
 
 HRESULT ResourceLoadDelegate::didFailLoadingWithError(_In_opt_ IWebView*, unsigned long identifier, _In_opt_ IWebError*, _In_opt_ IWebDataSource*)
 {
-    if (!m_client)
-        return E_FAIL;
-
-    m_client->pageLoadTestClient().didEndResourceLoad(identifier);
-
-    return S_OK;
+    return E_NOTIMPL;
 }
 
 HRESULT ResourceLoadDelegate::plugInFailedWithError(_In_opt_ IWebView*, _In_opt_ IWebError*, _In_opt_ IWebDataSource*)

Modified: trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -104,7 +104,7 @@
     return adoptWK(WKURLCreateWithUTF8CString(utf8.data()));
 }
 
-Ref<BrowserWindow> WebKitBrowserWindow::create(HWND mainWnd, HWND urlBarWnd, bool, bool)
+Ref<BrowserWindow> WebKitBrowserWindow::create(HWND mainWnd, HWND urlBarWnd, bool)
 {
     auto conf = adoptWK(WKPageConfigurationCreate());
 
@@ -354,7 +354,7 @@
 WKPageRef WebKitBrowserWindow::createNewPage(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
 {
     auto& newWindow = MainWindow::create().leakRef();
-    auto factory = [configuration](HWND mainWnd, HWND urlBarWnd, bool, bool) -> auto {
+    auto factory = [configuration](HWND mainWnd, HWND urlBarWnd, bool) -> auto {
         return adoptRef(*new WebKitBrowserWindow(configuration, mainWnd, urlBarWnd));
     };
     bool ok = newWindow.init(factory, hInst);

Modified: trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.h (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.h	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.h	2019-07-29 02:03:32 UTC (rev 247896)
@@ -29,10 +29,11 @@
 #include <WebKit/WKRetainPtr.h>
 #include <WebKit/WebKit2_C.h>
 #include <unordered_map>
+#include <wtf/Ref.h>
 
 class WebKitBrowserWindow : public BrowserWindow {
 public:
-    static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false);
+    static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false);
 
 private:
     WebKitBrowserWindow(WKPageConfigurationRef, HWND mainWnd, HWND urlBarWnd);

Modified: trunk/Tools/MiniBrowser/win/WebKitLegacyBrowserWindow.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/WebKitLegacyBrowserWindow.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/WebKitLegacyBrowserWindow.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -59,16 +59,15 @@
 
 typedef _com_ptr_t<_com_IIID<IWebMutableURLRequest, &__uuidof(IWebMutableURLRequest)>> IWebMutableURLRequestPtr;
 
-Ref<BrowserWindow> WebKitLegacyBrowserWindow::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting)
+Ref<BrowserWindow> WebKitLegacyBrowserWindow::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView)
 {
-    return adoptRef(*new WebKitLegacyBrowserWindow(mainWnd, urlBarWnd, useLayeredWebView, pageLoadTesting));
+    return adoptRef(*new WebKitLegacyBrowserWindow(mainWnd, urlBarWnd, useLayeredWebView));
 }
 
-WebKitLegacyBrowserWindow::WebKitLegacyBrowserWindow(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting)
+WebKitLegacyBrowserWindow::WebKitLegacyBrowserWindow(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView)
     : m_hMainWnd(mainWnd)
     , m_hURLBarWnd(urlBarWnd)
     , m_useLayeredWebView(useLayeredWebView)
-    , m_pageLoadTestClient(std::make_unique<PageLoadTestClient>(this, pageLoadTesting))
 {
 }
 
@@ -508,11 +507,6 @@
     return hr;
 }
 
-void WebKitLegacyBrowserWindow::exitProgram()
-{
-    ::PostMessage(m_hMainWnd, static_cast<UINT>(WM_COMMAND), MAKELPARAM(IDM_EXIT, 0), 0);
-}
-
 void WebKitLegacyBrowserWindow::setUserAgent(_bstr_t& customUserAgent)
 {
     if (!webView())

Modified: trunk/Tools/MiniBrowser/win/WebKitLegacyBrowserWindow.h (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/WebKitLegacyBrowserWindow.h	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/WebKitLegacyBrowserWindow.h	2019-07-29 02:03:32 UTC (rev 247896)
@@ -25,11 +25,11 @@
 
 #pragma once
 #include "BrowserWindow.h"
-#include "PageLoadTestClient.h"
 #include <WebKitLegacy/WebKit.h>
 #include <comip.h>
 #include <memory>
 #include <vector>
+#include <wtf/Ref.h>
 
 typedef _com_ptr_t<_com_IIID<IWebFrame, &__uuidof(IWebFrame)>> IWebFramePtr;
 typedef _com_ptr_t<_com_IIID<IWebView, &__uuidof(IWebView)>> IWebViewPtr;
@@ -50,7 +50,7 @@
 
 class WebKitLegacyBrowserWindow : public BrowserWindow {
 public:
-    static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false);
+    static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false);
 
 private:
     friend class AccessibilityDelegate;
@@ -58,7 +58,6 @@
     friend class PrintWebUIDelegate;
     friend class WebDownloadDelegate;
     friend class ResourceLoadDelegate;
-    friend class PageLoadTestClient;
 
     ULONG AddRef();
     ULONG Release();
@@ -73,7 +72,6 @@
     void openProxySettings();
     void navigateForwardOrBackward(UINT menuID);
     void navigateToHistory(UINT menuID);
-    void exitProgram();
     bool seedInitialDefaultPreferences();
     bool setToDefaultPreferences();
 
@@ -99,8 +97,6 @@
     void setUserAgent(_bstr_t& customUAString);
     _bstr_t userAgent();
 
-    PageLoadTestClient& pageLoadTestClient() { return *m_pageLoadTestClient; }
-
     void resetZoom();
     void zoomIn();
     void zoomOut();
@@ -113,7 +109,7 @@
     void updateStatistics(HWND dialog);
     void setPreference(UINT menuID, bool enable);
 
-    WebKitLegacyBrowserWindow(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting);
+    WebKitLegacyBrowserWindow(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView);
     void subclassForLayeredWindow();
     bool setCacheFolder();
 
@@ -141,6 +137,4 @@
     HWND m_viewWnd { nullptr };
 
     bool m_useLayeredWebView;
-
-    std::unique_ptr<PageLoadTestClient> m_pageLoadTestClient;
 };

Modified: trunk/Tools/MiniBrowser/win/WinMain.cpp (247895 => 247896)


--- trunk/Tools/MiniBrowser/win/WinMain.cpp	2019-07-28 21:28:24 UTC (rev 247895)
+++ trunk/Tools/MiniBrowser/win/WinMain.cpp	2019-07-29 02:03:32 UTC (rev 247896)
@@ -71,7 +71,7 @@
         factory = WebKitBrowserWindow::create;
 #endif
     auto& mainWindow = MainWindow::create().leakRef();
-    HRESULT hr = mainWindow.init(factory, hInst, options.usesLayeredWebView, options.pageLoadTesting);
+    HRESULT hr = mainWindow.init(factory, hInst, options.usesLayeredWebView);
     if (FAILED(hr))
         goto exit;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to