Remove redundant native scan event
Summary: It didnt need to exist and can be seen as a subtree update of type full scan Reviewed By: lblasa Differential Revision: D39731552 fbshipit-source-id: e351413d9480e118fc000c5e55eae0e7980233f2
This commit is contained in:
committed by
Facebook GitHub Bot
parent
78e84a0cc3
commit
7ae2c35476
@@ -10,9 +10,10 @@ package com.facebook.flipper.plugins.uidebugger.core
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.facebook.flipper.plugins.uidebugger.LogTag
|
import com.facebook.flipper.plugins.uidebugger.LogTag
|
||||||
import com.facebook.flipper.plugins.uidebugger.model.NativeScanEvent
|
import com.facebook.flipper.plugins.uidebugger.descriptors.nodeId
|
||||||
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.observers.TreeObserverFactory
|
import com.facebook.flipper.plugins.uidebugger.observers.TreeObserverFactory
|
||||||
import com.facebook.flipper.plugins.uidebugger.scheduler.Scheduler
|
import com.facebook.flipper.plugins.uidebugger.scheduler.Scheduler
|
||||||
import com.facebook.flipper.plugins.uidebugger.traversal.PartialLayoutTraversal
|
import com.facebook.flipper.plugins.uidebugger.traversal.PartialLayoutTraversal
|
||||||
@@ -25,6 +26,8 @@ data class ScanResult(
|
|||||||
val nodes: List<Node>
|
val nodes: List<Node>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const val observerType = "FullScan"
|
||||||
|
|
||||||
/** This is used to stress test the ui debugger, should not be used in production */
|
/** This is used to stress test the ui debugger, should not be used in production */
|
||||||
class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
|
class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +36,7 @@ class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
|
|||||||
*/
|
*/
|
||||||
private val emptyObserverFactory = TreeObserverFactory()
|
private val emptyObserverFactory = TreeObserverFactory()
|
||||||
private val traversal = PartialLayoutTraversal(context.descriptorRegister, emptyObserverFactory)
|
private val traversal = PartialLayoutTraversal(context.descriptorRegister, emptyObserverFactory)
|
||||||
private var txId = 0L
|
private var txId = 100000L
|
||||||
|
|
||||||
override fun execute(): ScanResult {
|
override fun execute(): ScanResult {
|
||||||
val start = System.currentTimeMillis()
|
val start = System.currentTimeMillis()
|
||||||
@@ -49,11 +52,14 @@ class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
|
|||||||
|
|
||||||
override fun process(input: ScanResult) {
|
override fun process(input: ScanResult) {
|
||||||
val serialized =
|
val serialized =
|
||||||
Json.encodeToString(NativeScanEvent.serializer(), NativeScanEvent(input.txId, input.nodes))
|
Json.encodeToString(
|
||||||
|
SubtreeUpdateEvent.serializer(),
|
||||||
|
SubtreeUpdateEvent(
|
||||||
|
input.txId, observerType, context.applicationRef.nodeId(), input.nodes))
|
||||||
val serializationEnd = System.currentTimeMillis()
|
val serializationEnd = System.currentTimeMillis()
|
||||||
|
|
||||||
context.connectionRef.connection?.send(
|
context.connectionRef.connection?.send(
|
||||||
NativeScanEvent.name,
|
SubtreeUpdateEvent.name,
|
||||||
serialized,
|
serialized,
|
||||||
)
|
)
|
||||||
val socketEnd = System.currentTimeMillis()
|
val socketEnd = System.currentTimeMillis()
|
||||||
@@ -64,7 +70,7 @@ class NativeScanScheduler(val context: Context) : Scheduler.Task<ScanResult> {
|
|||||||
PerfStatsEvent.serializer(),
|
PerfStatsEvent.serializer(),
|
||||||
PerfStatsEvent(
|
PerfStatsEvent(
|
||||||
input.txId,
|
input.txId,
|
||||||
"FullScan",
|
observerType,
|
||||||
input.scanStart,
|
input.scanStart,
|
||||||
input.scanStart,
|
input.scanStart,
|
||||||
input.scanEnd,
|
input.scanEnd,
|
||||||
|
|||||||
@@ -29,13 +29,6 @@ data class SubtreeUpdateEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@kotlinx.serialization.Serializable
|
|
||||||
data class NativeScanEvent(val txId: Long, val nodes: List<Node>) {
|
|
||||||
companion object {
|
|
||||||
const val name = "nativeScan"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Separate optional performance statistics event */
|
/** Separate optional performance statistics event */
|
||||||
@kotlinx.serialization.Serializable
|
@kotlinx.serialization.Serializable
|
||||||
data class PerfStatsEvent(
|
data class PerfStatsEvent(
|
||||||
|
|||||||
@@ -35,11 +35,6 @@ export function plugin(client: PluginClient<Events>) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
client.onMessage('nativeScan', ({nodes}) => {
|
|
||||||
//Native scan is a full update so overwrite everything
|
|
||||||
nodesAtom.set(new Map(nodes.map((node) => [node.id, node])));
|
|
||||||
});
|
|
||||||
|
|
||||||
return {rootId, snapshots: snapshotsAtom, nodes: nodesAtom, perfEvents};
|
return {rootId, snapshots: snapshotsAtom, nodes: nodesAtom, perfEvents};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export type Events = {
|
export type Events = {
|
||||||
init: {rootId: string};
|
init: InitEvent;
|
||||||
nativeScan: {txId: number; nodes: UINode[]};
|
|
||||||
subtreeUpdate: SubtreeUpdateEvent;
|
subtreeUpdate: SubtreeUpdateEvent;
|
||||||
perfStats: PerfStatsEvent;
|
perfStats: PerfStatsEvent;
|
||||||
};
|
};
|
||||||
@@ -21,6 +20,8 @@ export type SubtreeUpdateEvent = {
|
|||||||
snapshot: Snapshot;
|
snapshot: Snapshot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type InitEvent = {rootId: Id};
|
||||||
|
|
||||||
export type PerfStatsEvent = {
|
export type PerfStatsEvent = {
|
||||||
txId: number;
|
txId: number;
|
||||||
observerType: string;
|
observerType: string;
|
||||||
@@ -50,8 +51,8 @@ export type Bounds = {
|
|||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Id = string;
|
|
||||||
export type Snapshot = string;
|
export type Snapshot = string;
|
||||||
|
export type Id = number;
|
||||||
|
|
||||||
export type Tag = 'Native' | 'Declarative' | 'Android' | 'Litho ';
|
export type Tag = 'Native' | 'Declarative' | 'Android' | 'Litho ';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user