The shutdown procedure for socket classes ensures that the I/O class is
deleted independently from its socket class. If the socket class has been
deleted, no I/O is performed and no socket events are forwarded. The I/O
class therefore doesn't require a strong reference to its socket class.
This patch removes the remaining ref-counted pointers from the socket I/O
classes. The socket class clears the weak reference in its socket I/O class
when closing the socket.
The bulk of this commit was generated by running:
run-clang-tidy.py \
-checks='-*,llvm-namespace-comment' \
-header-filter=^/.../mozilla-central/.* \
-fix
Dispatching events via |nsIThread| doesn't work with worker threads. This
patch replaces all uses of |nsIThread| in the socket code by equivalent
uses of |MessageLoop|.
The socket IPC interfaces still use 'main thread' in a number of
places. This patch changes all such interfaces and documentation
to speak of 'consumer thread' instead.
The consumer thread handles socket creation, destruction, and
data processing for socket IPC. Traditionally this has been
done on the main thread.
This patch extends the socket IPC classes to support arbitrary
consumer threads. The thread is configured when establishing a
connection, and performs all of the above operations until the
socket is closed.
The I/O thread sends and receives data on a file descriptor. This
has traditionally been performed on a single I/O thread.
This patch extends the socket IPC classes to support arbitrary I/O
threads. The thread is configured when a connection is established
and used until the socket gets closed.
The method |BluetoothSocket::Disconnect| is just a wrapper around
|Close|. This patch replaces all invocations of |Disconnect| with
|Close| and removes the method.
Both types, |union sockaddr_any| and |struct sockaddr_storage|, provide
a sockaddr type that can hold any address. The latter is standardized by
POSIX, so we prefer it.
The new method |UnixSocketConnector::Duplicate| allows a socket
connector to duplicate itself. Listening sockets will used this
feature to create socket connectors for accepted connections.
This patch converts the socket I/O classes to use the new interface
of the socket-connector classes. All sockets are now created and set
up by a socket connector.
This patch removes |DispatchBluetoothReply|. The only remaining user
is |BluetoothDBusService|, but it comes with its own implemenation of
the function.
This patch moves the code for setting socket flags in the socket I/O
classes to the few locations were sockets are created. Any other socket
setup is redundant and has been removed.
Both implementations mostly differ in coding style and correctness
fixes. The last remaining differences are related to different
interfaces in Bluetooth v1 and v2.
This patch cleans up the inherited methods of BlueZ's |BluetooothSocket|.
Methods of the same base class are grouped within the file, and each
method is labeled with 'override'.
This patch removes the template parameters from
|SocketIORequestClosingRunnable| and moves its methods into
the C++ source file. All users have been adapted.