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

Side by Side Diff: Source/core/dom/shadow/ComposedTreeWalker.h

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/TreeScopeAdopter.cpp ('k') | Source/core/editing/EditCommand.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 private: 67 private:
68 ComposedTreeWalker(const Node*, ParentTraversalDetails*); 68 ComposedTreeWalker(const Node*, ParentTraversalDetails*);
69 69
70 enum TraversalDirection { 70 enum TraversalDirection {
71 TraversalDirectionForward, 71 TraversalDirectionForward,
72 TraversalDirectionBackward 72 TraversalDirectionBackward
73 }; 73 };
74 74
75 void assertPrecondition() const 75 void assertPrecondition() const
76 { 76 {
77 #ifndef NDEBUG 77 #if ENABLE(ASSERT)
78 ASSERT(m_node); 78 ASSERT(m_node);
79 ASSERT(!m_node->isShadowRoot()); 79 ASSERT(!m_node->isShadowRoot());
80 ASSERT(!isActiveInsertionPoint(*m_node)); 80 ASSERT(!isActiveInsertionPoint(*m_node));
81 #endif 81 #endif
82 } 82 }
83 83
84 void assertPostcondition() const 84 void assertPostcondition() const
85 { 85 {
86 #ifndef NDEBUG 86 #if ENABLE(ASSERT)
87 if (m_node) 87 if (m_node)
88 assertPrecondition(); 88 assertPrecondition();
89 #endif 89 #endif
90 } 90 }
91 91
92 static Node* traverseNode(const Node*, TraversalDirection); 92 static Node* traverseNode(const Node*, TraversalDirection);
93 static Node* traverseLightChildren(const Node*, TraversalDirection); 93 static Node* traverseLightChildren(const Node*, TraversalDirection);
94 94
95 Node* traverseFirstChild(const Node*) const; 95 Node* traverseFirstChild(const Node*) const;
96 Node* traverseLastChild(const Node*) const; 96 Node* traverseLastChild(const Node*) const;
(...skipping 11 matching lines...) Expand all
108 static Node* traverseBackToYoungerShadowRoot(const Node*, TraversalDirection ); 108 static Node* traverseBackToYoungerShadowRoot(const Node*, TraversalDirection );
109 109
110 Node* traverseParentOrHost(const Node*) const; 110 Node* traverseParentOrHost(const Node*) const;
111 111
112 RawPtrWillBeMember<const Node> m_node; 112 RawPtrWillBeMember<const Node> m_node;
113 }; 113 };
114 114
115 inline ComposedTreeWalker::ComposedTreeWalker(const Node* node, StartPolicy star tPolicy) 115 inline ComposedTreeWalker::ComposedTreeWalker(const Node* node, StartPolicy star tPolicy)
116 : m_node(node) 116 : m_node(node)
117 { 117 {
118 #ifndef NDEBUG 118 #if ENABLE(ASSERT)
119 if (m_node && startPolicy == CannotStartFromShadowBoundary) 119 if (m_node && startPolicy == CannotStartFromShadowBoundary)
120 assertPrecondition(); 120 assertPrecondition();
121 #endif 121 #endif
122 } 122 }
123 123
124 inline void ComposedTreeWalker::parent() 124 inline void ComposedTreeWalker::parent()
125 { 125 {
126 assertPrecondition(); 126 assertPrecondition();
127 m_node = traverseParent(m_node); 127 m_node = traverseParent(m_node);
128 assertPostcondition(); 128 assertPostcondition();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 inline Node* ComposedTreeWalker::traverseLastChild(const Node* node) const 207 inline Node* ComposedTreeWalker::traverseLastChild(const Node* node) const
208 { 208 {
209 ASSERT(node); 209 ASSERT(node);
210 return traverseChild(node, TraversalDirectionBackward); 210 return traverseChild(node, TraversalDirectionBackward);
211 } 211 }
212 212
213 } // namespace 213 } // namespace
214 214
215 #endif 215 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/TreeScopeAdopter.cpp ('k') | Source/core/editing/EditCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698