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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/EditingState.h

Issue 1703903002: Editing: Remove unreasonable ASSERT_NO_EDITING_ABORT instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 EditingState_h 5 #ifndef EditingState_h
6 #define EditingState_h 6 #define EditingState_h
7 7
8 #include "wtf/Allocator.h" 8 #include "wtf/Allocator.h"
9 #include "wtf/Assertions.h" 9 #include "wtf/Assertions.h"
10 #include "wtf/Noncopyable.h" 10 #include "wtf/Noncopyable.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #define ASSERT_IN_EDITING_COMMAND(expr) \ 58 #define ASSERT_IN_EDITING_COMMAND(expr) \
59 do { \ 59 do { \
60 if (!(expr)) { \ 60 if (!(expr)) { \
61 editingState->abort(); \ 61 editingState->abort(); \
62 return; \ 62 return; \
63 } \ 63 } \
64 break; \ 64 break; \
65 } while (true) 65 } while (true)
66 66
67 #if ENABLE(ASSERT) 67 #if ENABLE(ASSERT)
68 // TODO(yosin): Once all commands aware |EditingState|, we get rid of 68 // This class is inspired by |NoExceptionStateAssertionChecker|.
69 // |NoEditingAbortChecker| class
70 // This class is inspired by |NoExceptionStateAssertionChecke|.
71 class NoEditingAbortChecker final { 69 class NoEditingAbortChecker final {
72 STACK_ALLOCATED(); 70 STACK_ALLOCATED();
73 WTF_MAKE_NONCOPYABLE(NoEditingAbortChecker); 71 WTF_MAKE_NONCOPYABLE(NoEditingAbortChecker);
74 public: 72 public:
75 NoEditingAbortChecker(const char* file, int line); 73 NoEditingAbortChecker(const char* file, int line);
76 ~NoEditingAbortChecker(); 74 ~NoEditingAbortChecker();
77 75
78 EditingState* editingState() { return &m_editingState; } 76 EditingState* editingState() { return &m_editingState; }
79 77
80 private: 78 private:
81 EditingState m_editingState; 79 EditingState m_editingState;
82 const char* const m_file; 80 const char* const m_file;
83 int const m_line; 81 int const m_line;
84 }; 82 };
85 83
86 // A macro for default parameter of |EditingState*| parameter. 84 // If a function with EditingState* argument should not be aborted,
87 // TODO(yosin): Once all commands aware |EditingState|, we get rid of 85 // ASSERT_NO_EDITING_ABORT should be specified.
88 // |ASSERT_NO_EDITING_ABORT| macro. 86 // fooFunc(...., ASSERT_NO_EDITING_ABORT);
87 // It causes an assertion failure If ENABLE(ASSERT) and the function was aborted
88 // unexpectedly.
89 #define ASSERT_NO_EDITING_ABORT (NoEditingAbortChecker(__FILE__, __LINE__).editi ngState()) 89 #define ASSERT_NO_EDITING_ABORT (NoEditingAbortChecker(__FILE__, __LINE__).editi ngState())
90 #else 90 #else
91 #define ASSERT_NO_EDITING_ABORT (IgnorableEditingAbortState().editingState()) 91 #define ASSERT_NO_EDITING_ABORT (IgnorableEditingAbortState().editingState())
92 #endif 92 #endif
93 93
94 } // namespace blink 94 } // namespace blink
95 95
96 #endif // EditingState_h 96 #endif // EditingState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698