Commit Graph

182 Commits

Author SHA1 Message Date
Thomas Zimmermann
f19339336d Bug 1166638: Use |ListenSocketConsumer| in |ListenSocket|, r=kmachulis, dlee, chucklee, shuang
This patch converts |ListenSocket| to forward events to an instance
of |ListenSocketConsumer|. All users are converted and the related
listener and consumer classes are removed.
2015-05-26 13:24:20 +02:00
Thomas Zimmermann
4e155b5c96 Bug 1166638: Add |ListenSocketConsumer|, r=kmachulis
|ListenSocketConsumer| receives events from a listening socket. It
unifies all existing consumer and listener classes of the socket I/O
users.
2015-05-26 13:24:20 +02:00
Thomas Zimmermann
70111c54d3 Bug 1166638: Use |StreamSocketConsumer| in |StreamSocket|, r=kmachulis, dlee, chucklee, htsai
This patch converts |StreamSocket| to forward events and data to an
instance of |StreamSocketConsumer|. All users are converted and the
related listener and consumer classes are removed.
2015-05-26 13:24:20 +02:00
Thomas Zimmermann
eb0aaf349d Bug 1166638: Add |StreamSocketConsumer|, r=kmachulis
|StreamSocketConsumer| receives events and data from a stream
socket. It unifies all existing consumer and listener classes
of the socket I/O users.
2015-05-26 13:24:19 +02:00
Thomas Zimmermann
5362ed1bf6 Bug 1164417: Add |ConnectionOrientedSocket::PrepareAccept| for accepting socket connections, r=kmachulis
With this patch, stream and listening sockets handle the setup of
accepted sockets internally. Sub-classes of |StreamSocket| don't
have to overload StreamSocket's |GetIO| any longer.
2015-05-21 13:34:37 +02:00
Thomas Zimmermann
25b408e533 Bug 1164417: Add |UnixSocketConnector::Duplicate|, r=kmachulis
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.
2015-05-21 13:34:37 +02:00
Thomas Zimmermann
8fb67a5055 Bug 1164425: Cleanup interfaces of |ListenSocket|, r=kmachulis
This patch removes |ListenSocket::GetSocketAddr|, which is unused
and not thread-safe. The |Listen| methods now return error codes.
2015-05-20 10:50:43 +02:00
Thomas Zimmermann
4ae7a8c07b Bug 1164425: Cleanup interfaces of |StreamSocket|, r=kmachulis
This patch cleans up the interface of |StreamSocket|. All arguments
that contain protocol parameters are removed from |Connect|. They are
stored in the connector class. |Connect| now returns error codes. The
method |GetSocketAddr| is unused and not thread-safe and therefore
removed. The method |SendSocketData| for strings is unused and removed.
2015-05-20 10:50:43 +02:00
Thomas Zimmermann
797b11df18 Bug 1164425: Rename |SocketBase::CloseSocket| to |SocketBase::Close|, r=kmachulis 2015-05-20 10:50:43 +02:00
Carsten "Tomcat" Book
c89b0c098f Backed out changeset 1e93024c9fec (bug 1164425) for bustage 2015-05-20 10:31:55 +02:00
Carsten "Tomcat" Book
e62550b3f7 Backed out changeset 2fd186d1a288 (bug 1164425) 2015-05-20 10:31:09 +02:00
Carsten "Tomcat" Book
70b8a9bab5 Backed out changeset 17bd0777339a (bug 1164425) 2015-05-20 10:30:55 +02:00
Thomas Zimmermann
60a59f574c Bug 1164425: Cleanup interfaces of |ListenSocket|, r=kmachulis
This patch removes |ListenSocket::GetSocketAddr|, which is unused
and not thread-safe. The |Listen| methods now return error codes.
2015-05-20 09:54:27 +02:00
Thomas Zimmermann
f3f2ddd971 Bug 1164425: Cleanup interfaces of |StreamSocket|, r=kmachulis
This patch cleans up the interface of |StreamSocket|. All arguments
that contain protocol parameters are removed from |Connect|. They are
stored in the connector class. |Connect| now returns error codes. The
method |GetSocketAddr| is unused and not thread-safe and therefore
removed. The method |SendSocketData| for strings is unused and removed.
2015-05-20 09:54:27 +02:00
Thomas Zimmermann
8e10928ea3 Bug 1164425: Rename |SocketBase::CloseSocket| to |SocketBase::Close|, r=kmachulis 2015-05-20 09:54:27 +02:00
Thomas Zimmermann
86db93eaf2 Bug 1161020: Remove old interface and implementation from socket-connector classes, r=kmachulis 2015-05-19 13:28:46 +02:00
Thomas Zimmermann
1097a756a3 Bug 1161020: Use new socket-connector interface in socket classes, r=kmachulis
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.
2015-05-19 13:28:46 +02:00
Thomas Zimmermann
7dc01cb0eb Bug 1161020: Added clean interface to |UnixSocketConnector|, r=kmachulis
The current interface of |UnixSocketConnector| doesn't follow any design
and is not easily understandable.

