mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Bug 1888766 - Decouple the dismiss and profiler state update logics r=mleclair,android-reviewers,gl
Previously we had the `profilerViewModel.setProfilerState` call inside the dismiss method. Because of this it was updating the profiler state prematurely when user was pressing "upload profile" button and then returning home quickly. After decoupling the dismiss and setProfilerState calls, now we only update the profiler state once the profiler state changes, which makes sure that profiler states in geckoview and ProfilerViewModel stay in sync. Differential Revision: https://phabricator.services.mozilla.com/D206647
This commit is contained in:
parent
d0f70542e1
commit
644e75f157
@ -56,9 +56,8 @@ class ProfilerStopDialogFragment : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
private fun setProfilerState() {
|
||||
profilerViewModel.setProfilerState(requireContext().components.core.engine.profiler!!.isProfilerActive())
|
||||
super.dismiss()
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ -111,7 +110,14 @@ class ProfilerStopDialogFragment : DialogFragment() {
|
||||
) {
|
||||
TextButton(
|
||||
onClick = {
|
||||
requireContext().components.core.engine.profiler?.stopProfiler({}, {})
|
||||
requireContext().components.core.engine.profiler?.stopProfiler(
|
||||
onSuccess = {
|
||||
setProfilerState()
|
||||
},
|
||||
onError = {
|
||||
setProfilerState()
|
||||
},
|
||||
)
|
||||
dismiss()
|
||||
},
|
||||
) {
|
||||
@ -162,6 +168,7 @@ class ProfilerStopDialogFragment : DialogFragment() {
|
||||
resources.getString(message) + extra,
|
||||
Toast.LENGTH_LONG,
|
||||
).show()
|
||||
setProfilerState()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user