Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move DocumentTiming inside ENABLE(WEB_TIMING) guards.
<https://webkit.org/b/120281>

Reviewed by Anders Carlsson.

Looks like this struct is only used by other ENABLE(WEB_TIMING) code, so don't bother
filling it in if we're not building like that.

* dom/Document.cpp:
(WebCore::Document::setReadyState):
(WebCore::Document::finishedParsing):
* dom/Document.h:
* dom/DocumentTiming.h:


Canonical link: https://commits.webkit.org/138251@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Aug 26, 2013
1 parent 0594155 commit e5450ba
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
2013-08-26 Andreas Kling <akling@apple.com>

Move DocumentTiming inside ENABLE(WEB_TIMING) guards.
<https://webkit.org/b/120281>

Reviewed by Anders Carlsson.

Looks like this struct is only used by other ENABLE(WEB_TIMING) code, so don't bother
filling it in if we're not building like that.

* dom/Document.cpp:
(WebCore::Document::setReadyState):
(WebCore::Document::finishedParsing):
* dom/Document.h:
* dom/DocumentTiming.h:

2013-08-26 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Fix compile warning in WebKitDOMCustom
Expand Down
9 changes: 9 additions & 0 deletions Source/WebCore/dom/Document.cpp
Expand Up @@ -1199,6 +1199,7 @@ void Document::setReadyState(ReadyState readyState)
if (readyState == m_readyState)
return;

#if ENABLE(WEB_TIMING)
switch (readyState) {
case Loading:
if (!m_documentTiming.domLoading)
Expand All @@ -1213,6 +1214,7 @@ void Document::setReadyState(ReadyState readyState)
m_documentTiming.domComplete = monotonicallyIncreasingTime();
break;
}
#endif

m_readyState = readyState;
dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false));
Expand Down Expand Up @@ -4396,11 +4398,18 @@ void Document::finishedParsing()
ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
setParsing(false);

#if ENABLE(WEB_TIMING)
if (!m_documentTiming.domContentLoadedEventStart)
m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime();
#endif

dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false));

#if ENABLE(WEB_TIMING)
if (!m_documentTiming.domContentLoadedEventEnd)
m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();
#endif

if (RefPtr<Frame> f = frame()) {
// FrameLoader::finishedParsing() might end up calling Document::implicitClose() if all
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/dom/Document.h
Expand Up @@ -1074,7 +1074,9 @@ class Document : public ContainerNode, public TreeScope, public ScriptExecutionC
PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&) const;
#endif

#if ENABLE(WEB_TIMING)
const DocumentTiming* timing() const { return &m_documentTiming; }
#endif

#if ENABLE(REQUEST_ANIMATION_FRAME)
int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
Expand Down Expand Up @@ -1494,7 +1496,10 @@ class Document : public ContainerNode, public TreeScope, public ScriptExecutionC
bool m_directionSetOnDocumentElement;
bool m_writingModeSetOnDocumentElement;

#if ENABLE(WEB_TIMING)
DocumentTiming m_documentTiming;
#endif

RefPtr<MediaQueryMatcher> m_mediaQueryMatcher;
bool m_writeRecursionIsTooDeep;
unsigned m_writeRecursionDepth;
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/dom/DocumentTiming.h
Expand Up @@ -26,6 +26,8 @@
#ifndef DocumentTiming_h
#define DocumentTiming_h

#if ENABLE(WEB_TIMING)

namespace WebCore {

struct DocumentTiming {
Expand All @@ -48,3 +50,5 @@ struct DocumentTiming {
}

#endif

#endif

0 comments on commit e5450ba

Please sign in to comment.