mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Convert debug/holder module (#43747)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43747 Convert module to Kotlin. changelog: [internal] internal Reviewed By: cortinico Differential Revision: D55598977 fbshipit-source-id: d289e230bae721de6d7d209663fcdc35ec37fbac
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1139700424
commit
7a458025ca
-31
@@ -1,31 +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.debug.holder;
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
|
||||
/** No-op implementation of {@link Printer}. */
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public class NoopPrinter implements Printer {
|
||||
|
||||
public static final NoopPrinter INSTANCE = new NoopPrinter();
|
||||
|
||||
private NoopPrinter() {}
|
||||
|
||||
@Override
|
||||
public void logMessage(DebugOverlayTag tag, String message, Object... args) {}
|
||||
|
||||
@Override
|
||||
public void logMessage(DebugOverlayTag tag, String message) {}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayLogMessage(final DebugOverlayTag tag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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.debug.holder
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag
|
||||
|
||||
/** No-op implementation of [Printer]. */
|
||||
public object NoopPrinter : Printer {
|
||||
|
||||
public override fun logMessage(tag: DebugOverlayTag, message: String, vararg args: Any?): Unit =
|
||||
Unit
|
||||
|
||||
public override fun logMessage(tag: DebugOverlayTag, message: String): Unit = Unit
|
||||
|
||||
public override fun shouldDisplayLogMessage(tag: DebugOverlayTag): Boolean = false
|
||||
}
|
||||
-20
@@ -1,20 +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.debug.holder;
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||
|
||||
/** Interface to debugging tool. */
|
||||
public interface Printer {
|
||||
|
||||
void logMessage(final DebugOverlayTag tag, final String message, Object... args);
|
||||
|
||||
void logMessage(final DebugOverlayTag tag, final String message);
|
||||
|
||||
boolean shouldDisplayLogMessage(final DebugOverlayTag tag);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.debug.holder
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag
|
||||
|
||||
/** Interface to debugging tool. */
|
||||
public interface Printer {
|
||||
|
||||
public fun logMessage(tag: DebugOverlayTag, message: String, vararg args: Any?)
|
||||
|
||||
public fun logMessage(tag: DebugOverlayTag, message: String)
|
||||
|
||||
public fun shouldDisplayLogMessage(tag: DebugOverlayTag): Boolean
|
||||
}
|
||||
-29
@@ -1,29 +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.debug.holder;
|
||||
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
|
||||
/** Holder for debugging tool instance. */
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
public class PrinterHolder {
|
||||
|
||||
private static Printer sPrinter = NoopPrinter.INSTANCE;
|
||||
|
||||
public static void setPrinter(Printer printer) {
|
||||
if (printer == null) {
|
||||
sPrinter = NoopPrinter.INSTANCE;
|
||||
} else {
|
||||
sPrinter = printer;
|
||||
}
|
||||
}
|
||||
|
||||
public static Printer getPrinter() {
|
||||
return sPrinter;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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.debug.holder
|
||||
|
||||
/** Holder for debugging tool instance. */
|
||||
public object PrinterHolder {
|
||||
@JvmStatic public var printer: Printer = NoopPrinter
|
||||
}
|
||||
Reference in New Issue
Block a user