Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Android): Migrate Hermes Instruments to Kotlin #48378

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TheRogue76
Copy link
Contributor

@TheRogue76 TheRogue76 commented Dec 24, 2024

Summary:

Time to migrate some of Hermes's instruments. I see that HermesMemoryDumper(react/hermes/instrumentation/HermesMemoryDumper.h) implements the interface on C++, but not sure if i need to update the getId call to just id (same with getInternalStorage) or if the interop between Kotlin and Java applies to these things as well. @cortinico Any thoughts on your side would be appreciated.
HermesSamplingProfiler just became an object, since it was a singleton and a static anyway.
Here is what HermesMemoryDumper.h looks like:
Screenshot 2024-12-24 at 10 03 00

Updated: I ended up making them match the function signature on Cxx, because even if it does have that implicit behavior, doesn't feel right to tap into it like this.

Changelog:

[INTERNAL] [FIXED] - Migrate HermesMemoryDumper and HermesSamplingProfiler to Kotlin

Test Plan:

/gradlew test:
Screenshot 2024-12-24 at 09 54 29

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Dec 24, 2024
…utorFactory so it markes the NonNull values it overrides correctly.
@@ -34,6 +35,7 @@ public void setDebuggerName(String debuggerName) {
mDebuggerName = debuggerName;
}

@NonNull
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaScriptExecutorFactory explicitly marks these values as non nullable, so it is ok to mark them here as well.
Screenshot 2024-12-24 at 23 27 06

Comment on lines -13 to +14
String getInternalStorage();
public fun getInternalStorage(): String

String getId();
public fun getId(): String
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I marked these as String and not String? since in Cxx the return type is std::string and not a pointer, but i do see some pointer shenanigans going on over there. Will leave it up to the person who reviews to give their thoughts as well. I can not find any use of this class anywhere, in Cxx or in the JVM land so i can't tell by usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants