<!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>[186756] branches/safari-601.1-branch/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/186756">186756</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2015-07-12 23:54:36 -0700 (Sun, 12 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/186707">r186707</a>.  rdar://problem/21779205</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCorepageDiagnosticLoggingClienth">branches/safari-601.1-branch/Source/WebCore/page/DiagnosticLoggingClient.h</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2ChangeLog">branches/safari-601.1-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2NetworkProcessNetworkProcesscpp">branches/safari-601.1-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessNetworkNetworkProcessProxyh">branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin">branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessWebPageProxycpp">branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessWebPageProxyh">branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2UIProcessWebPageProxymessagesin">branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#branchessafari6011branchSourceWebKit2WebProcessWebCoreSupportWebDiagnosticLoggingClientcpp">branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2015-07-12  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r186707.
+
+    2015-07-10  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+            [WK2] Diagnostic logging messages are causing too much IPC
+            https://bugs.webkit.org/show_bug.cgi?id=146873
+            &lt;rdar://problem/21779205&gt;
+
+            Reviewed by Ryosuke Niwa.
+
+            Move shouldLogAfterSampling() utility function to DiagnosticLoggingClient
+            so it can be easily reused.
+
+            * page/DiagnosticLoggingClient.h:
+            (WebCore::DiagnosticLoggingClient::shouldLogAfterSampling):
+
+2015-07-12  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r186684.
</span><span class="cx"> 
</span><span class="cx">     2015-07-10  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorepageDiagnosticLoggingClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/page/DiagnosticLoggingClient.h (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/page/DiagnosticLoggingClient.h        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebCore/page/DiagnosticLoggingClient.h        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DiagnosticLoggingResultType.h&quot;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><ins>+#include &lt;wtf/RandomNumber.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -41,10 +42,21 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void mainFrameDestroyed() = 0;
</span><span class="cx"> 
</span><ins>+    static bool shouldLogAfterSampling(ShouldSample);
+
</ins><span class="cx"> protected:
</span><span class="cx">     virtual ~DiagnosticLoggingClient() { }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+inline bool DiagnosticLoggingClient::shouldLogAfterSampling(ShouldSample shouldSample)
+{
+    if (shouldSample == ShouldSample::No)
+        return true;
+
+    static const double selectionProbability = 0.05;
+    return randomNumber() &lt;= selectionProbability;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -1,5 +1,46 @@
</span><span class="cx"> 2015-07-12  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r186707.
+
+    2015-07-10  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+            [WK2] Diagnostic logging messages are causing too much IPC
+            https://bugs.webkit.org/show_bug.cgi?id=146873
+            &lt;rdar://problem/21779205&gt;
+
+            Reviewed by Ryosuke Niwa.
+
+            Diagnostic logging messages are causing too much IPC. To address the
+            problem, we now do the sampling of the senders' side (WebContent
+            process and Networking process) instead of the receiver's side
+            (UIProcess).
+
+            * NetworkProcess/NetworkProcess.cpp:
+            (WebKit::NetworkProcess::logDiagnosticMessage):
+            (WebKit::NetworkProcess::logDiagnosticMessageWithResult):
+            (WebKit::NetworkProcess::logDiagnosticMessageWithValue):
+            * UIProcess/Network/NetworkProcessProxy.cpp:
+            (WebKit::NetworkProcessProxy::logSampledDiagnosticMessage):
+            (WebKit::NetworkProcessProxy::logSampledDiagnosticMessageWithResult):
+            (WebKit::NetworkProcessProxy::logSampledDiagnosticMessageWithValue):
+            * UIProcess/Network/NetworkProcessProxy.h:
+            * UIProcess/Network/NetworkProcessProxy.messages.in:
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::logDiagnosticMessage):
+            (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
+            (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
+            (WebKit::WebPageProxy::logSampledDiagnosticMessage):
+            (WebKit::WebPageProxy::logSampledDiagnosticMessageWithResult):
+            (WebKit::WebPageProxy::logSampledDiagnosticMessageWithValue):
+            * UIProcess/WebPageProxy.h:
+            * UIProcess/WebPageProxy.messages.in:
+            * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
+            (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessage):
+            (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithResult):
+            (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValue):
+
+2015-07-12  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r186703.
</span><span class="cx"> 
</span><span class="cx">     2015-07-10  Dean Jackson  &lt;dino@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #include &quot;WebCookieManager.h&quot;
</span><span class="cx"> #include &quot;WebProcessPoolMessages.h&quot;
</span><span class="cx"> #include &quot;WebsiteData.h&quot;
</span><ins>+#include &lt;WebCore/DiagnosticLoggingClient.h&gt;
</ins><span class="cx"> #include &lt;WebCore/Logging.h&gt;
</span><span class="cx"> #include &lt;WebCore/PlatformCookieJar.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceRequest.h&gt;
</span><span class="lines">@@ -478,17 +479,26 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String&amp; message, const String&amp; description, WebCore::ShouldSample shouldSample)
</span><span class="cx"> {
</span><del>-    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogDiagnosticMessage(webPageID, message, description, shouldSample == ShouldSample::Yes), 0);
</del><ins>+    if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
+        return;
+
+    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogSampledDiagnosticMessage(webPageID, message, description), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const String&amp; message, const String&amp; description, WebCore::DiagnosticLoggingResultType result, WebCore::ShouldSample shouldSample)
</span><span class="cx"> {
</span><del>-    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithResult(webPageID, message, description, result, shouldSample == ShouldSample::Yes), 0);
</del><ins>+    if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
+        return;
+
+    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogSampledDiagnosticMessageWithResult(webPageID, message, description, result), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::logDiagnosticMessageWithValue(uint64_t webPageID, const String&amp; message, const String&amp; description, const String&amp; value, WebCore::ShouldSample shouldSample)
</span><span class="cx"> {
</span><del>-    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithValue(webPageID, message, description, value, shouldSample == ShouldSample::Yes), 0);
</del><ins>+    if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
+        return;
+
+    parentProcessConnection()-&gt;send(Messages::NetworkProcessProxy::LogSampledDiagnosticMessageWithValue(webPageID, message, description, value), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::terminate()
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -285,7 +285,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcessProxy::logDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description, bool shouldSample)
</del><ins>+void NetworkProcessProxy::logSampledDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description)
</ins><span class="cx"> {
</span><span class="cx">     WebPageProxy* page = WebProcessProxy::webPage(pageID);
</span><span class="cx">     // 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,
</span><span class="lines">@@ -293,10 +293,10 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    page-&gt;logDiagnosticMessage(message, description, shouldSample);
</del><ins>+    page-&gt;logSampledDiagnosticMessage(message, description);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcessProxy::logDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result, bool shouldSample)
</del><ins>+void NetworkProcessProxy::logSampledDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result)
</ins><span class="cx"> {
</span><span class="cx">     WebPageProxy* page = WebProcessProxy::webPage(pageID);
</span><span class="cx">     // 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,
</span><span class="lines">@@ -304,10 +304,10 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    page-&gt;logDiagnosticMessageWithResult(message, description, result, shouldSample);
</del><ins>+    page-&gt;logSampledDiagnosticMessageWithResult(message, description, result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcessProxy::logDiagnosticMessageWithValue(uint64_t pageID, const String&amp; message, const String&amp; description, const String&amp; value, bool shouldSample)
</del><ins>+void NetworkProcessProxy::logSampledDiagnosticMessageWithValue(uint64_t pageID, const String&amp; message, const String&amp; description, const String&amp; value)
</ins><span class="cx"> {
</span><span class="cx">     WebPageProxy* page = WebProcessProxy::webPage(pageID);
</span><span class="cx">     // 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,
</span><span class="lines">@@ -315,7 +315,7 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    page-&gt;logDiagnosticMessageWithValue(message, description, value, shouldSample);
</del><ins>+    page-&gt;logSampledDiagnosticMessageWithValue(message, description, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcessProxy::sendProcessWillSuspendImminently()
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2UIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -109,9 +109,9 @@
</span><span class="cx">     void didFetchWebsiteData(uint64_t callbackID, const WebsiteData&amp;);
</span><span class="cx">     void didDeleteWebsiteData(uint64_t callbackID);
</span><span class="cx">     void didDeleteWebsiteDataForOrigins(uint64_t callbackID);
</span><del>-    void logDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description, bool shouldSample);
-    void logDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result, bool shouldSample);
-    void logDiagnosticMessageWithValue(uint64_t pageID, const String&amp; message, const String&amp; description, const String&amp; value, bool shouldSample);
</del><ins>+    void logSampledDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description);
+    void logSampledDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result);
+    void logSampledDiagnosticMessageWithValue(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="branchessafari6011branchSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -36,9 +36,9 @@
</span><span class="cx">     SetIsHoldingLockedFiles(bool isHoldingLockedFiles)
</span><span class="cx"> 
</span><span class="cx">     # Diagnostic messages logging
</span><del>-    LogDiagnosticMessage(uint64_t pageID, String message, String description, bool shouldSample)
-    LogDiagnosticMessageWithResult(uint64_t pageID, String message, String description, uint32_t result, bool shouldSample)
-    LogDiagnosticMessageWithValue(uint64_t pageID, String message, String description, String value, bool shouldSample)
</del><ins>+    LogSampledDiagnosticMessage(uint64_t pageID, String message, String description)
+    LogSampledDiagnosticMessageWithResult(uint64_t pageID, String message, String description, uint32_t result)
+    LogSampledDiagnosticMessageWithValue(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="branchessafari6011branchSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx"> #include &quot;WebUserContentControllerProxy.h&quot;
</span><span class="cx"> #include &quot;WebsiteDataStore.h&quot;
</span><span class="cx"> #include &lt;WebCore/BitmapImage.h&gt;
</span><ins>+#include &lt;WebCore/DiagnosticLoggingClient.h&gt;
</ins><span class="cx"> #include &lt;WebCore/DragController.h&gt;
</span><span class="cx"> #include &lt;WebCore/DragData.h&gt;
</span><span class="cx"> #include &lt;WebCore/FloatRect.h&gt;
</span><span class="lines">@@ -114,7 +115,6 @@
</span><span class="cx"> #include &lt;WebCore/WindowFeatures.h&gt;
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><del>-#include &lt;wtf/RandomNumber.h&gt;
</del><span class="cx"> #include &lt;wtf/text/StringView.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><span class="lines">@@ -4717,33 +4717,45 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-static bool shouldLogDiagnosticMessage(bool shouldSample)
</del><ins>+void WebPageProxy::logDiagnosticMessage(const String&amp; message, const String&amp; description, bool shouldSample)
</ins><span class="cx"> {
</span><del>-    if (!shouldSample)
-        return true;
-    // Log 5% of messages when sampling.
-    static const double selectionProbability = 0.05;
-    return randomNumber() &lt;= selectionProbability;
-}
</del><ins>+    if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample ? ShouldSample::Yes : ShouldSample::No))
+        return;
</ins><span class="cx"> 
</span><del>-void WebPageProxy::logDiagnosticMessage(const String&amp; message, const String&amp; description, bool shouldSample)
-{
-    if (shouldLogDiagnosticMessage(shouldSample))
-        m_diagnosticLoggingClient-&gt;logDiagnosticMessage(this, message, description);
</del><ins>+    logSampledDiagnosticMessage(message, description);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, uint32_t result, bool shouldSample)
</span><span class="cx"> {
</span><del>-    if (shouldLogDiagnosticMessage(shouldSample))
-        m_diagnosticLoggingClient-&gt;logDiagnosticMessageWithResult(this, message, description, static_cast&lt;WebCore::DiagnosticLoggingResultType&gt;(result));
</del><ins>+    if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample ? ShouldSample::Yes : ShouldSample::No))
+        return;
+
+    logSampledDiagnosticMessageWithResult(message, description, static_cast&lt;WebCore::DiagnosticLoggingResultType&gt;(result));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value, bool shouldSample)
</span><span class="cx"> {
</span><del>-    if (shouldLogDiagnosticMessage(shouldSample))
-        m_diagnosticLoggingClient-&gt;logDiagnosticMessageWithValue(this, message, description, value);
</del><ins>+    if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample ? ShouldSample::Yes : ShouldSample::No))
+        return;
+
+    logSampledDiagnosticMessageWithValue(message, description, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::logSampledDiagnosticMessage(const String&amp; message, const String&amp; description)
+{
+    m_diagnosticLoggingClient-&gt;logDiagnosticMessage(this, message, description);
+}
+
+void WebPageProxy::logSampledDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, uint32_t result)
+{
+    m_diagnosticLoggingClient-&gt;logDiagnosticMessageWithResult(this, message, description, static_cast&lt;WebCore::DiagnosticLoggingResultType&gt;(result));
+}
+
+void WebPageProxy::logSampledDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value)
+{
+    m_diagnosticLoggingClient-&gt;logDiagnosticMessageWithValue(this, message, description, value);
+}
+
</ins><span class="cx"> void WebPageProxy::rectForCharacterRangeCallback(const IntRect&amp; rect, const EditingRange&amp; actualRange, uint64_t callbackID)
</span><span class="cx"> {
</span><span class="cx">     MESSAGE_CHECK(actualRange.isValid());
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -1060,6 +1060,9 @@
</span><span class="cx">     void logDiagnosticMessage(const String&amp; message, const String&amp; description, bool shouldSample);
</span><span class="cx">     void logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, uint32_t result, bool shouldSample);
</span><span class="cx">     void logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value, bool shouldSample);
</span><ins>+    void logSampledDiagnosticMessage(const String&amp; message, const String&amp; description);
+    void logSampledDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, uint32_t result);
+    void logSampledDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET) &amp;&amp; !PLATFORM(IOS)
</span><span class="cx">     void addPlaybackTargetPickerClient(uint64_t);
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -226,9 +226,9 @@
</span><span class="cx">     ExecuteUndoRedo(uint32_t action) -&gt; (bool result)
</span><span class="cx"> 
</span><span class="cx">     # Diagnostic messages logging
</span><del>-    LogDiagnosticMessage(String message, String description, bool shouldSample)
-    LogDiagnosticMessageWithResult(String message, String description, uint32_t result, bool shouldSample)
-    LogDiagnosticMessageWithValue(String message, String description, String value, bool shouldSample)
</del><ins>+    LogSampledDiagnosticMessage(String message, String description)
+    LogSampledDiagnosticMessageWithResult(String message, String description, uint32_t result)
+    LogSampledDiagnosticMessageWithValue(String message, String description, String value)
</ins><span class="cx"> 
</span><span class="cx">     # Editor notifications
</span><span class="cx">     EditorStateChanged(struct WebKit::EditorState editorState)
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebKit2WebProcessWebCoreSupportWebDiagnosticLoggingClientcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp (186755 => 186756)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp        2015-07-13 06:52:30 UTC (rev 186755)
+++ branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp        2015-07-13 06:54:36 UTC (rev 186756)
</span><span class="lines">@@ -43,32 +43,38 @@
</span><span class="cx"> 
</span><span class="cx"> void WebDiagnosticLoggingClient::logDiagnosticMessage(const String&amp; message, const String&amp; description, WebCore::ShouldSample shouldSample)
</span><span class="cx"> {
</span><del>-    if (!m_page.corePage() || !m_page.corePage()-&gt;settings().diagnosticLoggingEnabled())
</del><ins>+    ASSERT(!m_page.corePage() || m_page.corePage()-&gt;settings().diagnosticLoggingEnabled());
+
+    if (!shouldLogAfterSampling(shouldSample))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Remove this injected bundle API.
</span><span class="cx">     m_page.injectedBundleDiagnosticLoggingClient().logDiagnosticMessage(&amp;m_page, message, description);
</span><del>-    m_page.send(Messages::WebPageProxy::LogDiagnosticMessage(message, description, shouldSample == WebCore::ShouldSample::Yes));
</del><ins>+    m_page.send(Messages::WebPageProxy::LogSampledDiagnosticMessage(message, description));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebDiagnosticLoggingClient::logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, WebCore::DiagnosticLoggingResultType result, WebCore::ShouldSample shouldSample)
</span><span class="cx"> {
</span><del>-    if (!m_page.corePage() || !m_page.corePage()-&gt;settings().diagnosticLoggingEnabled())
</del><ins>+    ASSERT(!m_page.corePage() || m_page.corePage()-&gt;settings().diagnosticLoggingEnabled());
+
+    if (!shouldLogAfterSampling(shouldSample))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Remove this injected bundle API.
</span><span class="cx">     m_page.injectedBundleDiagnosticLoggingClient().logDiagnosticMessageWithResult(&amp;m_page, message, description, result);
</span><del>-    m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithResult(message, description, result, shouldSample == WebCore::ShouldSample::Yes));
</del><ins>+    m_page.send(Messages::WebPageProxy::LogSampledDiagnosticMessageWithResult(message, description, result));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebDiagnosticLoggingClient::logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value, WebCore::ShouldSample shouldSample)
</span><span class="cx"> {
</span><del>-    if (!m_page.corePage() || !m_page.corePage()-&gt;settings().diagnosticLoggingEnabled())
</del><ins>+    ASSERT(!m_page.corePage() || m_page.corePage()-&gt;settings().diagnosticLoggingEnabled());
+
+    if (!shouldLogAfterSampling(shouldSample))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Remove this injected bundle API.
</span><span class="cx">     m_page.injectedBundleDiagnosticLoggingClient().logDiagnosticMessageWithValue(&amp;m_page, message, description, value);
</span><del>-    m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithValue(message, description, value, shouldSample == WebCore::ShouldSample::Yes));
</del><ins>+    m_page.send(Messages::WebPageProxy::LogSampledDiagnosticMessageWithValue(message, description, value));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebDiagnosticLoggingClient::mainFrameDestroyed()
</span></span></pre>
</div>
</div>

</body>
</html>