Improve configuration of custom JSC

Reviewed By: amnn

Differential Revision: D4237462

fbshipit-source-id: ef16b7f81d3158c63a12e32e2e35204635a57543
This commit is contained in:
Pieter De Baets 2016-11-28 12:40:43 -08:00 committed by Facebook Github Bot
parent ebc65cecd6
commit 118e981174
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -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.