summaryrefslogtreecommitdiff
path: root/simpleperf/environment.h
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/environment.h')
-rw-r--r--simpleperf/environment.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/simpleperf/environment.h b/simpleperf/environment.h
index 33e4c680..84794f2c 100644
--- a/simpleperf/environment.h
+++ b/simpleperf/environment.h
@@ -103,8 +103,18 @@ void SetDefaultAppPackageName(const std::string& package_name);
const std::string& GetDefaultAppPackageName();
void AllowMoreOpenedFiles();
-void SetTempDirectoryUsedInRecording(const std::string& tmp_dir);
-std::unique_ptr<TemporaryFile> CreateTempFileUsedInRecording();
+class ScopedTempFiles {
+ public:
+ ScopedTempFiles(const std::string& tmp_dir);
+ ~ScopedTempFiles();
+ // If delete_in_destructor = true, the temp file will be deleted in the destructor of
+ // ScopedTempFile. Otherwise, it should be deleted by the caller.
+ static std::unique_ptr<TemporaryFile> CreateTempFile(bool delete_in_destructor = true);
+
+ private:
+ static std::string tmp_dir_;
+ static std::vector<std::string> files_to_delete_;
+};
bool SignalIsIgnored(int signo);