Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
29f1784a
提交
29f1784a
authored
5月 03, 2018
作者:
Mike Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11047: [build] support v8 6.6 fixes from Andrey Volk
上级
028f0e9d
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
23 行增加
和
42 行删除
+23
-42
javascript.hpp
src/mod/languages/mod_v8/include/javascript.hpp
+1
-1
mod_v8.cpp
src/mod/languages/mod_v8/mod_v8.cpp
+3
-3
fscoredb.cpp
src/mod/languages/mod_v8/src/fscoredb.cpp
+0
-5
fscurl.cpp
src/mod/languages/mod_v8/src/fscurl.cpp
+1
-1
fsdbh.cpp
src/mod/languages/mod_v8/src/fsdbh.cpp
+0
-5
fsglobal.cpp
src/mod/languages/mod_v8/src/fsglobal.cpp
+3
-3
fssession.cpp
src/mod/languages/mod_v8/src/fssession.cpp
+4
-4
jsbase.cpp
src/mod/languages/mod_v8/src/jsbase.cpp
+7
-16
jsmain.cpp
src/mod/languages/mod_v8/src/jsmain.cpp
+4
-4
没有找到文件。
src/mod/languages/mod_v8/include/javascript.hpp
浏览文件 @
29f1784a
...
...
@@ -127,7 +127,7 @@
/* Macro for basic script state check (to know if the script is being terminated), should be called before calling any callback actual code */
#define JS_CHECK_SCRIPT_STATE() \
if (
v8::V8::IsExecutionTerminating(info.GetIsolate()
)) return;\
if (
info.GetIsolate()->IsExecutionTerminating(
)) return;\
if (JSMain::GetScriptInstanceFromIsolate(info.GetIsolate()) && JSMain::GetScriptInstanceFromIsolate(info.GetIsolate())->GetForcedTermination()) return
/* Macro for easy unlocking an isolate on a long running c call */
...
...
src/mod/languages/mod_v8/mod_v8.cpp
浏览文件 @
29f1784a
...
...
@@ -645,7 +645,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
isolate
->
SetData
(
0
,
js
);
// New global template
Handle
<
ObjectTemplate
>
global
=
ObjectTemplate
::
New
();
Handle
<
ObjectTemplate
>
global
=
ObjectTemplate
::
New
(
isolate
);
if
(
global
.
IsEmpty
())
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to create JS global object template
\n
"
);
...
...
@@ -793,7 +793,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
free
(
path
);
}
TryCatch
try_catch
;
TryCatch
try_catch
(
isolate
)
;
// Compile the source code.
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
...
...
@@ -827,7 +827,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
switch_mutex_lock
(
globals
.
mutex
);
if
(
globals
.
performance_monitor
)
{
switch_time_t
end
=
switch_time_now
();
switch_time_
t
delay
=
(
end
-
start
);
unsigned
in
t
delay
=
(
end
-
start
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Javascript execution time: %u microseconds
\n
"
,
delay
);
}
switch_mutex_unlock
(
globals
.
mutex
);
...
...
src/mod/languages/mod_v8/src/fscoredb.cpp
浏览文件 @
29f1784a
...
...
@@ -396,11 +396,6 @@ JS_COREDB_GET_PROPERTY_IMPL(GetProperty)
{
HandleScope
handle_scope
(
info
.
GetIsolate
());
if
(
!
this
)
{
info
.
GetReturnValue
().
Set
(
false
);
return
;
}
String
::
Utf8Value
str
(
property
);
if
(
!
strcmp
(
js_safe_str
(
*
str
),
"path"
))
{
...
...
src/mod/languages/mod_v8/src/fscurl.cpp
浏览文件 @
29f1784a
...
...
@@ -60,7 +60,7 @@ string FSCURL::GetJSClassName()
size_t
FSCURL
::
FileCallback
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
void
*
data
)
{
FSCURL
*
obj
=
static_cast
<
FSCURL
*>
(
data
);
register
unsigned
int
realsize
=
(
unsigned
int
)
(
size
*
nmemb
);
unsigned
int
realsize
=
(
unsigned
int
)
(
size
*
nmemb
);
uint32_t
argc
=
0
;
Handle
<
Value
>
argv
[
4
];
...
...
src/mod/languages/mod_v8/src/fsdbh.cpp
浏览文件 @
29f1784a
...
...
@@ -335,11 +335,6 @@ JS_DBH_GET_PROPERTY_IMPL(GetProperty)
{
HandleScope
handle_scope
(
info
.
GetIsolate
());
if
(
!
this
)
{
info
.
GetReturnValue
().
Set
(
false
);
return
;
}
String
::
Utf8Value
str
(
property
);
if
(
!
strcmp
(
js_safe_str
(
*
str
),
"dsn"
))
{
...
...
src/mod/languages/mod_v8/src/fsglobal.cpp
浏览文件 @
29f1784a
...
...
@@ -63,7 +63,7 @@ public:
size_t
FSGlobal
::
HashCallback
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
void
*
data
)
{
register
size_t
realsize
=
size
*
nmemb
;
size_t
realsize
=
size
*
nmemb
;
char
*
line
,
lineb
[
2048
],
*
nextline
=
NULL
,
*
val
=
NULL
,
*
p
=
NULL
;
CURLCallbackData
*
config_data
=
(
CURLCallbackData
*
)
data
;
...
...
@@ -112,7 +112,7 @@ size_t FSGlobal::HashCallback(void *ptr, size_t size, size_t nmemb, void *data)
size_t
FSGlobal
::
FileCallback
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
void
*
data
)
{
register
unsigned
int
realsize
=
(
unsigned
int
)
(
size
*
nmemb
);
unsigned
int
realsize
=
(
unsigned
int
)
(
size
*
nmemb
);
CURLCallbackData
*
config_data
=
(
CURLCallbackData
*
)
data
;
if
((
write
(
config_data
->
fileHandle
,
ptr
,
realsize
)
!=
(
int
)
realsize
))
{
...
...
@@ -124,7 +124,7 @@ size_t FSGlobal::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
size_t
FSGlobal
::
FetchUrlCallback
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
void
*
data
)
{
register
unsigned
int
realsize
=
(
unsigned
int
)
(
size
*
nmemb
);
unsigned
int
realsize
=
(
unsigned
int
)
(
size
*
nmemb
);
CURLCallbackData
*
config_data
=
(
CURLCallbackData
*
)
data
;
/* Too much data. Do not increase buffer, but abort fetch instead. */
...
...
src/mod/languages/mod_v8/src/fssession.cpp
浏览文件 @
29f1784a
...
...
@@ -1221,28 +1221,28 @@ JS_SESSION_FUNCTION_IMPL(Ready)
{
HandleScope
handle_scope
(
info
.
GetIsolate
());
info
.
GetReturnValue
().
Set
((
this
&&
this
->
_session
&&
switch_channel_ready
(
switch_core_session_get_channel
(
this
->
_session
)))
?
true
:
false
);
info
.
GetReturnValue
().
Set
((
this
->
_session
&&
switch_channel_ready
(
switch_core_session_get_channel
(
this
->
_session
)))
?
true
:
false
);
}
JS_SESSION_FUNCTION_IMPL
(
MediaReady
)
{
HandleScope
handle_scope
(
info
.
GetIsolate
());
info
.
GetReturnValue
().
Set
((
this
&&
this
->
_session
&&
switch_channel_media_ready
(
switch_core_session_get_channel
(
this
->
_session
)))
?
true
:
false
);
info
.
GetReturnValue
().
Set
((
this
->
_session
&&
switch_channel_media_ready
(
switch_core_session_get_channel
(
this
->
_session
)))
?
true
:
false
);
}
JS_SESSION_FUNCTION_IMPL
(
RingReady
)
{
HandleScope
handle_scope
(
info
.
GetIsolate
());
info
.
GetReturnValue
().
Set
((
this
&&
this
->
_session
&&
switch_channel_test_flag
(
switch_core_session_get_channel
(
this
->
_session
),
CF_RING_READY
))
?
true
:
false
);
info
.
GetReturnValue
().
Set
((
this
->
_session
&&
switch_channel_test_flag
(
switch_core_session_get_channel
(
this
->
_session
),
CF_RING_READY
))
?
true
:
false
);
}
JS_SESSION_FUNCTION_IMPL
(
Answered
)
{
HandleScope
handle_scope
(
info
.
GetIsolate
());
info
.
GetReturnValue
().
Set
((
this
&&
this
->
_session
&&
switch_channel_test_flag
(
switch_core_session_get_channel
(
this
->
_session
),
CF_ANSWERED
))
?
true
:
false
);
info
.
GetReturnValue
().
Set
((
this
->
_session
&&
switch_channel_test_flag
(
switch_core_session_get_channel
(
this
->
_session
),
CF_ANSWERED
))
?
true
:
false
);
}
JS_SESSION_FUNCTION_IMPL
(
WaitForMedia
)
...
...
src/mod/languages/mod_v8/src/jsbase.cpp
浏览文件 @
29f1784a
...
...
@@ -154,15 +154,7 @@ void JSBase::CreateInstance(const v8::FunctionCallbackInfo<Value>& args)
}
else
{
// Create a new C++ instance
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
Isolate
*
isolate
=
args
.
GetIsolate
();
v8
::
Local
<
v8
::
Context
>
context
=
isolate
->
GetCurrentContext
();
v8
::
Local
<
v8
::
String
>
key
=
String
::
NewFromUtf8
(
isolate
,
"constructor_method"
);
v8
::
Local
<
v8
::
Private
>
privateKey
=
v8
::
Private
::
ForApi
(
isolate
,
key
);
Handle
<
External
>
ex
;
v8
::
MaybeLocal
<
v8
::
Value
>
hiddenValue
=
args
.
Callee
()
->
GetPrivate
(
context
,
privateKey
);
if
(
!
hiddenValue
.
IsEmpty
())
{
ex
=
Handle
<
External
>::
Cast
(
hiddenValue
.
ToLocalChecked
());
}
Handle
<
External
>
ex
=
Handle
<
External
>::
Cast
(
args
.
Data
());
#else
Handle
<
External
>
ex
=
Handle
<
External
>::
Cast
(
args
.
Callee
()
->
GetHiddenValue
(
String
::
NewFromUtf8
(
args
.
GetIsolate
(),
"constructor_method"
)));
#endif
...
...
@@ -197,8 +189,10 @@ void JSBase::Register(Isolate *isolate, const js_class_definition_t *desc)
// Get the context's global scope (that's where we'll put the constructor)
Handle
<
Object
>
global
=
isolate
->
GetCurrentContext
()
->
Global
();
Local
<
External
>
data
=
External
::
New
(
isolate
,
(
void
*
)
desc
->
constructor
);
// Create function template for our constructor it will call the JSBase::createInstance method
Handle
<
FunctionTemplate
>
function
=
FunctionTemplate
::
New
(
isolate
,
JSBase
::
CreateInstance
);
Handle
<
FunctionTemplate
>
function
=
FunctionTemplate
::
New
(
isolate
,
JSBase
::
CreateInstance
,
data
);
function
->
SetClassName
(
String
::
NewFromUtf8
(
isolate
,
desc
->
name
));
// Make room for saving the C++ object reference somewhere
...
...
@@ -217,10 +211,6 @@ void JSBase::Register(Isolate *isolate, const js_class_definition_t *desc)
}
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
v8
::
Local
<
v8
::
Context
>
context
=
isolate
->
GetCurrentContext
();
v8
::
Local
<
v8
::
String
>
key
=
String
::
NewFromUtf8
(
isolate
,
"constructor_method"
);
v8
::
Local
<
v8
::
Private
>
privateKey
=
v8
::
Private
::
ForApi
(
isolate
,
key
);
function
->
GetFunction
()
->
SetPrivate
(
context
,
privateKey
,
External
::
New
(
isolate
,
(
void
*
)
desc
->
constructor
));
#else
function
->
GetFunction
()
->
SetHiddenValue
(
String
::
NewFromUtf8
(
isolate
,
"constructor_method"
),
External
::
New
(
isolate
,
(
void
*
)
desc
->
constructor
));
#endif
...
...
@@ -232,13 +222,14 @@ void JSBase::Register(Isolate *isolate, const js_class_definition_t *desc)
void
JSBase
::
RegisterInstance
(
Isolate
*
isolate
,
string
name
,
bool
autoDestroy
)
{
// Get the context's global scope (that's where we'll put the constructor)
Handle
<
Object
>
global
=
isolate
->
GetCurrentContext
()
->
Global
();
Local
<
Context
>
context
=
isolate
->
GetCurrentContext
();
Handle
<
Object
>
global
=
context
->
Global
();
Local
<
Function
>
func
=
Local
<
Function
>::
Cast
(
global
->
Get
(
v8
::
String
::
NewFromUtf8
(
isolate
,
this
->
GetJSClassName
().
c_str
())));
// Add the C++ instance as an argument, so it won't try to create another one.
Handle
<
Value
>
args
[]
=
{
External
::
New
(
isolate
,
this
),
Boolean
::
New
(
isolate
,
autoDestroy
)
};
Handle
<
Object
>
newObj
=
func
->
NewInstance
(
2
,
args
);
Handle
<
Object
>
newObj
=
func
->
NewInstance
(
context
,
2
,
args
).
ToLocalChecked
(
);
// Add the instance to JavaScript.
if
(
name
.
size
()
>
0
)
{
...
...
src/mod/languages/mod_v8/src/jsmain.cpp
浏览文件 @
29f1784a
...
...
@@ -209,7 +209,7 @@ const string JSMain::GetExceptionInfo(Isolate* isolate, TryCatch* try_catch)
ss
<<
" "
;
}
int
end
=
message
->
GetEndColumn
(
);
int
32_t
end
=
message
->
GetEndColumn
(
isolate
->
GetCurrentContext
()).
FromMaybe
(
0
);
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
ss
<<
"^"
;
...
...
@@ -292,7 +292,7 @@ const string JSMain::ExecuteString(const string& scriptData, const string& fileN
isolate
->
SetData
(
0
,
this
);
Handle
<
ObjectTemplate
>
global
=
ObjectTemplate
::
New
();
Handle
<
ObjectTemplate
>
global
=
ObjectTemplate
::
New
(
isolate
);
global
->
Set
(
String
::
NewFromUtf8
(
isolate
,
"include"
),
FunctionTemplate
::
New
(
isolate
,
Include
));
global
->
Set
(
String
::
NewFromUtf8
(
isolate
,
"require"
),
FunctionTemplate
::
New
(
isolate
,
Include
));
global
->
Set
(
String
::
NewFromUtf8
(
isolate
,
"log"
),
FunctionTemplate
::
New
(
isolate
,
Log
));
...
...
@@ -323,7 +323,7 @@ const string JSMain::ExecuteString(const string& scriptData, const string& fileN
inst
->
obj
->
RegisterInstance
(
isolate
,
inst
->
name
,
inst
->
auto_destroy
);
}
TryCatch
try_catch
;
TryCatch
try_catch
(
isolate
)
;
// Compile the source code.
#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >=5
...
...
@@ -583,7 +583,7 @@ void JSMain::ExitScript(Isolate *isolate, const char *msg)
js
->
forcedTerminationScriptFile
=
GetStackInfo
(
isolate
,
&
js
->
forcedTerminationLineNumber
);
}
V8
::
TerminateExecution
(
isolate
);
isolate
->
TerminateExecution
(
);
}
char
*
JSMain
::
GetStackInfo
(
Isolate
*
isolate
,
int
*
lineNumber
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论