Change ToRawPointers method call to MakeNonOwningPointerVector in reporter.cc
This CL removes the code for the ToRawPointers method previously
introduced in libartbase/base/utils.h, as an equivalent
MakeNonOwningPointerVector method exists in libartbase/base/stl_util.h
Ignore-AOSP-First: this change is to be applied on top of ag/20595797, which has been cherry-picked onto AOSP yet.
Bug: 246330418
Test: atest ArtGtestsTargetChroot
Change-Id: Ie412542e014899d50a47a6375b730c70211c6c26
(cherry picked from commit 12050b39ef561dbe9f18771c5736ee274ff4b994)
Merged-In: Ie412542e014899d50a47a6375b730c70211c6c26
diff --git a/libartbase/base/utils.h b/libartbase/base/utils.h
index b32dcec..f311f09 100644
--- a/libartbase/base/utils.h
+++ b/libartbase/base/utils.h
@@ -186,19 +186,6 @@
// Returns the number of threads running.
int GetTaskCount();
-// Returns a vector holding the raw pointer targets of the elements of "unique_pointers", a vector
-// of smart pointers. This does not affect the target objects e.g. by incrementing ref-counts; it's
-// a raw pointer read.
-template <typename T>
-static std::vector<T*> ToRawPointers(const std::vector<std::unique_ptr<T>>& unique_pointers) {
- std::vector<T*> raw_pointers;
- raw_pointers.reserve(unique_pointers.size());
- for (const std::unique_ptr<T>& p : unique_pointers) {
- raw_pointers.push_back(p.get());
- }
- return raw_pointers;
-}
-
} // namespace art
#endif // ART_LIBARTBASE_BASE_UTILS_H_
diff --git a/runtime/metrics/reporter.cc b/runtime/metrics/reporter.cc
index 736ef7f..6fc1a14 100644
--- a/runtime/metrics/reporter.cc
+++ b/runtime/metrics/reporter.cc
@@ -16,11 +16,12 @@
#include "reporter.h"
-#include <algorithm>
-
#include <android-base/parseint.h>
+#include <algorithm>
+
#include "base/flags.h"
+#include "base/stl_util.h"
#include "oat_file_manager.h"
#include "runtime.h"
#include "runtime_options.h"
@@ -208,7 +209,7 @@
session_started_ = true;
}
- metrics->ReportAllMetricsAndResetValueMetrics(ToRawPointers(backends_));
+ metrics->ReportAllMetricsAndResetValueMetrics(MakeNonOwningPointerVector(backends_));
}
void MetricsReporter::UpdateSessionInBackends() {