This patch adds a new interface to the class. The new interface provides
a method for each of the following operations:

  * converting an address to a human-readable string,
  * creating a listening socket,
  * creating a stream socket, and
  * accepting a stream socket from a listening socket.

All arguments are stored in the connector class, so that connect and
listen methods of the socket classes don't require protocol-specific
arguments. All socket parameters are set within the connector class,
so each connector class can now select parameters individually.
2015-05-19 13:28:46 +02:00
Carsten "Tomcat" Book
03af28a47e Backed out 8 changesets (bug 1161020) for b2g ics emulator debug mochitest memory leaks on a CLOSED TREE
Backed out changeset 976e19eac8b5 (bug 1161020)
Backed out changeset 4f782be31f87 (bug 1161020)
Backed out changeset 384de663084c (bug 1161020)
Backed out changeset a8f42d85ce3f (bug 1161020)
Backed out changeset ac23206e80bd (bug 1161020)
Backed out changeset 34a20b05af6c (bug 1161020)
Backed out changeset 13753f9043f7 (bug 1161020)
Backed out changeset f90b8d3d6b70 (bug 1161020)
2015-05-18 15:01:27 +02:00
Thomas Zimmermann
71a19f39a9 Bug 1161020: Remove old interface and implementation from socket-connector classes, r=kmachulis 2015-05-18 11:28:30 +02:00
Thomas Zimmermann
cff86911f3 Bug 1161020: Use new socket-connector interface in socket classes, r=kmachulis
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.
2015-05-18 11:28:30 +02:00
Thomas Zimmermann
31fe56c843 Bug 1161020: Added clean interface to |UnixSocketConnector|, r=kmachulis
The current interface of |UnixSocketConnector| doesn't follow any design
and is not easily understandable.

This patch adds a new interface to the class. The new interface provides
a method for each of the following operations:

  * converting an address to a human-readable string,
  * creating a listening socket,
  * creating a stream socket, and
  * accepting a stream socket from a listening socket.

