mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/reactperflogger:reactperfloggerAndroid (#43872)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43872 Changelog: [Internal] Reviewed By: cortinico Differential Revision: D55725695 fbshipit-source-id: bdb9112203c744b59e74bb099f8a994e3a8b8dbe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dc8b7f8322
commit
13432b5d8c
@@ -3616,7 +3616,7 @@ public abstract interface class com/facebook/react/packagerconnection/Responder
|
||||
public abstract class com/facebook/react/perflogger/NativeModulePerfLogger {
|
||||
protected fun <init> ()V
|
||||
protected abstract fun initHybrid ()Lcom/facebook/jni/HybridData;
|
||||
protected fun maybeLoadOtherSoLibraries ()V
|
||||
protected final fun maybeLoadOtherSoLibraries ()V
|
||||
public abstract fun moduleCreateCacheHit (Ljava/lang/String;I)V
|
||||
public abstract fun moduleCreateConstructEnd (Ljava/lang/String;I)V
|
||||
public abstract fun moduleCreateConstructStart (Ljava/lang/String;I)V
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.perflogger;
|
||||
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public abstract class NativeModulePerfLogger {
|
||||
private final HybridData mHybridData;
|
||||
|
||||
private static volatile boolean sIsSoLibraryLoaded;
|
||||
|
||||
protected abstract HybridData initHybrid();
|
||||
|
||||
protected NativeModulePerfLogger() {
|
||||
maybeLoadOtherSoLibraries();
|
||||
maybeLoadSoLibrary();
|
||||
mHybridData = initHybrid();
|
||||
}
|
||||
|
||||
public abstract void moduleDataCreateStart(String moduleName, int id);
|
||||
|
||||
public abstract void moduleDataCreateEnd(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateStart(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateCacheHit(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateConstructStart(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateConstructEnd(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateSetUpStart(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateSetUpEnd(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateEnd(String moduleName, int id);
|
||||
|
||||
public abstract void moduleCreateFail(String moduleName, int id);
|
||||
|
||||
// Prevents issues with initializer interruptions. See T38996825 and D13793825 for more context.
|
||||
private static synchronized void maybeLoadSoLibrary() {
|
||||
if (!sIsSoLibraryLoaded) {
|
||||
SoLoader.loadLibrary("reactperfloggerjni");
|
||||
sIsSoLibraryLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** Subclasses will override this method to load their own SO libraries. */
|
||||
protected synchronized void maybeLoadOtherSoLibraries() {}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.perflogger
|
||||
|
||||
import com.facebook.jni.HybridData
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
public abstract class NativeModulePerfLogger protected constructor() {
|
||||
|
||||
@Suppress("NoHungarianNotation") private val mHybridData: HybridData
|
||||
|
||||
init {
|
||||
maybeLoadOtherSoLibraries()
|
||||
maybeLoadSoLibrary()
|
||||
mHybridData = initHybrid()
|
||||
}
|
||||
|
||||
protected abstract fun initHybrid(): HybridData
|
||||
|
||||
public abstract fun moduleDataCreateStart(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleDataCreateEnd(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateStart(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateCacheHit(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateConstructStart(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateConstructEnd(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateSetUpStart(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateSetUpEnd(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateEnd(moduleName: String, id: Int)
|
||||
|
||||
public abstract fun moduleCreateFail(moduleName: String, id: Int)
|
||||
|
||||
/** Subclasses will override this method to load their own SO libraries. */
|
||||
@Synchronized
|
||||
protected fun maybeLoadOtherSoLibraries() {
|
||||
// No-op by default.
|
||||
}
|
||||
|
||||
private companion object {
|
||||
@Volatile private var isSoLibraryLoaded = false
|
||||
|
||||
// Prevents issues with initializer interruptions. See T38996825 and D13793825 for more context.
|
||||
@Synchronized
|
||||
private fun maybeLoadSoLibrary() {
|
||||
if (!isSoLibraryLoaded) {
|
||||
SoLoader.loadLibrary("reactperfloggerjni")
|
||||
isSoLibraryLoaded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user