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

Side by Side Diff: src/splay-tree.h

Issue 7754022: Fix presubmit errors caused by updated depot tools (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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 | « src/spaces.h ('k') | src/string-stream.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 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return Allocator::New(static_cast<int>(size)); 116 return Allocator::New(static_cast<int>(size));
117 } 117 }
118 INLINE(void operator delete(void* p, size_t)) { 118 INLINE(void operator delete(void* p, size_t)) {
119 return Allocator::Delete(p); 119 return Allocator::Delete(p);
120 } 120 }
121 121
122 Key key() { return key_; } 122 Key key() { return key_; }
123 Value value() { return value_; } 123 Value value() { return value_; }
124 Node* left() { return left_; } 124 Node* left() { return left_; }
125 Node* right() { return right_; } 125 Node* right() { return right_; }
126
126 private: 127 private:
127
128 friend class SplayTree; 128 friend class SplayTree;
129 friend class Locator; 129 friend class Locator;
130 Key key_; 130 Key key_;
131 Value value_; 131 Value value_;
132 Node* left_; 132 Node* left_;
133 Node* right_; 133 Node* right_;
134 }; 134 };
135 135
136 // A locator provides access to a node in the tree without actually 136 // A locator provides access to a node in the tree without actually
137 // exposing the node. 137 // exposing the node.
138 class Locator BASE_EMBEDDED { 138 class Locator BASE_EMBEDDED {
139 public: 139 public:
140 explicit Locator(Node* node) : node_(node) { } 140 explicit Locator(Node* node) : node_(node) { }
141 Locator() : node_(NULL) { } 141 Locator() : node_(NULL) { }
142 const Key& key() { return node_->key_; } 142 const Key& key() { return node_->key_; }
143 Value& value() { return node_->value_; } 143 Value& value() { return node_->value_; }
144 void set_value(const Value& value) { node_->value_ = value; } 144 void set_value(const Value& value) { node_->value_ = value; }
145 inline void bind(Node* node) { node_ = node; } 145 inline void bind(Node* node) { node_ = node; }
146
146 private: 147 private:
147 Node* node_; 148 Node* node_;
148 }; 149 };
149 150
150 template <class Callback> 151 template <class Callback>
151 void ForEach(Callback* callback); 152 void ForEach(Callback* callback);
152 153
153 protected: 154 protected:
154
155 // Resets tree root. Existing nodes become unreachable. 155 // Resets tree root. Existing nodes become unreachable.
156 void ResetRoot() { root_ = NULL; } 156 void ResetRoot() { root_ = NULL; }
157 157
158 private: 158 private:
159 // Search for a node with a given key. If found, root_ points 159 // Search for a node with a given key. If found, root_ points
160 // to the node. 160 // to the node.
161 bool FindInternal(const Key& key); 161 bool FindInternal(const Key& key);
162 162
163 // Inserts a node assuming that root_ is already set up. 163 // Inserts a node assuming that root_ is already set up.
164 void InsertInternal(int cmp, Node* node); 164 void InsertInternal(int cmp, Node* node);
(...skipping 15 matching lines...) Expand all
180 180
181 DISALLOW_COPY_AND_ASSIGN(NodeToPairAdaptor); 181 DISALLOW_COPY_AND_ASSIGN(NodeToPairAdaptor);
182 }; 182 };
183 183
184 class NodeDeleter BASE_EMBEDDED { 184 class NodeDeleter BASE_EMBEDDED {
185 public: 185 public:
186 NodeDeleter() { } 186 NodeDeleter() { }
187 void Call(Node* node) { delete node; } 187 void Call(Node* node) { delete node; }
188 188
189 private: 189 private:
190
191 DISALLOW_COPY_AND_ASSIGN(NodeDeleter); 190 DISALLOW_COPY_AND_ASSIGN(NodeDeleter);
192 }; 191 };
193 192
194 template <class Callback> 193 template <class Callback>
195 void ForEachNode(Callback* callback); 194 void ForEachNode(Callback* callback);
196 195
197 Node* root_; 196 Node* root_;
198 197
199 DISALLOW_COPY_AND_ASSIGN(SplayTree); 198 DISALLOW_COPY_AND_ASSIGN(SplayTree);
200 }; 199 };
201 200
202 201
203 } } // namespace v8::internal 202 } } // namespace v8::internal
204 203
205 #endif // V8_SPLAY_TREE_H_ 204 #endif // V8_SPLAY_TREE_H_
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/string-stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698