All arguments are stored in the connector class, so that connect and
listen methods of the socket classes don't require protocol-specific
arguments. All socket parameters are set within the connector class,
so each connector class can now select parameters individually.
2015-05-18 11:28:30 +02:00
Thomas Zimmermann
392fa0aab5 Bug 1162585: Set socket flags after socket has been created, r=kmachulis
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.
2015-05-08 09:45:42 +02:00
Thomas Zimmermann
685e9b30e8 Bug 1162524: Move |accept| out of |UnixSocketWatcher|, r=kmachulis
Calls to |accept| are now handled by the corresponding socket I/O
class. This makes the code more flexible. All callers have been
adapted.
2015-05-08 09:43:01 +02:00
Thomas Zimmermann
5cab8e5006 Bug 1159709: Cleanup inherited methods of |ListenSocket|, r=kmachulis
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'.
2015-04-30 12:55:37 +02:00
Thomas Zimmermann
b61c68c1ca Bug 1159709: Cleanup inherited methods of |StreamSocket|, r=kmachulis
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'.
2015-04-30 12:55:37 +02:00
Thomas Zimmermann
f21f5cd47f Bug 1159709: Integrate |ConnectionOrientedSocket| into socket I/O class hierarchy, r=kmachulis
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.
2015-04-30 12:55:37 +02:00
Thomas Zimmermann
b3af1051a9 Bug 1159209: Remove template parameters from |DataSocketIO|, r=kmachulis
This patch removes the template parameters from |DataSocketIO| and
moves its methods into the C++ source file. All users have been
adapted.
2015-04-29 11:19:28 +02:00
Thomas Zimmermann
a076ff736c Bug 1159209: Remove template parameters from |SocketIOShutdownTask|, r=kmachulis
This patch removes the template parameters from |SocketIOShutdownTask|
and moves its methods into the C++ source file. All users have been
adapted.
2015-04-29 11:19:28 +02:00
Thomas Zimmermann
1df9dd995c Bug 1159209: Remove template parameters from |SocketIODeleteInstanceRunnable|, r=kmachulis
This patch removes the template parameters from
|SocketIODeleteInstanceRunnable| and moves its methods into the
C++ source file. All users have been adapted.
2015-04-29 11:19:28 +02:00
Thomas Zimmermann
2aac7d4aa4 Bug 1159209: Remove template parameters from |SocketIORequestClosingRunnable|, r=kmachulis
This patch removes the template parameters from
|SocketIORequestClosingRunnable| and moves its methods into
the C++ source file. All users have been adapted.
2015-04-29 11:19:28 +02:00
Thomas Zimmermann
a780955c3e Bug 1159209: Remove template parameters from |SocketIOEventRunnable|, r=kmachulis
This patch removes the template parameters from |SocketIOEventRunnable|
and moves its methods into the C++ source file. All users have been
adapted.
2015-04-29 11:19:28 +02:00
Thomas Zimmermann
71aaba0c24 Bug 1158876: Move |DataSocket::ReceiveSocketData| into sub classes, r=kmachulis
|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.
2015-04-28 10:18:13 +02:00
Thomas Zimmermann
358002fcbd Bug 1158876: Move management of socket I/O buffers into socket I/O classes, r=kmachulis
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.
2015-04-28 10:18:13 +02:00
Thomas Zimmermann
f1427ebbb7 Bug 1158876: Rename |SocketConsumerBase| to |DataSocket|, r=kmachulis
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.
2015-04-28 10:18:12 +02:00
Thomas Zimmermann
0f58b21c4e Bug 1156352: Remove |UnixSocketRawData| from socket I/O interfaces, r=kmachulis 2015-04-23 13:48:48 +02:00
Thomas Zimmermann
d7d719ed77 Bug 1156352: Refactor |UnixSocketIOBuffer|, r=kmachulis
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|.
2015-04-23 13:48:47 +02:00
Thomas Zimmermann
450903b88b Bug 1154281: Remove |UnixSocketConsumer| and its helpers, r=kmachulis 2015-04-21 10:33:06 +02:00
Andrea Marchesini
b212600c95 Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
Ehsan Akhgari
33bb32f549 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Thomas Zimmermann
2a810f7896 Bug 1136729: Make destructor of |SocketBase| protected, r=qdot
The destructor methods of ref-counted classes are supposed to
be non-public to prevent accidential deletion. This patch fixes
|SocketBase|'s destructor.
2015-03-02 10:23:52 +01:00
Thomas Zimmermann
7a10047f6e Bug 1119746: Signal active listening in |ListenSocket|, r=qdot
The listen socket will now send-out CONNECT_SUCCESS after it started
listening. Callers might rely on this event. Before, CONNECT_SUCCESS
in |ListenSocket| was not used by callers.
2015-01-20 10:17:19 +08:00
Botond Ballo
b08ca88b2a Bug 1073081 - Fix -Wsign-compare and -Wsign-conversion warnings. r=ehsan
--HG--
extra : source : 88c58a8cc276a4691ed23fd8b8f2f6c0713b50fd
2014-11-24 19:54:33 -05:00
Thomas Zimmermann
6124722821 Bug 1093025: Add |StreamSocket|, r=kyle
|StreamSocket| implements a |ConnectionOrientedSocket| for stream
sockets. It utilizes |ListenSocket| to wait for incoming connection
requests.
2014-12-02 15:00:36 -08:00
Thomas Zimmermann
5cee256658 Bug 1093025: Add |ListenSocket|, r=kyle
The new class |ListenSocket| listens on Unix sockets for incoming
connections. Accepted connections are handed over to a compatible
connection-oriented socket.
2014-12-02 15:00:36 -08:00
Thomas Zimmermann
6d07312483 Bug 1093025: Move |UnixSocketConnector| to separate file, r=kyle
|UnixSocketConnector| will be shared by |UnixSocketConsumer| and
the upcoming listen and stream sockets.
2014-12-02 15:00:36 -08:00
Gina Yeh
f093ed9a75 Bug 1091479, Patch2: Rename enum members, r=sinker. 2014-11-24 09:47:39 +08:00
Thomas Zimmermann
395962fa36 Bug 1083092: Add |mozilla::ipc::UnixSocketIOBuffer|, r=shawnjohnjr
The class |UnixSocketIOBuffer| maintains memory buffers for socket I/O
operations. The actual I/O is still implemented by subclasses, such as
|UnixSocketRawData|.
2014-10-21 10:52:12 +02:00
Thomas Zimmermann
7bf2af4097 Bug 1083092: Data parameter for |mozilla::ipc::SocketIOSendTask| template, r=shawnjohnjr
The data class in |SocketIOSendTask| is now a template parameter, instead
of being hard-coded to |UnixSocketRawData|. The patch also adds soem minor
cleanups to the file.
2014-10-21 10:52:12 +02:00
Thomas Zimmermann
e86ec92e48 Bug 1083092: Introduce |mozilla::ipc::SocketBase|, r=shawnjohnjr
The new class |SocketBase| contains the notification mechanism of
|SocketConsumerBase|. The latter still contains I/O methods.
2014-10-21 10:52:11 +02:00