19 #ifndef MIR_CLIENT_RPC_MIR_PROTOBUF_RPC_CHANNEL_H_
20 #define MIR_CLIENT_RPC_MIR_PROTOBUF_RPC_CHANNEL_H_
28 #include "../lifecycle_control.h"
29 #include "../ping_handler.h"
33 #include <experimental/optional>
40 class DisplayConfiguration;
55 std::shared_ptr<SurfaceMap>
const& surface_map,
56 std::shared_ptr<DisplayConfiguration>
const& disp_config,
57 std::shared_ptr<RpcReport>
const& rpc_report,
58 std::shared_ptr<LifecycleControl>
const& lifecycle_control,
59 std::shared_ptr<PingHandler>
const& ping_handler,
60 std::shared_ptr<EventSink>
const& event_sink);
89 google::protobuf::MessageLite
const* parameters,
90 google::protobuf::MessageLite* response,
91 google::protobuf::Closure* complete)
override;
94 std::shared_ptr<RpcReport>
const rpc_report;
97 static constexpr
size_t size_of_header = 2;
101 void receive_file_descriptors(google::protobuf::MessageLite* response);
102 template<
class MessageType>
103 void receive_any_file_descriptors_for(MessageType* response);
104 void send_message(mir::protobuf::wire::Invocation
const& body,
105 mir::protobuf::wire::Invocation
const& invocation,
106 std::vector<mir::Fd>& fds);
109 void process_event_sequence(
std::string const& event);
111 void notify_disconnected();
113 std::shared_ptr<SurfaceMap> surface_map;
114 std::shared_ptr<DisplayConfiguration> display_configuration;
115 std::shared_ptr<LifecycleControl> lifecycle_control;
116 std::shared_ptr<PingHandler>
const ping_handler;
117 std::shared_ptr<EventSink> event_sink;
118 std::atomic<bool> disconnected;
119 std::mutex read_mutex;
120 std::mutex write_mutex;
122 bool prioritise_next_request{
false};
123 std::experimental::optional<uint32_t> id_to_wait_for;
135 std::shared_ptr<StreamTransport>
const transport;
136 std::shared_ptr<mir::dispatch::ActionQueue>
const delayed_processor;
All things Mir.
Definition: atomic_callback.h:25
MirProtobufRpcChannel(std::unique_ptr< StreamTransport > transport, std::shared_ptr< SurfaceMap > const &surface_map, std::shared_ptr< DisplayConfiguration > const &disp_config, std::shared_ptr< RpcReport > const &rpc_report, std::shared_ptr< LifecycleControl > const &lifecycle_control, std::shared_ptr< PingHandler > const &ping_handler, std::shared_ptr< EventSink > const &event_sink)
Definition: mir_protobuf_rpc_channel.cpp:50
void on_disconnected() override
Called by the Transport when the connection to the server has been broken.
Definition: mir_protobuf_rpc_channel.cpp:422
void process_next_request_first()
Switch the RpcChannel into out-of-order mode.
Definition: mir_protobuf_rpc_channel.cpp:442
~MirProtobufRpcChannel()=default
Definition: mir_basic_rpc_channel.h:59
void call_method(std::string const &method_name, google::protobuf::MessageLite const *parameters, google::protobuf::MessageLite *response, google::protobuf::Closure *complete) override
Definition: mir_protobuf_rpc_channel.cpp:176
mir::dispatch::FdEvents relevant_events() const override
The set of file-descriptor events this Dispatchable handles.
Definition: mir_protobuf_rpc_channel.cpp:437
Definition: mir_basic_rpc_channel.h:100
bool dispatch(mir::dispatch::FdEvents events) override
Dispatch one pending event.
Definition: mir_protobuf_rpc_channel.cpp:432
An adaptor that combines multiple Dispatchables into a single Dispatchable.
Definition: multiplexing_dispatchable.h:52
std::vector< uint8_t > SendBuffer
Definition: mir_basic_rpc_channel.h:57
Fd watch_fd() const override
Get a poll()able file descriptor.
Definition: mir_protobuf_rpc_channel.cpp:427
Definition: dispatchable.h:38
Definition: mir_protobuf_rpc_channel.h:48
uint32_t FdEvents
Definition: dispatchable.h:36
void on_data_available() override
Called by the Transport when data is available for reading.
Definition: mir_protobuf_rpc_channel.cpp:342
Observer of IO status.
Definition: stream_transport.h:87