Merge "nativeloader: Add Reset capabilities" into nyc-dev

This commit is contained in:
Dimitry Ivanov 2016-05-02 21:20:00 +00:00 committed by Android (Google) Code Review
commit 3174bda7ac
2 changed files with 13 additions and 0 deletions

View file

@ -50,6 +50,9 @@ __attribute__((visibility("default")))
android_namespace_t* FindNamespaceByClassLoader(JNIEnv* env, jobject class_loader);
#endif
__attribute__((visibility("default")))
void ResetNativeLoader();
}; // namespace android
#endif // NATIVE_BRIDGE_H_

View file

@ -131,6 +131,10 @@ class LibraryNamespaces {
public_libraries_ = base::Join(sonames, ':');
}
void Reset() {
namespaces_.clear();
}
private:
bool ReadConfig(const std::string& configFile, std::vector<std::string>* sonames) {
// Read list of public native libraries from the config file.
@ -185,6 +189,12 @@ void InitializeNativeLoader() {
#endif
}
void ResetNativeLoader() {
#if defined(__ANDROID__)
std::lock_guard<std::mutex> guard(g_namespaces_mutex);
g_namespaces->Reset();
#endif
}
jstring CreateClassLoaderNamespace(JNIEnv* env,
int32_t target_sdk_version,