Skip to content

Commit

Permalink
Move InspectorFlags JNI wrapper into devsupport library (#42179)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42179

As titled, also moving `InspectorFlags.java` across packages.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D52367642

fbshipit-source-id: 01fabbb57942e8a61ce711e9e0beb564a30bbfbd
  • Loading branch information
huntie authored and facebook-github-bot committed Jan 10, 2024
1 parent a4231a7 commit 7d8af3b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.InspectorFlags;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.R;
import com.facebook.react.bridge.DefaultJSExceptionHandler;
import com.facebook.react.bridge.InspectorFlags;
import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactMarker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.bridge;
package com.facebook.react.devsupport;

import com.facebook.proguard.annotations.DoNotStrip;

/** fbjni interface for reading `jsinspector_modern::InspectorFlags`. */
/** JNI wrapper for `jsinspector_modern::InspectorFlags`. */
@DoNotStrip
public class InspectorFlags {
static {
ReactBridge.staticInit();
DevSupportSoLoader.staticInit();
}

@DoNotStrip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

#include <jsinspector-modern/InspectorFlags.h>

namespace facebook::react {
namespace facebook::react::jsinspector_modern {

bool JInspectorFlags::getEnableModernCDPRegistry(jni::alias_ref<jclass>) {
auto& inspectorFlags = jsinspector_modern::InspectorFlags::getInstance();
auto& inspectorFlags = InspectorFlags::getInstance();
return inspectorFlags.getEnableModernCDPRegistry();
}

bool JInspectorFlags::getEnableCxxInspectorPackagerConnection(
jni::alias_ref<jclass>) {
auto& inspectorFlags = jsinspector_modern::InspectorFlags::getInstance();
auto& inspectorFlags = InspectorFlags::getInstance();
return inspectorFlags.getEnableCxxInspectorPackagerConnection();
}

Expand All @@ -33,4 +33,4 @@ void JInspectorFlags::registerNatives() {
});
}

} // namespace facebook::react
} // namespace facebook::react::jsinspector_modern
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

#include <fbjni/fbjni.h>

namespace facebook::react {
namespace facebook::react::jsinspector_modern {

/**
* fbjni interface for reading `jsinspector_modern::InspectorFlags`.
* JNI wrapper for `jsinspector_modern::InspectorFlags`.
*/
class JInspectorFlags : public jni::JavaClass<JInspectorFlags> {
public:
static constexpr auto kJavaDescriptor =
"Lcom/facebook/react/bridge/InspectorFlags;";
"Lcom/facebook/react/devsupport/InspectorFlags;";

static bool getEnableModernCDPRegistry(jni::alias_ref<jclass>);

Expand All @@ -29,4 +29,4 @@ class JInspectorFlags : public jni::JavaClass<JInspectorFlags> {
JInspectorFlags();
};

} // namespace facebook::react
} // namespace facebook::react::jsinspector_modern
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "JCxxInspectorPackagerConnection.h"
#include "JCxxInspectorPackagerConnectionWebSocketDelegate.h"
#include "JInspectorFlags.h"

#include <fbjni/fbjni.h>

Expand All @@ -16,5 +17,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
registerNatives();
facebook::react::jsinspector_modern::
JCxxInspectorPackagerConnectionWebSocketDelegate::registerNatives();
facebook::react::jsinspector_modern::JInspectorFlags::registerNatives();
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "CxxModuleWrapperBase.h"
#include "JCallback.h"
#include "JInspector.h"
#include "JInspectorFlags.h"
#include "JReactMarker.h"
#include "JavaScriptExecutorHolder.h"
#include "ProxyExecutor.h"
Expand Down Expand Up @@ -85,7 +84,6 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
WritableNativeMap::registerNatives();
JReactMarker::registerNatives();
JInspector::registerNatives();
JInspectorFlags::registerNatives();
});
}

Expand Down

0 comments on commit 7d8af3b

Please sign in to comment.