Skip to content

Revertglog #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
#include <react/jni/JSLogging.h>
#include <react/jni/ReadableNativeMap.h>

namespace facebook {
namespace v8runtime {
std::unique_ptr<jsi::Runtime> makeV8Runtime();
} // namespace v8runtime
} // namespace facebook

namespace facebook {
namespace react {

Expand All @@ -25,16 +31,13 @@ class V8ExecutorFactory : public JSExecutorFactory {

std::unique_ptr<JSExecutor> createJSExecutor(
std::shared_ptr<ExecutorDelegate> delegate,
std::shared_ptr<MessageQueueThread> jsQueue) override {

auto logger = std::make_shared<JSIExecutor::Logger>([](const std::string& message, unsigned int logLevel) {
reactAndroidLoggingHook(message, logLevel);
});

std::shared_ptr<MessageQueueThread> jsQueue) override {
return folly::make_unique<JSIExecutor>(
facebook::v8runtime::makeV8Runtime(m_v8Config, logger),
facebook::v8runtime::makeV8Runtime(m_v8Config),
delegate,
*logger,
[](const std::string& message, unsigned int logLevel) {
reactAndroidLoggingHook(message, logLevel);
},
JSIExecutor::defaultTimeoutInvoker,
nullptr);
}
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jsi/V8Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace v8runtime {
std::unique_ptr<const jsi::Buffer> custom_snapshot = nullptr); /*Optional*/

std::unique_ptr<jsi::Runtime> makeV8Runtime();
std::unique_ptr<jsi::Runtime> makeV8Runtime(const folly::dynamic& v8Config, const std::shared_ptr<Logger>& logger);
std::unique_ptr<jsi::Runtime> makeV8Runtime(const folly::dynamic& v8Config);

} // namespace v8runtime
} // namespace facebook
3 changes: 1 addition & 2 deletions ReactCommon/jsi/V8Runtime_droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ namespace facebook { namespace v8runtime {
}
}

V8Runtime::V8Runtime(const folly::dynamic& v8Config, const std::shared_ptr<Logger>& logger) : V8Runtime() {
logger_ = logger;
V8Runtime::V8Runtime(const folly::dynamic& v8Config) : V8Runtime() {
isCacheEnabled_ = IsCacheEnabled(v8Config);
shouldProduceFullCache_ = ShouldProduceFullCache(v8Config);
shouldSetNoLazyFlag_ = ShouldSetNoLazyFlag(v8Config);
Expand Down
8 changes: 1 addition & 7 deletions ReactCommon/jsi/V8Runtime_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace facebook { namespace v8runtime {
class V8Runtime : public jsi::Runtime {
public:
V8Runtime();
V8Runtime(const folly::dynamic& v8Config, const std::shared_ptr<Logger>& logger);
V8Runtime(const folly::dynamic& v8Config);

V8Runtime(const v8::Platform* platform, std::shared_ptr<Logger>&& logger,
std::shared_ptr<facebook::react::MessageQueueThread>&& jsQueue, std::shared_ptr<CacheProvider>&& cacheProvider,
Expand Down Expand Up @@ -374,12 +374,6 @@ namespace facebook { namespace v8runtime {
bool ExecuteString(v8::Local<v8::String> source, const jsi::Buffer* cache, v8::Local<v8::Value> name, bool report_exceptions);
bool ExecuteString(const v8::Local<v8::String>& source, const std::string& sourceURL);

void Log(const std::string& message, const unsigned int logLevel) {
if (logger_) {
(*logger_)("V8Runtime:: " + message, logLevel);
}
}

void ReportException(v8::TryCatch* try_catch);

v8::Isolate* GetIsolate() const { return isolate_; }
Expand Down
14 changes: 5 additions & 9 deletions ReactCommon/jsi/V8Runtime_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ namespace facebook { namespace v8runtime {
if (message.IsEmpty()) {
// V8 didn't provide any extra information about this error; just
// throw the exception.
std::string errorMessage{ "<Unknown exception>" };
Log(errorMessage, 3 /*LogLevel error*/);
throw jsi::JSError(*this, errorMessage);
throw jsi::JSError(*this, "<Unknown exception>");
}
else {
// Print (filename):(line number): (message).
Expand Down Expand Up @@ -285,9 +283,7 @@ namespace facebook { namespace v8runtime {
sstr << stack_trace_string2 << std::endl;
}

std::string errorMessage{ sstr.str() };
Log(errorMessage, 3 /*LogLevel error*/);
throw jsi::JSError(*this, errorMessage);
throw jsi::JSError(*this, sstr.str());
}
}

Expand Down Expand Up @@ -744,7 +740,7 @@ namespace facebook { namespace v8runtime {
return std::make_unique<V8Runtime>();
}

std::unique_ptr<jsi::Runtime> makeV8Runtime(const folly::dynamic& v8Config, const std::shared_ptr<Logger>& logger) {
return std::make_unique<V8Runtime>(v8Config, logger);
std::unique_ptr<jsi::Runtime> makeV8Runtime(const folly::dynamic& v8Config) {
return std::make_unique<V8Runtime>(v8Config);
}
}} // namespace facebook::v8runtime
}} // namespace facebook::v8runtime
8 changes: 8 additions & 0 deletions glog/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ autom4te.cache
glog-*.tar.gz
packages/rpm-unknown
packages/debian-*
CMakeCache.txt
CMakeFiles/
*.cmake
config.h
*.sln
*.vcxproj
*.filters
bazel-*
2 changes: 2 additions & 0 deletions glog/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

Abhishek Dasgupta <abhi2743@gmail.com>
Abhishek Parmar <abhishek@orng.net>
Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Andy Ying <andy@trailofbits.com>
Brian Silverman <bsilver16384@gmail.com>
Google Inc.
Expand All @@ -20,3 +21,4 @@ romange <romange@users.noreply.github.com>
Sergiu Deitsch <sergiu.deitsch@gmail.com>
tbennun <tbennun@gmail.com>
Teddy Reed <teddy@prosauce.org>
Zhongming Qu <qzmfranklin@gmail.com>
5 changes: 5 additions & 0 deletions glog/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
licenses(['notice'])

load(':bazel/glog.bzl', 'glog_library')

glog_library()
Loading