[new downloader][android] del: Explicit shared_ptr dereferences removed.

This commit is contained in:
Alexander Marchuk 2016-02-19 19:03:51 +03:00 committed by Sergey Yershov
parent e9f784734b
commit 7106a09613
5 changed files with 20 additions and 20 deletions

View file

@ -163,8 +163,8 @@ extern "C"
JNIEnv * env = jni::GetEnv();
jmethodID methodID = jni::GetMethodID(env, *obj.get(), "onFinish", "(I)V");
env->CallVoidMethod(*obj.get(), methodID, errorCode);
jmethodID methodID = jni::GetMethodID(env, *obj, "onFinish", "(I)V");
env->CallVoidMethod(*obj, methodID, errorCode);
}
static void DownloadFileProgress(shared_ptr<jobject> listener, HttpRequest const & req)
@ -215,7 +215,7 @@ extern "C"
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_DownloadResourcesActivity_nativeCancelCurrentFile(JNIEnv * env, jclass clazz)
{
LOG(LDEBUG, ("cancelCurrentFile, currentRequest=", g_currentRequest.get()));
LOG(LDEBUG, ("cancelCurrentFile, currentRequest=", g_currentRequest));
g_currentRequest.reset();
}
}

View file

@ -435,18 +435,18 @@ extern "C"
void CallOnMapObjectActivatedListener(shared_ptr<jobject> listener, jobject mapObject)
{
JNIEnv * env = jni::GetEnv();
jmethodID const methodId = jni::GetMethodID(env, *listener.get(), "onMapObjectActivated",
jmethodID const methodId = jni::GetMethodID(env, *listener, "onMapObjectActivated",
"(Lcom/mapswithme/maps/bookmarks/data/MapObject;)V");
//public MapObject(@MapObjectType int mapObjectType, String name, double lat, double lon, String typeName)
env->CallVoidMethod(*listener.get(), methodId, mapObject);
env->CallVoidMethod(*listener, methodId, mapObject);
}
void CallOnDismissListener(shared_ptr<jobject> obj)
{
JNIEnv * env = jni::GetEnv();
jmethodID const methodId = jni::GetMethodID(env, *obj.get(), "onDismiss", "()V");
jmethodID const methodId = jni::GetMethodID(env, *obj, "onDismiss", "()V");
ASSERT(methodId, ());
env->CallVoidMethod(*obj.get(), methodId);
env->CallVoidMethod(*obj, methodId);
}
void CallOnUserMarkActivated(shared_ptr<jobject> obj, unique_ptr<UserMarkCopy> markCopy)
@ -468,7 +468,7 @@ extern "C"
void CallRoutingListener(shared_ptr<jobject> listener, int errorCode, vector<storage::TCountryId> const & absentMaps, vector<storage::TCountryId> const & absentRoutes)
{
JNIEnv * env = jni::GetEnv();
jmethodID const method = jni::GetMethodID(env, *listener.get(), "onRoutingEvent", "(I[Ljava/lang/String;)V");
jmethodID const method = jni::GetMethodID(env, *listener, "onRoutingEvent", "(I[Ljava/lang/String;)V");
ASSERT(method, ());
jni::ScopedLocalRef<jobjectArray> const countries(env, env->NewObjectArray(absentMaps.size(), jni::GetStringClass(env), 0));
@ -478,14 +478,14 @@ extern "C"
env->SetObjectArrayElement(countries.get(), i, id.get());
}
env->CallVoidMethod(*listener.get(), method, errorCode, countries.get());
env->CallVoidMethod(*listener, method, errorCode, countries.get());
}
void CallRouteProgressListener(shared_ptr<jobject> listener, float progress)
{
JNIEnv * env = jni::GetEnv();
jmethodID const methodId = jni::GetMethodID(env, *listener.get(), "onRouteBuildingProgress", "(F)V");
env->CallVoidMethod(*listener.get(), methodId, progress);
jmethodID const methodId = jni::GetMethodID(env, *listener, "onRouteBuildingProgress", "(F)V");
env->CallVoidMethod(*listener, methodId, progress);
}
/// @name JNI EXPORTS

View file

