mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ea73a66936
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35226 Changelog: [Internal] This adds scaffolding for the C++ side of NativePerformanceObserver module. Thanks to christophpurrer for helping set this up, as this is the first one of this kind inside core/OSS. Reviewed By: rubennorte Differential Revision: D41028555 fbshipit-source-id: 4acf0e71a254a42044cbbe5f94f40938342c6aa2
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <FBReactNativeSpec/FBReactNativeSpecJSI.h>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "NativePerformanceObserver_RawPerformanceEntry.h"
|
|
|
|
namespace facebook::react {
|
|
|
|
class NativePerformanceObserver
|
|
: public NativePerformanceObserverCxxSpec<NativePerformanceObserver>,
|
|
std::enable_shared_from_this<NativePerformanceObserver> {
|
|
public:
|
|
NativePerformanceObserver(std::shared_ptr<CallInvoker> jsInvoker);
|
|
|
|
void startReporting(jsi::Runtime &rt, std::string entryType);
|
|
|
|
void stopReporting(jsi::Runtime &rt, std::string entryType);
|
|
|
|
std::vector<RawPerformanceEntry> getPendingEntries(jsi::Runtime &rt);
|
|
|
|
void setOnPerformanceEntryCallback(
|
|
jsi::Runtime &rt,
|
|
std::optional<AsyncCallback<>> callback);
|
|
|
|
private:
|
|
std::optional<AsyncCallback<>> callback_;
|
|
};
|
|
|
|
} // namespace facebook::react
|