本文整理汇总了C++中JEnv::CallStaticVoidMethod方法的典型用法代码示例。如果您正苦于以下问题:C++ JEnv::CallStaticVoidMethod方法的具体用法?C++ JEnv::CallStaticVoidMethod怎么用?C++ JEnv::CallStaticVoidMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEnv
的用法示例。
在下文中一共展示了JEnv::CallStaticVoidMethod方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeImplObjectsWeak
void ObjectManager::MakeImplObjectsWeak(const vector<PersistentObjectIdPair>& instances, DirectBuffer& inputBuff)
{
JEnv env;
jboolean keepAsWeak = JNI_TRUE;
for (const auto& poIdPair : instances)
{
int javaObjectId = poIdPair.javaObjectId;
bool success = inputBuff.Write(javaObjectId);
if (!success)
{
int length = inputBuff.Length();
jboolean keepAsWeak = JNI_TRUE;
env.CallStaticVoidMethod(PlatformClass, MAKE_INSTANCE_WEAK_BATCH_METHOD_ID, (jobject) inputBuff, length, keepAsWeak);
inputBuff.Reset();
success = inputBuff.Write(javaObjectId);
assert(success);
}
}
int size = inputBuff.Size();
if (size > 0)
{
jboolean keepAsWeak = JNI_TRUE;
env.CallStaticVoidMethod(PlatformClass, MAKE_INSTANCE_WEAK_BATCH_METHOD_ID, (jobject) inputBuff, size, keepAsWeak);
}
inputBuff.Reset();
}
示例2: MakeRegularObjectsWeak
void ObjectManager::MakeRegularObjectsWeak(const set<int>& instances, DirectBuffer& inputBuff)
{
JEnv env;
jboolean keepAsWeak = JNI_FALSE;
for (auto javaObjectId : instances)
{
bool success = inputBuff.Write(javaObjectId);
if (!success)
{
int length = inputBuff.Length();
env.CallStaticVoidMethod(PlatformClass, MAKE_INSTANCE_WEAK_BATCH_METHOD_ID, (jobject) inputBuff, length, keepAsWeak);
inputBuff.Reset();
success = inputBuff.Write(javaObjectId);
assert(success);
}
}
int size = inputBuff.Size();
if (size > 0)
{
env.CallStaticVoidMethod(PlatformClass, MAKE_INSTANCE_WEAK_BATCH_METHOD_ID, (jobject) inputBuff, size, keepAsWeak);
}
inputBuff.Reset();
}
示例3: CheckWeakObjectsAreAlive
void ObjectManager::CheckWeakObjectsAreAlive(const vector<PersistentObjectIdPair>& instances, DirectBuffer& inputBuff, DirectBuffer& outputBuff)
{
JEnv env;
for (const auto& poIdPair : instances)
{
int javaObjectId = poIdPair.javaObjectId;
bool success = inputBuff.Write(javaObjectId);
if (!success)
{
int length = inputBuff.Length();
env.CallStaticVoidMethod(PlatformClass, CHECK_WEAK_OBJECTS_ARE_ALIVE_METHOD_ID, (jobject) inputBuff, (jobject) outputBuff, length);
//
int *released = outputBuff.GetData();
for (int i = 0; i < length; i++)
{
bool isReleased = *released++ != 0;
if (isReleased)
{
Persistent<Object> *po = instances[i].po;
po->Reset();
}
}
//
inputBuff.Reset();
success = inputBuff.Write(javaObjectId);
assert(success);
}
}
int size = inputBuff.Size();
if (size > 0)
{
env.CallStaticVoidMethod(PlatformClass, CHECK_WEAK_OBJECTS_ARE_ALIVE_METHOD_ID, (jobject) inputBuff, (jobject) outputBuff, size);
int *released = outputBuff.GetData();
for (int i = 0; i < size; i++)
{
bool isReleased = *released++ != 0;
if (isReleased)
{
Persistent<Object> *po = instances[i].po;
po->Reset();
}
}
}
}
示例4: DebugBreakCallback
void JsDebugger::DebugBreakCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
if (s_jsDebugger == nullptr)
{
return;
}
try
{
JEnv env;
env.CallStaticVoidMethod(s_JsDebuggerClass, s_EnableAgent);
DebugBreak();
}
catch (NativeScriptException& e)
{
e.ReThrowToV8();
}
catch (std::exception e) {
stringstream ss;
ss << "Error: c++ exception: " << e.what() << endl;
NativeScriptException nsEx(ss.str());
nsEx.ReThrowToV8();
}
catch (...) {
NativeScriptException nsEx(std::string("Error: c++ exception!"));
nsEx.ReThrowToV8();
}
}
示例5: APP_FAIL
void NativeScriptRuntime::APP_FAIL(const char *message)
{
//ASSERT_FAIL(message);
JEnv env;
jstring msg = env.NewStringUTF(message);
env.CallStaticVoidMethod(PlatformClass, APP_FAIL_METHOD_ID, msg);
}
示例6: DumpReferenceTablesMethodCallback
void NativeScriptRuntime::DumpReferenceTablesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
JEnv env;
jclass vmDbgClass = env.FindClass("dalvik/system/VMDebug");
if (vmDbgClass != nullptr)
{
jmethodID mid = env.GetStaticMethodID(vmDbgClass, "dumpReferenceTables", "()V");
if (mid != 0)
{
env.CallStaticVoidMethod(vmDbgClass, mid);
}
}
}
示例7: DisableVerboseLoggingMethodCallback
void NativeScriptRuntime::DisableVerboseLoggingMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
try {
tns::LogEnabled = false;
JEnv env;
env.CallStaticVoidMethod(PlatformClass, DISABLE_VERBOSE_LOGGING_METHOD_ID);
} catch (NativeScriptException& e) {
e.ReThrowToV8();
}
catch (exception e) {
DEBUG_WRITE("Error: c++ exception: %s", e.what());
}
catch (...) {
DEBUG_WRITE("Error: c++ exception!");
}
}
示例8: DumpReferenceTablesMethodCallback
void NativeScriptRuntime::DumpReferenceTablesMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
try {
JEnv env;
jclass vmDbgClass = env.FindClass("dalvik/system/VMDebug");
if (vmDbgClass != nullptr)
{
jmethodID mid = env.GetStaticMethodID(vmDbgClass, "dumpReferenceTables", "()V");
if (mid != 0)
{
env.CallStaticVoidMethod(vmDbgClass, mid);
}
}
} catch (NativeScriptException& e) {
e.ReThrowToV8();
}
catch (exception e) {
DEBUG_WRITE("Error: c++ exception: %s", e.what());
}
catch (...) {
DEBUG_WRITE("Error: c++ exception!");
}
}
示例9: DisableVerboseLoggingMethodCallback
void NativeScriptRuntime::DisableVerboseLoggingMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
JEnv env;
env.CallStaticVoidMethod(PlatformClass, DISABLE_VERBOSE_LOGGING_METHOD_ID);
}