Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  threads.js

  Sprache: JAVA
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */


/**
 * Threads reducer
 * @module reducers/threads
 */


import { sortThreads } from "./sources-tree.js";

const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
  BinarySearch: "resource://gre/modules/BinarySearch.sys.mjs",
});

export function initialThreadsState() {
  return {
    threads: [],

    // List of thread actor IDs which are current tracing.
    // i.e. where JavaScript tracing is enabled.
    mutableTracingThreads: new Set(),
  };
}

export default function update(state = initialThreadsState(), action) {
  switch (action.type) {
    case "INSERT_THREAD": {
      const { newThread } = action;
      if (newThread.isTopLevel) {
        return {
          ...state,
          threads: [newThread, ...state.threads],
        };
      }

      const index = lazy.BinarySearch.insertionIndexOf(
        sortThreads,
        state.threads,
        newThread
      );
      return {
        ...state,
        threads: state.threads.toSpliced(index, 0, newThread),
      };
    }

    case "REMOVE_THREAD":
      return {
        ...state,
        threads: state.threads.filter(
          thread => action.threadActorID != thread.actor
        ),
      };

    case "UPDATE_SERVICE_WORKER_STATUS":
      return {
        ...state,
        threads: state.threads.map(t => {
          if (t.actor == action.thread) {
            return { ...t, serviceWorkerStatus: action.status };
          }
          return t;
        }),
      };

    case "TRACING_TOGGLED":
      const { mutableTracingThreads } = state;
      const sizeBefore = mutableTracingThreads.size;
      if (action.enabled) {
        mutableTracingThreads.add(action.thread);
      } else {
        mutableTracingThreads.delete(action.thread);
      }
      // We may receive toggle events when we change the logging method
      // while we are already tracing, but the list of tracing thread stays the same.
      const changed = mutableTracingThreads.size != sizeBefore;
      if (changed) {
        return {
          ...state,
          mutableTracingThreads,
        };
      }
      return state;

    default:
      return state;
  }
}

Messung V0.5 in Prozent
C=98 H=96 G=96

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik