Commit Graph

202 Commits

Author SHA1 Message Date
Thomas Zimmermann
3a35f019a6 Bug 1194721: Add additional PDU pack and unpack functions, r=shuang
This patch adds PDU pack and unpack functions for 64-bit integer
values and floating-point values.
2016-02-04 12:35:13 +01:00
Carsten "Tomcat" Book
e8a8b2a7da Backed out changeset 2a5cf57e8b67 (bug 1194721) 2016-02-03 16:24:28 +01:00
Thomas Zimmermann
e8de319161 Bug 1194721: Add additional PDU pack and unpack functions, r=shuang
This patch adds PDU pack and unpack functions for 64-bit integer
values and floating-point values.
2016-02-03 15:16:00 +01:00
Nathan Froyd
40441ccdb8 Bug 1236574 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in SocketBase subclasses; r=tzimmerman 2015-12-06 10:53:37 -05:00
Nathan Froyd
2dbc1d274a Bug 1221547 - part 1 - enable UnixSocketRawData to take ownership of a passed-in-buffer; r=tzimmerman 2015-11-02 16:13:10 -05:00
Nathan Froyd
9c5965b035 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi
2015-10-18 01:24:48 -04:00
Nathan Froyd
e504437747 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Chris Peterson
b06d7f99a7 Bug 1207030 - Enable -Wshadow flag in more directories that have no -Wshadow warnings. r=glandium 2015-09-22 21:39:03 -07:00
Nicholas Nethercote
10d95cca57 Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.
2015-08-27 20:44:53 -07:00
Thomas Zimmermann
8399857001 Bug 1185478: Remove strong references from socket I/O class to socket classes
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.
2015-07-21 08:06:29 +02:00
Thomas Zimmermann
1cdfb998aa Bug 1185478: Add leak checks to socket I/O classes 2015-07-21 08:06:29 +02:00
Thomas Zimmermann
0976600ce3 Bug 1172479: Replace |nsIThread| by |MessageLoop| in socket I/O code, r=kmachulis
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|.
2015-06-09 09:50:10 +02:00
Thomas Zimmermann
56ea3d0868 Bug 1170993: Manage socket buffers in sub-classes of |UnixSocketBuffer|, r=kmachulis
Different users of the socket I/O code have different requirements
for their I/O buffers. This patch moves the buffer management into
sub-classes of |UnixSocketBuffer|. Each of them can maintain memory
according to its needs.
2015-06-08 10:20:17 +02:00
Thomas Zimmermann
1310d3cdaa Bug 1170466: Implement accept and connect in |ConnectionOrientedSocketIO|, r=kmachulis
|ConnectionOrientedSocketIO| now handles accepting and connecting
sockets. All sub-classes have been changed accordingly.
2015-06-03 11:53:50 +02:00
Thomas Zimmermann
e9a6a1e76a Bug 1170466: Share socket I/O methods in |ConnectionOrientedSocketIO|, r=kmachulis
With this patch, |ConnectionOrientedSocketIO| implements methods
for sending and receiving data. All sub-classes have been changed
accordingly.
2015-06-03 11:53:50 +02:00
Thomas Zimmermann
5f273174b4 Bug 1170466: Inherit |ConnectionOrientedSocketIO| from |UnixSocketWatcher|, r=kmachulis
Inheriting |ConncetionOrientedSocketIO| from |UnixSocketWatcher| will
allow for sharing common I/O code of the sub-class.
2015-06-03 11:53:50 +02:00
Thomas Zimmermann
0f08e85d05 Bug 1168806: Use 'consumer thread' in socket interface, r=kmachulis
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.
2015-06-02 10:01:58 +02:00
Thomas Zimmermann
fb090327db Bug 1168806: Configurable consumer thread for socket IPC classes, r=kmachulis
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.
2015-06-02 10:01:57 +02:00
Thomas Zimmermann
d8e16014cd Bug 1168806: Configurable I/O thread for socket IPC classes, r=kmachulis
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.
2015-06-02 10:01:57 +02:00
Thomas Zimmermann
c6bdc49f29 Bug 1167210: Replace |union sockaddr_any| with |struct sockaddr_storage|, r=kmachulis
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.
2015-05-27 13:49:07 +02:00
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