Files
react-native/ReactCommon/hermes/inspector/detail/Thread.cpp
T
cpojer d7f5153cd8 Add Hermes support to React Native on Android (#25613)
Summary:
Yesterday we shipped hermesengine.dev as part of the current 0.60 release. This PR brings those changes to master.

## Changelog

[General] [Added] - Added support for Hermes
Pull Request resolved: https://github.com/facebook/react-native/pull/25613

Test Plan:
* CI is green both on GitHub and at FB
* Creating a new app from source can use Hermes on Android

Reviewed By: cpojer

Differential Revision: D16221777

Pulled By: willholen

fbshipit-source-id: aa6be10537863039cb666292465ba2e1d44b64ef
2019-07-25 23:05:53 -07:00

35 lines
698 B
C++

// Copyright 2004-present Facebook. All Rights Reserved.
#ifdef __ANDROID__
#include "Thread.h"
#include <fb/fbjni/JThread.h>
namespace facebook {
namespace hermes {
namespace inspector {
namespace detail {
struct Thread::Impl {
facebook::jni::global_ref<facebook::jni::JThread> thread_;
};
Thread::Thread(std::string, std::function<void()> runnable)
: impl_(std::make_unique<Impl>(Impl{facebook::jni::make_global(
facebook::jni::JThread::create(std::move(runnable)))})) {
impl_->thread_->start();
}
Thread::~Thread() {}
void Thread::join() {
impl_->thread_->join();
}
} // namespace detail
} // namespace inspector
} // namespace hermes
} // namespace facebook
#endif