<!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>[197728] trunk/Source</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/197728">197728</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-07 22:44:59 -0800 (Mon, 07 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Enhance logging: Use &quot;always on&quot; macros
https://bugs.webkit.org/show_bug.cgi?id=154499
&lt;rdar://problem/24757730&gt;

Patch by Keith Rollin &lt;krollin@apple.com&gt; on 2016-03-07
Reviewed by Chris Dumez.

Source/WebCore:

Make use of new logging macros by reporting on frame and resource
load activity.

Add new logging to memory pressure handler to show when it's called
and its effectiveness. As part of this change, the various
platform-specific implementations have been unified.

No new tests. No new basic functionality has been added. Only new
logging has been added in release mode or has been enabled to execute
in release mode as well as debug mode.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::prepareForLoadStart):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::isAlwaysOnLoggingAllowed):
* loader/FrameLoader.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::isAlwaysOnLoggingAllowed):
* loader/ResourceLoader.h:
* page/Frame.cpp:
(WebCore::Frame::isAlwaysOnLoggingAllowed):
* page/Frame.h:
* page/Page.cpp:
(WebCore::Page::isAlwaysOnLoggingAllowed):
* page/Page.h:
* page/SessionID.h:
(WebCore::SessionID::isAlwaysOnLoggingAllowed):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
(WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
* platform/MemoryPressureHandler.h:
(WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger):
(WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
* platform/linux/MemoryPressureHandlerLinux.cpp:
(WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
* platform/win/MemoryPressureHandlerWin.cpp:
(WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.

Source/WebKit2:

Make use of new logging macros by reporting on frame and resource
load activity.

Connection updated to report IPC errors, helping us identify when
messaging between processes breaks down.

ChildProcess updated to log if it is terminating early. Some
sysdiagnose logging from customers indicate that this is happening in
the wild.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::didFailLoading):
(WebKit::NetworkResourceLoader::continueWillSendRequest):
(WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed):
* NetworkProcess/NetworkResourceLoader.h:
* Platform/IPC/Connection.cpp:
(IPC::Connection::waitForSyncReply):
* Shared/ChildProcess.cpp:
(WebKit::didCloseOnConnectionWorkQueue):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest):
(WebKit::WebResourceLoader::didReceiveResponse):
(WebKit::WebResourceLoader::didReceiveData):
(WebKit::WebResourceLoader::didFinishResourceLoad):
(WebKit::WebResourceLoader::didFailResourceLoad):
(WebKit::WebResourceLoader::didReceiveResource):
(WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
* WebProcess/Network/WebResourceLoader.h:

Source/WTF:

Update LOG_ALWAYS and LOG_ALWAYS_ERROR macros to take an expression to
be evaluated. If the expression evaluates to True, the associated
message is logged. This facility is used to prevent logging from being
performed in private sessions, but it could be extended to prevent
logging under other circumstances as well.

* wtf/Assertions.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfAssertionsh">trunk/Source/WTF/wtf/Assertions.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderh">trunk/Source/WebCore/loader/FrameLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoaderh">trunk/Source/WebCore/loader/ResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCorepageFramecpp">trunk/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameh">trunk/Source/WebCore/page/Frame.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebCorepageSessionIDh">trunk/Source/WebCore/page/SessionID.h</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlercpp">trunk/Source/WebCore/platform/MemoryPressureHandler.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlerh">trunk/Source/WebCore/platform/MemoryPressureHandler.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm">trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformlinuxMemoryPressureHandlerLinuxcpp">trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformwinMemoryPressureHandlerWincpp">trunk/Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectioncpp">trunk/Source/WebKit2/Platform/IPC/Connection.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedChildProcesscpp">trunk/Source/WebKit2/Shared/ChildProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebLoaderStrategycpp">trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoadercpp">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoaderh">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WTF/ChangeLog        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-03-07  Keith Rollin  &lt;krollin@apple.com&gt;
+
+        Enhance logging: Use &quot;always on&quot; macros
+        https://bugs.webkit.org/show_bug.cgi?id=154499
+        &lt;rdar://problem/24757730&gt;
+
+        Reviewed by Chris Dumez.
+
+        Update LOG_ALWAYS and LOG_ALWAYS_ERROR macros to take an expression to
+        be evaluated. If the expression evaluates to True, the associated
+        message is logged. This facility is used to prevent logging from being
+        performed in private sessions, but it could be extended to prevent
+        logging under other circumstances as well.
+
+        * wtf/Assertions.h:
+
</ins><span class="cx"> 2016-03-04  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove vcxproj build system
</span></span></pre></div>
<a id="trunkSourceWTFwtfAssertionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Assertions.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Assertions.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WTF/wtf/Assertions.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -384,12 +384,12 @@
</span><span class="cx"> 
</span><span class="cx"> #define WTF_LOGGING_PREFIX &quot;#WK: &quot;
</span><span class="cx"> #if LOG_ALWAYS_DISABLED
</span><del>-#define LOG_ALWAYS(format, ...)       ((void)0)
-#define LOG_ALWAYS_ERROR(format, ...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, format, ##__VA_ARGS__)
</del><ins>+#define LOG_ALWAYS(isAllowed, format, ...)       ((void)0)
+#define LOG_ALWAYS_ERROR(isAllowed, format, ...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, format, ##__VA_ARGS__)
</ins><span class="cx"> #else
</span><span class="cx"> #define WTF_LOG_DEFAULT OS_LOG_DEFAULT
</span><del>-#define LOG_ALWAYS(format, ...)       os_log(WTF_LOG_DEFAULT, WTF_LOGGING_PREFIX format, ##__VA_ARGS__)
-#define LOG_ALWAYS_ERROR(format, ...) os_log_error(WTF_LOG_DEFAULT, WTF_LOGGING_PREFIX format, ##__VA_ARGS__)
</del><ins>+#define LOG_ALWAYS(isAllowed, format, ...)       do { if (isAllowed) os_log(WTF_LOG_DEFAULT, WTF_LOGGING_PREFIX format, ##__VA_ARGS__); } while (0)
+#define LOG_ALWAYS_ERROR(isAllowed, format, ...) do { if (isAllowed) os_log_error(WTF_LOG_DEFAULT, WTF_LOGGING_PREFIX format, ##__VA_ARGS__); } while (0)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> /* RELEASE_ASSERT */
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/ChangeLog        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2016-03-07  Keith Rollin  &lt;krollin@apple.com&gt;
+
+        Enhance logging: Use &quot;always on&quot; macros
+        https://bugs.webkit.org/show_bug.cgi?id=154499
+        &lt;rdar://problem/24757730&gt;
+
+        Reviewed by Chris Dumez.
+
+        Make use of new logging macros by reporting on frame and resource
+        load activity.
+
+        Add new logging to memory pressure handler to show when it's called
+        and its effectiveness. As part of this change, the various
+        platform-specific implementations have been unified.
+
+        No new tests. No new basic functionality has been added. Only new
+        logging has been added in release mode or has been enabled to execute
+        in release mode as well as debug mode.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::prepareForLoadStart):
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        (WebCore::FrameLoader::isAlwaysOnLoggingAllowed):
+        * loader/FrameLoader.h:
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::isAlwaysOnLoggingAllowed):
+        * loader/ResourceLoader.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::isAlwaysOnLoggingAllowed):
+        * page/Frame.h:
+        * page/Page.cpp:
+        (WebCore::Page::isAlwaysOnLoggingAllowed):
+        * page/Page.h:
+        * page/SessionID.h:
+        (WebCore::SessionID::isAlwaysOnLoggingAllowed):
+        * platform/MemoryPressureHandler.cpp:
+        (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
+        (WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
+        * platform/MemoryPressureHandler.h:
+        (WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger):
+        (WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
+        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+        (WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
+        * platform/linux/MemoryPressureHandlerLinux.cpp:
+        (WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
+        * platform/win/MemoryPressureHandlerWin.cpp:
+        (WebCore::MemoryPressureHandler::ReliefLogger::platformLog): Deleted.
+
</ins><span class="cx"> 2016-03-07  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Align HTMLCanvasElement.width / height with the specification
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -140,6 +140,8 @@
</span><span class="cx"> #include &quot;WKContentObservation.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#define FRAMELOADER_LOG_ALWAYS(...) LOG_ALWAYS(isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="lines">@@ -1084,6 +1086,8 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::prepareForLoadStart()
</span><span class="cx"> {
</span><ins>+    FRAMELOADER_LOG_ALWAYS(&quot;Starting frame load, frame = %p, main = %d&quot;, &amp;m_frame, m_frame.isMainFrame());
+
</ins><span class="cx">     m_progressTracker-&gt;progressStarted();
</span><span class="cx">     m_client.dispatchDidStartProvisionalLoad();
</span><span class="cx"> 
</span><span class="lines">@@ -2277,9 +2281,11 @@
</span><span class="cx"> 
</span><span class="cx">             AXObjectCache::AXLoadingEvent loadingEvent;
</span><span class="cx">             if (!error.isNull()) {
</span><ins>+                FRAMELOADER_LOG_ALWAYS(&quot;Finished frame load with error, frame = %p, main = %d, isTimeout = %d, isCancellation = %d, errorCode = %d&quot;, &amp;m_frame, m_frame.isMainFrame(), error.isTimeout(), error.isCancellation(), error.errorCode());
</ins><span class="cx">                 m_client.dispatchDidFailLoad(error);
</span><span class="cx">                 loadingEvent = AXObjectCache::AXLoadingFailed;
</span><span class="cx">             } else {
</span><ins>+                FRAMELOADER_LOG_ALWAYS(&quot;Finished frame load without error, frame = %p, main = %d&quot;, &amp;m_frame, m_frame.isMainFrame());
</ins><span class="cx"> #if ENABLE(DATA_DETECTION)
</span><span class="cx">                 if (m_frame.settings().dataDetectorTypes() != DataDetectorTypeNone) {
</span><span class="cx">                     RefPtr&lt;Range&gt; documentRange = makeRange(firstPositionInNode(m_frame.document()-&gt;documentElement()), lastPositionInNode(m_frame.document()-&gt;documentElement()));
</span><span class="lines">@@ -3566,6 +3572,11 @@
</span><span class="cx">     documentLoader.setShouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicyToApply(m_frame, propagatedPolicy));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool FrameLoader::isAlwaysOnLoggingAllowed() const
+{
+    return frame().isAlwaysOnLoggingAllowed();
+}
+
</ins><span class="cx"> bool FrameLoaderClient::hasHTMLView() const
</span><span class="cx"> {
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/loader/FrameLoader.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -296,6 +296,8 @@
</span><span class="cx">     const URL&amp; provisionalLoadErrorBeingHandledURL() const { return m_provisionalLoadErrorBeingHandledURL; }
</span><span class="cx">     void setProvisionalLoadErrorBeingHandledURL(const URL&amp; url) { m_provisionalLoadErrorBeingHandledURL = url; }
</span><span class="cx"> 
</span><ins>+    bool isAlwaysOnLoggingAllowed() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     enum FormSubmissionCacheLoadPolicy {
</span><span class="cx">         MayAttemptCacheOnlyLoadForFormSubmissionItem,
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -754,4 +754,9 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool ResourceLoader::isAlwaysOnLoggingAllowed() const
+{
+    return frameLoader() &amp;&amp; frameLoader()-&gt;isAlwaysOnLoggingAllowed();
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/loader/ResourceLoader.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -145,6 +145,8 @@
</span><span class="cx">     void unschedule(WTF::SchedulePair&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT bool isAlwaysOnLoggingAllowed() const;
+
</ins><span class="cx"> protected:
</span><span class="cx">     ResourceLoader(Frame*, ResourceLoaderOptions);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/page/Frame.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -1053,4 +1053,9 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool Frame::isAlwaysOnLoggingAllowed() const
+{
+    return page() &amp;&amp; page()-&gt;isAlwaysOnLoggingAllowed();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/page/Frame.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -272,6 +272,7 @@
</span><span class="cx">         bool activeDOMObjectsAndAnimationsSuspended() const { return m_activeDOMObjectsAndAnimationsSuspendedCount &gt; 0; }
</span><span class="cx"> 
</span><span class="cx">         bool isURLAllowed(const URL&amp;) const;
</span><ins>+        bool isAlwaysOnLoggingAllowed() const;
</ins><span class="cx"> 
</span><span class="cx">     // ========
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/page/Page.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -2003,4 +2003,9 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool Page::isAlwaysOnLoggingAllowed() const
+{
+    return m_sessionID.isAlwaysOnLoggingAllowed();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/page/Page.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -507,6 +507,8 @@
</span><span class="cx">     bool isControlledByAutomation() const { return m_controlledByAutomation; }
</span><span class="cx">     void setControlledByAutomation(bool controlled) { m_controlledByAutomation = controlled; }
</span><span class="cx"> 
</span><ins>+    bool isAlwaysOnLoggingAllowed() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     WEBCORE_EXPORT void initGroup();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageSessionIDh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SessionID.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SessionID.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/page/SessionID.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     uint64_t sessionID() const { return m_sessionID; }
</span><span class="cx">     bool operator==(SessionID sessionID) const { return m_sessionID == sessionID.m_sessionID; }
</span><span class="cx">     bool operator!=(SessionID sessionID) const { return m_sessionID != sessionID.m_sessionID; }
</span><ins>+    bool isAlwaysOnLoggingAllowed() const { return !isEphemeral(); }
</ins><span class="cx"> 
</span><span class="cx">     static SessionID emptySessionID() { return SessionID(0); }
</span><span class="cx">     static SessionID defaultSessionID() { return SessionID(1); }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -180,13 +180,37 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MemoryPressureHandler::ReliefLogger::logMemoryUsageChange()
+{
+#if !LOG_ALWAYS_DISABLED
+#define STRING_SPECIFICATION &quot;%{public}s&quot;
+#define MEMORYPRESSURE_LOG(...) LOG_ALWAYS(true, __VA_ARGS__)
+#else
+#define STRING_SPECIFICATION &quot;%s&quot;
+#define MEMORYPRESSURE_LOG(...) WTFLogAlways(__VA_ARGS__)
+#endif
+
+    size_t currentMemory = platformMemoryUsage();
+    if (currentMemory == static_cast&lt;size_t&gt;(-1) || m_initialMemory == static_cast&lt;size_t&gt;(-1)) {
+        MEMORYPRESSURE_LOG(&quot;Memory pressure relief: &quot; STRING_SPECIFICATION &quot;: (Unable to get dirty memory information for process)&quot;, m_logString);
+        return;
+    }
+
+    ssize_t memoryDiff = currentMemory - m_initialMemory;
+    if (memoryDiff &lt; 0)
+        MEMORYPRESSURE_LOG(&quot;Memory pressure relief: &quot; STRING_SPECIFICATION &quot;: -dirty %ld bytes (from %lu to %lu)&quot;, m_logString, (memoryDiff * -1), m_initialMemory, currentMemory);
+    else if (memoryDiff &gt; 0)
+        MEMORYPRESSURE_LOG(&quot;Memory pressure relief: &quot; STRING_SPECIFICATION &quot;: +dirty %ld bytes (from %lu to %lu)&quot;, m_logString, memoryDiff, m_initialMemory, currentMemory);
+    else
+        MEMORYPRESSURE_LOG(&quot;Memory pressure relief: &quot; STRING_SPECIFICATION &quot;: =dirty (at %lu bytes)&quot;, m_logString, currentMemory);
+}
+
</ins><span class="cx"> #if !PLATFORM(COCOA) &amp;&amp; !OS(LINUX) &amp;&amp; !PLATFORM(WIN)
</span><span class="cx"> void MemoryPressureHandler::install() { }
</span><span class="cx"> void MemoryPressureHandler::uninstall() { }
</span><span class="cx"> void MemoryPressureHandler::holdOff(unsigned) { }
</span><span class="cx"> void MemoryPressureHandler::respondToMemoryPressure(Critical, Synchronous) { }
</span><span class="cx"> void MemoryPressureHandler::platformReleaseMemory(Critical) { }
</span><del>-void MemoryPressureHandler::ReliefLogger::platformLog() { }
</del><span class="cx"> size_t MemoryPressureHandler::ReliefLogger::platformMemoryUsage() { return 0; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -87,14 +87,22 @@
</span><span class="cx">     public:
</span><span class="cx">         explicit ReliefLogger(const char *log)
</span><span class="cx">             : m_logString(log)
</span><ins>+#if !LOG_ALWAYS_DISABLED
+            , m_initialMemory(platformMemoryUsage())
+#else
</ins><span class="cx">             , m_initialMemory(s_loggingEnabled ? platformMemoryUsage() : 0)
</span><ins>+#endif
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         ~ReliefLogger()
</span><span class="cx">         {
</span><ins>+#if !LOG_ALWAYS_DISABLED
+            logMemoryUsageChange();
+#else
</ins><span class="cx">             if (s_loggingEnabled)
</span><del>-                platformLog();
</del><ins>+                logMemoryUsageChange();
+#endif
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         const char* logString() const { return m_logString; }
</span><span class="lines">@@ -103,7 +111,7 @@
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         size_t platformMemoryUsage();
</span><del>-        void platformLog();
</del><ins>+        void logMemoryUsageChange();
</ins><span class="cx"> 
</span><span class="cx">         const char* m_logString;
</span><span class="cx">         size_t m_initialMemory;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -234,23 +234,6 @@
</span><span class="cx">     return static_cast&lt;size_t&gt;(vmInfo.internal);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MemoryPressureHandler::ReliefLogger::platformLog()
-{
-    size_t currentMemory = platformMemoryUsage();
-    if (currentMemory == static_cast&lt;size_t&gt;(-1) || m_initialMemory == static_cast&lt;size_t&gt;(-1)) {
-        NSLog(@&quot;%s (Unable to get dirty memory information for process)\n&quot;, m_logString);
-        return;
-    }
-
-    ssize_t memoryDiff = currentMemory - m_initialMemory;
-    if (memoryDiff &lt; 0)
-        NSLog(@&quot;Pressure relief: %s: -dirty %ld bytes (from %ld to %ld)\n&quot;, m_logString, (memoryDiff * -1), m_initialMemory, currentMemory);
-    else if (memoryDiff &gt; 0)
-        NSLog(@&quot;Pressure relief: %s: +dirty %ld bytes (from %ld to %ld)\n&quot;, m_logString, memoryDiff, m_initialMemory, currentMemory);
-    else
-        NSLog(@&quot;Pressure relief: %s: =dirty (at %ld bytes)\n&quot;, m_logString, currentMemory);
-}
-
</del><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> static void respondToMemoryPressureCallback(CFRunLoopObserverRef observer, CFRunLoopActivity /*activity*/, void* /*info*/)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformlinuxMemoryPressureHandlerLinuxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -207,23 +207,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MemoryPressureHandler::ReliefLogger::platformLog()
-{
-    size_t currentMemory = platformMemoryUsage();
-    if (currentMemory == static_cast&lt;size_t&gt;(-1) || m_initialMemory == static_cast&lt;size_t&gt;(-1)) {
-        LOG(MemoryPressure, &quot;%s (Unable to get dirty memory information for process)&quot;, m_logString);
-        return;
-    }
-
-    ssize_t memoryDiff = currentMemory - m_initialMemory;
-    if (memoryDiff &lt; 0)
-        LOG(MemoryPressure, &quot;Pressure relief: %s: -dirty %lu bytes (from %lu to %lu)&quot;, m_logString, static_cast&lt;unsigned long&gt;(memoryDiff * -1), static_cast&lt;unsigned long&gt;(m_initialMemory), static_cast&lt;unsigned long&gt;(currentMemory));
-    else if (memoryDiff &gt; 0)
-        LOG(MemoryPressure, &quot;Pressure relief: %s: +dirty %lu bytes (from %lu to %lu)&quot;, m_logString, static_cast&lt;unsigned long&gt;(memoryDiff), static_cast&lt;unsigned long&gt;(m_initialMemory), static_cast&lt;unsigned long&gt;(currentMemory));
-    else
-        LOG(MemoryPressure, &quot;Pressure relief: %s: =dirty (at %lu bytes)&quot;, m_logString, static_cast&lt;unsigned long&gt;(currentMemory));
-}
-
</del><span class="cx"> size_t MemoryPressureHandler::ReliefLogger::platformMemoryUsage()
</span><span class="cx"> {
</span><span class="cx">     FILE* file = fopen(s_processStatus, &quot;r&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinMemoryPressureHandlerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -128,8 +128,4 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MemoryPressureHandler::ReliefLogger::platformLog()
-{
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-03-07  Keith Rollin  &lt;krollin@apple.com&gt;
+
+        Enhance logging: Use &quot;always on&quot; macros
+        https://bugs.webkit.org/show_bug.cgi?id=154499
+        &lt;rdar://problem/24757730&gt;
+
+        Reviewed by Chris Dumez.
+
+        Make use of new logging macros by reporting on frame and resource
+        load activity.
+
+        Connection updated to report IPC errors, helping us identify when
+        messaging between processes breaks down.
+
+        ChildProcess updated to log if it is terminating early. Some
+        sysdiagnose logging from customers indicate that this is happening in
+        the wild.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::startNetworkLoad):
+        (WebKit::NetworkResourceLoader::didFinishLoading):
+        (WebKit::NetworkResourceLoader::didFailLoading):
+        (WebKit::NetworkResourceLoader::continueWillSendRequest):
+        (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed):
+        * NetworkProcess/NetworkResourceLoader.h:
+        * Platform/IPC/Connection.cpp:
+        (IPC::Connection::waitForSyncReply):
+        * Shared/ChildProcess.cpp:
+        (WebKit::didCloseOnConnectionWorkQueue):
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::scheduleLoad):
+        * WebProcess/Network/WebResourceLoader.cpp:
+        (WebKit::WebResourceLoader::willSendRequest):
+        (WebKit::WebResourceLoader::didReceiveResponse):
+        (WebKit::WebResourceLoader::didReceiveData):
+        (WebKit::WebResourceLoader::didFinishResourceLoad):
+        (WebKit::WebResourceLoader::didFailResourceLoad):
+        (WebKit::WebResourceLoader::didReceiveResource):
+        (WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
+        * WebProcess/Network/WebResourceLoader.h:
+
</ins><span class="cx"> 2016-03-07  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reduce startup and shutdown cost of resource load statistics
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -46,6 +46,9 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><ins>+#define NETWORKRESOURCELOADER_LOG_ALWAYS(...) LOG_ALWAYS(isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+#define NETWORKRESOURCELOADER_LOG_ALWAYS_ERROR(...) LOG_ALWAYS_ERROR(isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> struct NetworkResourceLoader::SynchronousLoadData {
</span><span class="lines">@@ -200,6 +203,8 @@
</span><span class="cx">         m_bufferedDataForCache = SharedBuffer::create();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Starting network resource load: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
+
</ins><span class="cx">     NetworkLoadParameters parameters = m_parameters;
</span><span class="cx">     parameters.defersLoading = m_defersLoading;
</span><span class="cx">     parameters.request = request;
</span><span class="lines">@@ -271,6 +276,8 @@
</span><span class="cx"> 
</span><span class="cx"> auto NetworkResourceLoader::didReceiveResponse(const ResourceResponse&amp; receivedResponse) -&gt; ShouldContinueDidReceiveResponse
</span><span class="cx"> {
</span><ins>+    NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Received network resource response: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d, httpStatusCode = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous(), receivedResponse.httpStatusCode());
+
</ins><span class="cx">     m_response = receivedResponse;
</span><span class="cx"> 
</span><span class="cx">     // For multipart/x-mixed-replace didReceiveResponseAsync gets called multiple times and buffering would require special handling.
</span><span class="lines">@@ -296,13 +303,16 @@
</span><span class="cx">     shouldSendDidReceiveResponse = !m_cacheEntryForValidation;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    bool shouldWaitContinueDidReceiveResponse = originalRequest().requester() == ResourceRequest::Requester::Main;
</del><ins>+    bool shouldWaitContinueDidReceiveResponse = isMainResource();
</ins><span class="cx">     if (shouldSendDidReceiveResponse) {
</span><span class="cx">         if (isSynchronous())
</span><span class="cx">             m_synchronousLoadData-&gt;response = m_response;
</span><span class="cx">         else {
</span><del>-            if (!sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(m_response, shouldWaitContinueDidReceiveResponse)))
</del><ins>+            NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Sending didReceiveResponse message to the WebContent process: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
+            if (!sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(m_response, shouldWaitContinueDidReceiveResponse))) {
+                NETWORKRESOURCELOADER_LOG_ALWAYS_ERROR(&quot;Failed to send the didReceiveResponse IPC message to the WebContent process: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
</ins><span class="cx">                 return ShouldContinueDidReceiveResponse::No;
</span><ins>+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -312,7 +322,13 @@
</span><span class="cx">     shouldContinueDidReceiveResponse = shouldContinueDidReceiveResponse || m_cacheEntryForValidation;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    return shouldContinueDidReceiveResponse ? ShouldContinueDidReceiveResponse::Yes : ShouldContinueDidReceiveResponse::No;
</del><ins>+    if (shouldContinueDidReceiveResponse) {
+        NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Should wait for message from WebContent process before continuing resource load: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
+        return ShouldContinueDidReceiveResponse::Yes;
+    }
+
+    NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Should not wait for message from WebContent process before continuing resource load: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
+    return ShouldContinueDidReceiveResponse::No;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkResourceLoader::didReceiveBuffer(RefPtr&lt;SharedBuffer&gt;&amp;&amp; buffer, int reportedEncodedDataLength)
</span><span class="lines">@@ -344,6 +360,8 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkResourceLoader::didFinishLoading(double finishTime)
</span><span class="cx"> {
</span><ins>+    NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Finished loading network resource: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
+
</ins><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><span class="cx">     if (m_cacheEntryForValidation) {
</span><span class="cx">         // 304 Not Modified
</span><span class="lines">@@ -375,6 +393,8 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkResourceLoader::didFailLoading(const ResourceError&amp; error)
</span><span class="cx"> {
</span><ins>+    NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Failed loading network resource: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d, isTimeout = %d, isCancellation = %d, errCode = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous(), error.isTimeout(), error.isCancellation(), error.errorCode());
+
</ins><span class="cx">     ASSERT(!error.isNull());
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><span class="lines">@@ -419,6 +439,8 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkResourceLoader::continueWillSendRequest(const ResourceRequest&amp; newRequest)
</span><span class="cx"> {
</span><ins>+    NETWORKRESOURCELOADER_LOG_ALWAYS(&quot;Following redirect of network resource: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d&quot;, this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous());
+
</ins><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><span class="cx">     if (m_isWaitingContinueWillSendRequestForCachedRedirect) {
</span><span class="cx">         LOG(NetworkCache, &quot;(NetworkProcess) Retrieving cached redirect&quot;);
</span><span class="lines">@@ -510,7 +532,7 @@
</span><span class="cx">         m_synchronousLoadData-&gt;response = entry-&gt;response();
</span><span class="cx">         sendReplyToSynchronousRequest(*m_synchronousLoadData, entry-&gt;buffer());
</span><span class="cx">     } else {
</span><del>-        bool needsContinueDidReceiveResponseMessage = originalRequest().requester() == ResourceRequest::Requester::Main;
</del><ins>+        bool needsContinueDidReceiveResponseMessage = isMainResource();
</ins><span class="cx">         sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(entry-&gt;response(), needsContinueDidReceiveResponseMessage));
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SHAREABLE_RESOURCE)
</span><span class="lines">@@ -624,4 +646,9 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool NetworkResourceLoader::isAlwaysOnLoggingAllowed() const
+{
+    return sessionID().isAlwaysOnLoggingAllowed();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -98,6 +98,9 @@
</span><span class="cx">     
</span><span class="cx">     void didConvertToDownload();
</span><span class="cx"> 
</span><ins>+    bool isMainResource() const { return m_parameters.request.requester() == WebCore::ResourceRequest::Requester::Main; }
+    bool isAlwaysOnLoggingAllowed() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     NetworkResourceLoader(const NetworkResourceLoadParameters&amp;, NetworkConnectionToWebProcess&amp;, RefPtr&lt;Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply&gt;&amp;&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> #include &lt;wtf/threads/BinarySemaphore.h&gt;
</span><span class="cx"> 
</span><ins>+#define CONNECTION_LOG_ALWAYS_ERROR(...) LOG_ALWAYS_ERROR(true, __VA_ARGS__)
+
</ins><span class="cx"> namespace IPC {
</span><span class="cx"> 
</span><span class="cx"> struct WaitForMessageState {
</span><span class="lines">@@ -575,6 +577,7 @@
</span><span class="cx">         // If that happens, we need to stop waiting, or we'll hang since we won't get
</span><span class="cx">         // any more incoming messages.
</span><span class="cx">         if (!isValid()) {
</span><ins>+            CONNECTION_LOG_ALWAYS_ERROR(&quot;Connection::waitForSyncReply: Connection no longer valid, id = %&quot; PRIu64, syncRequestID);
</ins><span class="cx">             didReceiveSyncReply(syncSendFlags);
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="lines">@@ -585,6 +588,7 @@
</span><span class="cx">         timedOut = !SyncMessageState::singleton().wait(absoluteTime);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    CONNECTION_LOG_ALWAYS_ERROR(&quot;Connection::waitForSyncReply: Timed-out while waiting for reply, id = %&quot; PRIu64, syncRequestID);
</ins><span class="cx">     didReceiveSyncReply(syncSendFlags);
</span><span class="cx"> 
</span><span class="cx">     return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ChildProcess.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcess.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/Shared/ChildProcess.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #include &quot;SandboxInitializationParameters.h&quot;
</span><span class="cx"> #include &lt;unistd.h&gt;
</span><span class="cx"> 
</span><ins>+#define CHILDPROCESS_LOG_ALWAYS_ERROR(...) LOG_ALWAYS_ERROR(true, __VA_ARGS__)
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> ChildProcess::ChildProcess()
</span><span class="lines">@@ -53,6 +55,7 @@
</span><span class="cx">         // We use _exit here since the watchdog callback is called from another thread and we don't want
</span><span class="cx">         // global destructors or atexit handlers to be called from this thread while the main thread is busy
</span><span class="cx">         // doing its thing.
</span><ins>+        CHILDPROCESS_LOG_ALWAYS_ERROR(&quot;Exiting process early due to unacknowledged closed-connection&quot;);
</ins><span class="cx">         _exit(EXIT_FAILURE);
</span><span class="cx">     });
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebLoaderStrategycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/WebProcess/Network/WebLoaderStrategy.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -57,6 +57,9 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><ins>+#define WEBLOADERSTRATEGY_LOG_ALWAYS(...) LOG_ALWAYS(loadParameters.sessionID.isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+#define WEBLOADERSTRATEGY_LOG_ALWAYS_ERROR(...) LOG_ALWAYS_ERROR(loadParameters.sessionID.isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> WebLoaderStrategy::WebLoaderStrategy()
</span><span class="lines">@@ -170,7 +173,7 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    LOG(NetworkScheduling, &quot;(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled with the NetworkProcess with priority %d&quot;, resourceLoader-&gt;url().string().utf8().data(), static_cast&lt;int&gt;(resourceLoader-&gt;request().priority()));
</del><ins>+    LOG(NetworkScheduling, &quot;(WebProcess) WebLoaderStrategy::scheduleLoad, url '%s' will be scheduled with the NetworkProcess with priority %d&quot;, resourceLoader-&gt;url().string().latin1().data(), static_cast&lt;int&gt;(resourceLoader-&gt;request().priority()));
</ins><span class="cx"> 
</span><span class="cx">     ContentSniffingPolicy contentSniffingPolicy = resourceLoader-&gt;shouldSniffContent() ? SniffContent : DoNotSniffContent;
</span><span class="cx">     StoredCredentials allowStoredCredentials = resourceLoader-&gt;shouldUseCredentialStorage() ? AllowStoredCredentials : DoNotAllowStoredCredentials;
</span><span class="lines">@@ -200,13 +203,16 @@
</span><span class="cx">     ASSERT((loadParameters.webPageID &amp;&amp; loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == DoNotAskClientForAnyCredentials);
</span><span class="cx"> 
</span><span class="cx">     if (!WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad(loadParameters), 0)) {
</span><ins>+        WEBLOADERSTRATEGY_LOG_ALWAYS_ERROR(&quot;WebLoaderStrategy::scheduleLoad: Unable to schedule resource with the NetworkProcess with priority = %d, pageID = %llu, frameID = %llu&quot;, static_cast&lt;int&gt;(resourceLoader-&gt;request().priority()), loadParameters.webPageID, loadParameters.webFrameID);
</ins><span class="cx">         // We probably failed to schedule this load with the NetworkProcess because it had crashed.
</span><span class="cx">         // This load will never succeed so we will schedule it to fail asynchronously.
</span><span class="cx">         scheduleInternallyFailedLoad(resourceLoader);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    
-    m_webResourceLoaders.set(identifier, WebResourceLoader::create(resourceLoader));
</del><ins>+
+    auto webResourceLoader = WebResourceLoader::create(resourceLoader);
+    WEBLOADERSTRATEGY_LOG_ALWAYS(&quot;WebLoaderStrategy::scheduleLoad: Resource will be scheduled with the NetworkProcess with priority = %d, pageID = %llu, frameID = %llu, WebResourceLoader = %p&quot;, static_cast&lt;int&gt;(resourceLoader-&gt;request().priority()), loadParameters.webPageID, loadParameters.webFrameID, webResourceLoader.ptr());
+    m_webResourceLoaders.set(identifier, WTFMove(webResourceLoader));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebLoaderStrategy::scheduleInternallyFailedLoad(WebCore::ResourceLoader* resourceLoader)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -42,6 +42,8 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><ins>+#define WEBRESOURCELOADER_LOG_ALWAYS(...) LOG_ALWAYS(isAlwaysOnLoggingAllowed(), __VA_ARGS__)
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;WebResourceLoader&gt; WebResourceLoader::create(PassRefPtr&lt;ResourceLoader&gt; coreLoader)
</span><span class="lines">@@ -75,7 +77,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoader::willSendRequest(const ResourceRequest&amp; proposedRequest, const ResourceResponse&amp; redirectResponse)
</span><span class="cx"> {
</span><del>-    LOG(Network, &quot;(WebProcess) WebResourceLoader::willSendRequest to '%s'&quot;, proposedRequest.url().string().utf8().data());
</del><ins>+    LOG(Network, &quot;(WebProcess) WebResourceLoader::willSendRequest to '%s'&quot;, proposedRequest.url().string().latin1().data());
+    WEBRESOURCELOADER_LOG_ALWAYS(&quot;WebResourceLoader::willSendRequest, WebResourceLoader = %p&quot;, this);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebResourceLoader&gt; protect(this);
</span><span class="cx"> 
</span><span class="lines">@@ -98,7 +101,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoader::didReceiveResponse(const ResourceResponse&amp; response, bool needsContinueDidReceiveResponseMessage)
</span><span class="cx"> {
</span><del>-    LOG(Network, &quot;(WebProcess) WebResourceLoader::didReceiveResponse for '%s'. Status %d.&quot;, m_coreLoader-&gt;url().string().utf8().data(), response.httpStatusCode());
</del><ins>+    LOG(Network, &quot;(WebProcess) WebResourceLoader::didReceiveResponse for '%s'. Status %d.&quot;, m_coreLoader-&gt;url().string().latin1().data(), response.httpStatusCode());
+    WEBRESOURCELOADER_LOG_ALWAYS(&quot;WebResourceLoader::didReceiveResponse, WebResourceLoader = %p, status = %d.&quot;, this, response.httpStatusCode());
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;WebResourceLoader&gt; protect(*this);
</span><span class="cx"> 
</span><span class="lines">@@ -129,7 +133,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoader::didReceiveData(const IPC::DataReference&amp; data, int64_t encodedDataLength)
</span><span class="cx"> {
</span><del>-    LOG(Network, &quot;(WebProcess) WebResourceLoader::didReceiveData of size %i for '%s'&quot;, (int)data.size(), m_coreLoader-&gt;url().string().utf8().data());
</del><ins>+    LOG(Network, &quot;(WebProcess) WebResourceLoader::didReceiveData of size %lu for '%s'&quot;, data.size(), m_coreLoader-&gt;url().string().latin1().data());
+    WEBRESOURCELOADER_LOG_ALWAYS(&quot;WebResourceLoader::didReceiveData, WebResourceLoader = %p, size = %lu&quot;, this, data.size());
</ins><span class="cx"> 
</span><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx">     if (QuickLookHandle* quickLookHandle = m_coreLoader-&gt;documentLoader()-&gt;quickLookHandle()) {
</span><span class="lines">@@ -142,7 +147,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoader::didFinishResourceLoad(double finishTime)
</span><span class="cx"> {
</span><del>-    LOG(Network, &quot;(WebProcess) WebResourceLoader::didFinishResourceLoad for '%s'&quot;, m_coreLoader-&gt;url().string().utf8().data());
</del><ins>+    LOG(Network, &quot;(WebProcess) WebResourceLoader::didFinishResourceLoad for '%s'&quot;, m_coreLoader-&gt;url().string().latin1().data());
+    WEBRESOURCELOADER_LOG_ALWAYS(&quot;WebResourceLoader::didFinishResourceLoad, WebResourceLoader = %p&quot;, this);
</ins><span class="cx"> 
</span><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx">     if (QuickLookHandle* quickLookHandle = m_coreLoader-&gt;documentLoader()-&gt;quickLookHandle()) {
</span><span class="lines">@@ -155,8 +161,9 @@
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoader::didFailResourceLoad(const ResourceError&amp; error)
</span><span class="cx"> {
</span><del>-    LOG(Network, &quot;(WebProcess) WebResourceLoader::didFailResourceLoad for '%s'&quot;, m_coreLoader-&gt;url().string().utf8().data());
-    
</del><ins>+    LOG(Network, &quot;(WebProcess) WebResourceLoader::didFailResourceLoad for '%s'&quot;, m_coreLoader-&gt;url().string().latin1().data());
+    WEBRESOURCELOADER_LOG_ALWAYS(&quot;WebResourceLoader::didFailResourceLoad, WebResourceLoader = %p&quot;, this);
+
</ins><span class="cx"> #if USE(QUICK_LOOK)
</span><span class="cx">     if (QuickLookHandle* quickLookHandle = m_coreLoader-&gt;documentLoader()-&gt;quickLookHandle())
</span><span class="cx">         quickLookHandle-&gt;didFail();
</span><span class="lines">@@ -169,7 +176,8 @@
</span><span class="cx"> #if ENABLE(SHAREABLE_RESOURCE)
</span><span class="cx"> void WebResourceLoader::didReceiveResource(const ShareableResource::Handle&amp; handle, double finishTime)
</span><span class="cx"> {
</span><del>-    LOG(Network, &quot;(WebProcess) WebResourceLoader::didReceiveResource for '%s'&quot;, m_coreLoader-&gt;url().string().utf8().data());
</del><ins>+    LOG(Network, &quot;(WebProcess) WebResourceLoader::didReceiveResource for '%s'&quot;, m_coreLoader-&gt;url().string().latin1().data());
+    WEBRESOURCELOADER_LOG_ALWAYS(&quot;WebResourceLoader::didReceiveResource, WebResourceLoader = %p&quot;, this);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;SharedBuffer&gt; buffer = handle.tryWrapInSharedBuffer();
</span><span class="cx"> 
</span><span class="lines">@@ -213,4 +221,9 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool WebResourceLoader::isAlwaysOnLoggingAllowed() const
+{
+    return resourceLoader() &amp;&amp; resourceLoader()-&gt;isAlwaysOnLoggingAllowed();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h (197727 => 197728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h        2016-03-08 06:42:51 UTC (rev 197727)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h        2016-03-08 06:44:59 UTC (rev 197728)
</span><span class="lines">@@ -66,6 +66,8 @@
</span><span class="cx"> 
</span><span class="cx">     void detachFromCoreLoader();
</span><span class="cx"> 
</span><ins>+    bool isAlwaysOnLoggingAllowed() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     WebResourceLoader(PassRefPtr&lt;WebCore::ResourceLoader&gt;);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>