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.
This commit is contained in:
Thomas Zimmermann 2015-07-21 08:06:29 +02:00
parent 1cdfb998aa
commit 8399857001
4 changed files with 13 additions and 13 deletions

View File

@ -114,7 +114,7 @@ public:
BluetoothSocket* GetBluetoothSocket()
{
return mConsumer.get();
return mConsumer;
}
DataSocket* GetDataSocket()
@ -123,11 +123,11 @@ public:
}
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mImpl as container.
*/
RefPtr<BluetoothSocket> mConsumer;
BluetoothSocket* mConsumer;
// Methods for |DataSocket|
//

View File

@ -94,11 +94,11 @@ private:
void FireSocketError();
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mIO as container.
*/
RefPtr<BluetoothSocket> mConsumer;
BluetoothSocket* mConsumer;
/**
* Connector object used to create the connection we are currently using.
@ -183,7 +183,7 @@ BluetoothSocket::BluetoothSocketIO::GetSocketAddr(nsAString& aAddrStr) const
BluetoothSocket*
BluetoothSocket::BluetoothSocketIO::GetBluetoothSocket()
{
return mConsumer.get();
return mConsumer;
}
DataSocket*

View File

@ -67,11 +67,11 @@ private:
void FireSocketError();
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mIO as container.
*/
RefPtr<ListenSocket> mListenSocket;
ListenSocket* mListenSocket;
/**
* Connector object used to create the connection we are currently using.
@ -231,7 +231,7 @@ ListenSocketIO::OnSocketCanAcceptWithoutBlocking()
SocketBase*
ListenSocketIO::GetSocketBase()
{
return mListenSocket.get();
return mListenSocket;
}
bool

View File

@ -69,11 +69,11 @@ public:
private:
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mIO as container.
*/
RefPtr<StreamSocket> mStreamSocket;
StreamSocket* mStreamSocket;
/**
* If true, do not requeue whatever task we're running
@ -136,13 +136,13 @@ StreamSocketIO::~StreamSocketIO()
StreamSocket*
StreamSocketIO::GetStreamSocket()
{
return mStreamSocket.get();
return mStreamSocket;
}
DataSocket*
StreamSocketIO::GetDataSocket()
{
return mStreamSocket.get();
return GetStreamSocket();
}
void