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

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

Issue 2846303002: Replace ASSERT with DCHECK in platform/ (Closed)
Patch Set: rebase Created 3 years, 7 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 "platform/wtf/Allocator.h" 9 #include "platform/wtf/Allocator.h"
10 #include "platform/wtf/Assertions.h" 10 #include "platform/wtf/Assertions.h"
11 #include "platform/wtf/AutoReset.h" 11 #include "platform/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 20
21 public: 21 public:
22 EventDispatchForbiddenScope() { 22 EventDispatchForbiddenScope() {
23 ASSERT(IsMainThread()); 23 DCHECK(IsMainThread());
24 ++count_; 24 ++count_;
25 } 25 }
26 26
27 ~EventDispatchForbiddenScope() { 27 ~EventDispatchForbiddenScope() {
28 ASSERT(IsMainThread()); 28 DCHECK(IsMainThread());
29 ASSERT(count_); 29 DCHECK(count_);
30 --count_; 30 --count_;
31 } 31 }
32 32
33 static bool IsEventDispatchForbidden() { 33 static bool IsEventDispatchForbidden() {
34 if (!IsMainThread()) 34 if (!IsMainThread())
35 return false; 35 return false;
36 return count_; 36 return count_;
37 } 37 }
38 38
39 class AllowUserAgentEvents { 39 class AllowUserAgentEvents {
40 STACK_ALLOCATED(); 40 STACK_ALLOCATED();
41 41
42 public: 42 public:
43 AllowUserAgentEvents() : change_(&count_, 0) { ASSERT(IsMainThread()); } 43 AllowUserAgentEvents() : change_(&count_, 0) { DCHECK(IsMainThread()); }
44 44
45 ~AllowUserAgentEvents() { ASSERT(!count_); } 45 ~AllowUserAgentEvents() { DCHECK(!count_); }
46 46
47 AutoReset<unsigned> change_; 47 AutoReset<unsigned> change_;
48 }; 48 };
49 49
50 private: 50 private:
51 PLATFORM_EXPORT static unsigned count_; 51 PLATFORM_EXPORT static unsigned count_;
52 }; 52 };
53 53
54 #else 54 #else
55 55
56 class EventDispatchForbiddenScope { 56 class EventDispatchForbiddenScope {
57 STACK_ALLOCATED(); 57 STACK_ALLOCATED();
58 WTF_MAKE_NONCOPYABLE(EventDispatchForbiddenScope); 58 WTF_MAKE_NONCOPYABLE(EventDispatchForbiddenScope);
59 59
60 public: 60 public:
61 EventDispatchForbiddenScope() {} 61 EventDispatchForbiddenScope() {}
62 62
63 class AllowUserAgentEvents { 63 class AllowUserAgentEvents {
64 public: 64 public:
65 AllowUserAgentEvents() {} 65 AllowUserAgentEvents() {}
66 }; 66 };
67 }; 67 };
68 68
69 #endif // DCHECK_IS_ON() 69 #endif // DCHECK_IS_ON()
70 70
71 } // namespace blink 71 } // namespace blink
72 72
73 #endif // EventDispatchForbiddenScope_h 73 #endif // EventDispatchForbiddenScope_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/DragImageTest.cpp ('k') | third_party/WebKit/Source/platform/Language.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698