From 118e981174ae513426e2f5ddd7ee3c5860519ff7 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 28 Nov 2016 12:40:43 -0800 Subject: [PATCH] Improve configuration of custom JSC Reviewed By: amnn Differential Revision: D4237462 fbshipit-source-id: ef16b7f81d3158c63a12e32e2e35204635a57543 --- ReactCommon/jschelpers/JSCWrapper.cpp | 5 ++++- ReactCommon/jschelpers/JSCWrapper.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactCommon/jschelpers/JSCWrapper.cpp b/ReactCommon/jschelpers/JSCWrapper.cpp index 27942a5b0..0da38ae84 100644 --- a/ReactCommon/jschelpers/JSCWrapper.cpp +++ b/ReactCommon/jschelpers/JSCWrapper.cpp @@ -51,6 +51,10 @@ static const JSCWrapper* s_customWrapper = nullptr; static JSCWrapper s_systemWrapper = {}; +bool isCustomJSCWrapperSet() { + return s_customWrapper != nullptr; +} + const JSCWrapper* customJSCWrapper() { #if USE_GLOG CHECK(s_customWrapper != nullptr) << "Accessing custom JSC wrapper before it's set"; @@ -60,7 +64,6 @@ const JSCWrapper* customJSCWrapper() { void setCustomJSCWrapper(const JSCWrapper* wrapper) { #if USE_GLOG - CHECK(wrapper != nullptr) << "Can't set null wrapper"; CHECK(s_customWrapper == nullptr) << "Can't set custom JSC wrapper multiple times"; #endif s_customWrapper = wrapper; diff --git a/ReactCommon/jschelpers/JSCWrapper.h b/ReactCommon/jschelpers/JSCWrapper.h index 0bfd3693b..5bc0e206e 100644 --- a/ReactCommon/jschelpers/JSCWrapper.h +++ b/ReactCommon/jschelpers/JSCWrapper.h @@ -127,6 +127,7 @@ bool isCustomJSCPtr(T *x) { return (uintptr_t)x & 0x1; } +bool isCustomJSCWrapperSet(); void setCustomJSCWrapper(const JSCWrapper* wrapper); // This will return a single value for the whole life of the process.