Update ReactAndroid/main/jni/react to use glog for logging
Summary: Updates uses of FBLOG* and FBASSERT* to their glog equivalents. public Reviewed By: astreet Differential Revision: D2905159 fb-gh-sync-id: 1f916283aa3de68d8469c8d4ca7fa0874cec28ef
This commit is contained in:
parent
294185ac32
commit
fc94f1e6d0
|
@ -9,6 +9,7 @@ DEPS = [
|
|||
'//native/third-party/android-ndk:android',
|
||||
'//xplat/fbsystrace:fbsystrace',
|
||||
'//xplat/folly:molly',
|
||||
'//xplat/third-party/glog:glog',
|
||||
]
|
||||
|
||||
PREPROCESSOR_FLAGS = [
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "JSCHelpers.h"
|
||||
|
||||
#include <JavaScriptCore/JSStringRef.h>
|
||||
#include <fb/log.h>
|
||||
#include <glog/logging.h>
|
||||
#include <jni/fbjni/Exceptions.h>
|
||||
|
||||
#include "Value.h"
|
||||
|
@ -52,7 +52,7 @@ JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef
|
|||
if (result == nullptr) {
|
||||
Value exception = Value(context, exn);
|
||||
std::string exceptionText = exception.toString().str();
|
||||
FBLOGE("Got JS Exception: %s", exceptionText.c_str());
|
||||
LOG(ERROR) << "Got JS Exception: " << exceptionText;
|
||||
auto line = exception.asObject().getProperty("line");
|
||||
|
||||
std::ostringstream locationInfo;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#include "JSCWebWorker.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <fb/assert.h>
|
||||
#include <fb/log.h>
|
||||
#include <glog/logging.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <jni/fbjni/Exceptions.h>
|
||||
#include <jni/LocalReference.h>
|
||||
|
||||
#include "JSCWebWorker.h"
|
||||
#include "JSCHelpers.h"
|
||||
#include "jni/JMessageQueueThread.h"
|
||||
#include "jni/JSLoader.h"
|
||||
|
@ -33,9 +33,9 @@ JSCWebWorker::JSCWebWorker(int id, JSCWebWorkerOwner *owner, std::string scriptS
|
|||
scriptName_(std::move(scriptSrc)),
|
||||
owner_(owner) {
|
||||
ownerMessageQueueThread_ = owner->getMessageQueueThread();
|
||||
FBASSERTMSGF(ownerMessageQueueThread_, "Owner MessageQueueThread must not be null");
|
||||
CHECK(ownerMessageQueueThread_) << "Owner MessageQueue must not be null";
|
||||
workerMessageQueueThread_ = WebWorkers::createWebWorkerThread(id, ownerMessageQueueThread_.get());
|
||||
FBASSERTMSGF(workerMessageQueueThread_, "Failed to create worker thread");
|
||||
CHECK(workerMessageQueueThread_) << "Failed to create worker thread";
|
||||
|
||||
workerMessageQueueThread_->runOnQueue([this] () {
|
||||
initJSVMAndLoadScript();
|
||||
|
@ -43,7 +43,7 @@ JSCWebWorker::JSCWebWorker(int id, JSCWebWorkerOwner *owner, std::string scriptS
|
|||
}
|
||||
|
||||
JSCWebWorker::~JSCWebWorker() {
|
||||
FBASSERTMSGF(isTerminated(), "Didn't terminate the web worker before releasing it!");
|
||||
CHECK(isTerminated()) << "Didn't terminate the web worker before releasing it!";;
|
||||
}
|
||||
|
||||
void JSCWebWorker::postMessage(JSValueRef msg) {
|
||||
|
@ -99,15 +99,15 @@ bool JSCWebWorker::isTerminated() {
|
|||
}
|
||||
|
||||
void JSCWebWorker::initJSVMAndLoadScript() {
|
||||
FBASSERTMSGF(!isTerminated(), "Worker was already finished!");
|
||||
FBASSERTMSGF(!context_, "Worker JS VM was already created!");
|
||||
CHECK(!isTerminated()) << "Worker was already finished!";
|
||||
CHECK(!context_) << "Worker JS VM was already created!";
|
||||
|
||||
context_ = JSGlobalContextCreateInGroup(
|
||||
NULL, // use default JS 'global' object
|
||||
NULL // create new group (i.e. new VM)
|
||||
);
|
||||
);
|
||||
s_globalContextRefToJSCWebWorker[context_] = this;
|
||||
|
||||
|
||||
// TODO(9604438): Protect against script does not exist
|
||||
std::string script = loadScriptFromAssets(scriptName_);
|
||||
evaluateScript(context_, String(script.c_str()), String(scriptName_.c_str()));
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include "Value.h"
|
||||
|
||||
using namespace facebook::jni;
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
|
|
Loading…
Reference in New Issue