@ -23,7 +23,7 @@ extern "C"
g_framework->SetMyPositionMode(mode);
JNIEnv * env = jni::GetEnv();
env->CallVoidMethod(*obj.get(), jni::GetMethodID(env, *obj.get(), "onMyPositionModeChangedCallback", "(I)V"), static_cast<jint>(mode));
env->CallVoidMethod(*obj, jni::GetMethodID(env, *obj.get(), "onMyPositionModeChangedCallback", "(I)V"), static_cast<jint>(mode));
}
JNIEXPORT void JNICALL

View file

@ -275,16 +275,16 @@ static void StatusChangedCallback(shared_ptr<jobject> const & listenerRef, TCoun
NodeAttrs attrs;
GetStorage().GetNodeAttrs(countryId, attrs);
jmethodID const methodID = jni::GetMethodID(env, *listenerRef.get(), "onStatusChanged", "(Ljava/lang/String;I)V");
env->CallVoidMethod(*listenerRef.get(), methodID, jni::ToJavaString(env, countryId), attrs.m_status);
jmethodID const methodID = jni::GetMethodID(env, *listenerRef, "onStatusChanged", "(Ljava/lang/String;I)V");
env->CallVoidMethod(*listenerRef, methodID, jni::ToJavaString(env, countryId), attrs.m_status);
}
static void ProgressChangedCallback(shared_ptr<jobject> const & listenerRef, TCountryId const & countryId, TLocalAndRemoteSize const & sizes)
{
JNIEnv * env = jni::GetEnv();
jmethodID const methodID = jni::GetMethodID(env, *listenerRef.get(), "onProgress", "(Ljava/lang/String;JJ)V");
env->CallVoidMethod(*listenerRef.get(), methodID, jni::ToJavaString(env, countryId), sizes.first, sizes.second);
jmethodID const methodID = jni::GetMethodID(env, *listenerRef, "onProgress", "(Ljava/lang/String;JJ)V");
env->CallVoidMethod(*listenerRef, methodID, jni::ToJavaString(env, countryId), sizes.first, sizes.second);
}
// static int nativeSubscribe(StorageCallback listener);

View file

@ -59,10 +59,10 @@ string Platform::GetMemoryInfo() const
static shared_ptr<jobject> classMemLogging = jni::make_global_ref(env->FindClass("com/mapswithme/util/log/MemLogging"));
ASSERT(classMemLogging, ());
static jmethodID const getMemoryInfoId = env->GetStaticMethodID(static_cast<jclass>(*classMemLogging.get()), "getMemoryInfo", "()Ljava/lang/String;");
static jmethodID const getMemoryInfoId = env->GetStaticMethodID(static_cast<jclass>(*classMemLogging), "getMemoryInfo", "()Ljava/lang/String;");
ASSERT(getMemoryInfoId, ());
jstring const memInfoString = (jstring)env->CallStaticObjectMethod(static_cast<jclass>(*classMemLogging.get()), getMemoryInfoId);
jstring const memInfoString = (jstring)env->CallStaticObjectMethod(static_cast<jclass>(*classMemLogging), getMemoryInfoId);
ASSERT(memInfoString, ());
return jni::ToNativeString(env, memInfoString);
@ -82,10 +82,10 @@ Platform::EConnectionType Platform::ConnectionStatus()
static shared_ptr<jobject> clazzConnectionState = jni::make_global_ref(env->FindClass("com/mapswithme/util/ConnectionState"));
ASSERT(clazzConnectionState, ());
static jmethodID const getConnectionMethodId = env->GetStaticMethodID(static_cast<jclass>(*clazzConnectionState.get()), "getConnectionState", "()B");
static jmethodID const getConnectionMethodId = env->GetStaticMethodID(static_cast<jclass>(*clazzConnectionState), "getConnectionState", "()B");
ASSERT(getConnectionMethodId, ());
return static_cast<Platform::EConnectionType>(env->CallStaticByteMethod(static_cast<jclass>(*clazzConnectionState.get()), getConnectionMethodId));
return static_cast<Platform::EConnectionType>(env->CallStaticByteMethod(static_cast<jclass>(*clazzConnectionState), getConnectionMethodId));
}
namespace android