Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Replaced ReactMarker::logTaggedMarker() with JReactMarker::logPerfMar…
Browse files Browse the repository at this point in the history
…ker to fix events logging
  • Loading branch information
Leandro Mazzuquini committed Mar 6, 2019
1 parent 41577ec commit b1ccb00
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
3 changes: 1 addition & 2 deletions ReactAndroid/src/main/jni/react/jni/JReactMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ class JReactMarker : public facebook::jni::JavaClass<JReactMarker> {
public:
static constexpr auto kJavaDescriptor = "Lcom/facebook/react/bridge/ReactMarker;";
static void setLogPerfMarkerIfNeeded();

private:
static void logMarker(const std::string& marker);
static void logMarker(const std::string& marker, const std::string& tag);
static void logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char* tag);

};

}
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jsiexecutor/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_CFLAGS := -fexceptions -frtti -O3

LOCAL_STATIC_LIBRARIES := libjsi reactnative
LOCAL_SHARED_LIBRARIES := libfolly_json glog
LOCAL_SHARED_LIBRARIES := libfolly_json glog libreactnativejni

include $(BUILD_STATIC_LIBRARY)
23 changes: 11 additions & 12 deletions ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cxxreact/JSBigString.h>
#include <cxxreact/ModuleRegistry.h>
#include <cxxreact/ReactMarker.h>
#include <react/jni/JReactMarker.h>
#include <cxxreact/SystraceSection.h>
#include <folly/Conv.h>
#include <folly/json.h>
Expand Down Expand Up @@ -162,20 +163,18 @@ void JSIExecutor::loadApplicationScript(
runtimeInstaller_(*runtime_);
}

bool hasLogger(ReactMarker::logTaggedMarker);
std::string scriptName = simpleBasename(sourceURL);
if (hasLogger) {
ReactMarker::logTaggedMarker(
ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
}

JReactMarker::logPerfMarker(
ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());

runtime_->evaluateJavaScript(
std::make_unique<BigStringBuffer>(std::move(script)), sourceURL);
flush();
if (hasLogger) {
ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP);
ReactMarker::logTaggedMarker(
ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
}

JReactMarker::logPerfMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP, nullptr);
JReactMarker::logPerfMarker(
ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
}

void JSIExecutor::setBundleRegistry(std::unique_ptr<RAMBundleRegistry> r) {
Expand All @@ -200,7 +199,7 @@ void JSIExecutor::registerBundle(
uint32_t bundleId,
const std::string& bundlePath) {
const auto tag = folly::to<std::string>(bundleId);
ReactMarker::logTaggedMarker(
JReactMarker::logPerfMarker(
ReactMarker::REGISTER_JS_SEGMENT_START, tag.c_str());
if (bundleRegistry_) {
bundleRegistry_->registerBundle(bundleId, bundlePath);
Expand All @@ -210,7 +209,7 @@ void JSIExecutor::registerBundle(
std::make_unique<BigStringBuffer>(std::move(script)),
JSExecutor::getSyntheticBundlePath(bundleId, bundlePath));
}
ReactMarker::logTaggedMarker(
JReactMarker::logPerfMarker(
ReactMarker::REGISTER_JS_SEGMENT_STOP, tag.c_str());
}

Expand Down
16 changes: 7 additions & 9 deletions ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <string>

#include <react/jni/JReactMarker.h>

using namespace facebook::jsi;

namespace facebook {
Expand Down Expand Up @@ -52,11 +54,9 @@ void JSINativeModules::reset() {
folly::Optional<Object> JSINativeModules::createModule(
Runtime& rt,
const std::string& name) {
bool hasLogger(ReactMarker::logTaggedMarker);
if (hasLogger) {
ReactMarker::logTaggedMarker(
ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str());
}

JReactMarker::logPerfMarker(
ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str());

if (!m_genNativeModuleJS) {
m_genNativeModuleJS =
Expand All @@ -77,10 +77,8 @@ folly::Optional<Object> JSINativeModules::createModule(
folly::Optional<Object> module(
moduleInfo.asObject(rt).getPropertyAsObject(rt, "module"));

if (hasLogger) {
ReactMarker::logTaggedMarker(
ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str());
}
JReactMarker::logPerfMarker(
ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str());

return module;
}
Expand Down

0 comments on commit b1ccb00

Please sign in to comment.