mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Reduced number of JNI calls to getCore()
This commit is contained in:
parent
c41132f31d
commit
e35b483fa1
2 changed files with 8 additions and 4 deletions
|
|
@ -470,9 +470,10 @@ class JavaTranslator(object):
|
|||
|
||||
classDict['isLinphoneFactory'] = _class.name.to_camel_case() == "Factory"
|
||||
classDict['isLinphoneCore'] = _class.name.to_camel_case() == "Core"
|
||||
hasCoreAccessor = _class.name.to_camel_case() in CORE_ACCESSOR_LIST
|
||||
classDict['hasCoreAccessor'] = hasCoreAccessor
|
||||
classDict['doc'] = _class.briefDescription.translate(self.docTranslator) if _class.briefDescription is not None else None
|
||||
|
||||
hasCoreAccessor = _class.name.to_camel_case() in CORE_ACCESSOR_LIST
|
||||
for _property in _class.properties:
|
||||
try:
|
||||
classDict['methods'] += self.translate_property(_property, hasCoreAccessor)
|
||||
|
|
@ -706,6 +707,7 @@ class JavaClass(object):
|
|||
self.isLinphoneFactory = self._class['isLinphoneFactory']
|
||||
self.isLinphoneCore = self._class['isLinphoneCore']
|
||||
self.isNotLinphoneFactory = not self.isLinphoneFactory
|
||||
self.hasCoreAccessor = self._class['hasCoreAccessor']
|
||||
self.cName = 'Linphone' + _class.name.to_camel_case()
|
||||
self.cPrefix = 'linphone_' + _class.name.to_snake_case()
|
||||
self.packageName = package
|
||||
|
|
|
|||
|
|
@ -132,10 +132,12 @@ public {{#isLinphoneFactory}}abstract class{{/isLinphoneFactory}}{{#isNotLinphon
|
|||
class {{classImplName}} {{#isLinphoneFactory}}extends{{/isLinphoneFactory}}{{#isNotLinphoneFactory}}implements{{/isNotLinphoneFactory}} {{className}} {
|
||||
|
||||
protected long nativePtr = 0;
|
||||
protected Object userData = null;
|
||||
protected Object userData = null;{{#hasCoreAccessor}}
|
||||
protected Core core = null;{{/hasCoreAccessor}}
|
||||
|
||||
protected {{classImplName}}(long ptr) {
|
||||
nativePtr = ptr;
|
||||
nativePtr = ptr;{{#hasCoreAccessor}}
|
||||
core = getCore();{{/hasCoreAccessor}}
|
||||
}
|
||||
|
||||
{{#isLinphoneFactory}}
|
||||
|
|
@ -182,7 +184,7 @@ class {{classImplName}} {{#isLinphoneFactory}}extends{{/isLinphoneFactory}}{{#is
|
|||
private native {{return_native}} {{name}}({{native_params}});
|
||||
@Override
|
||||
synchronized public {{return}} {{name}}({{params}}) {{#exception}}throws CoreException{{/exception}} {
|
||||
{{#hasCoreAccessor}}{{#isNotGetCore}}synchronized(getCore()) { {{/isNotGetCore}}{{/hasCoreAccessor}}
|
||||
{{#hasCoreAccessor}}{{#isNotGetCore}}synchronized(core) { {{/isNotGetCore}}{{/hasCoreAccessor}}
|
||||
{{#exception}}int exceptionResult = {{/exception}}{{return_keyword}}{{#enumCast}}{{return}}.fromInt({{/enumCast}}{{#classCast}}({{return}}){{/classCast}}{{name}}(nativePtr{{native_params_impl}}){{#enumCast}}){{/enumCast}};{{#exception}}
|
||||
if (exceptionResult != 0) throw new CoreException("{{name}} returned value " + exceptionResult);{{/exception}}{{#hasCoreAccessor}}{{#isNotGetCore}}
|
||||
}{{/isNotGetCore}}{{/hasCoreAccessor}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue