Skip to content

Commit aac583b

Browse files
coadofacebook-github-bot
authored andcommitted
Make select jsinspector implementation headers private (#58943)
Summary: Mark the following `jsinspector-modern` headers as private instead of for-frameworks. All of them are implementation details of the inspector, and no for-frameworks header includes them: - `ConsoleTask`, `ConsoleTaskContext` and `ConsoleTaskOrchestrator` implement `console.createTask()`: the task object, the context that captures the stack trace when a task is created, and the singleton that tracks which task is currently running. They are only used by the inspector's console sources, a console test, and `PerformanceEntryReporter.cpp`, which reads the current task from the orchestrator. - `EmulationAgent` handles the CDP `Emulation` domain. It is only used by `EmulationAgent.cpp` and `HostAgent.cpp`. - `FallbackRuntimeAgentDelegate` answers CDP requests for a JavaScript runtime that does not support debugging. It is only used by `FallbackRuntimeAgentDelegate.cpp` and `FallbackRuntimeTargetDelegate.cpp`. `FallbackRuntimeTargetDelegate.h`, which creates it, stays for-frameworks. - `InspectorPackagerConnectionImpl.h` defines `InspectorPackagerConnection::Impl`, the hidden implementation of the inspector-proxy protocol. `InspectorPackagerConnection.h` only forward-declares it, and it is only used by `InspectorPackagerConnection.cpp`. `InspectorPackagerConnection.h` and `WebSocketInterfaces.h` stay for-frameworks, because each platform implements `InspectorPackagerConnectionDelegate`. - `RuntimeTargetGlobalStateObserver` installs a JavaScript global that reports a boolean state, such as whether a debugger session is active, and notifies its subscribers when the state changes. `RuntimeTargetTracingStateObserver` uses it to report whether tracing is active. Both are only used by the `RuntimeTarget` sources and their own sources. - `Utf8.h` provides `truncateToValidUTF8`, which trims a byte buffer so it does not end in the middle of a UTF-8 code point when `IO.read` slices a network resource. It is only used by `NetworkIOAgent.cpp` and its own unit test. - `ExecutionContextManager` allocates execution context IDs. It is only created by `HostTarget.cpp` and used by `InstanceTarget.cpp`. `HostTarget.h` and `InstanceTarget.h` only hold it through `std::shared_ptr`, so they now forward-declare it instead of including the header, and the two sources include it directly. React Native's own targets define `RN_BUILDING`, so the private guard does not affect them. Changelog: [Internal] Differential Revision: D123009197
1 parent 8d067a5 commit aac583b

17 files changed

Lines changed: 14 additions & 270 deletions

‎packages/react-native/ReactCommon/jsinspector-modern/ConsoleTask.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include <memory>
1313

‎packages/react-native/ReactCommon/jsinspector-modern/ConsoleTaskContext.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include "StackTrace.h"
1313

‎packages/react-native/ReactCommon/jsinspector-modern/ConsoleTaskOrchestrator.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include <memory>
1313
#include <mutex>

‎packages/react-native/ReactCommon/jsinspector-modern/EmulationAgent.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include "HostTarget.h"
1313
#include "InspectorInterfaces.h"

‎packages/react-native/ReactCommon/jsinspector-modern/ExecutionContextManager.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include <cinttypes>
1313

‎packages/react-native/ReactCommon/jsinspector-modern/FallbackRuntimeAgentDelegate.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include "SessionState.h"
1313

‎packages/react-native/ReactCommon/jsinspector-modern/HostTarget.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "HostTarget.h"
9+
#include "ExecutionContextManager.h"
910
#include "HostAgent.h"
1011
#include "HostTargetTraceRecording.h"
1112
#include "HostTargetTracing.h"

‎packages/react-native/ReactCommon/jsinspector-modern/HostTarget.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

12-
#include "ExecutionContextManager.h"
1312
#include "HostCommand.h"
1413
#include "InspectorInterfaces.h"
1514
#include "InstanceTarget.h"
@@ -44,6 +43,7 @@
4443

4544
namespace facebook::react::jsinspector_modern {
4645

46+
class ExecutionContextManager;
4747
class HostTargetSession;
4848
class HostAgent;
4949
class HostTracingAgent;

‎packages/react-native/ReactCommon/jsinspector-modern/InspectorPackagerConnectionImpl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/FrameworksGuard.h>
10+
#include <react/cxxstableapi/PrivateGuard.h>
1111

1212
#include "InspectorInterfaces.h"
1313
#include "InspectorPackagerConnection.h"

‎packages/react-native/ReactCommon/jsinspector-modern/InstanceTarget.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
#include "ExecutionContextManager.h"
89
#include "InstanceAgent.h"
910
#include "SessionState.h"
1011

0 commit comments

Comments
 (0)