ART: Add runtime phase callback
Add callback that describes the current runtime phase, one of
starting, initialized and death. Add test.
Bug: 31684920
Test: m test-art-host-gtest-runtime_callbacks_test
Change-Id: I08ae7c45851572f8b3e446c07f0498f66bb032d3
diff --git a/runtime/runtime_callbacks.cc b/runtime/runtime_callbacks.cc
index cd38ead..7b15a4f 100644
--- a/runtime/runtime_callbacks.cc
+++ b/runtime/runtime_callbacks.cc
@@ -87,4 +87,18 @@
}
}
+void RuntimeCallbacks::AddRuntimePhaseCallback(RuntimePhaseCallback* cb) {
+ phase_callbacks_.push_back(cb);
+}
+
+void RuntimeCallbacks::RemoveRuntimePhaseCallback(RuntimePhaseCallback* cb) {
+ Remove(cb, &phase_callbacks_);
+}
+
+void RuntimeCallbacks::NextRuntimePhase(RuntimePhaseCallback::RuntimePhase phase) {
+ for (RuntimePhaseCallback* cb : phase_callbacks_) {
+ cb->NextRuntimePhase(phase);
+ }
+}
+
} // namespace art