This source file includes following definitions.
- m_finalState
- m_to
- canAdvanceTo
- advanceTo
#include "config.h"
#include "core/dom/DocumentLifecycle.h"
#include "wtf/Assertions.h"
namespace WebCore {
static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0;
DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState)
: m_lifecycle(lifecycle)
, m_finalState(finalState)
{
}
DocumentLifecycle::Scope::~Scope()
{
m_lifecycle.advanceTo(m_finalState);
}
DocumentLifecycle::DeprecatedTransition::DeprecatedTransition(State from, State to)
: m_previous(s_deprecatedTransitionStack)
, m_from(from)
, m_to(to)
{
s_deprecatedTransitionStack = this;
}
DocumentLifecycle::DeprecatedTransition::~DeprecatedTransition()
{
s_deprecatedTransitionStack = m_previous;
}
DocumentLifecycle::DocumentLifecycle()
: m_state(Uninitialized)
{
}
DocumentLifecycle::~DocumentLifecycle()
{
}
#if !ASSERT_DISABLED
bool DocumentLifecycle::canAdvanceTo(State state) const
{
if (s_deprecatedTransitionStack && m_state == s_deprecatedTransitionStack->from() && state == s_deprecatedTransitionStack->to())
return true;
if (state > m_state)
return true;
if (m_state == Disposed) {
return state == Disposed;
}
if (m_state == StyleClean) {
if (state == StyleRecalcPending)
return true;
if (state == InStyleRecalc)
return true;
if (state == InPreLayout)
return true;
if (state == InPerformLayout)
return true;
if (state == StyleClean)
return true;
return false;
}
if (m_state == InPreLayout) {
if (state == InStyleRecalc)
return true;
if (state == StyleClean)
return true;
if (state == InPreLayout)
return true;
return false;
}
if (m_state == AfterPerformLayout) {
if (state == InPreLayout)
return true;
if (state == StyleClean)
return true;
return false;
}
if (m_state == LayoutClean) {
if (state == StyleRecalcPending)
return true;
if (state == InStyleRecalc)
return true;
if (state == InPreLayout)
return true;
if (state == InPerformLayout)
return true;
if (state == LayoutClean)
return true;
if (state == StyleClean)
return true;
return false;
}
if (m_state == CompositingClean) {
if (state == StyleRecalcPending)
return true;
if (state == InStyleRecalc)
return true;
if (state == InPreLayout)
return true;
if (state == InCompositingUpdate)
return true;
return false;
}
return false;
}
#endif
void DocumentLifecycle::advanceTo(State state)
{
ASSERT(canAdvanceTo(state));
m_state = state;
}
}