Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
21f32b85
Commit
21f32b85
authored
May 12, 2021
by
Nikolay Igotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize library loading.
parent
41ad22b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
Library.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skija/impl/Library.kt
+5
-1
Library.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
+2
-7
No files found.
skiko/src/jvmMain/kotlin/org/jetbrains/skija/impl/Library.kt
View file @
21f32b85
package
org.jetbrains.skija.impl
package
org.jetbrains.skija.impl
import
org.jetbrains.skiko.Library
import
org.jetbrains.skiko.Library
import
java.util.concurrent.atomic.AtomicBoolean
class
Library
{
class
Library
{
companion
object
{
companion
object
{
var
loaded
=
AtomicBoolean
(
false
)
@JvmStatic
@JvmStatic
fun
staticLoad
()
{
fun
staticLoad
()
{
Library
.
load
()
if
(!
loaded
.
compareAndExchange
(
false
,
true
))
{
Library
.
load
()
}
}
}
@JvmStatic
@JvmStatic
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
View file @
21f32b85
...
@@ -7,8 +7,6 @@ import java.nio.file.Files
...
@@ -7,8 +7,6 @@ import java.nio.file.Files
import
java.nio.file.StandardCopyOption
import
java.nio.file.StandardCopyOption
object
Library
{
object
Library
{
private
var
loaded
=
false
private
val
skikoLibraryPath
=
System
.
getProperty
(
"skiko.library.path"
)
private
val
skikoLibraryPath
=
System
.
getProperty
(
"skiko.library.path"
)
private
val
cacheRoot
=
"${System.getProperty("
user
.
home
")}/.skiko/"
private
val
cacheRoot
=
"${System.getProperty("
user
.
home
")}/.skiko/"
...
@@ -32,8 +30,6 @@ object Library {
...
@@ -32,8 +30,6 @@ object Library {
// localization resource on platforms wher it is needed.
// localization resource on platforms wher it is needed.
@Synchronized
@Synchronized
fun
load
()
{
fun
load
()
{
if
(
loaded
)
return
val
name
=
"skiko-$hostId"
val
name
=
"skiko-$hostId"
val
platformName
=
System
.
mapLibraryName
(
name
)
val
platformName
=
System
.
mapLibraryName
(
name
)
...
@@ -55,6 +51,7 @@ object Library {
...
@@ -55,6 +51,7 @@ object Library {
loadOrGet
(
cacheDir
,
resourcePath
,
platformName
,
true
)
loadOrGet
(
cacheDir
,
resourcePath
,
platformName
,
true
)
val
loadIcu
=
hostOs
.
isWindows
val
loadIcu
=
hostOs
.
isWindows
if
(
loadIcu
)
{
if
(
loadIcu
)
{
println
(
"Loading ICU"
)
loadOrGet
(
cacheDir
,
resourcePath
,
"icudtl.dat"
,
false
)
loadOrGet
(
cacheDir
,
resourcePath
,
"icudtl.dat"
,
false
)
}
}
}
}
...
@@ -69,11 +66,9 @@ object Library {
...
@@ -69,11 +66,9 @@ object Library {
try
{
try
{
// Init code executed after library was loaded.
// Init code executed after library was loaded.
org
.
jetbrains
.
skija
.
impl
.
Library
.
_nAfterLoad
()
org
.
jetbrains
.
skija
.
impl
.
Library
.
_nAfterLoad
()
println
(
"after load called"
)
}
catch
(
t
:
Throwable
)
{
}
catch
(
t
:
Throwable
)
{
t
.
printStackTrace
()
t
.
printStackTrace
()
}
}
loaded
=
true
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment