This patch cleans up the inherited methods of |ListenSocket|. Methods
of the same base class are grouped within the file, and each method is
labeled with 'override'.
This patch cleans up the inherited methods of |StreamSocket|. Methods
of the same base class are grouped within the file, and each method
is labeled with 'override'.
This patch integrates |ConnectionOrientedSocket| into the hierarchy
of socket I/O classes. In future patches, the class can provide
common interfaces and functionality for all connection-oriented
sockets.
With the current code, the Bluetooth result runnable is saved for
receiving before a command has been sent successfully. If sending
fails afterwards, the saved result runnable will still sit in the
result queue, and interfere with later, successful commands.
With this patch, the result runnable is saved only if the sending
was successful.
This patch removes the template parameters from
|SocketIODeleteInstanceRunnable| and moves its methods into the
C++ source file. All users have been adapted.
This patch removes the template parameters from
|SocketIORequestClosingRunnable| and moves its methods into
the C++ source file. All users have been adapted.
|ReceiveSocketData| receives socket data on the main thread. This
is a specific detail of the current socket classes, which should not
be required by future implementations.
This patch moves the receive method and the corresponding runnable
into socket classes.
This patch moves management of received socket I/O buffers from
|DataSocketIO| into the I/O classes. Each I/O class is responsible
for (de-)allocating buffers, and consuming them once data has been
received.
All current I/O classes forward their buffers to the main thread,
but other operations are possible. For example, received data can
be parsed and processed directly in the I/O thread.
This patch renames |SocketConsumerBase| to |DataSocket|, and for the
I/O classes |SocketConsumerIO| to |DataSocketIO|. |DataSocketIO| also
contains send and receive functionality from |SocketBaseIO|.
|DataSocket| is a virtual base class that represents a socket that
transfers data, without a particular constraints to what the data
represents. |DataSocketIO| is the corresponding helper class on the
I/O thread.
Coverity was complaining that we have things like:
if ((!(actor))) {
return false;
}
if ((!(actor))) {
return false;
}
in the generated code, as the second return will clearly never be hit. To
address this, let's remove a redundant call to dtorPrologue.
This patch moves memory management of |UnixSocketIOBuffer| into
|UnixSocketBuffer| and extends |UnixSocketIOBuffer| with send and
receive interfaces. The class is now the base for all socket-buffer
classes, such as |UnixSocketRawData| and |BluetoothDaemonPDU|.
PFoo::Transition currently looks something like:
bool
Transition(
State from,
mozilla::ipc::Trigger trigger,
State* next)
{
switch (from) {
...
default:
NS_RUNTIMEABORT("corrupted actor state");
return false;
}
(*(next)) = __Error;
return false;
}
Coverity complains that the assignment (*(next)) = __Error will never be
reached, and rightfully so. We can remove this fallthrough block when
there are no states declared in the individual protocol.
Loosely based on Chromium git commit 86c3d9ef4fdf, but redone to insert a
sched_yield(), because treating EMSGSIZE as if it were EAGAIN/EWOULDBLOCK
is (as the Chromium developers note) likely to act as a busy-wait for the
receiver to make progress.
This means that B2G plugin-container must (dynamically) link against
libmozsandbox in order to call into it before initializing Binder.
(Desktop Linux plugin-container already contains the sandbox code.)