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

Side by Side Diff: third_party/WebKit/Source/platform/EventDispatchForbiddenScope.h

Issue 2151933003: Change WTF::TemporaryChange to be an alias for AutoReset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TemporaryChange -> AutoReset Created 4 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EventDispatchForbiddenScope_h 5 #ifndef EventDispatchForbiddenScope_h
6 #define EventDispatchForbiddenScope_h 6 #define EventDispatchForbiddenScope_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
11 #include "wtf/TemporaryChange.h" 11 #include "wtf/AutoReset.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 #if DCHECK_IS_ON() 15 #if DCHECK_IS_ON()
16 16
17 class EventDispatchForbiddenScope { 17 class EventDispatchForbiddenScope {
18 STACK_ALLOCATED(); 18 STACK_ALLOCATED();
19 WTF_MAKE_NONCOPYABLE(EventDispatchForbiddenScope); 19 WTF_MAKE_NONCOPYABLE(EventDispatchForbiddenScope);
20 public: 20 public:
21 EventDispatchForbiddenScope() 21 EventDispatchForbiddenScope()
(...skipping 13 matching lines...) Expand all
35 { 35 {
36 if (!isMainThread()) 36 if (!isMainThread())
37 return false; 37 return false;
38 return s_count; 38 return s_count;
39 } 39 }
40 40
41 class AllowUserAgentEvents { 41 class AllowUserAgentEvents {
42 STACK_ALLOCATED(); 42 STACK_ALLOCATED();
43 public: 43 public:
44 AllowUserAgentEvents() 44 AllowUserAgentEvents()
45 : m_change(s_count, 0) 45 : m_change(&s_count, 0)
46 { 46 {
47 ASSERT(isMainThread()); 47 ASSERT(isMainThread());
48 } 48 }
49 49
50 ~AllowUserAgentEvents() 50 ~AllowUserAgentEvents()
51 { 51 {
52 ASSERT(!s_count); 52 ASSERT(!s_count);
53 } 53 }
54 54
55 TemporaryChange<unsigned> m_change; 55 AutoReset<unsigned> m_change;
56 }; 56 };
57 57
58 private: 58 private:
59 PLATFORM_EXPORT static unsigned s_count; 59 PLATFORM_EXPORT static unsigned s_count;
60 }; 60 };
61 61
62 #else 62 #else
63 63
64 class EventDispatchForbiddenScope { 64 class EventDispatchForbiddenScope {
65 STACK_ALLOCATED(); 65 STACK_ALLOCATED();
66 WTF_MAKE_NONCOPYABLE(EventDispatchForbiddenScope); 66 WTF_MAKE_NONCOPYABLE(EventDispatchForbiddenScope);
67 public: 67 public:
68 EventDispatchForbiddenScope() { } 68 EventDispatchForbiddenScope() { }
69 69
70 class AllowUserAgentEvents { 70 class AllowUserAgentEvents {
71 public: 71 public:
72 AllowUserAgentEvents() { } 72 AllowUserAgentEvents() { }
73 }; 73 };
74 }; 74 };
75 75
76 #endif // DCHECK_IS_ON() 76 #endif // DCHECK_IS_ON()
77 77
78 } // namespace blink 78 } // namespace blink
79 79
80 #endif // EventDispatchForbiddenScope_h 80 #endif // EventDispatchForbiddenScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698