Fabric: Adding some logs to Scheduler, UIManager and co

Summary:
We hope that will help us to understand more.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18599164

fbshipit-source-id: 431f83de707fc7113e04abd3dd5b59ee5c9cc675
This commit is contained in:
Valentin Shergin
2019-11-21 16:21:25 -08:00
committed by Facebook Github Bot
parent 6dcd0de96c
commit be324ca2dc
5 changed files with 26 additions and 0 deletions
@@ -102,6 +102,9 @@ void Binding::startSurfaceWithConstraints(
jfloat maxHeight) {
SystraceSection s("FabricUIManagerBinding::startSurfaceWithConstraints");
LOG(WARNING) << "Binding::startSurfaceWithConstraints() was called (address: "
<< this << ", surfaceId: " << surfaceId << ").";
std::shared_ptr<Scheduler> scheduler = getScheduler();
if (!scheduler) {
LOG(ERROR) << "Binding::startSurfaceWithConstraints: scheduler disappeared";
@@ -145,6 +148,9 @@ void Binding::renderTemplateToSurface(jint surfaceId, jstring uiTemplate) {
void Binding::stopSurface(jint surfaceId) {
SystraceSection s("FabricUIManagerBinding::stopSurface");
LOG(WARNING) << "Binding::stopSurface() was called (address: " << this
<< ", surfaceId: " << surfaceId << ").";
std::shared_ptr<Scheduler> scheduler = getScheduler();
if (!scheduler) {
LOG(ERROR) << "Binding::stopSurface: scheduler disappeared";
@@ -191,6 +197,9 @@ void Binding::installFabricUIManager(
jni::alias_ref<jobject> reactNativeConfig) {
SystraceSection s("FabricUIManagerBinding::installFabricUIManager");
LOG(WARNING) << "Binding::installFabricUIManager() was called (address: "
<< this << ").";
// Use std::lock and std::adopt_lock to prevent deadlocks by locking mutexes at the same time
std::lock(schedulerMutex_, javaUIManagerMutex_);
std::lock_guard<std::mutex> schedulerLock(schedulerMutex_, std::adopt_lock);
@@ -252,6 +261,8 @@ void Binding::installFabricUIManager(
}
void Binding::uninstallFabricUIManager() {
LOG(WARNING) << "Binding::uninstallFabricUIManager() was called (address: "
<< this << ").";
// Use std::lock and std::adopt_lock to prevent deadlocks by locking mutexes at the same time
std::lock(schedulerMutex_, javaUIManagerMutex_);
std::lock_guard<std::mutex> schedulerLock(schedulerMutex_, std::adopt_lock);