Move process state into runtime
Clean up.
Bug: 27420435
(cherry picked from commit f8484c8b55f4b423048f94dfabbe44110a039a9b)
Change-Id: Ia20781ee36e6a31c88ca41d3866b26813cff434d
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 9eda422..2925591 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -36,6 +36,7 @@
#include "globals.h"
#include "object_callbacks.h"
#include "offsets.h"
+#include "process_state.h"
#include "safe_map.h"
#include "verify_object.h"
@@ -116,14 +117,6 @@
// If true, use thread-local allocation stack.
static constexpr bool kUseThreadLocalAllocationStack = true;
-// The process state passed in from the activity manager, used to determine when to do trimming
-// and compaction.
-enum ProcessState {
- kProcessStateJankPerceptible = 0,
- kProcessStateJankImperceptible = 1,
-};
-std::ostream& operator<<(std::ostream& os, const ProcessState& process_state);
-
class Heap {
public:
// If true, measure the total allocation time.
@@ -382,7 +375,7 @@
collector::GcType WaitForGcToComplete(GcCause cause, Thread* self) REQUIRES(!*gc_complete_lock_);
// Update the heap's process state to a new value, may cause compaction to occur.
- void UpdateProcessState(ProcessState process_state)
+ void UpdateProcessState(ProcessState old_process_state, ProcessState new_process_state)
REQUIRES(!*pending_task_lock_, !*gc_complete_lock_);
bool HaveContinuousSpaces() const NO_THREAD_SAFETY_ANALYSIS {
@@ -664,11 +657,6 @@
void DumpGcPerformanceInfo(std::ostream& os) REQUIRES(!*gc_complete_lock_);
void ResetGcPerformanceInfo() REQUIRES(!*gc_complete_lock_);
- // Returns true if we currently care about pause times.
- bool CareAboutPauseTimes() const {
- return process_state_ == kProcessStateJankPerceptible;
- }
-
// Thread pool.
void CreateThreadPool();
void DeleteThreadPool();
@@ -1152,9 +1140,6 @@
// Whether or not we need to run finalizers in the next native allocation.
bool native_need_to_run_finalization_;
- // Whether or not we currently care about pause times.
- ProcessState process_state_;
-
// When num_bytes_allocated_ exceeds this amount then a concurrent GC should be requested so that
// it completes ahead of an allocation failing.
size_t concurrent_start_bytes_;