Chromium Code Reviews| Index: test/cctest/cctest.h |
| diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h |
| index b9c5d00fdd15cf979fb682a98683710d3815a890..04bee6806d545d3e40342abffe1fd3df275f2bf9 100644 |
| --- a/test/cctest/cctest.h |
| +++ b/test/cctest/cctest.h |
| @@ -78,7 +78,6 @@ typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags; |
| EXTENSION_LIST(DEFINE_EXTENSION_FLAG) |
| #undef DEFINE_EXTENSION_FLAG |
| - |
|
yurys
2013/09/25 10:41:12
revert this
Alexandra Mikhaylova
2013/09/25 14:33:40
Done.
|
| class CcTest { |
| public: |
| typedef void (TestFunction)(); |
| @@ -344,4 +343,26 @@ static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { |
| } |
| +// Helper class for new allocations tracking and checking. |
| +// To use checking of JS allocations tracking in a test, |
| +// just create an instance of this class. |
| +class HeapObjectsTracker { |
| + public: |
| + HeapObjectsTracker() { |
| + heap_profiler_ = i::Isolate::Current()->heap_profiler(); |
| + CHECK_NE(NULL, heap_profiler_); |
| + heap_profiler_->StartHeapAllocationsRecording(); |
| + } |
| + |
| + virtual ~HeapObjectsTracker() { |
|
yurys
2013/09/25 10:41:12
No need to make it virtual.
Alexandra Mikhaylova
2013/09/25 14:33:40
Done.
|
| + i::Isolate::Current()->heap()->CollectAllAvailableGarbage(); |
| + CHECK_EQ(0, heap_profiler_->FindUntrackedObjects()); |
| + heap_profiler_->StopHeapAllocationsRecording(); |
| + } |
| + |
| + private: |
| + i::HeapProfiler* heap_profiler_; |
| +}; |
| + |
| + |
| #endif // ifndef CCTEST_H_ |