Skip to content
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

fix(ios): build failure when using custom native marks #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 0 additions & 16 deletions packages/react-native-performance/ios/RNPerformance.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#import "RNPerformanceEntry.h"
#include <chrono>

static int64_t RNPerformanceGetTimestamp()
{
// Copied from https://github.com/facebook/react-native/blob/main/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm#L25
auto time = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
time.time_since_epoch())
.count();

constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0;

return duration / NANOSECONDS_IN_MILLISECOND;
}

NSString * _Nonnull const RNPerformanceEntryWasAddedNotification = @"RNPerformanceEntryWasAdded";

@interface RNPerformance: NSObject

3 changes: 3 additions & 0 deletions packages/react-native-performance/ios/RNPerformance.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#import "RNPerformance.h"
#import "RNPerformanceEntry.h"
#import "RNPerformanceUtils.h"

NSString *const RNPerformanceEntryWasAddedNotification = @"RNPerformanceEntryWasAdded";

@implementation RNPerformance
{
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
#import <QuartzCore/QuartzCore.h>
#import <React/RCTRootView.h>
#import <React/RCTPerformanceLogger.h>
#import "RNPerformanceUtils.h"

#ifdef RCT_NEW_ARCH_ENABLED
#import <RNPerformanceSpec/RNPerformanceSpec.h>
23 changes: 23 additions & 0 deletions packages/react-native-performance/ios/RNPerformanceUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef RNPerformanceUtils_h
#define RNPerformanceUtils_h

#import <React/RCTDefines.h>

RCT_EXTERN NSString * _Nonnull const RNPerformanceEntryWasAddedNotification;

#include <chrono>

static int64_t RNPerformanceGetTimestamp()
{
// Copied from https://github.com/facebook/react-native/blob/main/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm#L25
auto time = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(
time.time_since_epoch())
.count();

constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0;

return duration / NANOSECONDS_IN_MILLISECOND;
}

#endif /* RNPerformanceUtils_h */