1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EventDispatchForbiddenScope_h
6 #define EventDispatchForbiddenScope_h
8 #include "platform/PlatformExport.h"
9 #include "wtf/Assertions.h"
10 #include "wtf/MainThread.h"
11 #include "wtf/TemporaryChange.h"
17 class EventDispatchForbiddenScope
{
19 EventDispatchForbiddenScope()
21 ASSERT(isMainThread());
25 ~EventDispatchForbiddenScope()
27 ASSERT(isMainThread());
32 static bool isEventDispatchForbidden()
39 class AllowUserAgentEvents
{
41 AllowUserAgentEvents()
42 : m_change(s_count
, 0)
44 ASSERT(isMainThread());
47 ~AllowUserAgentEvents()
52 TemporaryChange
<unsigned> m_change
;
56 PLATFORM_EXPORT
static unsigned s_count
;
61 class EventDispatchForbiddenScope
{
63 EventDispatchForbiddenScope() { }
65 class AllowUserAgentEvents
{
67 AllowUserAgentEvents() { }
71 #endif // ENABLE(ASSERT)
75 #endif // EventDispatchForbiddenScope_h