<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174664] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174664">174664</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2014-10-13 16:10:20 -0700 (Mon, 13 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Win] Implement a page load profiling tool
https://bugs.webkit.org/show_bug.cgi?id=137673
Reviewed by Dean Jackson.
Source/WebKit/win:
Add a new predicate (isMainFrame) to the IWebFrame interface so
that we can make decisions about a frames position in the page
load hierarchy in client programs.
* Interfaces/IWebFrame.idl: Added new isMainFrame
predicate to interface definition.
* WebFrame.cpp:
(WebFrame::isMainFrame): Added.
* WebFrame.h:
Tools:
Add a tool to capture and summarize page load statistics.
* WinLauncher/Common.cpp:
(parseCommandLine): Move from WinMain.cpp so that it can
be shared with internal tools.
* WinLauncher/PageLoadTestClient.cpp: Added.
(PageLoadTestClient::PageLoadTestClient):
(PageLoadTestClient::pageLoadStartedAtTime):
(PageLoadTestClient::didStartProvisionalLoad):
(PageLoadTestClient::didCommitLoad):
(PageLoadTestClient::didFirstLayoutForMainFrame):
(PageLoadTestClient::didHandleOnLoadEvents):
(PageLoadTestClient::didFinishLoad):
(PageLoadTestClient::didFailLoad):
(PageLoadTestClient::didInitiateResourceLoad):
(PageLoadTestClient::didEndResourceLoad):
(PageLoadTestClient::pageLoadEndedAtTime):
(PageLoadTestClient::endPageLoad):
(PageLoadTestClient::clearPageLoadState):
(PageLoadTestClient::shouldConsiderPageLoadEnded):
(PageLoadTestClient::maybeEndPageLoadSoon):
(PageLoadTestClient::setPageURL):
(PageLoadTestClient::dumpRunStatistics):
* WinLauncher/PrintWebUIDelegate.cpp:
(PrintWebUIDelegate::createWebViewWithRequest): Handle
nullptr URL properly.
* WinLauncher/ResourceLoadDelegate.cpp: Added.
(ResourceLoadDelegate::QueryInterface):
(ResourceLoadDelegate::AddRef):
(ResourceLoadDelegate::Release):
(ResourceLoadDelegate::identifierForInitialRequest):
(ResourceLoadDelegate::willSendRequest):
(ResourceLoadDelegate::didReceiveAuthenticationChallenge):
(ResourceLoadDelegate::didCancelAuthenticationChallenge):
(ResourceLoadDelegate::didReceiveResponse):
(ResourceLoadDelegate::didReceiveContentLength):
(ResourceLoadDelegate::didFinishLoadingFromDataSource):
(ResourceLoadDelegate::didFailLoadingWithError):
(ResourceLoadDelegate::plugInFailedWithError):
* WinLauncher/ResourceLoadDelegate.h: Added.
(ResourceLoadDelegate::ResourceLoadDelegate):
* WinLauncher/WinLauncher.cpp:
(WinLauncher::WinLauncher): Accept argument to indicate we want to capture
page loading statistics.
(WinLauncher::setFrameLoadDelegatePrivate): Get rid of stub implementation
and set private load delegate state.
(WinLauncher::setResourceLoadDelegate): Replace stub with a full implementation
that sets the view's resource load delegate.
(WinLauncher::loadURL): If no URL is passed, load the test document.
* WinLauncher/WinLauncher.h:
(WinLauncher::pageLoadTestClient):
* WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj: Updated for new source files.
* WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters: Ditto.
* WinLauncher/WinLauncherWebHost.cpp:
(WinLauncherWebHost::updateAddressBar): Hook into page load statistics routine.
(WinLauncherWebHost::loadURL): Moved 'SendMessage' call to its own method so that
it could be used from other source files.
(WinLauncherWebHost::didFinishLoadForFrame): Added overload to capture statistics.
(WinLauncherWebHost::didStartProvisionalLoadForFrame): Ditto.
(WinLauncherWebHost::didFailLoadWithError): Ditto.
(WinLauncherWebHost::didHandleOnloadEventsForFrame): Ditto.
(WinLauncherWebHost::didFirstLayoutInFrame): Ditto.
(WinLauncherWebHost::didFinishDocumentLoadForFrame): Ditto.
(WinLauncherWebHost::didFirstVisuallyNonEmptyLayoutInFrame): Ditto.
(WinLauncherWebHost::didStartProvisionalLoadForFrame): Deleted.
* WinLauncher/WinLauncherWebHost.h:
* WinLauncher/WinMain.cpp:
(wWinMain): Create and use new delegates for gathering page load data.
* WinLauncher/stdafx.h: Need to add <wtf/Platform> include for various macros used in build.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinInterfacesIWebFrameidl">trunk/Source/WebKit/win/Interfaces/IWebFrame.idl</a></li>
<li><a href="#trunkSourceWebKitwinWebFramecpp">trunk/Source/WebKit/win/WebFrame.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebFrameh">trunk/Source/WebKit/win/WebFrame.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWinLauncherCommoncpp">trunk/Tools/WinLauncher/Common.cpp</a></li>
<li><a href="#trunkToolsWinLauncherPrintWebUIDelegatecpp">trunk/Tools/WinLauncher/PrintWebUIDelegate.cpp</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchercpp">trunk/Tools/WinLauncher/WinLauncher.cpp</a></li>
<li><a href="#trunkToolsWinLauncherWinLauncherh">trunk/Tools/WinLauncher/WinLauncher.h</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxproj">trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxprojfilters">trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters</a></li>
<li><a href="#trunkToolsWinLauncherWinLauncherWebHostcpp">trunk/Tools/WinLauncher/WinLauncherWebHost.cpp</a></li>
<li><a href="#trunkToolsWinLauncherWinLauncherWebHosth">trunk/Tools/WinLauncher/WinLauncherWebHost.h</a></li>
<li><a href="#trunkToolsWinLauncherWinMaincpp">trunk/Tools/WinLauncher/WinMain.cpp</a></li>
<li><a href="#trunkToolsWinLauncherstdafxh">trunk/Tools/WinLauncher/stdafx.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsWinLauncherPageLoadTestClientcpp">trunk/Tools/WinLauncher/PageLoadTestClient.cpp</a></li>
<li><a href="#trunkToolsWinLauncherPageLoadTestClienth">trunk/Tools/WinLauncher/PageLoadTestClient.h</a></li>
<li><a href="#trunkToolsWinLauncherResourceLoadDelegatecpp">trunk/Tools/WinLauncher/ResourceLoadDelegate.cpp</a></li>
<li><a href="#trunkToolsWinLauncherResourceLoadDelegateh">trunk/Tools/WinLauncher/ResourceLoadDelegate.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Source/WebKit/win/ChangeLog        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-10-13 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Implement a page load profiling tool
+ https://bugs.webkit.org/show_bug.cgi?id=137673
+
+ Reviewed by Dean Jackson.
+
+ Add a new predicate (isMainFrame) to the IWebFrame interface so
+ that we can make decisions about a frames position in the page
+ load hierarchy in client programs.
+
+ * Interfaces/IWebFrame.idl: Added new isMainFrame
+ predicate to interface definition.
+ * WebFrame.cpp:
+ (WebFrame::isMainFrame): Added.
+ * WebFrame.h:
+
</ins><span class="cx"> 2014-10-13 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Use is<>() / downcast<>() for PlatformCALayer subclasses
</span></span></pre></div>
<a id="trunkSourceWebKitwinInterfacesIWebFrameidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/Interfaces/IWebFrame.idl (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/Interfaces/IWebFrame.idl        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Source/WebKit/win/Interfaces/IWebFrame.idl        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -268,4 +268,10 @@
</span><span class="cx"> - (DOMWindow *)DOMWindow;
</span><span class="cx"> */
</span><span class="cx"> HRESULT DOMWindow([out, retval] IDOMWindow** window);
</span><ins>+
+ /*!
+ @method isMainFrame
+ @description Returns TRUE if the frame is the main frame.
+ */
+ HRESULT isMainFrame([out, retval] BOOL* flag);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebFrame.cpp (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebFrame.cpp        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Source/WebKit/win/WebFrame.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006-2009, 2011, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2009, 2011, 2013-2014 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) Research In Motion Limited 2009. All rights reserved.
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -2097,3 +2097,13 @@
</span><span class="cx"> coreFrame->view()->updateBackgroundRecursively(backgroundColor, webView()->transparent());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+HRESULT WebFrame::isMainFrame(BOOL* value)
+{
+ if (!value)
+ return E_POINTER;
+
+ Frame* coreFrame = core(this);
+ *value = coreFrame->isMainFrame();
+
+ return S_OK;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitwinWebFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebFrame.h (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebFrame.h        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Source/WebKit/win/WebFrame.h        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2011, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2011, 2013-2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -287,6 +287,8 @@
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE selectAll();
</span><span class="cx">
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE deselectAll();
</span><ins>+
+ virtual HRESULT STDMETHODCALLTYPE isMainFrame(BOOL*);
</ins><span class="cx">
</span><span class="cx"> // FrameLoaderClient
</span><span class="cx"> virtual void frameLoaderDestroyed();
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/ChangeLog        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -1,3 +1,80 @@
</span><ins>+2014-10-13 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Implement a page load profiling tool
+ https://bugs.webkit.org/show_bug.cgi?id=137673
+
+ Reviewed by Dean Jackson.
+
+ Add a tool to capture and summarize page load statistics.
+
+ * WinLauncher/Common.cpp:
+ (parseCommandLine): Move from WinMain.cpp so that it can
+ be shared with internal tools.
+ * WinLauncher/PageLoadTestClient.cpp: Added.
+ (PageLoadTestClient::PageLoadTestClient):
+ (PageLoadTestClient::pageLoadStartedAtTime):
+ (PageLoadTestClient::didStartProvisionalLoad):
+ (PageLoadTestClient::didCommitLoad):
+ (PageLoadTestClient::didFirstLayoutForMainFrame):
+ (PageLoadTestClient::didHandleOnLoadEvents):
+ (PageLoadTestClient::didFinishLoad):
+ (PageLoadTestClient::didFailLoad):
+ (PageLoadTestClient::didInitiateResourceLoad):
+ (PageLoadTestClient::didEndResourceLoad):
+ (PageLoadTestClient::pageLoadEndedAtTime):
+ (PageLoadTestClient::endPageLoad):
+ (PageLoadTestClient::clearPageLoadState):
+ (PageLoadTestClient::shouldConsiderPageLoadEnded):
+ (PageLoadTestClient::maybeEndPageLoadSoon):
+ (PageLoadTestClient::setPageURL):
+ (PageLoadTestClient::dumpRunStatistics):
+ * WinLauncher/PrintWebUIDelegate.cpp:
+ (PrintWebUIDelegate::createWebViewWithRequest): Handle
+ nullptr URL properly.
+ * WinLauncher/ResourceLoadDelegate.cpp: Added.
+ (ResourceLoadDelegate::QueryInterface):
+ (ResourceLoadDelegate::AddRef):
+ (ResourceLoadDelegate::Release):
+ (ResourceLoadDelegate::identifierForInitialRequest):
+ (ResourceLoadDelegate::willSendRequest):
+ (ResourceLoadDelegate::didReceiveAuthenticationChallenge):
+ (ResourceLoadDelegate::didCancelAuthenticationChallenge):
+ (ResourceLoadDelegate::didReceiveResponse):
+ (ResourceLoadDelegate::didReceiveContentLength):
+ (ResourceLoadDelegate::didFinishLoadingFromDataSource):
+ (ResourceLoadDelegate::didFailLoadingWithError):
+ (ResourceLoadDelegate::plugInFailedWithError):
+ * WinLauncher/ResourceLoadDelegate.h: Added.
+ (ResourceLoadDelegate::ResourceLoadDelegate):
+ * WinLauncher/WinLauncher.cpp:
+ (WinLauncher::WinLauncher): Accept argument to indicate we want to capture
+ page loading statistics.
+ (WinLauncher::setFrameLoadDelegatePrivate): Get rid of stub implementation
+ and set private load delegate state.
+ (WinLauncher::setResourceLoadDelegate): Replace stub with a full implementation
+ that sets the view's resource load delegate.
+ (WinLauncher::loadURL): If no URL is passed, load the test document.
+ * WinLauncher/WinLauncher.h:
+ (WinLauncher::pageLoadTestClient):
+ * WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj: Updated for new source files.
+ * WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters: Ditto.
+ * WinLauncher/WinLauncherWebHost.cpp:
+ (WinLauncherWebHost::updateAddressBar): Hook into page load statistics routine.
+ (WinLauncherWebHost::loadURL): Moved 'SendMessage' call to its own method so that
+ it could be used from other source files.
+ (WinLauncherWebHost::didFinishLoadForFrame): Added overload to capture statistics.
+ (WinLauncherWebHost::didStartProvisionalLoadForFrame): Ditto.
+ (WinLauncherWebHost::didFailLoadWithError): Ditto.
+ (WinLauncherWebHost::didHandleOnloadEventsForFrame): Ditto.
+ (WinLauncherWebHost::didFirstLayoutInFrame): Ditto.
+ (WinLauncherWebHost::didFinishDocumentLoadForFrame): Ditto.
+ (WinLauncherWebHost::didFirstVisuallyNonEmptyLayoutInFrame): Ditto.
+ (WinLauncherWebHost::didStartProvisionalLoadForFrame): Deleted.
+ * WinLauncher/WinLauncherWebHost.h:
+ * WinLauncher/WinMain.cpp:
+ (wWinMain): Create and use new delegates for gathering page load data.
+ * WinLauncher/stdafx.h: Need to add <wtf/Platform> include for various macros used in build.
+
</ins><span class="cx"> 2014-10-13 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve the test image diffs page
</span></span></pre></div>
<a id="trunkToolsWinLauncherCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/Common.cpp (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/Common.cpp        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/Common.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "AccessibilityDelegate.h"
</span><span class="cx"> #include "DOMDefaultImpl.h"
</span><span class="cx"> #include "PrintWebUIDelegate.h"
</span><ins>+#include "ResourceLoadDelegate.h"
</ins><span class="cx"> #include "WinLauncher.h"
</span><span class="cx"> #include "WinLauncherReplace.h"
</span><span class="cx"> #include <WebKit/WebKitCOMAPI.h>
</span><span class="lines">@@ -685,6 +686,26 @@
</span><span class="cx"> setWindowText(dialog, IDC_SITE_ICONS_WITH_DATA, count);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void parseCommandLine(bool& usesLayeredWebView, bool& useFullDesktop, bool& pageLoadTesting, _bstr_t& requestedURL)
+{
+ usesLayeredWebView = false;
+ useFullDesktop = false;
+ pageLoadTesting = false;
+
+ int argc = 0;
+ WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+ for (int i = 1; i < argc; ++i) {
+ if (!wcsicmp(argv[i], L"--transparent"))
+ usesLayeredWebView = true;
+ else if (!wcsicmp(argv[i], L"--desktop"))
+ useFullDesktop = true;
+ else if (!requestedURL)
+ requestedURL = argv[i];
+ else if (!wcsicmp(argv[i], L"--performance"))
+ pageLoadTesting = true;
+ }
+}
+
</ins><span class="cx"> extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
</span><span class="cx"> {
</span><span class="cx"> return wWinMain(hInstance, hPrevInstance, lpstrCmdLine, nCmdShow);
</span></span></pre></div>
<a id="trunkToolsWinLauncherPageLoadTestClientcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/WinLauncher/PageLoadTestClient.cpp (0 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/PageLoadTestClient.cpp         (rev 0)
+++ trunk/Tools/WinLauncher/PageLoadTestClient.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -0,0 +1,244 @@
</span><ins>+/*
+* 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.
+*/
+
+#include "stdafx.h"
+#include "PageLoadTestClient.h"
+
+#include "WinLauncher.h"
+#include <WebCore/PlatformExportMacros.h>
+#include <wtf/Assertions.h>
+#include <wtf/FilePrintStream.h>
+#include <cmath>
+
+static const CFTimeInterval waitForNewResourceLoadDuration = 0.1;
+
+PageLoadTestClient::PageLoadTestClient(WinLauncher* host, bool pageLoadTesting)
+ : m_host(host)
+ , m_pageLoadEndTime(0)
+ , m_totalTime(0)
+ , m_totalSquareRootsOfTime(0)
+ , m_longestTime(0)
+ , m_geometricMeanProductSum(1.0)
+ , m_frames(0)
+ , m_onLoadEvents(0)
+ , m_currentURLIndex(0)
+ , m_currentRepetition(0)
+ , m_pagesTimed(0)
+ , m_repetitions(pageLoadTesting ? 20 : 1)
+ , m_waitForLoadToReallyEnd(this, &PageLoadTestClient::endPageLoad)
+ , m_currentPageLoadFinished(false)
+ , m_pageLoadTesting(pageLoadTesting)
+{
+}
+
+void PageLoadTestClient::pageLoadStartedAtTime(CFAbsoluteTime startTime)
+{
+ m_startTimes.append(startTime);
+}
+
+void PageLoadTestClient::didStartProvisionalLoad(IWebFrame& frame)
+{
+ BOOL mainFrame;
+ if (FAILED(frame.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_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];
+
+#if PLATFORM(WIN)
+ DWORD pid = GetCurrentProcessId();
+ _snprintf(filenameSuffix, sizeof(filenameSuffix), ".%d.txt", pid);
+#else
+ long pid = getpid();
+ snprintf(filenameSuffix, sizeof(filenameSuffix), ".%d.txt", pid);
+#endif
+
+ const char* filename = "webkit_performance_log";
+ char actualFilename[maxPathLength + 1];
+
+#if PLATFORM(WIN)
+ _snprintf(actualFilename, sizeof(actualFilename), "%s%s", filename, filenameSuffix);
+#else
+ snprintf(actualFilename, sizeof(actualFilename), "%s%s", filename, filenameSuffix);
+#endif
+
+ 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 = std::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();
+}
</ins></span></pre></div>
<a id="trunkToolsWinLauncherPageLoadTestClienth"></a>
<div class="addfile"><h4>Added: trunk/Tools/WinLauncher/PageLoadTestClient.h (0 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/PageLoadTestClient.h         (rev 0)
+++ trunk/Tools/WinLauncher/PageLoadTestClient.h        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -0,0 +1,158 @@
</span><ins>+/*
+* 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 <WebKit/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 WinLauncher;
+
+class PageLoadTestClient {
+ WTF_MAKE_NONCOPYABLE(PageLoadTestClient);
+public:
+ PageLoadTestClient(WinLauncher* 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;
+
+ virtual void pageLoadStartedAtTime(CFAbsoluteTime);
+ virtual void pageLoadEndedAtTime(CFAbsoluteTime);
+ void dumpRunStatistics();
+
+ WinLauncher* m_host;
+ CFAbsoluteTime m_pageLoadEndTime;
+ CFTimeInterval m_totalTime;
+ CFTimeInterval m_totalSquareRootsOfTime;
+ CFTimeInterval m_longestTime;
+ 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;
+ unsigned m_frames;
+ unsigned m_onLoadEvents;
+ unsigned m_currentURLIndex;
+ unsigned m_currentRepetition;
+ unsigned m_pagesTimed;
+ unsigned m_repetitions;
+
+ bool m_currentPageLoadFinished;
+ bool m_pageLoadTesting;
+};
+
+#endif // PageLoadTestClient_h
</ins></span></pre></div>
<a id="trunkToolsWinLauncherPrintWebUIDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/PrintWebUIDelegate.cpp (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/PrintWebUIDelegate.cpp        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/PrintWebUIDelegate.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HRESULT STDMETHODCALLTYPE PrintWebUIDelegate::createWebViewWithRequest(IWebView*, IWebURLRequest* request, IWebView**)
</del><ins>+HRESULT PrintWebUIDelegate::createWebViewWithRequest(IWebView*, IWebURLRequest* request, IWebView**)
</ins><span class="cx"> {
</span><span class="cx"> if (!request)
</span><span class="cx"> return E_POINTER;
</span><span class="lines">@@ -64,6 +64,9 @@
</span><span class="cx"> if (FAILED(hr))
</span><span class="cx"> return E_FAIL;
</span><span class="cx">
</span><ins>+ if (!url)
+ return S_OK;
+
</ins><span class="cx"> std::wstring command = std::wstring(L"\"") + executablePath + L"\" " + (const wchar_t*)url;
</span><span class="cx">
</span><span class="cx"> PROCESS_INFORMATION processInformation;
</span></span></pre></div>
<a id="trunkToolsWinLauncherResourceLoadDelegatecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/WinLauncher/ResourceLoadDelegate.cpp (0 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/ResourceLoadDelegate.cpp         (rev 0)
+++ trunk/Tools/WinLauncher/ResourceLoadDelegate.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -0,0 +1,124 @@
</span><ins>+/*
+* 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.
+*
+* 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 "ResourceLoadDelegate.h"
+
+#include "PageLoadTestClient.h"
+#include "WinLauncher.h"
+#include <WebKit/WebKitCOMAPI.h>
+#include <comip.h>
+#include <commctrl.h>
+#include <commdlg.h>
+#include <objbase.h>
+#include <shlwapi.h>
+#include <wininet.h>
+
+HRESULT ResourceLoadDelegate::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = 0;
+ if (IsEqualIID(riid, IID_IUnknown))
+ *ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
+ else if (IsEqualIID(riid, IID_IWebResourceLoadDelegate))
+ *ppvObject = static_cast<IWebResourceLoadDelegate*>(this);
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+}
+
+ULONG ResourceLoadDelegate::AddRef(void)
+{
+ return ++m_refCount;
+}
+
+ULONG ResourceLoadDelegate::Release(void)
+{
+ ULONG newRef = --m_refCount;
+ if (!newRef)
+ delete this;
+
+ return newRef;
+}
+
+HRESULT ResourceLoadDelegate::identifierForInitialRequest(IWebView*, IWebURLRequest*, IWebDataSource*, unsigned long identifier)
+{
+ if (!m_client)
+ return E_FAIL;
+
+ m_client->pageLoadTestClient().didInitiateResourceLoad(identifier);
+
+ return S_OK;
+}
+
+HRESULT ResourceLoadDelegate::willSendRequest(IWebView*, unsigned long, IWebURLRequest*, IWebURLResponse*, IWebDataSource*, IWebURLRequest**)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT ResourceLoadDelegate::didReceiveAuthenticationChallenge(IWebView*, unsigned long, IWebURLAuthenticationChallenge*, IWebDataSource*)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT ResourceLoadDelegate::didCancelAuthenticationChallenge(IWebView*, unsigned long, IWebURLAuthenticationChallenge*, IWebDataSource*)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT ResourceLoadDelegate::didReceiveResponse(IWebView*, unsigned long, IWebURLResponse*, IWebDataSource*)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT ResourceLoadDelegate::didReceiveContentLength(IWebView*, unsigned long, UINT, IWebDataSource*)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT ResourceLoadDelegate::didFinishLoadingFromDataSource(IWebView*, unsigned long identifier, IWebDataSource*)
+{
+ if (!m_client)
+ return E_FAIL;
+
+ m_client->pageLoadTestClient().didEndResourceLoad(identifier);
+
+ return S_OK;
+}
+
+HRESULT ResourceLoadDelegate::didFailLoadingWithError(IWebView*, unsigned long identifier, IWebError*, IWebDataSource*)
+{
+ if (!m_client)
+ return E_FAIL;
+
+ m_client->pageLoadTestClient().didEndResourceLoad(identifier);
+
+ return S_OK;
+}
+
+HRESULT ResourceLoadDelegate::plugInFailedWithError(IWebView*, IWebError*, IWebDataSource*)
+{
+ return E_NOTIMPL;
+}
</ins></span></pre></div>
<a id="trunkToolsWinLauncherResourceLoadDelegateh"></a>
<div class="addfile"><h4>Added: trunk/Tools/WinLauncher/ResourceLoadDelegate.h (0 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/ResourceLoadDelegate.h         (rev 0)
+++ trunk/Tools/WinLauncher/ResourceLoadDelegate.h        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+* 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 ResourceLoadDelegate_h
+#define ResourceLoadDelegate_h
+
+#include <WebKit/WebKit.h>
+
+class WinLauncher;
+
+class ResourceLoadDelegate : public IWebResourceLoadDelegate {
+public:
+ ResourceLoadDelegate(WinLauncher* client)
+ : m_refCount(1), m_client(client) { }
+
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void);
+ virtual ULONG STDMETHODCALLTYPE Release(void);
+
+ // IWebResourceLoadDelegate
+ virtual HRESULT STDMETHODCALLTYPE identifierForInitialRequest(IWebView*, IWebURLRequest*, IWebDataSource*, unsigned long identifier);
+ virtual HRESULT STDMETHODCALLTYPE willSendRequest(IWebView*, unsigned long identifier, IWebURLRequest*, IWebURLResponse* redirectResponse, IWebDataSource*, IWebURLRequest** newRequest);
+ virtual HRESULT STDMETHODCALLTYPE didReceiveAuthenticationChallenge(IWebView*, unsigned long identifier, IWebURLAuthenticationChallenge*, IWebDataSource*);
+ virtual HRESULT STDMETHODCALLTYPE didCancelAuthenticationChallenge(IWebView*, unsigned long identifier, IWebURLAuthenticationChallenge*, IWebDataSource*);
+ virtual HRESULT STDMETHODCALLTYPE didReceiveResponse(IWebView*, unsigned long identifier, IWebURLResponse*, IWebDataSource*);
+ virtual HRESULT STDMETHODCALLTYPE didReceiveContentLength(IWebView*, unsigned long identifier, UINT length, IWebDataSource*);
+ virtual HRESULT STDMETHODCALLTYPE didFinishLoadingFromDataSource(IWebView*, unsigned long identifier, IWebDataSource*);
+ virtual HRESULT STDMETHODCALLTYPE didFailLoadingWithError(IWebView*, unsigned long identifier, IWebError*, IWebDataSource*);
+ virtual HRESULT STDMETHODCALLTYPE plugInFailedWithError(IWebView*, IWebError*, IWebDataSource*);
+
+private:
+ WinLauncher* m_client;
+ int m_refCount;
+};
+
+#endif // ResourceLoadDelegate
</ins></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.cpp (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.cpp        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinLauncher.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -51,10 +51,11 @@
</span><span class="cx">
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebMutableURLRequest, &__uuidof(IWebMutableURLRequest)>> IWebMutableURLRequestPtr;
</span><span class="cx">
</span><del>-WinLauncher::WinLauncher(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView)
</del><ins>+WinLauncher::WinLauncher(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting)
</ins><span class="cx"> : m_hMainWnd(mainWnd)
</span><span class="cx"> , m_hURLBarWnd(urlBarWnd)
</span><span class="cx"> , m_useLayeredWebView(useLayeredWebView)
</span><ins>+ , m_pageLoadTestClient(std::make_unique<PageLoadTestClient>(this, pageLoadTesting))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -122,6 +123,11 @@
</span><span class="cx"> return m_webView->setFrameLoadDelegate(frameLoadDelegate);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+HRESULT WinLauncher::setFrameLoadDelegatePrivate(IWebFrameLoadDelegatePrivate* frameLoadDelegatePrivate)
+{
+ return m_webViewPrivate->setFrameLoadDelegatePrivate(frameLoadDelegatePrivate);
+}
+
</ins><span class="cx"> HRESULT WinLauncher::setUIDelegate(IWebUIDelegate* uiDelegate)
</span><span class="cx"> {
</span><span class="cx"> m_uiDelegate = uiDelegate;
</span><span class="lines">@@ -134,6 +140,13 @@
</span><span class="cx"> return m_webView->setAccessibilityDelegate(accessibilityDelegate);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+
+HRESULT WinLauncher::setResourceLoadDelegate(IWebResourceLoadDelegate* resourceLoadDelegate)
+{
+ m_resourceLoadDelegate = resourceLoadDelegate;
+ return m_webView->setResourceLoadDelegate(resourceLoadDelegate);
+}
+
</ins><span class="cx"> IWebFramePtr WinLauncher::mainFrame()
</span><span class="cx"> {
</span><span class="cx"> IWebFramePtr framePtr;
</span><span class="lines">@@ -348,6 +361,9 @@
</span><span class="cx"> if (FAILED(hr))
</span><span class="cx"> return hr;
</span><span class="cx">
</span><ins>+ if (!passedURL)
+ return frame->loadHTMLString(_bstr_t(defaultHTML).GetBSTR(), 0);
+
</ins><span class="cx"> IWebMutableURLRequestPtr request;
</span><span class="cx"> hr = WebKitCreateInstance(CLSID_WebMutableURLRequest, 0, IID_IWebMutableURLRequest, (void**)&request);
</span><span class="cx"> if (FAILED(hr))
</span><span class="lines">@@ -366,3 +382,8 @@
</span><span class="cx">
</span><span class="cx"> return hr;
</span><span class="cx"> }
</span><ins>+
+void WinLauncher::exitProgram()
+{
+ ::PostMessage(m_hMainWnd, static_cast<UINT>(WM_COMMAND), MAKELPARAM(IDM_EXIT, 0), 0);
+}
</ins></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.h (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.h        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinLauncher.h        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -23,7 +23,9 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#include "PageLoadTestClient.h"
</ins><span class="cx"> #include <WebKit/WebKit.h>
</span><ins>+#include <memory>
</ins><span class="cx"> #include <vector>
</span><span class="cx">
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebFrame, &__uuidof(IWebFrame)>> IWebFramePtr;
</span><span class="lines">@@ -39,10 +41,11 @@
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebInspector, &__uuidof(IWebInspector)>> IWebInspectorPtr;
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebCoreStatistics, &__uuidof(IWebCoreStatistics)>> IWebCoreStatisticsPtr;
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebCache, &__uuidof(IWebCache)>> IWebCachePtr;
</span><ins>+typedef _com_ptr_t<_com_IIID<IWebResourceLoadDelegate, &__uuidof(IWebResourceLoadDelegate)>> IWebResourceLoadDelegatePtr;
</ins><span class="cx">
</span><span class="cx"> class WinLauncher {
</span><span class="cx"> public:
</span><del>- WinLauncher(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false);
</del><ins>+ WinLauncher(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false);
</ins><span class="cx">
</span><span class="cx"> HRESULT init();
</span><span class="cx"> HRESULT prepareViews(HWND mainWnd, const RECT& clientRect, const BSTR& requestedURL, HWND& viewWnd);
</span><span class="lines">@@ -53,12 +56,15 @@
</span><span class="cx"> void launchInspector();
</span><span class="cx"> void navigateForwardOrBackward(HWND hWnd, UINT menuID);
</span><span class="cx"> void navigateToHistory(HWND hWnd, UINT menuID);
</span><ins>+ void exitProgram();
</ins><span class="cx"> bool seedInitialDefaultPreferences();
</span><span class="cx"> bool setToDefaultPreferences();
</span><span class="cx">
</span><span class="cx"> HRESULT setFrameLoadDelegate(IWebFrameLoadDelegate*);
</span><ins>+ HRESULT setFrameLoadDelegatePrivate(IWebFrameLoadDelegatePrivate*);
</ins><span class="cx"> HRESULT setUIDelegate(IWebUIDelegate*);
</span><span class="cx"> HRESULT setAccessibilityDelegate(IAccessibilityDelegate*);
</span><ins>+ HRESULT setResourceLoadDelegate(IWebResourceLoadDelegate*);
</ins><span class="cx">
</span><span class="cx"> IWebPreferencesPtr standardPreferences() { return m_standardPreferences; }
</span><span class="cx"> IWebPreferencesPrivatePtr privatePreferences() { return m_prefsPrivate; }
</span><span class="lines">@@ -72,9 +78,13 @@
</span><span class="cx"> bool goBack();
</span><span class="cx"> bool goForward();
</span><span class="cx">
</span><ins>+ PageLoadTestClient& pageLoadTestClient() { return *m_pageLoadTestClient; }
+
</ins><span class="cx"> private:
</span><span class="cx"> std::vector<IWebHistoryItemPtr> m_historyItems;
</span><span class="cx">
</span><ins>+ std::unique_ptr<PageLoadTestClient> m_pageLoadTestClient;
+
</ins><span class="cx"> IWebViewPtr m_webView;
</span><span class="cx"> IWebViewPrivatePtr m_webViewPrivate;
</span><span class="cx">
</span><span class="lines">@@ -86,6 +96,7 @@
</span><span class="cx"> IWebFrameLoadDelegatePtr m_frameLoadDelegate;
</span><span class="cx"> IWebUIDelegatePtr m_uiDelegate;
</span><span class="cx"> IAccessibilityDelegatePtr m_accessibilityDelegate;
</span><ins>+ IWebResourceLoadDelegatePtr m_resourceLoadDelegate;
</ins><span class="cx">
</span><span class="cx"> IWebCoreStatisticsPtr m_statistics;
</span><span class="cx"> IWebCachePtr m_webCache;
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -218,7 +218,9 @@
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
</span><span class="cx"> </ClCompile>
</span><span class="cx"> <ClCompile Include="..\DOMDefaultImpl.cpp" />
</span><ins>+ <ClCompile Include="..\PageLoadTestClient.cpp" />
</ins><span class="cx"> <ClCompile Include="..\PrintWebUIDelegate.cpp" />
</span><ins>+ <ClCompile Include="..\ResourceLoadDelegate.cpp" />
</ins><span class="cx"> <ClCompile Include="..\stdafx.cpp">
</span><span class="cx"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</span><span class="cx"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</span><span class="lines">@@ -240,7 +242,9 @@
</span><span class="cx"> <ItemGroup>
</span><span class="cx"> <ClInclude Include="..\AccessibilityDelegate.h" />
</span><span class="cx"> <ClInclude Include="..\DOMDefaultImpl.h" />
</span><ins>+ <ClInclude Include="..\PageLoadTestClient.h" />
</ins><span class="cx"> <ClInclude Include="..\PrintWebUIDelegate.h" />
</span><ins>+ <ClInclude Include="..\ResourceLoadDelegate.h" />
</ins><span class="cx"> <ClInclude Include="..\stdafx.h" />
</span><span class="cx"> <ClInclude Include="..\WinLauncher.h" />
</span><span class="cx"> <ClInclude Include="..\WinLauncherReplace.h" />
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchervcxprojWinLauncherLibvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.vcxproj.filters        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -49,6 +49,12 @@
</span><span class="cx"> <ClCompile Include="..\Common.cpp">
</span><span class="cx"> <Filter>Source Files</Filter>
</span><span class="cx"> </ClCompile>
</span><ins>+ <ClCompile Include="..\ResourceLoadDelegate.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\PageLoadTestClient.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ins><span class="cx"> </ItemGroup>
</span><span class="cx"> <ItemGroup>
</span><span class="cx"> <ClInclude Include="..\DOMDefaultImpl.h">
</span><span class="lines">@@ -75,6 +81,12 @@
</span><span class="cx"> <ClInclude Include="..\WinLauncherWebHost.h">
</span><span class="cx"> <Filter>Header Files</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\ResourceLoadDelegate.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\PageLoadTestClient.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ins><span class="cx"> </ItemGroup>
</span><span class="cx"> <ItemGroup>
</span><span class="cx"> <ResourceCompile Include="WinLauncherLib.rc">
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherWebHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncherWebHost.cpp (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncherWebHost.cpp        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinLauncherWebHost.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2008, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2008, 2013-2014 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2009, 2011 Brent Fulgham. All rights reserved.
</span><span class="cx"> * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
</span><span class="cx"> * Copyright (C) 2013 Alex Christensen. All rights reserved.
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "WinLauncherWebHost.h"
</span><span class="cx">
</span><span class="cx"> #include "DOMDefaultImpl.h"
</span><ins>+#include "PageLoadTestClient.h"
</ins><span class="cx"> #include "WinLauncher.h"
</span><span class="cx"> #include <WebKit/WebKit.h>
</span><span class="cx">
</span><span class="lines">@@ -82,11 +83,21 @@
</span><span class="cx"> if (FAILED(hr))
</span><span class="cx"> return 0;
</span><span class="cx">
</span><del>- ::SendMessage(m_hURLBarWnd, static_cast<UINT>(WM_SETTEXT), 0, reinterpret_cast<LPARAM>(frameURL.GetBSTR()));
</del><ins>+ if (frameURL.length()) {
+ m_client->pageLoadTestClient().setPageURL(frameURL);
+ m_client->pageLoadTestClient().didCommitLoad();
+ }
</ins><span class="cx">
</span><ins>+ loadURL(frameURL);
+
</ins><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WinLauncherWebHost::loadURL(_bstr_t& url)
+{
+ ::SendMessage(m_hURLBarWnd, static_cast<UINT>(WM_SETTEXT), 0, reinterpret_cast<LPARAM>(url.GetBSTR()));
+}
+
</ins><span class="cx"> HRESULT WinLauncherWebHost::didFailProvisionalLoadWithError(IWebView*, IWebError *error, IWebFrame*)
</span><span class="cx"> {
</span><span class="cx"> _bstr_t errorDescription;
</span><span class="lines">@@ -134,6 +145,15 @@
</span><span class="cx">
</span><span class="cx"> HRESULT WinLauncherWebHost::didFinishLoadForFrame(IWebView* webView, IWebFrame* frame)
</span><span class="cx"> {
</span><ins>+ if (!frame || !webView)
+ return E_POINTER;
+
+ BOOL mainFrame;
+ if (SUCCEEDED(frame->isMainFrame(&mainFrame))) {
+ if (mainFrame)
+ m_client->pageLoadTestClient().didFinishLoad();
+ }
+
</ins><span class="cx"> IDOMDocumentPtr doc;
</span><span class="cx"> frame->DOMDocument(&doc.GetInterfacePtr());
</span><span class="cx">
</span><span class="lines">@@ -158,3 +178,54 @@
</span><span class="cx">
</span><span class="cx"> return hr;
</span><span class="cx"> }
</span><ins>+
+HRESULT WinLauncherWebHost::didStartProvisionalLoadForFrame(IWebView*, IWebFrame* frame)
+{
+ if (!frame)
+ return E_FAIL;
+
+ m_client->pageLoadTestClient().didStartProvisionalLoad(*frame);
+ return S_OK;
+}
+
+HRESULT WinLauncherWebHost::didFailLoadWithError(IWebView*, IWebError*, IWebFrame*)
+{
+ m_client->pageLoadTestClient().didFailLoad();
+ return S_OK;
+}
+
+HRESULT WinLauncherWebHost::didHandleOnloadEventsForFrame(IWebView* sender, IWebFrame* frame)
+{
+ IWebDataSourcePtr dataSource;
+ HRESULT hr = frame->dataSource(&dataSource.GetInterfacePtr());
+ if (FAILED(hr) || !dataSource)
+ hr = frame->provisionalDataSource(&dataSource.GetInterfacePtr());
+ if (FAILED(hr) || !dataSource)
+ return 0;
+
+ IWebMutableURLRequestPtr request;
+ hr = dataSource->request(&request.GetInterfacePtr());
+ if (FAILED(hr) || !request)
+ return 0;
+
+ _bstr_t frameURL;
+ hr = request->mainDocumentURL(frameURL.GetAddress());
+ if (FAILED(hr))
+ return 0;
+
+ if (frameURL.length())
+ m_client->pageLoadTestClient().didHandleOnLoadEvents();
+
+ return S_OK;
+}
+
+HRESULT WinLauncherWebHost::didFirstLayoutInFrame(IWebView*, IWebFrame* frame)
+{
+ BOOL mainFrame;
+ if (SUCCEEDED(frame->isMainFrame(&mainFrame))) {
+ if (mainFrame)
+ m_client->pageLoadTestClient().didFirstLayoutForMainFrame();
+ }
+
+ return S_OK;
+}
</ins></span></pre></div>
<a id="trunkToolsWinLauncherWinLauncherWebHosth"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncherWebHost.h (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncherWebHost.h        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinLauncherWebHost.h        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">
</span><span class="cx"> class WinLauncher;
</span><span class="cx">
</span><del>-class WinLauncherWebHost : public IWebFrameLoadDelegate {
</del><ins>+class WinLauncherWebHost : public IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate {
</ins><span class="cx"> public:
</span><span class="cx"> WinLauncherWebHost(WinLauncher* client, HWND urlBar)
</span><span class="cx"> : m_refCount(1), m_client(client), m_hURLBarWnd(urlBar) { }
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> virtual ULONG STDMETHODCALLTYPE Release();
</span><span class="cx">
</span><span class="cx"> // IWebFrameLoadDelegate
</span><del>- virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame(IWebView*, IWebFrame*) { return S_OK; }
</del><ins>+ virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame(IWebView*, IWebFrame*);
</ins><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame(IWebView*, IWebFrame*) { return S_OK; }
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError(IWebView*, IWebError*, IWebFrame*);
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame(IWebView* webView, IWebFrame*)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didChangeIcons(IWebView*, IWebFrame*) { return S_OK; }
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didReceiveIcon(IWebView*, HBITMAP, IWebFrame*) { return S_OK; }
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame(IWebView*, IWebFrame*);
</span><del>- virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError(IWebView*, IWebError*, IWebFrame*) { return S_OK; }
</del><ins>+ virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError(IWebView*, IWebError*, IWebFrame*);
</ins><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame(IWebView*, IWebFrame*) { return S_OK; }
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL(IWebView*, BSTR url, double delaySeconds, DATE fireDate, IWebFrame*) { return S_OK; }
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame(IWebView*, IWebFrame*) { return S_OK; }
</span><span class="lines">@@ -64,6 +64,14 @@
</span><span class="cx"> virtual /* [local] */ HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable(IWebView*, JSContextRef, JSObjectRef) { return S_OK; }
</span><span class="cx"> virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject(IWebView*, JSContextRef, JSObjectRef, IWebFrame*) { return S_OK; }
</span><span class="cx">
</span><ins>+ // IWebFrameLoadDelegatePrivate
+ virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame(IWebView* sender, IWebFrame*) { return S_OK; }
+ virtual HRESULT STDMETHODCALLTYPE didFirstLayoutInFrame(IWebView* sender, IWebFrame*);
+ virtual HRESULT STDMETHODCALLTYPE didHandleOnloadEventsForFrame(IWebView*, IWebFrame*);
+ virtual HRESULT STDMETHODCALLTYPE didFirstVisuallyNonEmptyLayoutInFrame(IWebView* sender, IWebFrame*) { return S_OK; }
+
+ void loadURL(_bstr_t&);
+
</ins><span class="cx"> protected:
</span><span class="cx"> HRESULT updateAddressBar(IWebView&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinMaincpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinMain.cpp (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinMain.cpp        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/WinMain.cpp        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -53,19 +53,11 @@
</span><span class="cx">
</span><span class="cx"> bool usesLayeredWebView = false;
</span><span class="cx"> bool useFullDesktop = false;
</span><del>-
</del><ins>+ bool pageLoadTesting = false;
</ins><span class="cx"> _bstr_t requestedURL;
</span><del>- int argc = 0;
- WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
- for (int i = 1; i < argc; ++i) {
- if (!wcsicmp(argv[i], L"--transparent"))
- usesLayeredWebView = true;
- else if (!wcsicmp(argv[i], L"--desktop"))
- useFullDesktop = true;
- else if (!requestedURL)
- requestedURL = argv[i];
- }
</del><span class="cx">
</span><ins>+ parseCommandLine(usesLayeredWebView, useFullDesktop, pageLoadTesting, requestedURL);
+
</ins><span class="cx"> // Initialize global strings
</span><span class="cx"> LoadString(hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
</span><span class="cx"> LoadString(hInst, IDC_WINLAUNCHER, szWindowClass, MAX_LOADSTRING);
</span><span class="lines">@@ -107,7 +99,9 @@
</span><span class="cx">
</span><span class="cx"> RECT clientRect = { s_windowPosition.x, s_windowPosition.y, s_windowPosition.x + s_windowSize.cx, s_windowPosition.y + s_windowSize.cy };
</span><span class="cx">
</span><del>- gWinLauncher = new WinLauncher(hMainWnd, hURLBarWnd, usesLayeredWebView);
</del><ins>+ WinLauncherWebHost* webHost = nullptr;
+
+ gWinLauncher = new WinLauncher(hMainWnd, hURLBarWnd, usesLayeredWebView, pageLoadTesting);
</ins><span class="cx"> if (!gWinLauncher)
</span><span class="cx"> goto exit;
</span><span class="cx">
</span><span class="lines">@@ -124,10 +118,16 @@
</span><span class="cx"> if (!setCacheFolder())
</span><span class="cx"> goto exit;
</span><span class="cx">
</span><del>- hr = gWinLauncher->setFrameLoadDelegate(new WinLauncherWebHost(gWinLauncher, hURLBarWnd));
</del><ins>+ webHost = new WinLauncherWebHost(gWinLauncher, hURLBarWnd);
+
+ hr = gWinLauncher->setFrameLoadDelegate(webHost);
</ins><span class="cx"> if (FAILED(hr))
</span><span class="cx"> goto exit;
</span><span class="cx">
</span><ins>+ hr = gWinLauncher->setFrameLoadDelegatePrivate(webHost);
+ if (FAILED(hr))
+ goto exit;
+
</ins><span class="cx"> hr = gWinLauncher->setUIDelegate(new PrintWebUIDelegate());
</span><span class="cx"> if (FAILED (hr))
</span><span class="cx"> goto exit;
</span><span class="lines">@@ -136,6 +136,10 @@
</span><span class="cx"> if (FAILED (hr))
</span><span class="cx"> goto exit;
</span><span class="cx">
</span><ins>+ hr = gWinLauncher->setResourceLoadDelegate(new ResourceLoadDelegate(gWinLauncher));
+ if (FAILED(hr))
+ goto exit;
+
</ins><span class="cx"> hr = gWinLauncher->prepareViews(hMainWnd, clientRect, requestedURL.GetBSTR(), gViewWindow);
</span><span class="cx"> if (FAILED(hr) || !gViewWindow)
</span><span class="cx"> goto exit;
</span></span></pre></div>
<a id="trunkToolsWinLauncherstdafxh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/stdafx.h (174663 => 174664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/stdafx.h        2014-10-13 22:46:59 UTC (rev 174663)
+++ trunk/Tools/WinLauncher/stdafx.h        2014-10-13 23:10:20 UTC (rev 174664)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> #include <windows.h>
</span><span class="cx"> #include <wininet.h>
</span><span class="cx"> #include <wtf/ExportMacros.h>
</span><ins>+#include <wtf/Platform.h>
</ins><span class="cx">
</span><span class="cx"> #if 0
</span><span class="cx"> // Visual Studio Leak Detection
</span></span></pre>
</div>
</div>
</body>
</html>