mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1109592 - Forward socket state from |NfcSocketListener|. r=allstars.chh
This patch allows to handle changes to the socket state at a higher level than |NfcSocketListener|.
This commit is contained in:
parent
4365986c1d
commit
3f04f600c1
@ -371,6 +371,24 @@ NfcService::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData)
|
|||||||
mThread->Dispatch(runnable, nsIEventTarget::DISPATCH_NORMAL);
|
mThread->Dispatch(runnable, nsIEventTarget::DISPATCH_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NfcService::OnConnectSuccess(enum SocketType aSocketType)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NfcService::OnConnectError(enum SocketType aSocketType)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NfcService::OnDisconnect(enum SocketType aSocketType)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
}
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(NfcService,
|
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(NfcService,
|
||||||
NfcService::FactoryCreate)
|
NfcService::FactoryCreate)
|
||||||
|
|
||||||
|
@ -29,8 +29,12 @@ public:
|
|||||||
|
|
||||||
void DispatchNfcEvent(const mozilla::dom::NfcEventOptions& aOptions);
|
void DispatchNfcEvent(const mozilla::dom::NfcEventOptions& aOptions);
|
||||||
|
|
||||||
virtual void
|
virtual void ReceiveSocketData(
|
||||||
ReceiveSocketData(nsAutoPtr<mozilla::ipc::UnixSocketRawData>& aData) MOZ_OVERRIDE;
|
nsAutoPtr<mozilla::ipc::UnixSocketRawData>& aData) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void OnConnectSuccess(enum SocketType aSocketType) MOZ_OVERRIDE;
|
||||||
|
virtual void OnConnectError(enum SocketType aSocketType) MOZ_OVERRIDE;
|
||||||
|
virtual void OnDisconnect(enum SocketType aSocketType) MOZ_OVERRIDE;
|
||||||
|
|
||||||
nsCOMPtr<nsIThread> GetThread() {
|
nsCOMPtr<nsIThread> GetThread() {
|
||||||
return mThread;
|
return mThread;
|
||||||
|
@ -209,14 +209,23 @@ NfcConsumer::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData)
|
|||||||
void
|
void
|
||||||
NfcConsumer::OnConnectSuccess()
|
NfcConsumer::OnConnectSuccess()
|
||||||
{
|
{
|
||||||
// Nothing to do here.
|
|
||||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
if (mListener) {
|
||||||
|
mListener->OnConnectSuccess(NfcSocketListener::STREAM_SOCKET);
|
||||||
|
}
|
||||||
|
// Nothing to do here.
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NfcConsumer::OnConnectError()
|
NfcConsumer::OnConnectError()
|
||||||
{
|
{
|
||||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
if (mListener) {
|
||||||
|
mListener->OnConnectError(NfcSocketListener::STREAM_SOCKET);
|
||||||
|
}
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +233,10 @@ void
|
|||||||
NfcConsumer::OnDisconnect()
|
NfcConsumer::OnDisconnect()
|
||||||
{
|
{
|
||||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
if (mListener) {
|
||||||
|
mListener->OnDisconnect(NfcSocketListener::STREAM_SOCKET);
|
||||||
|
}
|
||||||
if (!mShutdown) {
|
if (!mShutdown) {
|
||||||
Connect(new NfcConnector(), mAddress.get(), GetSuggestedConnectDelayMs());
|
Connect(new NfcConnector(), mAddress.get(), GetSuggestedConnectDelayMs());
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,15 @@ namespace ipc {
|
|||||||
class NfcSocketListener
|
class NfcSocketListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum SocketType {
|
||||||
|
STREAM_SOCKET
|
||||||
|
};
|
||||||
|
|
||||||
virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData) = 0;
|
virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData) = 0;
|
||||||
|
|
||||||
|
virtual void OnConnectSuccess(enum SocketType aSocketType) = 0;
|
||||||
|
virtual void OnConnectError(enum SocketType aSocketType) = 0;
|
||||||
|
virtual void OnDisconnect(enum SocketType aSocketType) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket
|
class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket
|
||||||
|
Loading…
Reference in New Issue
Block a user