main

square/leakcanary

Last updated at: 29/12/2023 09:38

Friendly.kt

TLDR

The "leakcanary-android-instrumentation_Friendly.kt" file contains a few utility functions related to the LeakCanary library. These functions include noOpDelegate(), checkNotMainThread(), and measureDurationMillis().

Methods

noOpDelegate()

This method is an inline function that returns a delegate of type T. It is used internally within the LeakCanary library, specifically for creating no-op delegates.

checkNotMainThread()

This method is an inline function that checks whether the current thread is the main thread. It is used internally within the LeakCanary library to ensure that certain operations are not performed on the main thread.

measureDurationMillis(block: () -> Unit)

This method is an inline function that measures the duration in milliseconds of executing a given block of code. It takes a lambda expression as a parameter and returns the duration in milliseconds. It is used internally within the LeakCanary library for measuring the duration of certain operations.

@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@file:JvmName("leakcanary-android-instrumentation_Friendly")
package leakcanary.internal.friendly

internal inline fun <reified T : Any> noOpDelegate(): T = leakcanary.internal.noOpDelegate()

internal inline fun checkNotMainThread() = leakcanary.internal.checkNotMainThread()

internal inline fun measureDurationMillis(block: () -> Unit) =
  leakcanary.internal.measureDurationMillis(block)