Skip to content

Commit 561fc5a

Browse files
dzinadgithub-actions[bot]
authored andcommitted
add performance marks
GitOrigin-RevId: 9ec31c222f92f6e51e558785f7e97fff89ee1b9d
1 parent f5ca180 commit 561fc5a

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

base/src/main/java/com/mapbox/navigation/base/route/NavigationRoute.kt

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -606,26 +606,30 @@ class NavigationRoute private constructor(
606606
* without comparing all other routes found in the [DirectionsResponse.routes].
607607
*/
608608
override fun equals(other: Any?): Boolean {
609-
if (this === other) return true
610-
if (javaClass != other?.javaClass) return false
609+
PerformanceTracker.trackPerformanceSync("NavRoute#equals") {
610+
if (this === other) return true
611+
if (javaClass != other?.javaClass) return false
611612

612-
other as NavigationRoute
613+
other as NavigationRoute
613614

614-
if (id != other.id) return false
615-
if (directionsRoute != other.directionsRoute) return false
616-
if (waypoints != other.waypoints) return false
615+
if (id != other.id) return false
616+
if (directionsRoute != other.directionsRoute) return false
617+
if (waypoints != other.waypoints) return false
617618

618-
return true
619+
return true
620+
}
619621
}
620622

621623
/**
622624
* Returns a hash code value for the object.
623625
*/
624626
override fun hashCode(): Int {
625-
var result = id.hashCode()
626-
result = 31 * result + directionsRoute.hashCode()
627-
result = 31 * result + waypoints.hashCode()
628-
return result
627+
PerformanceTracker.trackPerformanceSync("NavRoute#hashCode") {
628+
var result = id.hashCode()
629+
result = 31 * result + directionsRoute.hashCode()
630+
result = 31 * result + waypoints.hashCode()
631+
return result
632+
}
629633
}
630634

631635
/**

navigation/src/main/java/com/mapbox/navigation/core/replay/route/ReplayProgressObserver.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.mapbox.navigation.core.replay.route
33
import androidx.annotation.UiThread
44
import com.mapbox.api.directions.v5.models.RouteLeg
55
import com.mapbox.geojson.Point
6+
import com.mapbox.navigation.base.internal.performance.PerformanceTracker
67
import com.mapbox.navigation.base.trip.model.RouteProgress
78
import com.mapbox.navigation.core.MapboxNavigation
89
import com.mapbox.navigation.core.replay.MapboxReplayer
@@ -45,12 +46,14 @@ class ReplayProgressObserver @JvmOverloads constructor(
4546
* @param routeProgress from the navigation session
4647
*/
4748
override fun onRouteProgressChanged(routeProgress: RouteProgress) {
48-
val currentLegProgress = routeProgress.currentLegProgress
49-
val routeProgressRouteLeg = currentLegProgress?.routeLeg
50-
val legIdentifier = routeProgress.getCurrentRouteLegIdentifier()
51-
if (currentLegIdentifier != legIdentifier && currentLegProgress != null) {
52-
currentLegIdentifier = legIdentifier
53-
onRouteLegChanged(routeProgressRouteLeg, currentLegProgress.distanceTraveled)
49+
PerformanceTracker.trackPerformanceSync("ReplayProgressObserver") {
50+
val currentLegProgress = routeProgress.currentLegProgress
51+
val routeProgressRouteLeg = currentLegProgress?.routeLeg
52+
val legIdentifier = routeProgress.getCurrentRouteLegIdentifier()
53+
if (currentLegIdentifier != legIdentifier && currentLegProgress != null) {
54+
currentLegIdentifier = legIdentifier
55+
onRouteLegChanged(routeProgressRouteLeg, currentLegProgress.distanceTraveled)
56+
}
5457
}
5558
}
5659

0 commit comments

Comments
 (0)