<!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>[178794] trunk/Source/WebCore</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/178794">178794</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-01-20 18:16:43 -0800 (Tue, 20 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify DiagnosticLoggingClient call sites
https://bugs.webkit.org/show_bug.cgi?id=140701

Reviewed by Andreas Kling.

Simplify DiagnosticLoggingClient call sites by:
- Moving the Settings::diagnosticLoggingEnabled() check inside the
  MainFrame::diagnosticLoggingClient() getter.
- Having MainFrame::diagnosticLoggingClient() return a reference
  instead of a pointer (returning a dummy client if necessary).

Otherwise, each call site needs to both check the setting and do a
null-check on the client which is a bit annoying.

* history/PageCache.cpp:
(WebCore::logPageCacheFailureDiagnosticMessage):
(WebCore::logCanCacheFrameDecision):
(WebCore::logCanCachePageDecision):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::logNavigation):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/SubframeLoader.cpp:
(WebCore::logPluginRequest):
* loader/SubresourceLoader.cpp:
(WebCore::logResourceLoaded):
* page/DiagnosticLoggingClient.h:
(WebCore::DiagnosticLoggingClient::logDiagnosticMessage): Deleted.
(WebCore::DiagnosticLoggingClient::logDiagnosticMessageWithResult): Deleted.
(WebCore::DiagnosticLoggingClient::logDiagnosticMessageWithValue): Deleted.
* page/MainFrame.cpp:
(WebCore::MainFrame::diagnosticLoggingClient):
* page/MainFrame.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehistoryPageCachecpp">trunk/Source/WebCore/history/PageCache.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubframeLoadercpp">trunk/Source/WebCore/loader/SubframeLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDiagnosticLoggingClienth">trunk/Source/WebCore/page/DiagnosticLoggingClient.h</a></li>
<li><a href="#trunkSourceWebCorepageMainFramecpp">trunk/Source/WebCore/page/MainFrame.cpp</a></li>
<li><a href="#trunkSourceWebCorepageMainFrameh">trunk/Source/WebCore/page/MainFrame.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/ChangeLog        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2015-01-20  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Simplify DiagnosticLoggingClient call sites
+        https://bugs.webkit.org/show_bug.cgi?id=140701
+
+        Reviewed by Andreas Kling.
+
+        Simplify DiagnosticLoggingClient call sites by:
+        - Moving the Settings::diagnosticLoggingEnabled() check inside the
+          MainFrame::diagnosticLoggingClient() getter.
+        - Having MainFrame::diagnosticLoggingClient() return a reference
+          instead of a pointer (returning a dummy client if necessary).
+
+        Otherwise, each call site needs to both check the setting and do a
+        null-check on the client which is a bit annoying.
+
+        * history/PageCache.cpp:
+        (WebCore::logPageCacheFailureDiagnosticMessage):
+        (WebCore::logCanCacheFrameDecision):
+        (WebCore::logCanCachePageDecision):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * loader/EmptyClients.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::logNavigation):
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        * loader/SubframeLoader.cpp:
+        (WebCore::logPluginRequest):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::logResourceLoaded):
+        * page/DiagnosticLoggingClient.h:
+        (WebCore::DiagnosticLoggingClient::logDiagnosticMessage): Deleted.
+        (WebCore::DiagnosticLoggingClient::logDiagnosticMessageWithResult): Deleted.
+        (WebCore::DiagnosticLoggingClient::logDiagnosticMessageWithValue): Deleted.
+        * page/MainFrame.cpp:
+        (WebCore::MainFrame::diagnosticLoggingClient):
+        * page/MainFrame.h:
+
</ins><span class="cx"> 2015-01-20  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Should show dynamic specificity values
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryPageCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/PageCache.cpp (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/PageCache.cpp        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/history/PageCache.cpp        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -96,10 +96,9 @@
</span><span class="cx"> };
</span><span class="cx"> COMPILE_ASSERT(NumberOfReasonsFramesCannotBeInPageCache &lt;= sizeof(unsigned)*8, ReasonFrameCannotBeInPageCacheDoesNotFitInBitmap);
</span><span class="cx"> 
</span><del>-static inline void logPageCacheFailureDiagnosticMessage(DiagnosticLoggingClient* client, const String&amp; reason)
</del><ins>+static inline void logPageCacheFailureDiagnosticMessage(DiagnosticLoggingClient&amp; client, const String&amp; reason)
</ins><span class="cx"> {
</span><del>-    if (client)
-        client-&gt;logDiagnosticMessageWithValue(DiagnosticLoggingKeys::pageCacheKey(), DiagnosticLoggingKeys::failureKey(), reason);
</del><ins>+    client.logDiagnosticMessageWithValue(DiagnosticLoggingKeys::pageCacheKey(), DiagnosticLoggingKeys::failureKey(), reason);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline void logPageCacheFailureDiagnosticMessage(Page* page, const String&amp; reason)
</span><span class="lines">@@ -107,12 +106,10 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    MainFrame&amp; mainFrame = page-&gt;mainFrame();
-    if (mainFrame.settings().diagnosticLoggingEnabled())
-        logPageCacheFailureDiagnosticMessage(mainFrame.diagnosticLoggingClient(), reason);
</del><ins>+    logPageCacheFailureDiagnosticMessage(page-&gt;mainFrame().diagnosticLoggingClient(), reason);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static unsigned logCanCacheFrameDecision(Frame&amp; frame, DiagnosticLoggingClient* diagnosticLoggingClient, int indentLevel)
</del><ins>+static unsigned logCanCacheFrameDecision(Frame&amp; frame, DiagnosticLoggingClient&amp; diagnosticLoggingClient, int indentLevel)
</ins><span class="cx"> {
</span><span class="cx">     PCLOG(&quot;+---&quot;);
</span><span class="cx">     if (!frame.loader().documentLoader()) {
</span><span class="lines">@@ -241,7 +238,7 @@
</span><span class="cx">     
</span><span class="cx">     unsigned rejectReasons = 0;
</span><span class="cx">     MainFrame&amp; mainFrame = page.mainFrame();
</span><del>-    DiagnosticLoggingClient* diagnosticLoggingClient = mainFrame.settings().diagnosticLoggingEnabled() ? mainFrame.diagnosticLoggingClient() : nullptr;
</del><ins>+    DiagnosticLoggingClient&amp; diagnosticLoggingClient = mainFrame.diagnosticLoggingClient();
</ins><span class="cx">     unsigned frameRejectReasons = logCanCacheFrameDecision(mainFrame, diagnosticLoggingClient, indentLevel + 1);
</span><span class="cx">     if (frameRejectReasons)
</span><span class="cx">         rejectReasons |= 1 &lt;&lt; FrameCannotBeInPageCache;
</span><span class="lines">@@ -291,8 +288,7 @@
</span><span class="cx">     else
</span><span class="cx">         PCLOG(&quot; Page CAN be cached\n--------&quot;);
</span><span class="cx"> 
</span><del>-    if (diagnosticLoggingClient)
-        diagnosticLoggingClient-&gt;logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageCacheKey(), emptyString(), rejectReasons ? DiagnosticLoggingResultFail : DiagnosticLoggingResultPass);
</del><ins>+    diagnosticLoggingClient.logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageCacheKey(), emptyString(), rejectReasons ? DiagnosticLoggingResultFail : DiagnosticLoggingResultPass);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PageCache* pageCache()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -1829,25 +1829,22 @@
</span><span class="cx"> 
</span><span class="cx"> static void logMediaLoadRequest(Page* page, const String&amp; mediaEngine, const String&amp; errorMessage, bool succeeded)
</span><span class="cx"> {
</span><del>-    if (!page || !page-&gt;settings().diagnosticLoggingEnabled())
</del><ins>+    if (!page)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    DiagnosticLoggingClient* diagnosticLoggingClient = page-&gt;mainFrame().diagnosticLoggingClient();
-    if (!diagnosticLoggingClient)
-        return;
-
</del><ins>+    DiagnosticLoggingClient&amp; diagnosticLoggingClient = page-&gt;mainFrame().diagnosticLoggingClient();
</ins><span class="cx">     if (!succeeded) {
</span><del>-        diagnosticLoggingClient-&gt;logDiagnosticMessageWithResult(DiagnosticLoggingKeys::mediaLoadingFailedKey(), errorMessage, DiagnosticLoggingResultFail);
</del><ins>+        diagnosticLoggingClient.logDiagnosticMessageWithResult(DiagnosticLoggingKeys::mediaLoadingFailedKey(), errorMessage, DiagnosticLoggingResultFail);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    diagnosticLoggingClient-&gt;logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadedKey(), mediaEngine);
</del><ins>+    diagnosticLoggingClient.logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadedKey(), mediaEngine);
</ins><span class="cx"> 
</span><span class="cx">     if (!page-&gt;hasSeenAnyMediaEngine())
</span><del>-        diagnosticLoggingClient-&gt;logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey(), emptyString());
</del><ins>+        diagnosticLoggingClient.logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey(), emptyString());
</ins><span class="cx"> 
</span><span class="cx">     if (!page-&gt;hasSeenMediaEngine(mediaEngine))
</span><del>-        diagnosticLoggingClient-&gt;logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsMediaEngineKey(), mediaEngine);
</del><ins>+        diagnosticLoggingClient.logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsMediaEngineKey(), mediaEngine);
</ins><span class="cx"> 
</span><span class="cx">     page-&gt;sawMediaEngine(mediaEngine);
</span><span class="cx"> }
</span><span class="lines">@@ -5786,16 +5783,8 @@
</span><span class="cx">     if (!m_player)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    Page* page = document().page();
-    if (!page || !page-&gt;settings().diagnosticLoggingEnabled())
-        return;
-
-    DiagnosticLoggingClient* diagnosticLoggingClient = page-&gt;mainFrame().diagnosticLoggingClient();
-    if (!diagnosticLoggingClient)
-        return;
-
-    String engine = m_player-&gt;engineDescription();
-    diagnosticLoggingClient-&gt;logDiagnosticMessageWithValue(DiagnosticLoggingKeys::engineFailedToLoadKey(), engine, String::number(m_player-&gt;platformErrorCode()));
</del><ins>+    if (Frame* frame = document().frame())
+        frame-&gt;mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::engineFailedToLoadKey(), m_player-&gt;engineDescription(), String::number(m_player-&gt;platformErrorCode()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> double HTMLMediaElement::mediaPlayerRequestedPlaybackRate() const
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -631,7 +631,7 @@
</span><span class="cx">     virtual void progressFinished(Frame&amp;) override { }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class EmptyDiagnosticLoggingClient : public DiagnosticLoggingClient {
</del><ins>+class EmptyDiagnosticLoggingClient final : public DiagnosticLoggingClient {
</ins><span class="cx">     virtual void logDiagnosticMessage(const String&amp;, const String&amp;) override { }
</span><span class="cx">     virtual void logDiagnosticMessageWithResult(const String&amp;, const String&amp;, DiagnosticLoggingResultType) override { }
</span><span class="cx">     virtual void logDiagnosticMessageWithValue(const String&amp;, const String&amp;, const String&amp;) override { }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -1400,10 +1400,7 @@
</span><span class="cx">         // Not logging those for now.
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (frame.settings().diagnosticLoggingEnabled()) {
-        if (auto* client = frame.diagnosticLoggingClient())
-            client-&gt;logDiagnosticMessage(DiagnosticLoggingKeys::navigationKey(), navigationDescription);
-    }
</del><ins>+    frame.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::navigationKey(), navigationDescription);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, PassRefPtr&lt;FormState&gt; prpFormState, AllowNavigationToInvalidURL allowNavigationToInvalidURL)
</span><span class="lines">@@ -2277,15 +2274,9 @@
</span><span class="cx">             if (AXObjectCache* cache = m_frame.document()-&gt;existingAXObjectCache())
</span><span class="cx">                 cache-&gt;frameLoadingEventNotification(&amp;m_frame, loadingEvent);
</span><span class="cx"> 
</span><del>-            if (!page || !page-&gt;settings().diagnosticLoggingEnabled())
-                return;
</del><ins>+            if (page)
+                page-&gt;mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageLoadedKey(), emptyString(), error.isNull() ? DiagnosticLoggingResultPass : DiagnosticLoggingResultFail);
</ins><span class="cx"> 
</span><del>-            DiagnosticLoggingClient* diagnosticLoggingClient = page-&gt;mainFrame().diagnosticLoggingClient();
-            if (!diagnosticLoggingClient)
-                return;
-
-            diagnosticLoggingClient-&gt;logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageLoadedKey(), emptyString(), error.isNull() ? DiagnosticLoggingResultPass : DiagnosticLoggingResultFail);
-
</del><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubframeLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubframeLoader.cpp        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx"> 
</span><span class="cx"> static void logPluginRequest(Page* page, const String&amp; mimeType, const String&amp; url, bool success)
</span><span class="cx"> {
</span><del>-    if (!page || !page-&gt;settings().diagnosticLoggingEnabled())
</del><ins>+    if (!page)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     String newMIMEType = mimeType;
</span><span class="lines">@@ -194,17 +194,14 @@
</span><span class="cx">     String pluginFile = page-&gt;pluginData().pluginFileForMimeType(newMIMEType);
</span><span class="cx">     String description = !pluginFile ? newMIMEType : pluginFile;
</span><span class="cx"> 
</span><del>-    DiagnosticLoggingClient* diagnosticLoggingClient = page-&gt;mainFrame().diagnosticLoggingClient();
-    if (!diagnosticLoggingClient)
-        return;
</del><ins>+    DiagnosticLoggingClient&amp; diagnosticLoggingClient = page-&gt;mainFrame().diagnosticLoggingClient();
+    diagnosticLoggingClient.logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), description);
</ins><span class="cx"> 
</span><del>-    diagnosticLoggingClient-&gt;logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), description);
-
</del><span class="cx">     if (!page-&gt;hasSeenAnyPlugin())
</span><del>-        diagnosticLoggingClient-&gt;logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString());
</del><ins>+        diagnosticLoggingClient.logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString());
</ins><span class="cx"> 
</span><span class="cx">     if (!page-&gt;hasSeenPlugin(description))
</span><del>-        diagnosticLoggingClient-&gt;logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), description);
</del><ins>+        diagnosticLoggingClient.logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), description);
</ins><span class="cx"> 
</span><span class="cx">     page-&gt;sawPlugin(description);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -298,7 +298,7 @@
</span><span class="cx"> 
</span><span class="cx"> static void logResourceLoaded(Frame* frame, CachedResource::Type type)
</span><span class="cx"> {
</span><del>-    if (!frame || !frame-&gt;settings().diagnosticLoggingEnabled())
</del><ins>+    if (!frame)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     String resourceType;
</span><span class="lines">@@ -340,8 +340,7 @@
</span><span class="cx">         resourceType = DiagnosticLoggingKeys::otherKey();
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-    if (auto* client = frame-&gt;mainFrame().diagnosticLoggingClient())
-        client-&gt;logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceKey(), DiagnosticLoggingKeys::loadedKey(), resourceType);
</del><ins>+    frame-&gt;mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceKey(), DiagnosticLoggingKeys::loadedKey(), resourceType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SubresourceLoader::didFinishLoading(double finishTime)
</span></span></pre></div>
<a id="trunkSourceWebCorepageDiagnosticLoggingClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DiagnosticLoggingClient.h (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DiagnosticLoggingClient.h        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/page/DiagnosticLoggingClient.h        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -33,9 +33,9 @@
</span><span class="cx"> 
</span><span class="cx"> class DiagnosticLoggingClient {
</span><span class="cx"> public:
</span><del>-    virtual void logDiagnosticMessage(const String&amp; message, const String&amp; description) { UNUSED_PARAM(message); UNUSED_PARAM(description); }
-    virtual void logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, DiagnosticLoggingResultType) { UNUSED_PARAM(message); UNUSED_PARAM(description); }
-    virtual void logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value) { UNUSED_PARAM(message); UNUSED_PARAM(description); UNUSED_PARAM(value); }
</del><ins>+    virtual void logDiagnosticMessage(const String&amp; message, const String&amp; description) = 0;
+    virtual void logDiagnosticMessageWithResult(const String&amp; message, const String&amp; description, DiagnosticLoggingResultType) = 0;
+    virtual void logDiagnosticMessageWithValue(const String&amp; message, const String&amp; description, const String&amp; value) = 0;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual ~DiagnosticLoggingClient() { }
</span></span></pre></div>
<a id="trunkSourceWebCorepageMainFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/MainFrame.cpp (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/MainFrame.cpp        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/page/MainFrame.cpp        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -27,10 +27,13 @@
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Element.h&quot;
</span><ins>+#include &quot;EmptyClients.h&quot;
</ins><span class="cx"> #include &quot;PageConfiguration.h&quot;
</span><span class="cx"> #include &quot;PageOverlayController.h&quot;
</span><span class="cx"> #include &quot;ScrollLatchingState.h&quot;
</span><ins>+#include &quot;Settings.h&quot;
</ins><span class="cx"> #include &quot;WheelEventDeltaTracker.h&quot;
</span><ins>+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include &quot;ServicesOverlayController.h&quot;
</span><span class="lines">@@ -81,6 +84,15 @@
</span><span class="cx">     deref();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+DiagnosticLoggingClient&amp; MainFrame::diagnosticLoggingClient() const
+{
+    static NeverDestroyed&lt;EmptyDiagnosticLoggingClient&gt; dummyClient;
+    if (!settings().diagnosticLoggingEnabled() || !m_diagnosticLoggingClient)
+        return dummyClient;
+
+    return *m_diagnosticLoggingClient;
+}
+
</ins><span class="cx"> void MainFrame::dropChildren()
</span><span class="cx"> {
</span><span class="cx">     while (Frame* child = tree().firstChild())
</span></span></pre></div>
<a id="trunkSourceWebCorepageMainFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/MainFrame.h (178793 => 178794)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/MainFrame.h        2015-01-21 01:59:56 UTC (rev 178793)
+++ trunk/Source/WebCore/page/MainFrame.h        2015-01-21 02:16:43 UTC (rev 178794)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     void resetLatchingState();
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><del>-    DiagnosticLoggingClient* diagnosticLoggingClient() const { return m_diagnosticLoggingClient; }
</del><ins>+    DiagnosticLoggingClient&amp; diagnosticLoggingClient() const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     MainFrame(Page&amp;, PageConfiguration&amp;);
</span></span></pre>
</div>
</div>

</body>
</html>