Index: third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp |
diff --git a/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp b/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp |
index efc1b4b99a161bf0e73e1faf24b2430f7a210383..f1989fa13dbd7386630eed075ab946bf19641afc 100644 |
--- a/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp |
+++ b/third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp |
@@ -38,6 +38,10 @@ namespace blink { |
static DocumentLifecycle::DeprecatedTransition* s_deprecatedTransitionStack = 0; |
+// TODO(skyostil): Come up with a better way to store cross-frame lifecycle |
+// related data to avoid this being a global setting. |
+static unsigned s_preventThrottlingCount = 0; |
+ |
DocumentLifecycle::Scope::Scope(DocumentLifecycle& lifecycle, State finalState) |
: m_lifecycle(lifecycle) |
, m_finalState(finalState) |
@@ -62,6 +66,17 @@ DocumentLifecycle::DeprecatedTransition::~DeprecatedTransition() |
s_deprecatedTransitionStack = m_previous; |
} |
+DocumentLifecycle::PreventThrottlingScope::PreventThrottlingScope(DocumentLifecycle& lifecycle) |
+{ |
+ s_preventThrottlingCount++; |
+} |
+ |
+DocumentLifecycle::PreventThrottlingScope::~PreventThrottlingScope() |
+{ |
+ ASSERT(s_preventThrottlingCount > 0); |
+ s_preventThrottlingCount--; |
+} |
+ |
DocumentLifecycle::DocumentLifecycle() |
: m_state(Uninitialized) |
, m_detachCount(0) |
@@ -291,6 +306,11 @@ void DocumentLifecycle::ensureStateAtMost(State state) |
m_state = state; |
} |
+bool DocumentLifecycle::throttlingAllowed() const |
+{ |
+ return !s_preventThrottlingCount; |
+} |
+ |
#if ENABLE(ASSERT) |
#define DEBUG_STRING_CASE(StateName) \ |
case StateName: return #StateName |