Revert D5939688: [hermes][rn] Share logPerfMarker with hermes
Differential Revision: D5939688 fbshipit-source-id: 37daeeaa01144472c26383106c88dd49bb99a37b
This commit is contained in:
parent
3826c14c04
commit
e60a2d0a53
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "JSCPerfLogging.h"
|
||||
#include "JSLogging.h"
|
||||
#include "ReactMarker.h"
|
||||
|
||||
using namespace facebook::jni;
|
||||
|
||||
|
@ -22,6 +21,53 @@ namespace react {
|
|||
|
||||
namespace {
|
||||
|
||||
class JReactMarker : public JavaClass<JReactMarker> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/react/bridge/ReactMarker;";
|
||||
|
||||
static void logMarker(const std::string& marker) {
|
||||
static auto cls = javaClassStatic();
|
||||
static auto meth = cls->getStaticMethod<void(std::string)>("logMarker");
|
||||
meth(cls, marker);
|
||||
}
|
||||
|
||||
static void logMarker(const std::string& marker, const std::string& tag) {
|
||||
static auto cls = javaClassStatic();
|
||||
static auto meth = cls->getStaticMethod<void(std::string, std::string)>("logMarker");
|
||||
meth(cls, marker, tag);
|
||||
}
|
||||
};
|
||||
|
||||
void logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char* tag) {
|
||||
switch (markerId) {
|
||||
case ReactMarker::RUN_JS_BUNDLE_START:
|
||||
JReactMarker::logMarker("RUN_JS_BUNDLE_START", tag);
|
||||
break;
|
||||
case ReactMarker::RUN_JS_BUNDLE_STOP:
|
||||
JReactMarker::logMarker("RUN_JS_BUNDLE_END", tag);
|
||||
break;
|
||||
case ReactMarker::CREATE_REACT_CONTEXT_STOP:
|
||||
JReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
|
||||
break;
|
||||
case ReactMarker::JS_BUNDLE_STRING_CONVERT_START:
|
||||
JReactMarker::logMarker("loadApplicationScript_startStringConvert");
|
||||
break;
|
||||
case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP:
|
||||
JReactMarker::logMarker("loadApplicationScript_endStringConvert");
|
||||
break;
|
||||
case ReactMarker::NATIVE_MODULE_SETUP_START:
|
||||
JReactMarker::logMarker("NATIVE_MODULE_SETUP_START", tag);
|
||||
break;
|
||||
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
|
||||
JReactMarker::logMarker("NATIVE_MODULE_SETUP_END", tag);
|
||||
break;
|
||||
case ReactMarker::NATIVE_REQUIRE_START:
|
||||
case ReactMarker::NATIVE_REQUIRE_STOP:
|
||||
// These are not used on Android.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ExceptionHandling::ExtractedEror extractJniError(const std::exception& ex, const char *context) {
|
||||
auto jniEx = dynamic_cast<const jni::JniException *>(&ex);
|
||||
if (!jniEx) {
|
||||
|
@ -80,7 +126,7 @@ namespace detail {
|
|||
|
||||
void injectJSCExecutorAndroidPlatform() {
|
||||
// Inject some behavior into react/
|
||||
JReactMarker::setLogPerfMarkerIfNeeded();
|
||||
ReactMarker::logTaggedMarker = logPerfMarker;
|
||||
ExceptionHandling::platformErrorExtractor = extractJniError;
|
||||
JSCNativeHooks::loggingHook = nativeLoggingHook;
|
||||
JSCNativeHooks::nowHook = nativePerformanceNow;
|
||||
|
|
|
@ -13,7 +13,6 @@ EXPORTED_HEADERS = [
|
|||
"NativeArray.h",
|
||||
"NativeCommon.h",
|
||||
"NativeMap.h",
|
||||
"ReactMarker.h",
|
||||
"ReadableNativeArray.h",
|
||||
"ReadableNativeMap.h",
|
||||
"WritableNativeArray.h",
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#include "ReactMarker.h"
|
||||
#include <mutex>
|
||||
#include <cxxreact/Platform.h>
|
||||
#include <jschelpers/JSCHelpers.h>
|
||||
#include <fb/fbjni.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
void JReactMarker::setLogPerfMarkerIfNeeded() {
|
||||
static std::once_flag flag {};
|
||||
std::call_once(flag, [](){
|
||||
ReactMarker::logTaggedMarker = JReactMarker::logPerfMarker;
|
||||
});
|
||||
}
|
||||
|
||||
void JReactMarker::logMarker(const std::string& marker) {
|
||||
static auto cls = javaClassStatic();
|
||||
static auto meth = cls->getStaticMethod<void(std::string)>("logMarker");
|
||||
meth(cls, marker);
|
||||
}
|
||||
|
||||
void JReactMarker::logMarker(const std::string& marker, const std::string& tag) {
|
||||
static auto cls = javaClassStatic();
|
||||
static auto meth = cls->getStaticMethod<void(std::string, std::string)>("logMarker");
|
||||
meth(cls, marker, tag);
|
||||
}
|
||||
|
||||
void JReactMarker::logPerfMarker(const ReactMarker::ReactMarkerId markerId, const char* tag) {
|
||||
switch (markerId) {
|
||||
case ReactMarker::RUN_JS_BUNDLE_START:
|
||||
JReactMarker::logMarker("RUN_JS_BUNDLE_START", tag);
|
||||
break;
|
||||
case ReactMarker::RUN_JS_BUNDLE_STOP:
|
||||
JReactMarker::logMarker("RUN_JS_BUNDLE_END", tag);
|
||||
break;
|
||||
case ReactMarker::CREATE_REACT_CONTEXT_STOP:
|
||||
JReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
|
||||
break;
|
||||
case ReactMarker::JS_BUNDLE_STRING_CONVERT_START:
|
||||
JReactMarker::logMarker("loadApplicationScript_startStringConvert");
|
||||
break;
|
||||
case ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP:
|
||||
JReactMarker::logMarker("loadApplicationScript_endStringConvert");
|
||||
break;
|
||||
case ReactMarker::NATIVE_MODULE_SETUP_START:
|
||||
JReactMarker::logMarker("NATIVE_MODULE_SETUP_START", tag);
|
||||
break;
|
||||
case ReactMarker::NATIVE_MODULE_SETUP_STOP:
|
||||
JReactMarker::logMarker("NATIVE_MODULE_SETUP_END", tag);
|
||||
break;
|
||||
case ReactMarker::NATIVE_REQUIRE_START:
|
||||
case ReactMarker::NATIVE_REQUIRE_STOP:
|
||||
// These are not used on Android.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <fb/fbjni.h>
|
||||
#include <cxxreact/Platform.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue