Title: [154645] trunk/Source/WebCore
Revision
154645
Author
psola...@apple.com
Date
2013-08-26 14:54:39 -0700 (Mon, 26 Aug 2013)

Log Message

Page::console() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=120320

Reviewed by Darin Adler.

Page::m_console is never NULL so console() can just return a reference.

* css/CSSParser.cpp:
(WebCore::CSSParser::logError):
* dom/Document.cpp:
(WebCore::Document::addConsoleMessage):
(WebCore::Document::addMessage):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::pageConsole):
* page/Page.h:
(WebCore::Page::console):
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::parseString):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154644 => 154645)


--- trunk/Source/WebCore/ChangeLog	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/ChangeLog	2013-08-26 21:54:39 UTC (rev 154645)
@@ -1,3 +1,26 @@
+2013-08-26  Pratik Solanki  <psola...@apple.com>
+
+        Page::console() should return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=120320
+
+        Reviewed by Darin Adler.
+
+        Page::m_console is never NULL so console() can just return a reference.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::logError):
+        * dom/Document.cpp:
+        (WebCore::Document::addConsoleMessage):
+        (WebCore::Document::addMessage):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::pageConsole):
+        * page/Page.h:
+        (WebCore::Page::console):
+        * xml/XSLStyleSheetLibxslt.cpp:
+        (WebCore::XSLStyleSheet::parseString):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::docLoaderFunc):
+
 2013-08-26  Rob Buis  <rwlb...@webkit.org>
 
         Lonely stop crashes

Modified: trunk/Source/WebCore/css/CSSParser.cpp (154644 => 154645)


--- trunk/Source/WebCore/css/CSSParser.cpp	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2013-08-26 21:54:39 UTC (rev 154645)
@@ -11717,8 +11717,8 @@
 void CSSParser::logError(const String& message, int lineNumber)
 {
     // FIXME: <http://webkit.org/b/114313> CSS Parser ConsoleMessage errors should include column numbers
-    PageConsole* console = m_styleSheet->singleOwnerDocument()->page()->console();
-    console->addMessage(CSSMessageSource, WarningMessageLevel, message, m_styleSheet->baseURL().string(), lineNumber + 1, 0);
+    PageConsole& console = m_styleSheet->singleOwnerDocument()->page()->console();
+    console.addMessage(CSSMessageSource, WarningMessageLevel, message, m_styleSheet->baseURL().string(), lineNumber + 1, 0);
 }
 
 StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > popKeyframes)

Modified: trunk/Source/WebCore/dom/Document.cpp (154644 => 154645)


--- trunk/Source/WebCore/dom/Document.cpp	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-08-26 21:54:39 UTC (rev 154645)
@@ -4749,7 +4749,7 @@
     }
 
     if (Page* page = this->page())
-        page->console()->addMessage(source, level, message, requestIdentifier, this);
+        page->console().addMessage(source, level, message, requestIdentifier, this);
 }
 
 void Document::addMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, PassRefPtr<ScriptCallStack> callStack, ScriptState* state, unsigned long requestIdentifier)
@@ -4760,7 +4760,7 @@
     }
 
     if (Page* page = this->page())
-        page->console()->addMessage(source, level, message, sourceURL, lineNumber, columnNumber, callStack, state, requestIdentifier);
+        page->console().addMessage(source, level, message, sourceURL, lineNumber, columnNumber, callStack, state, requestIdentifier);
 }
 
 SecurityOrigin* Document::topOrigin() const

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (154644 => 154645)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2013-08-26 21:54:39 UTC (rev 154645)
@@ -691,7 +691,7 @@
 {
     if (!isCurrentlyDisplayedInFrame())
         return 0;
-    return m_frame->page() ? m_frame->page()->console() : 0;
+    return m_frame->page() ? &m_frame->page()->console() : 0;
 }
 
 DOMApplicationCache* DOMWindow::applicationCache() const

Modified: trunk/Source/WebCore/page/Page.h (154644 => 154645)


--- trunk/Source/WebCore/page/Page.h	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/page/Page.h	2013-08-26 21:54:39 UTC (rev 154645)
@@ -394,7 +394,7 @@
     PageThrottler* pageThrottler() { return m_pageThrottler.get(); }
     PassOwnPtr<PageActivityAssertionToken> createActivityToken();
 
-    PageConsole* console() { return m_console.get(); }
+    PageConsole& console() { return *m_console; }
 
 #if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
     void hiddenPageDOMTimerThrottlingStateChanged();
@@ -545,7 +545,7 @@
     bool m_scriptedAnimationsSuspended;
     OwnPtr<PageThrottler> m_pageThrottler;
 
-    OwnPtr<PageConsole> m_console;
+    const OwnPtr<PageConsole> m_console;
 
     HashSet<String> m_seenPlugins;
     HashSet<String> m_seenMediaEngines;

Modified: trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp (154644 => 154645)


--- trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp	2013-08-26 21:54:39 UTC (rev 154645)
@@ -147,7 +147,7 @@
     PageConsole* console = 0;
     Frame* frame = ownerDocument()->frame();
     if (frame && frame->page())
-        console = frame->page()->console();
+        console = &frame->page()->console();
 
     XMLDocumentParserScope scope(cachedResourceLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console);
 

Modified: trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp (154644 => 154645)


--- trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2013-08-26 21:53:05 UTC (rev 154644)
+++ trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2013-08-26 21:54:39 UTC (rev 154645)
@@ -140,7 +140,7 @@
         PageConsole* console = 0;
         Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame();
         if (frame && frame->page())
-            console = frame->page()->console();
+            console = &frame->page()->console();
         xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc);
         xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to