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

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

Issue 10534006: Remove TLS access for current Zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 8 years, 6 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
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const Key& key() { return node_->key_; } 146 const Key& key() { return node_->key_; }
147 Value& value() { return node_->value_; } 147 Value& value() { return node_->value_; }
148 void set_value(const Value& value) { node_->value_ = value; } 148 void set_value(const Value& value) { node_->value_ = value; }
149 inline void bind(Node* node) { node_ = node; } 149 inline void bind(Node* node) { node_ = node; }
150 150
151 private: 151 private:
152 Node* node_; 152 Node* node_;
153 }; 153 };
154 154
155 template <class Callback> 155 template <class Callback>
156 void ForEach(Callback* callback); 156 void ForEach(Callback* callback,
157 AllocationPolicy allocator = AllocationPolicy());
157 158
158 protected: 159 protected:
159 // Resets tree root. Existing nodes become unreachable. 160 // Resets tree root. Existing nodes become unreachable.
160 void ResetRoot() { root_ = NULL; } 161 void ResetRoot() { root_ = NULL; }
161 162
162 private: 163 private:
163 // Search for a node with a given key. If found, root_ points 164 // Search for a node with a given key. If found, root_ points
164 // to the node. 165 // to the node.
165 bool FindInternal(const Key& key); 166 bool FindInternal(const Key& key);
166 167
(...skipping 11 matching lines...) Expand all
178 void Call(Node* node) { 179 void Call(Node* node) {
179 callback_->Call(node->key(), node->value()); 180 callback_->Call(node->key(), node->value());
180 } 181 }
181 182
182 private: 183 private:
183 Callback* callback_; 184 Callback* callback_;
184 185
185 DISALLOW_COPY_AND_ASSIGN(NodeToPairAdaptor); 186 DISALLOW_COPY_AND_ASSIGN(NodeToPairAdaptor);
186 }; 187 };
187 188
188 class NodeDeleter BASE_EMBEDDED {
189 public:
190 NodeDeleter() { }
191 void Call(Node* node) { AllocationPolicy::Delete(node); }
192
193 private:
194 DISALLOW_COPY_AND_ASSIGN(NodeDeleter);
195 };
196 189
197 template <class Callback> 190 template <class Callback>
198 void ForEachNode(Callback* callback, 191 void ForEachNode(Callback* callback,
199 AllocationPolicy allocator = AllocationPolicy()); 192 AllocationPolicy allocator = AllocationPolicy());
200 193
201 Node* root_; 194 Node* root_;
202 195
203 DISALLOW_COPY_AND_ASSIGN(SplayTree); 196 DISALLOW_COPY_AND_ASSIGN(SplayTree);
204 }; 197 };
205 198
206 199
207 } } // namespace v8::internal 200 } } // namespace v8::internal
208 201
209 #endif // V8_SPLAY_TREE_H_ 202 #endif // V8_SPLAY_TREE_H_
OLDNEW
« no previous file with comments | « src/small-pointer-list.h ('k') | src/splay-tree-inl.h » ('j') | src/splay-tree-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698