Android start sending frame scan event instead of subtree update
Summary: Cosmetic change to make the events more inline with what they are Reviewed By: lblasa Differential Revision: D42999134 fbshipit-source-id: e026e38da7e50e8f5520271246f9627eb22e8965
This commit is contained in:
committed by
Facebook GitHub Bot
parent
98b94d62cf
commit
70cdc9bedc
@@ -24,19 +24,19 @@ data class MetadataUpdateEvent(val attributeMetadata: Map<MetadataId, Metadata>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@kotlinx.serialization.Serializable
|
@kotlinx.serialization.Serializable
|
||||||
data class SubtreeUpdateEvent(
|
data class FrameScanEvent(
|
||||||
val txId: Long,
|
val frameTime: Long,
|
||||||
val observerType: String,
|
|
||||||
val rootId: Id,
|
|
||||||
val nodes: List<Node>,
|
val nodes: List<Node>,
|
||||||
val snapshot: String?,
|
val snapshot: Snapshot?,
|
||||||
val frameworkEvents: List<FrameworkEvent>?
|
val frameworkEvents: List<FrameworkEvent>?
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
const val name = "subtreeUpdate"
|
const val name = "frameScan"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlinx.serialization.Serializable data class Snapshot(val nodeId: Id, val data: String)
|
||||||
|
|
||||||
/** Separate optional performance statistics event */
|
/** Separate optional performance statistics event */
|
||||||
@kotlinx.serialization.Serializable
|
@kotlinx.serialization.Serializable
|
||||||
data class PerfStatsEvent(
|
data class PerfStatsEvent(
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ import com.facebook.flipper.plugins.uidebugger.common.BitmapPool
|
|||||||
import com.facebook.flipper.plugins.uidebugger.core.UIDContext
|
import com.facebook.flipper.plugins.uidebugger.core.UIDContext
|
||||||
import com.facebook.flipper.plugins.uidebugger.descriptors.Id
|
import com.facebook.flipper.plugins.uidebugger.descriptors.Id
|
||||||
import com.facebook.flipper.plugins.uidebugger.descriptors.MetadataRegister
|
import com.facebook.flipper.plugins.uidebugger.descriptors.MetadataRegister
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.model.FrameScanEvent
|
||||||
import com.facebook.flipper.plugins.uidebugger.model.FrameworkEvent
|
import com.facebook.flipper.plugins.uidebugger.model.FrameworkEvent
|
||||||
import com.facebook.flipper.plugins.uidebugger.model.MetadataUpdateEvent
|
import com.facebook.flipper.plugins.uidebugger.model.MetadataUpdateEvent
|
||||||
import com.facebook.flipper.plugins.uidebugger.model.Node
|
import com.facebook.flipper.plugins.uidebugger.model.Node
|
||||||
import com.facebook.flipper.plugins.uidebugger.model.PerfStatsEvent
|
import com.facebook.flipper.plugins.uidebugger.model.PerfStatsEvent
|
||||||
import com.facebook.flipper.plugins.uidebugger.model.SubtreeUpdateEvent
|
import com.facebook.flipper.plugins.uidebugger.model.Snapshot
|
||||||
import com.facebook.flipper.plugins.uidebugger.util.MaybeDeferred
|
import com.facebook.flipper.plugins.uidebugger.util.MaybeDeferred
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
@@ -111,12 +112,12 @@ class TreeObserverManager(val context: UIDContext) {
|
|||||||
val snapshotUpdate = batchedUpdate.updates.find { it.snapshot != null }
|
val snapshotUpdate = batchedUpdate.updates.find { it.snapshot != null }
|
||||||
val deferredComputationEndTimestamp = System.currentTimeMillis()
|
val deferredComputationEndTimestamp = System.currentTimeMillis()
|
||||||
|
|
||||||
var snapshot: String? = null
|
var snapshot: Snapshot? = null
|
||||||
if (snapshotUpdate?.snapshot != null) {
|
if (snapshotUpdate?.snapshot != null) {
|
||||||
val stream = ByteArrayOutputStream()
|
val stream = ByteArrayOutputStream()
|
||||||
val base64Stream = Base64OutputStream(stream, Base64.DEFAULT)
|
val base64Stream = Base64OutputStream(stream, Base64.DEFAULT)
|
||||||
snapshotUpdate.snapshot.bitmap?.compress(Bitmap.CompressFormat.PNG, 100, base64Stream)
|
snapshotUpdate.snapshot.bitmap?.compress(Bitmap.CompressFormat.PNG, 100, base64Stream)
|
||||||
snapshot = stream.toString()
|
snapshot = Snapshot(snapshotUpdate.rootId, stream.toString())
|
||||||
snapshotUpdate.snapshot.readyForReuse()
|
snapshotUpdate.snapshot.readyForReuse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,18 +127,12 @@ class TreeObserverManager(val context: UIDContext) {
|
|||||||
|
|
||||||
val serialized =
|
val serialized =
|
||||||
Json.encodeToString(
|
Json.encodeToString(
|
||||||
SubtreeUpdateEvent.serializer(),
|
FrameScanEvent.serializer(),
|
||||||
SubtreeUpdateEvent(
|
FrameScanEvent(batchedUpdate.frameTimeMs, nodes, snapshot, frameworkEvents))
|
||||||
batchedUpdate.frameTimeMs,
|
|
||||||
"batched",
|
|
||||||
snapshotUpdate?.rootId ?: 1,
|
|
||||||
nodes,
|
|
||||||
snapshot,
|
|
||||||
frameworkEvents))
|
|
||||||
|
|
||||||
val serialisationEndTimestamp = System.currentTimeMillis()
|
val serialisationEndTimestamp = System.currentTimeMillis()
|
||||||
|
|
||||||
context.connectionRef.connection?.send(SubtreeUpdateEvent.name, serialized)
|
context.connectionRef.connection?.send(FrameScanEvent.name, serialized)
|
||||||
|
|
||||||
val socketEndTimestamp = System.currentTimeMillis()
|
val socketEndTimestamp = System.currentTimeMillis()
|
||||||
Log.i(LogTag, "Sent event for batched subtree update with nodes with ${nodes.size}")
|
Log.i(LogTag, "Sent event for batched subtree update with nodes with ${nodes.size}")
|
||||||
|
|||||||
Reference in New Issue
Block a user