Home / File/ ProfilerStore.js — react Source File

ProfilerStore.js — react Source File

Architecture documentation for ProfilerStore.js, a javascript file in the react codebase. 8 imports, 2 dependents.

File javascript BabelCompiler Validation 8 imports 2 dependents 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  85373914_42ee_ed07_c5b1_5dac4e356a82["ProfilerStore.js"]
  141645a3_e6e3_7211_4514_81e079648b8c["events.js"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> 141645a3_e6e3_7211_4514_81e079648b8c
  0f941e70_3fdb_aa42_7939_2878d5d4125b["utils.js"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> 0f941e70_3fdb_aa42_7939_2878d5d4125b
  af7aba1b_57c5_9030_4011_bcfaa9c37e21["ProfilingCache.js"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> af7aba1b_57c5_9030_4011_bcfaa9c37e21
  bba85af0_a356_d0c5_4d12_914508b89593["store.js"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> bba85af0_a356_d0c5_4d12_914508b89593
  98e7cbed_f4b4_9f35_838e_6e7cf3e5edcf["types.js"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> 98e7cbed_f4b4_9f35_838e_6e7cf3e5edcf
  2b832bf7_5b5b_7f08_2faa_1e7c8d8acc6d["Logger"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> 2b832bf7_5b5b_7f08_2faa_1e7c8d8acc6d
  4077b620_5c59_61c2_0910_273f565da757["bridge"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> 4077b620_5c59_61c2_0910_273f565da757
  40bf6909_04ae_bfb6_965f_14cfe98b94de["types"]
  85373914_42ee_ed07_c5b1_5dac4e356a82 --> 40bf6909_04ae_bfb6_965f_14cfe98b94de
  af7aba1b_57c5_9030_4011_bcfaa9c37e21["ProfilingCache.js"]
  af7aba1b_57c5_9030_4011_bcfaa9c37e21 --> 85373914_42ee_ed07_c5b1_5dac4e356a82
  bba85af0_a356_d0c5_4d12_914508b89593["store.js"]
  bba85af0_a356_d0c5_4d12_914508b89593 --> 85373914_42ee_ed07_c5b1_5dac4e356a82
  style 85373914_42ee_ed07_c5b1_5dac4e356a82 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * 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.
 *
 * @flow
 */

import EventEmitter from '../events';
import {prepareProfilingDataFrontendFromBackendAndStore} from './views/Profiler/utils';
import ProfilingCache from './ProfilingCache';
import Store from './store';
import {logEvent} from 'react-devtools-shared/src/Logger';

import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type {ProfilingDataBackend} from 'react-devtools-shared/src/backend/types';
import type {
  CommitDataFrontend,
  ProfilingDataForRootFrontend,
  ProfilingDataFrontend,
  SnapshotNode,
} from './views/Profiler/types';

export default class ProfilerStore extends EventEmitter<{
  isProcessingData: [],
  isProfiling: [],
  profilingData: [],
}> {
  _bridge: FrontendBridge;

  // Suspense cache for lazily calculating derived profiling data.
  _cache: ProfilingCache;

  // Temporary store of profiling data from the backend renderer(s).
  // This data will be converted to the ProfilingDataFrontend format after being collected from all renderers.
  _dataBackends: Array<ProfilingDataBackend> = [];

  // Data from the most recently completed profiling session,
  // or data that has been imported from a previously exported session.
  // This object contains all necessary data to drive the Profiler UI interface,
  // even though some of it is lazily parsed/derived via the ProfilingCache.
  _dataFrontend: ProfilingDataFrontend | null = null;

  // Snapshot of all attached renderer IDs.
  // Once profiling is finished, this snapshot will be used to query renderers for profiling data.
  //
  // This map is initialized when profiling starts and updated when a new root is added while profiling;
  // Upon completion, it is converted into the exportable ProfilingDataFrontend format.
  _initialRendererIDs: Set<number> = new Set();

  // Snapshot of the state of the main Store (including all roots) when profiling started.
  // Once profiling is finished, this snapshot can be used along with "operations" messages emitted during profiling,
  // to reconstruct the state of each root for each commit.
  // It's okay to use a single root to store this information because node IDs are unique across all roots.
  //
  // This map is initialized when profiling starts and updated when a new root is added while profiling;
  // Upon completion, it is converted into the exportable ProfilingDataFrontend format.
  _initialSnapshotsByRootID: Map<number, Map<number, SnapshotNode>> = new Map();

// ... (322 more lines)

Domain

Subdomains

Functions

Classes

Frequently Asked Questions

What does ProfilerStore.js do?
ProfilerStore.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ProfilerStore.js?
ProfilerStore.js defines 1 function(s): elementID.
What does ProfilerStore.js depend on?
ProfilerStore.js imports 8 module(s): Logger, ProfilingCache.js, bridge, events.js, store.js, types, types.js, utils.js.
What files import ProfilerStore.js?
ProfilerStore.js is imported by 2 file(s): ProfilingCache.js, store.js.
Where is ProfilerStore.js in the architecture?
ProfilerStore.js is located at packages/react-devtools-shared/src/devtools/ProfilerStore.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free