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

Unified Diff: src/splay-tree.h

Issue 10443114: Progress towards making Zones independent of Isolates and Threads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits and rebase on current bleeding_edge 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/safepoint-table.h ('k') | src/splay-tree-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/splay-tree.h
diff --git a/src/splay-tree.h b/src/splay-tree.h
index 72231e4d2a120a0fe3bf98eb12e52d3336ea6217..e21e21612540fb19d33e1f3ee1ba2b4f9ef47dc7 100644
--- a/src/splay-tree.h
+++ b/src/splay-tree.h
@@ -50,7 +50,7 @@ namespace internal {
// Forward defined as
// template <typename Config, class Allocator = FreeStoreAllocationPolicy>
// class SplayTree;
-template <typename Config, class Allocator>
+template <typename Config, class AllocationPolicy>
class SplayTree {
public:
typedef typename Config::Key Key;
@@ -61,15 +61,19 @@ class SplayTree {
SplayTree() : root_(NULL) { }
~SplayTree();
- INLINE(void* operator new(size_t size)) {
- return Allocator::New(static_cast<int>(size));
+ INLINE(void* operator new(size_t size,
+ AllocationPolicy allocator = AllocationPolicy())) {
+ return allocator.New(static_cast<int>(size));
+ }
+ INLINE(void operator delete(void* p, size_t)) {
+ AllocationPolicy::Delete(p);
}
- INLINE(void operator delete(void* p, size_t)) { return Allocator::Delete(p); }
// Inserts the given key in this tree with the given value. Returns
// true if a node was inserted, otherwise false. If found the locator
// is enabled and provides access to the mapping for the key.
- bool Insert(const Key& key, Locator* locator);
+ bool Insert(const Key& key, Locator* locator,
+ AllocationPolicy allocator = AllocationPolicy());
// Looks up the key in this tree and returns true if it was found,
// otherwise false. If the node is found the locator is enabled and
@@ -112,11 +116,11 @@ class SplayTree {
left_(NULL),
right_(NULL) { }
- INLINE(void* operator new(size_t size)) {
- return Allocator::New(static_cast<int>(size));
+ INLINE(void* operator new(size_t size, AllocationPolicy allocator)) {
+ return allocator.New(static_cast<int>(size));
}
INLINE(void operator delete(void* p, size_t)) {
- return Allocator::Delete(p);
+ return AllocationPolicy::Delete(p);
}
Key key() { return key_; }
@@ -184,14 +188,15 @@ class SplayTree {
class NodeDeleter BASE_EMBEDDED {
public:
NodeDeleter() { }
- void Call(Node* node) { delete node; }
+ void Call(Node* node) { AllocationPolicy::Delete(node); }
private:
DISALLOW_COPY_AND_ASSIGN(NodeDeleter);
};
template <class Callback>
- void ForEachNode(Callback* callback);
+ void ForEachNode(Callback* callback,
+ AllocationPolicy allocator = AllocationPolicy());
Node* root_;
« no previous file with comments | « src/safepoint-table.h ('k') | src/splay-tree-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698