[experimental/pedometer] Update jni and jnigen to 0.6 (#2006)

pull/2007/head
Hossein Yousefi 1 year ago committed by GitHub
parent d010d3fae6
commit 654e50beca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,7 +44,7 @@ dependencies:
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
ffi: ^2.0.1 ffi: ^2.0.1
intl: ^0.18.0 intl: ^0.18.0
jni: ^0.5.0 jni: ^0.6.1
fl_chart: ^0.63.0 fl_chart: ^0.63.0
dev_dependencies: dev_dependencies:

@ -3,8 +3,6 @@ android_sdk_config:
add_gradle_sources: true add_gradle_sources: true
android_example: 'example/' android_example: 'example/'
suspend_fun_to_async: true
output: output:
c: c:
library_name: health_connect library_name: health_connect

File diff suppressed because it is too large Load Diff

@ -11,12 +11,12 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
plugin_platform_interface: ^2.0.2 plugin_platform_interface: ^2.0.2
jni: ^0.5.0 jni: ^0.6.1
ffi: ^2.0.1 ffi: ^2.0.1
dev_dependencies: dev_dependencies:
ffigen: ^9.0.0 ffigen: ^9.0.0
jnigen: ^0.5.0 jnigen: ^0.6.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0

@ -45,6 +45,7 @@
#include <windows.h> #include <windows.h>
typedef CRITICAL_SECTION MutexLock; typedef CRITICAL_SECTION MutexLock;
typedef CONDITION_VARIABLE ConditionVariable;
static inline void init_lock(MutexLock* lock) { static inline void init_lock(MutexLock* lock) {
InitializeCriticalSection(lock); InitializeCriticalSection(lock);
@ -58,15 +59,32 @@ static inline void release_lock(MutexLock* lock) {
LeaveCriticalSection(lock); LeaveCriticalSection(lock);
} }
static inline void _destroyLock(MutexLock* lock) { static inline void destroy_lock(MutexLock* lock) {
DeleteCriticalSection(lock); DeleteCriticalSection(lock);
} }
#elif defined __DARWIN__ || defined __LINUX__ || defined __ANDROID__ || \ static inline void init_cond(ConditionVariable* cond) {
InitializeConditionVariable(cond);
}
static inline void signal_cond(ConditionVariable* cond) {
WakeConditionVariable(cond);
}
static inline void wait_for(ConditionVariable* cond, MutexLock* lock) {
SleepConditionVariableCS(cond, lock, INFINITE);
}
static inline void destroy_cond(ConditionVariable* cond) {
// Not available.
}
#elif defined __APPLE__ || defined __LINUX__ || defined __ANDROID__ || \
defined __GNUC__ defined __GNUC__
#include <pthread.h> #include <pthread.h>
typedef pthread_mutex_t MutexLock; typedef pthread_mutex_t MutexLock;
typedef pthread_cond_t ConditionVariable;
static inline void init_lock(MutexLock* lock) { static inline void init_lock(MutexLock* lock) {
pthread_mutex_init(lock, NULL); pthread_mutex_init(lock, NULL);
@ -80,16 +98,39 @@ static inline void release_lock(MutexLock* lock) {
pthread_mutex_unlock(lock); pthread_mutex_unlock(lock);
} }
static inline void _destroyLock(MutexLock* lock) { static inline void destroy_lock(MutexLock* lock) {
pthread_mutex_destroy(lock); pthread_mutex_destroy(lock);
} }
static inline void init_cond(ConditionVariable* cond) {
pthread_cond_init(cond, NULL);
}
static inline void signal_cond(ConditionVariable* cond) {
pthread_cond_signal(cond);
}
static inline void wait_for(ConditionVariable* cond, MutexLock* lock) {
pthread_cond_wait(cond, lock);
}
static inline void destroy_cond(ConditionVariable* cond) {
pthread_cond_destroy(cond);
}
#else #else
#error "No locking support; Possibly unsupported platform" #error "No locking/condition variable support; Possibly unsupported platform"
#endif #endif
typedef struct CallbackResult {
MutexLock lock;
ConditionVariable cond;
int ready;
jobject object;
} CallbackResult;
typedef struct JniLocks { typedef struct JniLocks {
MutexLock classLoadingLock; MutexLock classLoadingLock;
MutexLock methodLoadingLock; MutexLock methodLoadingLock;
@ -369,10 +410,15 @@ static inline JniResult to_global_ref_result(jobject ref) {
FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data); FFI_PLUGIN_EXPORT intptr_t InitDartApiDL(void* data);
JNIEXPORT void JNICALL FFI_PLUGIN_EXPORT
Java_com_github_dart_1lang_jni_PortContinuation__1resumeWith(JNIEnv* env, JniResult DartException__ctor(jstring message);
jobject thiz,
jlong port,
jobject result);
FFI_PLUGIN_EXPORT FFI_PLUGIN_EXPORT
JniResult PortContinuation__ctor(int64_t j); JniResult PortContinuation__ctor(int64_t j);
FFI_PLUGIN_EXPORT
JniResult PortProxy__newInstance(jobject binaryName,
int64_t port,
int64_t functionPtr);
FFI_PLUGIN_EXPORT void resultFor(CallbackResult* result, jobject object);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save