mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -77,6 +77,7 @@ class AnalyzeRule(
|
||||
private val regexCache = hashMapOf<String, Regex?>()
|
||||
private val scriptCache = hashMapOf<String, CompiledScript>()
|
||||
private var topScopeRef: WeakReference<Scriptable>? = null
|
||||
private var evalJSCallCount = 0
|
||||
|
||||
private var coroutineContext: CoroutineContext = EmptyCoroutineContext
|
||||
|
||||
@@ -781,7 +782,9 @@ class AnalyzeRule(
|
||||
val topScope = source?.getShareScope(coroutineContext) ?: topScopeRef?.get()
|
||||
val scope = if (topScope == null) {
|
||||
RhinoScriptEngine.getRuntimeScope(bindings).apply {
|
||||
topScopeRef = WeakReference(prototype)
|
||||
if (evalJSCallCount++ > 16) {
|
||||
topScopeRef = WeakReference(prototype)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bindings.apply {
|
||||
|
||||
Reference in New Issue
Block a user