forked from krockot/ipcz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasync_reference_driver.h
More file actions
40 lines (30 loc) · 1.43 KB
/
async_reference_driver.h
File metadata and controls
40 lines (30 loc) · 1.43 KB
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
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IPCZ_SRC_DRIVERS_ASYNC_REFERENCE_DRIVER_H_
#define IPCZ_SRC_DRIVERS_ASYNC_REFERENCE_DRIVER_H_
#include <utility>
#include "ipcz/ipcz.h"
namespace ipcz::reference_drivers {
// An async driver for single-process tests. Each transport runs its own thread
// with a simple task queue. Transmission from a transport posts a task to its
// peer's queue. The resulting non-determinism effectively simulates a typical
// production driver, without the complexity of a multiprocess environment.
extern const IpczDriver kAsyncReferenceDriver;
// Mostly the same as kAsyncReferenceDriver, but rejects direct transmission of
// driver handles between non-broker nodes. This forces ipcz to relay such
// messages through the broker.
extern const IpczDriver kAsyncReferenceDriverWithForcedBrokering;
// Creates a new pair of async transport endpoints, one for a broker and one
// for a non-broker.
struct AsyncTransportPair {
IpczDriverHandle broker;
IpczDriverHandle non_broker;
};
AsyncTransportPair CreateAsyncTransportPair();
// Creates a new pair of async transport endpoints, one for each of two
// different brokers to be connected.
std::pair<IpczDriverHandle, IpczDriverHandle>
CreateAsyncTransportPairForBrokers();
} // namespace ipcz::reference_drivers
#endif // IPCZ_SRC_DRIVERS_ASYNC_REFERENCE_DRIVER_H_