From 1c993b76bf00c8ee39335092ccf89c259cc5c9cd Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 28 Jan 2019 17:10:08 +0000 Subject: [PATCH] Allow to move frames out of Unwinder. This saves a copy for every unwind we do in heapprofd. Change-Id: Ife7aa1ce68831729d96ccd4c3e54ca531f98b6bc --- libunwindstack/include/unwindstack/Unwinder.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libunwindstack/include/unwindstack/Unwinder.h b/libunwindstack/include/unwindstack/Unwinder.h index ab239c1f1..dff043bc1 100644 --- a/libunwindstack/include/unwindstack/Unwinder.h +++ b/libunwindstack/include/unwindstack/Unwinder.h @@ -81,6 +81,12 @@ class Unwinder { const std::vector& frames() { return frames_; } + std::vector ConsumeFrames() { + std::vector frames = std::move(frames_); + frames_.clear(); + return frames; + } + std::string FormatFrame(size_t frame_num); static std::string FormatFrame(const FrameData& frame, bool is32bit);