linker_namespace: move sonames instead of copying

android_namespace_link_t::shared_lib_sonames_ is unorderd_set<string>.
When initializing, it's copied a few times unnecessarily.
- when add_linked_namespace is called
- when android_namespace_link_t() is called
- when push_back is called.

Now, it's moved around after the initial creation.

Bug: n/a
Test: atest --test-mapping .
Change-Id: I283954bb0c0bbf94ebd74407137f492e08fd41bd
diff --git a/linker/linker.cpp b/linker/linker.cpp
index c10e9f6..6246f8c 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -39,6 +39,7 @@
 #include <sys/vfs.h>
 #include <unistd.h>
 
+#include <iterator>
 #include <new>
 #include <string>
 #include <unordered_map>
@@ -2484,11 +2485,12 @@
     return false;
   }
 
-  auto sonames = android::base::Split(shared_lib_sonames, ":");
-  std::unordered_set<std::string> sonames_set(sonames.begin(), sonames.end());
+  std::vector<std::string> sonames = android::base::Split(shared_lib_sonames, ":");
+  std::unordered_set<std::string> sonames_set(std::make_move_iterator(sonames.begin()),
+                                              std::make_move_iterator(sonames.end()));
 
   ProtectedDataGuard guard;
-  namespace_from->add_linked_namespace(namespace_to, sonames_set, false);
+  namespace_from->add_linked_namespace(namespace_to, std::move(sonames_set), false);
 
   return true;
 }
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
index 6817901..671e0b5 100644
--- a/linker/linker_namespaces.h
+++ b/linker/linker_namespaces.h
@@ -41,11 +41,11 @@
 struct android_namespace_link_t {
  public:
   android_namespace_link_t(android_namespace_t* linked_namespace,
-                           const std::unordered_set<std::string>& shared_lib_sonames,
+                           std::unordered_set<std::string> shared_lib_sonames,
                            bool allow_all_shared_libs)
-      : linked_namespace_(linked_namespace), shared_lib_sonames_(shared_lib_sonames),
-        allow_all_shared_libs_(allow_all_shared_libs)
-  {}
+      : linked_namespace_(linked_namespace),
+        shared_lib_sonames_(std::move(shared_lib_sonames)),
+        allow_all_shared_libs_(allow_all_shared_libs) {}
 
   android_namespace_t* linked_namespace() const {
     return linked_namespace_;
@@ -127,10 +127,10 @@
     return linked_namespaces_;
   }
   void add_linked_namespace(android_namespace_t* linked_namespace,
-                            const std::unordered_set<std::string>& shared_lib_sonames,
+                            std::unordered_set<std::string> shared_lib_sonames,
                             bool allow_all_shared_libs) {
-    linked_namespaces_.push_back(
-        android_namespace_link_t(linked_namespace, shared_lib_sonames, allow_all_shared_libs));
+    linked_namespaces_.emplace_back(linked_namespace, std::move(shared_lib_sonames),
+                                    allow_all_shared_libs);
   }
 
   void add_soinfo(soinfo* si) {