tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PUtilityProcess.ipdl (4827B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3  * License, v. 2.0. If a copy of the MPL was not distributed with this
      4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 include CrashReporterInitArgs;
      7 include MemoryReportTypes;
      8 include PrefsTypes;
      9 
     10 include protocol PProfiler;
     11 include protocol PUtilityMediaService;
     12 include protocol PJSOracle;
     13 
     14 #if defined(XP_WIN)
     15 include protocol PWindowsUtils;
     16 include protocol PWinFileDialog;
     17 #endif
     18 
     19 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
     20 include protocol PSandboxTesting;
     21 #endif
     22 
     23 include "mozilla/ipc/ByteBufUtils.h";
     24 
     25 include GraphicsMessages;
     26 
     27 using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
     28 
     29 // Telemetry
     30 using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
     31 using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
     32 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
     33 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
     34 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
     35 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
     36 
     37 #if defined(XP_WIN)
     38 [MoveOnly] using mozilla::UntrustedModulesData from "mozilla/UntrustedModulesData.h";
     39 [MoveOnly] using mozilla::ModulePaths from "mozilla/UntrustedModulesData.h";
     40 [MoveOnly] using mozilla::ModulesMapResult from "mozilla/UntrustedModulesData.h";
     41 #endif  // defined(XP_WIN)
     42 
     43 namespace mozilla {
     44 
     45 namespace ipc {
     46 
     47 // This protocol allows the UI process to talk to the Utility process. There is
     48 // one instance of this protocol, with the UtilityProcessParent living on the main thread
     49 // of the main process and the UtilityProcessChild living on the main thread of the Utility
     50 // process.
     51 [NeedsOtherPid, ChildProc=Utility]
     52 protocol PUtilityProcess
     53 {
     54 parent:
     55   async InitCrashReporter(CrashReporterInitArgs aInitArgs);
     56 
     57   async AddMemoryReport(MemoryReport aReport);
     58 
     59   // Sent from time-to-time to limit the amount of telemetry vulnerable to loss
     60   // Buffer contains bincoded Rust structs.
     61   // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
     62   async FOGData(ByteBuf buf);
     63 
     64   async GeckoTraceExport(ByteBuf aBuf);
     65 
     66 #if defined(XP_WIN)
     67   async GetModulesTrust(ModulePaths aModPaths, bool aRunAtNormalPriority)
     68       returns (ModulesMapResult? modMapResult);
     69 #endif  // defined(XP_WIN)
     70 
     71   // Messages for sending telemetry to parent process.
     72   async AccumulateChildHistograms(HistogramAccumulation[] accumulations);
     73   async AccumulateChildKeyedHistograms(KeyedHistogramAccumulation[] accumulations);
     74   async UpdateChildScalars(ScalarAction[] actions);
     75   async UpdateChildKeyedScalars(KeyedScalarAction[] actions);
     76   async RecordChildEvents(ChildEventData[] events);
     77   async RecordDiscardedData(DiscardedData data);
     78 
     79   async InitCompleted();
     80 
     81 child:
     82   async Init(FileDescriptor? sandboxBroker, bool canRecordReleaseTelemetry, bool aIsReadyForBackgroundProcessing);
     83 
     84   async InitProfiler(Endpoint<PProfilerChild> endpoint);
     85 
     86   async RequestMemoryReport(uint32_t generation,
     87                             bool anonymize,
     88                             bool minimizeMemoryUsage,
     89                             FileDescriptor? DMDFile)
     90       returns (uint32_t aGeneration);
     91 
     92   async PreferenceUpdate(Pref pref);
     93 
     94   // Tells the Utility process to flush any pending telemetry.
     95   // Used in tests and ping assembly. Buffer contains bincoded Rust structs.
     96   // https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/ipc.html
     97   async FlushFOGData() returns (ByteBuf buf);
     98 
     99   // Test-only method.
    100   // Asks the Utility process to trigger test-only instrumentation.
    101   // The unused returned value is to have a promise we can await.
    102   async TestTriggerMetrics() returns (bool unused);
    103 
    104   async TestTelemetryProbes();
    105 
    106   async StartUtilityMediaService(Endpoint<PUtilityMediaServiceParent> aEndpoint, GfxVarUpdate[] updates);
    107 
    108   async StartJSOracleService(Endpoint<PJSOracleChild> aEndpoint);
    109 
    110 #if defined(XP_WIN)
    111   async StartWindowsUtilsService(Endpoint<PWindowsUtilsChild> aEndpoint);
    112   async StartWinFileDialogService(Endpoint<PWinFileDialogChild> aEndpoint);
    113 
    114   async GetUntrustedModulesData() returns (UntrustedModulesData? data);
    115 
    116   /**
    117   * This method is used to notify a child process to start
    118   * processing module loading events in UntrustedModulesProcessor.
    119   * This should be called when the parent process has gone idle.
    120   */
    121   async UnblockUntrustedModulesThread();
    122 #endif  // defined(XP_WIN)
    123 
    124 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
    125   async InitSandboxTesting(Endpoint<PSandboxTestingChild> aEndpoint);
    126 #endif
    127 };
    128 
    129 } // namespace ipc
    130 
    131 } // namespace mozilla