summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/ipc/FOGIPC.h
blob: 1b19f355e77b1bd459ddebbdd0bdc803c15447a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* -*- 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 "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(const 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);

}  // namespace glean
}  // namespace mozilla

#endif  // FOGIPC_h__