1
0
Fork 0

Add profiler markers for HomeActivity.load and DefaultTabTrayController.onNewTabTapped

master
Nazım Can Altınova 2020-07-03 16:47:18 +02:00 committed by Michael Comella
parent 1202b15b17
commit 7319f77114
2 changed files with 9 additions and 0 deletions

View File

@ -522,6 +522,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
engine: SearchEngine?,
forceSearch: Boolean
) {
val startTime = components.core.engine.profiler?.getProfilerTime()
val mode = browsingModeManager.mode
val loadUrlUseCase = if (newTab) {
@ -549,6 +550,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
} else {
searchUseCase.invoke(searchTermOrURL)
}
if (components.core.engine.profiler?.isProfilerActive() == true) {
// Wrapping the `addMarker` method with `isProfilerActive` even though it's no-op when
// profiler is not active. That way, `text` argument will not create a string builder all the time.
components.core.engine.profiler?.addMarker("HomeActivity.load", startTime, "newTab: $newTab")
}
}
override fun attachBaseContext(base: Context) {

View File

@ -38,9 +38,11 @@ class DefaultTabTrayController(
private val registerCollectionStorageObserver: () -> Unit
) : TabTrayController {
override fun onNewTabTapped(private: Boolean) {
val startTime = activity.components.core.engine.profiler?.getProfilerTime()
activity.browsingModeManager.mode = BrowsingMode.fromBoolean(private)
navController.navigate(TabTrayDialogFragmentDirections.actionGlobalHome(focusOnAddressBar = true))
dismissTabTray()
activity.components.core.engine.profiler?.addMarker("DefaultTabTrayController.onNewTabTapped", startTime)
}
override fun onTabTrayDismissed() {