From afa080c9568c4fb8aaf64cdefcb13d7c3aa935f3 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 4 Nov 2020 15:13:03 -0800 Subject: [PATCH] For #15279 - review: set LazyMonitored to private. --- app/src/main/java/org/mozilla/fenix/perf/LazyMonitored.kt | 4 ++-- .../test/java/org/mozilla/fenix/perf/LazyMonitoredTest.kt | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/perf/LazyMonitored.kt b/app/src/main/java/org/mozilla/fenix/perf/LazyMonitored.kt index d9efde5f7a..1cc593c6f0 100644 --- a/app/src/main/java/org/mozilla/fenix/perf/LazyMonitored.kt +++ b/app/src/main/java/org/mozilla/fenix/perf/LazyMonitored.kt @@ -20,14 +20,14 @@ object ComponentInitCount { * A convenience function for setting the [LazyMonitored] property delegate, which wraps * [lazy] to add performance monitoring. */ -fun lazyMonitored(initializer: () -> T) = LazyMonitored(initializer) +fun lazyMonitored(initializer: () -> T): Lazy = LazyMonitored(initializer) /** * A wrapper around the [lazy] property delegate to monitor for performance related issues. * For example, we can count the number of components initialized to see how the number of * components initialized on start up impacts start up time. */ -class LazyMonitored(initializer: () -> T) : Lazy { +private class LazyMonitored(initializer: () -> T) : Lazy { // Lazy is thread safe. private val lazyValue = lazy { // We're unlikely to have 4 billion components so we don't handle overflow. diff --git a/app/src/test/java/org/mozilla/fenix/perf/LazyMonitoredTest.kt b/app/src/test/java/org/mozilla/fenix/perf/LazyMonitoredTest.kt index 4e58cdf5e6..0c7ea3bd59 100644 --- a/app/src/test/java/org/mozilla/fenix/perf/LazyMonitoredTest.kt +++ b/app/src/test/java/org/mozilla/fenix/perf/LazyMonitoredTest.kt @@ -17,12 +17,6 @@ class LazyMonitoredTest { ComponentInitCount.count.set(0) } - @Test - fun `WHEN using the convenience function THEN it returns a lazy monitored`() { - val actual = lazyMonitored { } - assertEquals(LazyMonitored::class, actual::class) - } - @Test fun `WHEN accessing a lazy monitored THEN it returns the initializer value`() { val actual by lazyMonitored { 4 }