diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-05-03 15:20:23 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-05-04 09:39:23 -0700 |
commit | 414369a2e3f23e1408fc1cbf4f623014bd95cb8f (patch) | |
tree | 6baba5e4eb1d274c85b03c6c1e036643a0bfb84f /runtime/gc/heap.h | |
parent | 6f1be4493a558e8dabdc981b37852a2008f7bef1 (diff) | |
download | art-414369a2e3f23e1408fc1cbf4f623014bd95cb8f.tar.gz art-414369a2e3f23e1408fc1cbf4f623014bd95cb8f.tar.bz2 art-414369a2e3f23e1408fc1cbf4f623014bd95cb8f.zip |
Add some more DISALLOW_COPY_AND_ASSIGN
May help prevent bugs maybe.
(cherry picked from commit 3130cdf29eb203be0c38d1107a65d920ec39c106)
Change-Id: Ie73d469dfcd078492ecb3aa28682b42707221202
Diffstat (limited to 'runtime/gc/heap.h')
-rw-r--r-- | runtime/gc/heap.h | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index 565687c5b5..2ce2b3a547 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -1201,41 +1201,23 @@ class Heap { friend class VerifyReferenceVisitor; friend class VerifyObjectVisitor; friend class ScopedHeapFill; - friend class ScopedHeapLock; friend class space::SpaceTest; class AllocationTimer { + public: + ALWAYS_INLINE AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr); + ALWAYS_INLINE ~AllocationTimer(); private: - Heap* heap_; + Heap* const heap_; mirror::Object** allocated_obj_ptr_; - uint64_t allocation_start_time_; - public: - AllocationTimer(Heap* heap, mirror::Object** allocated_obj_ptr); - ~AllocationTimer(); + const uint64_t allocation_start_time_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationTimer); }; DISALLOW_IMPLICIT_CONSTRUCTORS(Heap); }; -// ScopedHeapFill changes the bytes allocated counter to be equal to the growth limit. This -// causes the next allocation to perform a GC and possibly an OOM. It can be used to ensure that a -// GC happens in specific methods such as ThrowIllegalMonitorStateExceptionF in Monitor::Wait. -class ScopedHeapFill { - public: - explicit ScopedHeapFill(Heap* heap) - : heap_(heap), - delta_(heap_->GetMaxMemory() - heap_->GetBytesAllocated()) { - heap_->num_bytes_allocated_.FetchAndAddSequentiallyConsistent(delta_); - } - ~ScopedHeapFill() { - heap_->num_bytes_allocated_.FetchAndSubSequentiallyConsistent(delta_); - } - - private: - Heap* const heap_; - const int64_t delta_; -}; - } // namespace gc } // namespace art |