• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package leakcanary.internal
2 
3 internal sealed class RetainInstanceEvent {
4   object NoMoreObjects : RetainInstanceEvent()
5   sealed class CountChanged : RetainInstanceEvent() {
6     class BelowThreshold(val retainedCount: Int) : RetainInstanceEvent()
7     class DumpingDisabled(val reason: String) : RetainInstanceEvent()
8     object DumpHappenedRecently : RetainInstanceEvent()
9   }
10 }
11 
12 /**
13  * Called by LeakCanary when the number of retained instances updates .
14  */
15 internal fun interface OnRetainInstanceListener {
16 
17   /**
18    * Called when there's a change to the Retained Instances. See [RetainInstanceEvent] for
19    * possible events.
20    */
onEventnull21   fun onEvent(event: RetainInstanceEvent)
22 }
23 
24 internal class DefaultOnRetainInstanceListener : OnRetainInstanceListener {
25 
26   override fun onEvent(event: RetainInstanceEvent) {}
27 }
28