/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCommon/jsinspector-modern/InspectorUtilities.cpp
47 строк
1 KB
Alex Hunt
Implement local connection for perf metrics in HostTarget (#52838)
07 авг 2025, 02:05
07 авг 2025, 02:05
2768c84
Код
Авторство
О чём код?
/* * 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. */ #include "InspectorUtilities.h" #include <cassert> namespace facebook::react::jsinspector_modern { CallbackLocalConnection::CallbackLocalConnection( std::function<void(std::string)> handler) : handler_(std::move(handler)) {} void CallbackLocalConnection::sendMessage(std::string message) { assert(handler_ && "Handler has been disconnected"); handler_(std::move(message)); } void CallbackLocalConnection::disconnect() { handler_ = nullptr; } CallbackRemoteConnection::CallbackRemoteConnection( std::function<void(std::string)> handler) : handler_(std::move(handler)) {} void CallbackRemoteConnection::onMessage(std::string message) { handler_(std::move(message)); } RAIIRemoteConnection::RAIIRemoteConnection( std::unique_ptr<IRemoteConnection> remote) : remote_(std::move(remote)) {} void RAIIRemoteConnection::onMessage(std::string message) { remote_->onMessage(std::move(message)); } RAIIRemoteConnection::~RAIIRemoteConnection() { remote_->onDisconnect(); } } // namespace facebook::react::jsinspector_modern