This commit is contained in:
Oleg.Korshul
2024-03-13 11:10:31 +03:00
parent 53677bf8cc
commit e518efc5e1

View File

@ -52,33 +52,36 @@
v8::Local<v8::String> CreateV8String(v8::Isolate* i, const char* str, const int& len = -1);
v8::Local<v8::String> CreateV8String(v8::Isolate* i, const std::string& str);
#ifdef __ANDROID__
#ifdef _DEBUG
#define ANDROID_LOGS
#endif
#ifdef ANDROID_LOGS
//#define ANDROID_LOGS_ALL_FUNCTIONS
#include <android/log.h>
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, "js", __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "js", __VA_ARGS__)
#endif
#endif
#if V8_OS_XP
class MallocArrayBufferAllocator : public v8::ArrayBuffer::Allocator
{
public:
virtual void* Allocate(size_t length)
{
LOGW("allocate: %d\n", (int)length);
void* ret = malloc(length);
memset(ret, 0, length);
return ret;
}
virtual void* AllocateUninitialized(size_t length)
{
LOGW("allocate_uninitialized: %d\n", (int)length);
return malloc(length);
}
virtual void Free(void* data, size_t length)
{
LOGW("free: %d\n", (int)length);
free(data);
}
};
@ -492,12 +495,6 @@ namespace NSJSBase
CInspectorPool::get().getInspector(V8IsolateOneArg).startAgent(false);
#endif
#ifdef ANDROID_LOGS_ALL_FUNCTIONS
std::string sFuncName(name);
std::string sFunc = "[JS call_func: " + sFuncName + "]";
LOGW(sFunc.c_str());
#endif
LOGGER_START
v8::Local<v8::String> _name = CreateV8String(CV8Worker::GetCurrent(), name);
@ -531,11 +528,6 @@ namespace NSJSBase
LOGGER_LAP_NAME(name)
#ifdef ANDROID_LOGS_ALL_FUNCTIONS
sFunc = "[JS call_func_end: " + sFuncName + "]";
LOGW(sFunc.c_str());
#endif
JSSmart<CJSValue> _ret = _return;
return _ret;
}