mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Mark SingleThreadAsserter as @LegacyArchitecture (#50307)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50307 Mark SingleThreadAsserter as LegacyArchitecture changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D71820293 fbshipit-source-id: a974ee65b2659028d14f73504f73db2b3ae63f70
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6d5dde6393
commit
a90bc9a766
@@ -1776,11 +1776,6 @@ public abstract interface class com/facebook/react/common/ShakeDetector$ShakeLis
|
||||
public abstract fun onShake ()V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/common/SingleThreadAsserter {
|
||||
public fun <init> ()V
|
||||
public final fun assertNow ()V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/common/SurfaceDelegate {
|
||||
public abstract fun createContentView (Ljava/lang/String;)V
|
||||
public abstract fun destroyContentView ()V
|
||||
|
||||
-23
@@ -1,23 +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.common
|
||||
|
||||
import com.facebook.infer.annotation.Assertions
|
||||
|
||||
/** Simple class for asserting that operations only run on a single thread. */
|
||||
public class SingleThreadAsserter {
|
||||
private var thread: Thread? = null
|
||||
|
||||
public fun assertNow() {
|
||||
val currentThread = Thread.currentThread()
|
||||
if (thread == null) {
|
||||
thread = currentThread
|
||||
}
|
||||
Assertions.assertCondition(thread == currentThread)
|
||||
}
|
||||
}
|
||||
+13
-1
@@ -10,7 +10,7 @@ package com.facebook.react.uimanager
|
||||
import android.util.SparseArray
|
||||
import android.util.SparseBooleanArray
|
||||
import android.view.View
|
||||
import com.facebook.react.common.SingleThreadAsserter
|
||||
import com.facebook.infer.annotation.Assertions
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
|
||||
@@ -88,4 +88,16 @@ internal class ShadowNodeRegistry {
|
||||
"ShadowNodeRegistry", LegacyArchitectureLogLevel.WARNING)
|
||||
}
|
||||
}
|
||||
|
||||
inner class SingleThreadAsserter {
|
||||
private var thread: Thread? = null
|
||||
|
||||
public fun assertNow() {
|
||||
val currentThread = Thread.currentThread()
|
||||
if (thread == null) {
|
||||
thread = currentThread
|
||||
}
|
||||
Assertions.assertCondition(thread == currentThread)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user