<!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>[179972] 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/179972">179972</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-02-11 15:57:31 -0800 (Wed, 11 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Add logging to validate the network cache efficacy (Part 2)
https://bugs.webkit.org/show_bug.cgi?id=141345
&lt;rdar://problem/19632080&gt;

Reviewed by Sam Weinig.

Source/WebCore:

Add a few more diagnostic logging keys for the network cache efficacy
logging.

Source/WebKit2:

Add diagnostic logging messages to validate the network cache efficacy.
The following 4 messages are added:
- networkCache / retrieval / success
- networkCache / retrieval / unhandledRequestFailure
- networkCache / retrieval / noLongerInCacheFailure
- networkCache / retrieval / unusableCachedEntryFailure

The messages are sent via IPC from the NetworkProcess to the UIProcess,
where the WebPageProxy code already handles diagnostic messages sent by
the WebProcess.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageDiagnosticLoggingKeyscpp">trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDiagnosticLoggingKeysh">trunk/Source/WebCore/page/DiagnosticLoggingKeys.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCachecpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheh">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheStatisticsh">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheStatisticsCocoamm">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxyh">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebCore/ChangeLog        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-02-11  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WK2] Add logging to validate the network cache efficacy (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=141345
+        &lt;rdar://problem/19632080&gt;
+
+        Reviewed by Sam Weinig.
+
+        Add a few more diagnostic logging keys for the network cache efficacy
+        logging.
+
</ins><span class="cx"> 2015-02-11  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r179166): Crash when accessing document.dir on a document with no elements
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebCore/WebCore.exp.in        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -945,6 +945,11 @@
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0EN3WTF6StringEE4copyERKS2_
</span><span class="cx"> __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_19IDBDatabaseMetadataEE4copyERKS1_
</span><span class="cx"> __ZN7WebCore21DiagnosticLoggingKeys10webViewKeyEv
</span><ins>+__ZN7WebCore21DiagnosticLoggingKeys12retrievalKeyEv
+__ZN7WebCore21DiagnosticLoggingKeys15networkCacheKeyEv
+__ZN7WebCore21DiagnosticLoggingKeys25noLongerInCacheFailureKeyEv
+__ZN7WebCore21DiagnosticLoggingKeys26unhandledRequestFailureKeyEv
+__ZN7WebCore21DiagnosticLoggingKeys29unusableCachedEntryFailureKeyEv
</ins><span class="cx"> __ZN7WebCore21DiagnosticLoggingKeys7userKeyEv
</span><span class="cx"> __ZN7WebCore21DiagnosticLoggingKeys9zoomedKeyEv
</span><span class="cx"> __ZN7WebCore21DisplayRefreshMonitor46handleDisplayRefreshedNotificationOnMainThreadEPv
</span></span></pre></div>
<a id="trunkSourceWebCorepageDiagnosticLoggingKeyscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.cpp        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -103,6 +103,11 @@
</span><span class="cx">     return ASCIILiteral(&quot;navigation&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::networkCacheKey()
+{
+    return ASCIILiteral(&quot;networkCache&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::networkKey()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;network&quot;);
</span><span class="lines">@@ -133,6 +138,11 @@
</span><span class="cx">     return ASCIILiteral(&quot;noDocumentLoader&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::noLongerInCacheFailureKey()
+{
+    return ASCIILiteral(&quot;noLongerInCacheFailure&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::otherKey()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;other&quot;);
</span><span class="lines">@@ -298,6 +308,11 @@
</span><span class="cx">     return ASCIILiteral(&quot;resourceResponse&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::retrievalKey()
+{
+    return ASCIILiteral(&quot;retrieval&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::revalidatingKey()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;revalidating&quot;);
</span><span class="lines">@@ -333,6 +348,16 @@
</span><span class="cx">     return ASCIILiteral(&quot;svgDocument&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String DiagnosticLoggingKeys::unhandledRequestFailureKey()
+{
+    return ASCIILiteral(&quot;unhandledRequestFailure&quot;);
+}
+
+String DiagnosticLoggingKeys::unusableCachedEntryFailureKey()
+{
+    return ASCIILiteral(&quot;unusableCachedEntryFailure&quot;);
+}
+
</ins><span class="cx"> String DiagnosticLoggingKeys::unusedKey()
</span><span class="cx"> {
</span><span class="cx">     return ASCIILiteral(&quot;unused&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorepageDiagnosticLoggingKeysh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DiagnosticLoggingKeys.h (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DiagnosticLoggingKeys.h        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebCore/page/DiagnosticLoggingKeys.h        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -63,10 +63,12 @@
</span><span class="cx">     static String mediaLoadingFailedKey();
</span><span class="cx">     static String mustRevalidateIsExpiredKey();
</span><span class="cx">     static String navigationKey();
</span><ins>+    WEBCORE_EXPORT static String networkCacheKey();
</ins><span class="cx">     static String networkKey();
</span><span class="cx">     static String noCacheKey();
</span><span class="cx">     static String noCurrentHistoryItemKey();
</span><span class="cx">     static String noDocumentLoaderKey();
</span><ins>+    WEBCORE_EXPORT static String noLongerInCacheFailureKey();
</ins><span class="cx">     static String noStoreKey();
</span><span class="cx">     static String notInMemoryCacheKey();
</span><span class="cx">     static String otherKey();
</span><span class="lines">@@ -90,12 +92,15 @@
</span><span class="cx">     static String resourceKey();
</span><span class="cx">     static String resourceRequestKey();
</span><span class="cx">     static String resourceResponseKey();
</span><ins>+    WEBCORE_EXPORT static String retrievalKey();
</ins><span class="cx">     static String revalidatingKey();
</span><span class="cx">     static String sameLoadKey();
</span><span class="cx">     static String scriptKey();
</span><span class="cx">     static String sourceKey();
</span><span class="cx">     static String styleSheetKey();
</span><span class="cx">     static String svgDocumentKey();
</span><ins>+    WEBCORE_EXPORT static String unhandledRequestFailureKey();
+    WEBCORE_EXPORT static String unusableCachedEntryFailureKey();
</ins><span class="cx">     static String unusedKey();
</span><span class="cx">     static String unusedReasonCredentialSettingsKey();
</span><span class="cx">     static String unusedReasonErrorKey();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/ChangeLog        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-02-11  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WK2] Add logging to validate the network cache efficacy (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=141345
+        &lt;rdar://problem/19632080&gt;
+
+        Reviewed by Sam Weinig.
+
+        Add diagnostic logging messages to validate the network cache efficacy.
+        The following 4 messages are added:
+        - networkCache / retrieval / success
+        - networkCache / retrieval / unhandledRequestFailure
+        - networkCache / retrieval / noLongerInCacheFailure
+        - networkCache / retrieval / unusableCachedEntryFailure
+
+        The messages are sent via IPC from the NetworkProcess to the UIProcess,
+        where the WebPageProxy code already handles diagnostic messages sent by
+        the WebProcess.
+
</ins><span class="cx"> 2015-02-11  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (iOS 8): PDFs embedded in &lt;object&gt;/&lt;embed&gt; tag don't load at all
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -301,6 +301,21 @@
</span><span class="cx">     parentProcessConnection()-&gt;send(Messages::WebProcessPool::DidGetStatistics(data, callbackID), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String&amp; message, const String&amp; description)
+{
+    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogDiagnosticMessage(webPageID, message, description), 0);
+}
+
+void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const String&amp; message, const String&amp; description, WebCore::DiagnosticLoggingResultType result)
+{
+    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithResult(webPageID, message, description, result), 0);
+}
+
+void NetworkProcess::logDiagnosticMessageWithValue(uint64_t webPageID, const String&amp; message, const String&amp; description, const String&amp; value)
+{
+    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithValue(webPageID, message, description, value), 0);
+}
+
</ins><span class="cx"> void NetworkProcess::terminate()
</span><span class="cx"> {
</span><span class="cx">     platformTerminate();
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;DownloadManager.h&quot;
</span><span class="cx"> #include &quot;MessageReceiverMap.h&quot;
</span><span class="cx"> #include &quot;NetworkResourceLoadScheduler.h&quot;
</span><ins>+#include &lt;WebCore/DiagnosticLoggingResultType.h&gt;
</ins><span class="cx"> #include &lt;WebCore/SessionID.h&gt;
</span><span class="cx"> #include &lt;memory&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="lines">@@ -75,6 +76,11 @@
</span><span class="cx">     DownloadManager&amp; downloadManager();
</span><span class="cx">     bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; }
</span><span class="cx"> 
</span><ins>+    // Diagnostic messages logging.
+    void logDiagnosticMessage(uint64_t webPageID, const String&amp; message, const String&amp; description);
+    void logDiagnosticMessageWithResult(uint64_t webPageID, const String&amp; message, const String&amp; description, WebCore::DiagnosticLoggingResultType);
+    void logDiagnosticMessageWithValue(uint64_t webPageID, const String&amp; message, const String&amp; description, const String&amp; value);
+
</ins><span class="cx"> private:
</span><span class="cx">     NetworkProcess();
</span><span class="cx">     ~NetworkProcess();
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;NetworkResourceLoader&gt; loader(this);
</span><del>-    NetworkCache::singleton().retrieve(originalRequest(), [loader](std::unique_ptr&lt;NetworkCache::Entry&gt; entry) {
</del><ins>+    NetworkCache::singleton().retrieve(originalRequest(), m_parameters.webPageID, [loader](std::unique_ptr&lt;NetworkCache::Entry&gt; entry) {
</ins><span class="cx">         if (loader-&gt;hasOneRef()) {
</span><span class="cx">             // The loader has been aborted and is only held alive by this lambda.
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -218,7 +218,7 @@
</span><span class="cx">     return NetworkCacheKey(request.httpMethod(), partition, request.url().string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkCache::retrieve(const WebCore::ResourceRequest&amp; originalRequest, std::function&lt;void (std::unique_ptr&lt;Entry&gt;)&gt; completionHandler)
</del><ins>+void NetworkCache::retrieve(const WebCore::ResourceRequest&amp; originalRequest, uint64_t webPageID, std::function&lt;void (std::unique_ptr&lt;Entry&gt;)&gt; completionHandler)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isEnabled());
</span><span class="cx"> 
</span><span class="lines">@@ -227,7 +227,7 @@
</span><span class="cx">     NetworkCacheKey storageKey = makeCacheKey(originalRequest);
</span><span class="cx">     if (!canRetrieve(originalRequest)) {
</span><span class="cx">         if (m_statistics)
</span><del>-            m_statistics-&gt;recordNotUsingCacheForRequest(storageKey, originalRequest);
</del><ins>+            m_statistics-&gt;recordNotUsingCacheForRequest(webPageID, storageKey, originalRequest);
</ins><span class="cx"> 
</span><span class="cx">         completionHandler(nullptr);
</span><span class="cx">         return;
</span><span class="lines">@@ -236,12 +236,12 @@
</span><span class="cx">     auto startTime = std::chrono::system_clock::now();
</span><span class="cx">     unsigned priority = originalRequest.priority();
</span><span class="cx"> 
</span><del>-    m_storage-&gt;retrieve(storageKey, priority, [this, originalRequest, completionHandler, startTime, storageKey](std::unique_ptr&lt;NetworkCacheStorage::Entry&gt; entry) {
</del><ins>+    m_storage-&gt;retrieve(storageKey, priority, [this, originalRequest, completionHandler, startTime, storageKey, webPageID](std::unique_ptr&lt;NetworkCacheStorage::Entry&gt; entry) {
</ins><span class="cx">         if (!entry) {
</span><span class="cx">             LOG(NetworkCache, &quot;(NetworkProcess) not found in storage&quot;);
</span><span class="cx"> 
</span><span class="cx">             if (m_statistics)
</span><del>-                m_statistics-&gt;recordRetrievalFailure(storageKey, originalRequest);
</del><ins>+                m_statistics-&gt;recordRetrievalFailure(webPageID, storageKey, originalRequest);
</ins><span class="cx"> 
</span><span class="cx">             completionHandler(nullptr);
</span><span class="cx">             return false;
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx">         auto decodedEntry = decodeStorageEntry(*entry, originalRequest);
</span><span class="cx">         bool success = !!decodedEntry;
</span><span class="cx">         if (m_statistics)
</span><del>-            m_statistics-&gt;recordRetrievedCachedEntry(storageKey, originalRequest, success);
</del><ins>+            m_statistics-&gt;recordRetrievedCachedEntry(webPageID, storageKey, originalRequest, success);
</ins><span class="cx"> 
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="cx">         auto elapsedMS = std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;(std::chrono::system_clock::now() - startTime).count();
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.h        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">         bool needsRevalidation;
</span><span class="cx">     };
</span><span class="cx">     // Completion handler may get called back synchronously on failure.
</span><del>-    void retrieve(const WebCore::ResourceRequest&amp;, std::function&lt;void (std::unique_ptr&lt;Entry&gt;)&gt;);
</del><ins>+    void retrieve(const WebCore::ResourceRequest&amp;, uint64_t webPageID, std::function&lt;void (std::unique_ptr&lt;Entry&gt;)&gt;);
</ins><span class="cx"> 
</span><span class="cx">     struct MappedBody {
</span><span class="cx"> #if ENABLE(SHAREABLE_RESOURCE)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheStatisticsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> 
</span><span class="cx">     void clear();
</span><span class="cx"> 
</span><del>-    void recordNotUsingCacheForRequest(const NetworkCacheKey&amp;, const WebCore::ResourceRequest&amp;);
-    void recordRetrievalFailure(const NetworkCacheKey&amp;, const WebCore::ResourceRequest&amp;);
-    void recordRetrievedCachedEntry(const NetworkCacheKey&amp;, const WebCore::ResourceRequest&amp;, bool success);
</del><ins>+    void recordNotUsingCacheForRequest(uint64_t webPageID, const NetworkCacheKey&amp;, const WebCore::ResourceRequest&amp;);
+    void recordRetrievalFailure(uint64_t webPageID, const NetworkCacheKey&amp;, const WebCore::ResourceRequest&amp;);
+    void recordRetrievedCachedEntry(uint64_t webPageID, const NetworkCacheKey&amp;, const WebCore::ResourceRequest&amp;, bool success);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit NetworkCacheStatistics(const String&amp; databasePath);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheStatisticsCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -31,6 +31,9 @@
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;NetworkCache.h&quot;
</span><span class="cx"> #include &quot;NetworkCacheFileSystemPosix.h&quot;
</span><ins>+#include &quot;NetworkProcess.h&quot;
+#include &lt;WebCore/DiagnosticLoggingKeys.h&gt;
+#include &lt;WebCore/DiagnosticLoggingResultType.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ResourceRequest.h&gt;
</span><span class="cx"> #include &lt;WebCore/SQLiteDatabaseTracker.h&gt;
</span><span class="cx"> #include &lt;WebCore/SQLiteStatement.h&gt;
</span><span class="lines">@@ -165,40 +168,42 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkCacheStatistics::recordNotUsingCacheForRequest(const NetworkCacheKey&amp; key, const WebCore::ResourceRequest&amp; request)
</del><ins>+void NetworkCacheStatistics::recordNotUsingCacheForRequest(uint64_t webPageID, const NetworkCacheKey&amp; key, const WebCore::ResourceRequest&amp; request)
</ins><span class="cx"> {
</span><span class="cx">     String hash = key.hashAsString();
</span><span class="cx">     WebCore::URL requestURL = request.url();
</span><del>-    queryWasEverRequested(hash, [this, hash, requestURL](bool wasEverRequested) {
</del><ins>+    queryWasEverRequested(hash, [this, hash, requestURL, webPageID](bool wasEverRequested) {
</ins><span class="cx">         if (wasEverRequested) {
</span><del>-            LOG(NetworkCache, &quot;(NetworkProcess) %s was previously requested but is not handled by the cache&quot;, requestURL.string().ascii().data());
-            // FIXME: Do diagnostic logging.
</del><ins>+            LOG(NetworkCache, &quot;(NetworkProcess) webPageID %llu: %s was previously requested but is not handled by the cache&quot;, webPageID, requestURL.string().ascii().data());
+            NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::unhandledRequestFailureKey());
</ins><span class="cx">         } else
</span><span class="cx">             markAsRequested(hash);
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkCacheStatistics::recordRetrievalFailure(const NetworkCacheKey&amp; key, const WebCore::ResourceRequest&amp; request)
</del><ins>+void NetworkCacheStatistics::recordRetrievalFailure(uint64_t webPageID, const NetworkCacheKey&amp; key, const WebCore::ResourceRequest&amp; request)
</ins><span class="cx"> {
</span><span class="cx">     String hash = key.hashAsString();
</span><span class="cx">     WebCore::URL requestURL = request.url();
</span><del>-    queryWasEverRequested(hash, [this, hash, requestURL](bool wasPreviouslyRequested) {
</del><ins>+    queryWasEverRequested(hash, [this, hash, requestURL, webPageID](bool wasPreviouslyRequested) {
</ins><span class="cx">         if (wasPreviouslyRequested) {
</span><del>-            LOG(NetworkCache, &quot;(NetworkProcess) %s was previously cached but is no longer in the cache&quot;, requestURL.string().ascii().data());
-            // FIXME: Do diagnostic logging.
</del><ins>+            LOG(NetworkCache, &quot;(NetworkProcess) webPageID %llu: %s was previously cached but is no longer in the cache&quot;, webPageID, requestURL.string().ascii().data());
+            NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::noLongerInCacheFailureKey());
</ins><span class="cx">         } else
</span><span class="cx">             markAsRequested(hash);
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkCacheStatistics::recordRetrievedCachedEntry(const NetworkCacheKey&amp; key, const WebCore::ResourceRequest&amp; request, bool success)
</del><ins>+void NetworkCacheStatistics::recordRetrievedCachedEntry(uint64_t webPageID, const NetworkCacheKey&amp; key, const WebCore::ResourceRequest&amp; request, bool success)
</ins><span class="cx"> {
</span><span class="cx">     WebCore::URL requestURL = request.url();
</span><del>-    if (success)
-        LOG(NetworkCache, &quot;(NetworkProcess) %s is in the cache and is used&quot;, requestURL.string().ascii().data());
-    else
-        LOG(NetworkCache, &quot;(NetworkProcess) %s is in the cache but wasn't used&quot;, requestURL.string().ascii().data());
-    // FIXME: Do diagnostic logging.
</del><ins>+    if (success) {
+        LOG(NetworkCache, &quot;(NetworkProcess) webPageID %llu: %s is in the cache and is used&quot;, webPageID, requestURL.string().ascii().data());
+        NetworkProcess::singleton().logDiagnosticMessageWithResult(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingResultPass);
+    } else {
+        LOG(NetworkCache, &quot;(NetworkProcess) webPageID %llu: %s is in the cache but wasn't used&quot;, webPageID, requestURL.string().ascii().data());
+        NetworkProcess::singleton().logDiagnosticMessageWithValue(webPageID, WebCore::DiagnosticLoggingKeys::networkCacheKey(), WebCore::DiagnosticLoggingKeys::retrievalKey(), WebCore::DiagnosticLoggingKeys::unusableCachedEntryFailureKey());
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkCacheStatistics::markAsRequested(const String&amp; hash)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -230,6 +230,39 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkProcessProxy::logDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description)
+{
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this,
+    // but for now we simply drop the message in the rare case this happens.
+    if (!page)
+        return;
+
+    page-&gt;logDiagnosticMessage(message, description);
+}
+
+void NetworkProcessProxy::logDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result)
+{
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this,
+    // but for now we simply drop the message in the rare case this happens.
+    if (!page)
+        return;
+
+    page-&gt;logDiagnosticMessageWithResult(message, description, result);
+}
+
+void NetworkProcessProxy::logDiagnosticMessageWithValue(uint64_t pageID, const String&amp; message, const String&amp; description, const String&amp; value)
+{
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    // FIXME: We do this null-check because by the time the decision to log is made, the page may be gone. We should refactor to avoid this,
+    // but for now we simply drop the message in the rare case this happens.
+    if (!page)
+        return;
+
+    page-&gt;logDiagnosticMessageWithValue(message, description, value);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(NETWORK_PROCESS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -91,6 +91,9 @@
</span><span class="cx">     void didCreateNetworkConnectionToWebProcess(const IPC::Attachment&amp;);
</span><span class="cx">     void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&amp;, uint64_t challengeID);
</span><span class="cx">     void didDeleteWebsiteData(uint64_t callbackID);
</span><ins>+    void logDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description);
+    void logDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result);
+    void logDiagnosticMessageWithValue(uint64_t pageID, const String&amp; message, const String&amp; description, const String&amp; value);
</ins><span class="cx"> 
</span><span class="cx">     // ProcessLauncher::Client
</span><span class="cx">     virtual void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -28,6 +28,11 @@
</span><span class="cx">     DidReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
</span><span class="cx"> 
</span><span class="cx">     DidDeleteWebsiteData(uint64_t callbackID)
</span><ins>+
+    # Diagnostic messages logging
+    LogDiagnosticMessage(uint64_t pageID, String message, String description)
+    LogDiagnosticMessageWithResult(uint64_t pageID, String message, String description, uint32_t result)
+    LogDiagnosticMessageWithValue(uint64_t pageID, String message, String description, String value)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(NETWORK_PROCESS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (179971 => 179972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-02-11 23:40:13 UTC (rev 179971)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-02-11 23:57:31 UTC (rev 179972)
</span><span class="lines">@@ -988,6 +988,11 @@
</span><span class="cx"> 
</span><span class="cx">     void setShouldDispatchFakeMouseMoveEvents(bool);
</span><span class="cx"> 
</span><ins>+    // Diagnostic messages logging.
+    void logDiagnosticMessage(const String&amp; message, const String&amp; description);
+    void logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, uint32_t result);
+    void logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value);
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, const WebPageConfiguration&amp;);
</span><span class="cx">     void platformInitialize();
</span><span class="lines">@@ -1237,11 +1242,6 @@
</span><span class="cx">     void setCursor(const WebCore::Cursor&amp;);
</span><span class="cx">     void setCursorHiddenUntilMouseMoves(bool);
</span><span class="cx"> 
</span><del>-    // Diagnostic messages logging.
-    void logDiagnosticMessage(const String&amp; message, const String&amp; description);
-    void logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, uint32_t result);
-    void logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value);
-
</del><span class="cx">     void didReceiveEvent(uint32_t opaqueType, bool handled);
</span><span class="cx">     void stopResponsivenessTimer();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>