mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-07 19:59:18 +02:00
Interestingly, on my machine, it appears to be after every 5s of idle, not just after the first 5s of idle. We may wish to tweak that. We also instrument the size and speed of IPC as seen from the POV of the parent process, for monitoring purposes. Differential Revision: https://phabricator.services.mozilla.com/D106947
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
|
|
/* 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/. */
|
|
|
|
#ifndef FOGIPC_h__
|
|
#define FOGIPC_h__
|
|
|
|
#include <functional>
|
|
|
|
#include "mozilla/Maybe.h"
|
|
#include "mozilla/MozPromise.h"
|
|
#include "nsTArrayForwardDeclare.h"
|
|
|
|
namespace mozilla {
|
|
namespace ipc {
|
|
class ByteBuf;
|
|
} // namespace ipc
|
|
} // namespace mozilla
|
|
|
|
// This module provides the interface for FOG to communicate between processes.
|
|
|
|
namespace mozilla {
|
|
namespace glean {
|
|
|
|
/**
|
|
* The parent process is asking you to flush your data ASAP.
|
|
*
|
|
* @param aResolver - The function you need to call with the bincoded,
|
|
* serialized payload that the Rust impl hands you.
|
|
*/
|
|
void FlushFOGData(std::function<void(ipc::ByteBuf&&)>&& aResolver);
|
|
|
|
/**
|
|
* Called by FOG on the parent process when it wants to flush all its
|
|
* children's data.
|
|
* @param aResolver - The function that'll be called with the results.
|
|
*/
|
|
void FlushAllChildData(
|
|
std::function<void(nsTArray<ipc::ByteBuf>&&)>&& aResolver);
|
|
|
|
/**
|
|
* A child process has sent you this buf as a treat.
|
|
* @param buf - a bincoded serialized payload that the Rust impl understands.
|
|
*/
|
|
void FOGData(ipc::ByteBuf&& buf);
|
|
|
|
/**
|
|
* Called by FOG on a child process when it wants to send a buf to the parent.
|
|
* @param buf - a bincoded serialized payload that the Rust impl understands.
|
|
*/
|
|
void SendFOGData(ipc::ByteBuf&& buf);
|
|
|
|
/**
|
|
* Called on the parent process to ask all child processes for data,
|
|
* sending it all down into Rust to be used.
|
|
*
|
|
* @returns a Promise that resolves when the data has made it to the parent.
|
|
*/
|
|
RefPtr<GenericPromise> FlushAndUseFOGData();
|
|
|
|
} // namespace glean
|
|
} // namespace mozilla
|
|
|
|
#endif // FOGIPC_h__
|