Skip to content

Commit

Permalink
no need to pass env to ref method , we can directly use getCurrentEnv()
Browse files Browse the repository at this point in the history
Summary: We can use getCurrentEnv() instead of passing environment variable around

Reviewed By: amir-shalem

Differential Revision: D17842042

fbshipit-source-id: 185b174ae7c08e746bc76c0600c2e326b15c4993
  • Loading branch information
SidharthGuglani-zz authored and facebook-github-bot committed Oct 10, 2019
1 parent 65a2f15 commit b658708
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ using facebook::yoga::detail::Log;
static inline ScopedLocalRef<jobject> YGNodeJobject(
YGNodeRef node,
void* layoutContext) {
return reinterpret_cast<PtrJNodeMapVanilla*>(layoutContext)
->ref(getCurrentEnv(), node);
return reinterpret_cast<PtrJNodeMapVanilla*>(layoutContext)->ref(node);
}

static inline YGNodeRef _jlong2YGNodeRef(jlong addr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class PtrJNodeMapVanilla {
}
}

ScopedLocalRef<jobject> ref(JNIEnv* env, YGNodeRef node) {
ScopedLocalRef<jobject> ref(YGNodeRef node) {
JNIEnv* env = getCurrentEnv();
auto idx = ptrsToIdxs_.find(node);
if (idx == ptrsToIdxs_.end()) {
return ScopedLocalRef<jobject>(env);
Expand Down

0 comments on commit b658708

Please sign in to comment.