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

Unified Diff: Source/platform/heap/Heap.h

Issue 559733004: remove template c++11'ism in Heap.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index af83b7c11ac4bdb74534cc6b3b538f6546208e7d..04ca17ade716ecc9f36859aa9ecfe407018a0865 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -1103,7 +1103,11 @@ public:
static bool weakTableRegistered(const void*);
#endif
- template<typename T, typename HeapTraits = HeapTypeTrait<T> > static Address allocate(size_t);
+ template<typename T, typename HeapTraits> static Address allocate(size_t);
+ // TODO(mostynb) remove this once c++11 is allowed, in favour of the one
haraken 2014/09/10 00:51:10 TODO(mostynb) => FIXME
Mostyn Bramley-Moore 2014/09/10 08:09:16 Done.
+ // above:
+ template<typename T> static Address allocate(size_t);
+
template<typename T> static Address reallocate(void* previous, size_t);
static void collectGarbage(ThreadState::StackState);
@@ -1573,6 +1577,18 @@ Address Heap::allocate(size_t size)
return static_cast<typename HeapTraits::HeapType*>(heap)->allocate(size, gcInfo);
}
+// TODO(mostynb) remove this once c++11 is allowed, in favour of the one above:
haraken 2014/09/10 00:51:10 Ditto.
Mostyn Bramley-Moore 2014/09/10 08:09:16 Done.
+template<typename T>
+Address Heap::allocate(size_t size)
+{
+ ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state();
+ ASSERT(state->isAllocationAllowed());
+ const GCInfo* gcInfo = GCInfoTrait<T>::get();
+ int heapIndex = HeapTypeTrait<T>::index(gcInfo->hasFinalizer());
+ BaseHeap* heap = state->heap(heapIndex);
+ return static_cast<typename HeapTypeTrait<T>::HeapType*>(heap)->allocate(size, gcInfo);
+}
+
template<typename T>
Address Heap::reallocate(void* previous, size_t size)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698