Skip to content

Commit

Permalink
Reuse and clean up JSC class ref bindings
Browse files Browse the repository at this point in the history
Reviewed By: fkgozali

Differential Revision: D7893634

fbshipit-source-id: de11cb93f9f7e7c935af2da4616671043438363b
  • Loading branch information
sebmarkbage authored and facebook-github-bot committed May 15, 2018
1 parent 4a2c560 commit 6c58035
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ typedef struct FabricJSCUIManager {
: wrapperObjectClassRef(classRef)
, useCustomJSC(customJSC) {
fabricUiManager = make_global(module);
JSC_JSClassRetain(useCustomJSC, wrapperObjectClassRef);
}
global_ref<jobject> fabricUiManager;
JSClassRef wrapperObjectClassRef;
bool useCustomJSC;

~FabricJSCUIManager() {
JSC_JSClassRelease(useCustomJSC, wrapperObjectClassRef);
}
} FabricJSCUIManager;

jobject makePlainGlobalRef(jobject object) {
Expand Down Expand Up @@ -283,6 +288,8 @@ void FabricJSCBinding::installFabric(jlong jsContextNativePointer,
addFabricMethod(context, fabricModule, classRef, module, "appendChildToSet", appendChildToSet);
addFabricMethod(context, fabricModule, classRef, module, "completeRoot", completeRoot);

JSC_JSClassRelease(useCustomJSC, classRef);

JSObjectRef globalObject = JSC_JSContextGetGlobalObject(context);
JSStringRef globalName = JSC_JSStringCreateWithUTF8CString(context, "nativeFabricUIManager");
JSC_JSObjectSetProperty(context, globalObject, globalName, module, kJSPropertyAttributeNone, NULL);
Expand Down

0 comments on commit 6c58035

Please sign in to comment.