-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve kit loading performance
- cache parsed kit configuration instance so we do not need to re-parse the same settings on kit reloads - move kit configuration parsing to a background thread
- Loading branch information
1 parent
3a70121
commit 9da38b8
Showing
30 changed files
with
338 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
android-core/src/main/java/com/mparticle/internal/KitsLoadedCallback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.mparticle.internal | ||
|
||
class KitsLoadedCallback { | ||
@Volatile private var onKitsLoadedRunnable: OnKitManagerLoaded? = null | ||
@Volatile private var loaded: Boolean = false | ||
|
||
fun setKitsLoaded() { | ||
synchronized(this) { | ||
if (!loaded) { | ||
loaded = true | ||
onKitsLoadedRunnable?.onKitManagerLoaded() | ||
} | ||
} | ||
} | ||
|
||
fun onKitsLoaded(callback: OnKitManagerLoaded) { | ||
synchronized(this) { | ||
if (loaded) { | ||
callback.onKitManagerLoaded() | ||
} else { | ||
onKitsLoadedRunnable = callback | ||
} | ||
} | ||
} | ||
} | ||
|
||
interface OnKitManagerLoaded { | ||
fun onKitManagerLoaded() | ||
} |
8 changes: 8 additions & 0 deletions
8
android-core/src/main/java/com/mparticle/internal/KitsLoadedListenerConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.mparticle.internal | ||
|
||
import com.mparticle.Configuration | ||
|
||
internal class KitsLoadedListenerConfiguration(private var kitsLoadedListener: KitsLoadedListener) : Configuration<KitFrameworkWrapper> { | ||
override fun configures() = KitFrameworkWrapper::class.java | ||
override fun apply(kitFrameworkWrapper: KitFrameworkWrapper) = kitFrameworkWrapper.addKitsLoadedListener(kitsLoadedListener) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.