MCPcopy Create free account
hub / github.com/Snapchat/Valdi / ViewRefSupport

Class ViewRefSupport

valdi/src/java/com/snap/valdi/utils/ViewRefSupport.kt:8–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import java.util.concurrent.Executors
7
8class ViewRefSupport(val logger: Logger,
9 val bitmapPool: BitmapPool,
10 val coordinateResolver: CoordinateResolver) {
11
12 private var renderCanvas: Canvas? = null
13 private var snapshotExecutor: ExecutorService? = null
14
15 fun getSnapshotExecutor(): ExecutorService {
16 var executor = this.snapshotExecutor
17 if (executor == null) {
18 executor = ExecutorsUtil.newSingleThreadCachedExecutor { r ->
19 Thread(r).apply {
20 name = "Valdi Snapshot Executor"
21 priority = Thread.MAX_PRIORITY
22 }
23 }
24
25 this.snapshotExecutor = executor
26 }
27
28 return executor
29 }
30
31 fun getRenderCanvas(): Canvas {
32 var renderCanvas = this.renderCanvas
33 if (renderCanvas == null) {
34 renderCanvas = Canvas()
35 this.renderCanvas = renderCanvas
36 }
37 return renderCanvas
38 }
39}

Callers 1

ValdiRuntimeManagerClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected