[android] Remove JNI_OnUnload; it is in practice never called

http://bleaklow.com/2006/02/18/jni_onunload_mostly_useless.html
This commit is contained in:
John Firebaugh
2016-03-01 12:52:36 -08:00
parent edbd4284f2
commit 068998cf8a

View File

@@ -3313,151 +3313,4 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return JNI_VERSION_1_6;
}
extern "C" JNIEXPORT void JNI_OnUnload(JavaVM *vm, void *reserved) {
mbgl::Log::Debug(mbgl::Event::JNI, "JNI_OnUnload");
theJVM = vm;
JNIEnv *env = nullptr;
jint ret = vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6);
if (ret != JNI_OK) {
mbgl::Log::Error(mbgl::Event::JNI, "GetEnv() failed with %i", ret);
throw new std::runtime_error("GetEnv() failed");
}
env->DeleteGlobalRef(latLngClass);
latLngClass = nullptr;
latLngConstructorId = nullptr;
latLngLongitudeId = nullptr;
latLngLatitudeId = nullptr;
env->DeleteGlobalRef(latLngBoundsClass);
latLngBoundsClass = nullptr;
latLngBoundsConstructorId = nullptr;
latLngBoundsLatNorthId = nullptr;
latLngBoundsLatSouthId = nullptr;
latLngBoundsLonEastId = nullptr;
latLngBoundsLonWestId = nullptr;
env->DeleteGlobalRef(iconClass);
iconClass = nullptr;
iconIdId = nullptr;
env->DeleteGlobalRef(markerClass);
markerClass = nullptr;
markerPositionId = nullptr;
markerIconId = nullptr;
markerIdId = nullptr;
env->DeleteGlobalRef(polylineClass);
polylineClass = nullptr;
polylineAlphaId = nullptr;
polylineColorId = nullptr;
polylineWidthId = nullptr;
polylinePointsId = nullptr;
env->DeleteGlobalRef(polygonClass);
polygonClass = nullptr;
polygonAlphaId = nullptr;
polygonFillColorId = nullptr;
polygonStrokeColorId = nullptr;
polygonPointsId = nullptr;
onInvalidateId = nullptr;
onMapChangedId = nullptr;
onFpsChangedId = nullptr;
env->DeleteGlobalRef(runtimeExceptionClass);
runtimeExceptionClass = nullptr;
env->DeleteGlobalRef(nullPointerExceptionClass);
nullPointerExceptionClass = nullptr;
listToArrayId = nullptr;
env->DeleteGlobalRef(arrayListClass);
arrayListClass = nullptr;
arrayListConstructorId = nullptr;
arrayListAddId = nullptr;
env->DeleteGlobalRef(projectedMetersClass);
projectedMetersClass = nullptr;
projectedMetersConstructorId = nullptr;
projectedMetersNorthingId = nullptr;
projectedMetersEastingId = nullptr;
env->DeleteGlobalRef(pointFClass);
pointFClass = nullptr;
pointFConstructorId = nullptr;
pointFXId = nullptr;
pointFYId = nullptr;
env->DeleteGlobalRef(rectFClass);
rectFClass = nullptr;
rectFConstructorId = nullptr;
rectFLeftId = nullptr;
rectFTopId = nullptr;
rectFRightId = nullptr;
rectFBottomId = nullptr;
// Offline delete begins
env->DeleteGlobalRef(offlineManagerClass);
offlineManagerClassPtrId = nullptr;
offlineManagerClassPtrId = nullptr;
env->DeleteGlobalRef(listOfflineRegionsCallbackClass);
listOnListMethodId = nullptr;
listOnErrorMethodId = nullptr;
env->DeleteGlobalRef(offlineRegionClass);
offlineRegionConstructorId = nullptr;
offlineRegionOfflineManagerId = nullptr;
offlineRegionIdId = nullptr;
offlineRegionDefinitionId = nullptr;
offlineRegionMetadataId = nullptr;
offlineRegionPtrId = nullptr;
env->DeleteGlobalRef(offlineRegionDefinitionClass);
offlineRegionDefinitionConstructorId = nullptr;
offlineRegionDefinitionStyleURLId = nullptr;
offlineRegionDefinitionBoundsId = nullptr;
offlineRegionDefinitionMinZoomId = nullptr;
offlineRegionDefinitionMaxZoomId = nullptr;
offlineRegionDefinitionPixelRatioId = nullptr;
env->DeleteGlobalRef(createOfflineRegionCallbackClass);
createOnCreateMethodId = nullptr;
createOnErrorMethodId = nullptr;
env->DeleteGlobalRef(offlineRegionObserverClass);
offlineRegionObserveronStatusChangedId = nullptr;
offlineRegionObserveronErrorId = nullptr;
offlineRegionObserveronLimitId = nullptr;
env->DeleteGlobalRef(offlineRegionStatusClass);
offlineRegionStatusConstructorId = nullptr;
offlineRegionStatusDownloadStateId = nullptr;
offlineRegionStatusCompletedResourceCountId = nullptr;
offlineRegionStatusCompletedResourceSizeId = nullptr;
offlineRegionStatusRequiredResourceCountId = nullptr;
offlineRegionStatusRequiredResourceCountIsPreciseId = nullptr;
env->DeleteGlobalRef(offlineRegionErrorClass);
offlineRegionErrorConstructorId = nullptr;
offlineRegionErrorReasonId = nullptr;
offlineRegionErrorMessageId = nullptr;
env->DeleteGlobalRef(offlineRegionStatusCallbackClass);
offlineRegionStatusOnStatusId = nullptr;
offlineRegionStatusOnErrorId = nullptr;
env->DeleteGlobalRef(offlineRegionDeleteCallbackClass);
offlineRegionDeleteOnDeleteId = nullptr;
offlineRegionDeleteOnErrorId = nullptr;
// Offline delete ends
theJVM = nullptr;
}
}