Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Unified Diff: Source/core/dom/ExecutionContext.cpp

Issue 779563003: [POC-WIP] Link window focus tokens with ExecutionContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ExecutionContext.h ('k') | Source/modules/serviceworkers/ServiceWorkerClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ExecutionContext.cpp
diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
index 23f4accad5d1ef752360d1a3de5642ed6c069d92..b3c60b7a26304807f54c5c00a1dbc128e4f9caa5 100644
--- a/Source/core/dom/ExecutionContext.cpp
+++ b/Source/core/dom/ExecutionContext.cpp
@@ -73,6 +73,7 @@ ExecutionContext::ExecutionContext()
, m_inDispatchErrorEvent(false)
, m_activeDOMObjectsAreSuspended(false)
, m_activeDOMObjectsAreStopped(false)
+ , m_windowFocusToken(0)
{
}
@@ -267,6 +268,23 @@ void ExecutionContext::enforceSandboxFlags(SandboxFlags mask)
}
}
+void ExecutionContext::giveWindowFocusToken()
+{
+ ++m_windowFocusToken;
+}
+
+void ExecutionContext::consumeWindowFocusToken()
+{
+ if (m_windowFocusToken == 0)
+ return;
+ --m_windowFocusToken;
+}
+
+bool ExecutionContext::isWindowFocusAllowed() const
+{
+ return m_windowFocusToken > 0;
+}
+
void ExecutionContext::trace(Visitor* visitor)
{
#if ENABLE(OILPAN)
« no previous file with comments | « Source/core/dom/ExecutionContext.h ('k') | Source/modules/serviceworkers/ServiceWorkerClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698