chromium/third_party/ipcz/src/reference_drivers/async_reference_driver.cc

// 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.

#include "reference_drivers/async_reference_driver.h"

#include <cstdint>
#include <memory>
#include <thread>
#include <tuple>
#include <utility>
#include <vector>

#include "ipcz/ipcz.h"
#include "reference_drivers/object.h"
#include "reference_drivers/single_process_reference_driver_base.h"
#include "third_party/abseil-cpp/absl/base/macros.h"
#include "third_party/abseil-cpp/absl/synchronization/mutex.h"
#include "third_party/abseil-cpp/absl/synchronization/notification.h"
#include "third_party/abseil-cpp/absl/types/span.h"
#include "util/ref_counted.h"

namespace ipcz::reference_drivers {

namespace {

// The driver transport implementation for the async reference driver. Each
// AsyncTransport holds a direct reference to its peer, and transmissions are
// tasks posted to the peer's task queue. Task are run on a dedicated background
// thread for each transport.
class AsyncTransport : public ObjectImpl<AsyncTransport, Object::kTransport> {};

IpczResult IPCZ_API CreateTransports(IpczDriverHandle transport0,
                                     IpczDriverHandle transport1,
                                     uint32_t,
                                     const void*,
                                     IpczDriverHandle* new_transport0,
                                     IpczDriverHandle* new_transport1) {}

IpczResult IPCZ_API ActivateTransport(IpczDriverHandle transport,
                                      IpczHandle listener,
                                      IpczTransportActivityHandler handler,
                                      uint32_t,
                                      const void*) {}

IpczResult IPCZ_API DeactivateTransport(IpczDriverHandle transport,
                                        uint32_t,
                                        const void*) {}

IpczResult IPCZ_API Transmit(IpczDriverHandle transport,
                             const void* data,
                             size_t num_bytes,
                             const IpczDriverHandle* handles,
                             size_t num_handles,
                             uint32_t,
                             const void*) {}

IpczResult IPCZ_API SerializeWithForcedBrokering(IpczDriverHandle handle,
                                                 IpczDriverHandle transport,
                                                 uint32_t flags,
                                                 const void* options,
                                                 volatile void* data,
                                                 size_t* num_bytes,
                                                 IpczDriverHandle* handles,
                                                 size_t* num_handles) {}

}  // namespace

// Note that this driver inherits most of its implementation from the baseline
// single-process driver. Only transport operation is overridden here.
const IpczDriver kAsyncReferenceDriver =;

const IpczDriver kAsyncReferenceDriverWithForcedBrokering =;

AsyncTransportPair CreateAsyncTransportPair() {}

std::pair<IpczDriverHandle, IpczDriverHandle>
CreateAsyncTransportPairForBrokers() {}

}  // namespace ipcz::reference_drivers