2007-03-22 10:30:00 -07:00
|
|
|
/* vim:set ts=2 sw=2 et cindent: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsServerSocket_h__
|
|
|
|
#define nsServerSocket_h__
|
|
|
|
|
|
|
|
#include "nsIServerSocket.h"
|
|
|
|
#include "nsSocketTransportService2.h"
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-03-31 21:29:02 -07:00
|
|
|
#include "mozilla/Mutex.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class nsServerSocket : public nsASocketHandler
|
|
|
|
, public nsIServerSocket
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISERVERSOCKET
|
|
|
|
|
|
|
|
// nsASocketHandler methods:
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void OnSocketReady(PRFileDesc *fd, int16_t outFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void OnSocketDetached(PRFileDesc *fd);
|
2012-09-17 16:45:10 -07:00
|
|
|
virtual void IsLocal(bool *aIsLocal);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-12-10 06:13:55 -08:00
|
|
|
virtual uint64_t ByteCountSent() { return 0; }
|
|
|
|
virtual uint64_t ByteCountReceived() { return 0; }
|
2007-03-22 10:30:00 -07:00
|
|
|
nsServerSocket();
|
|
|
|
|
|
|
|
// This must be public to support older compilers (xlC_r on AIX)
|
|
|
|
virtual ~nsServerSocket();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnMsgClose();
|
|
|
|
void OnMsgAttach();
|
|
|
|
|
|
|
|
// try attaching our socket (mFD) to the STS's poll list.
|
|
|
|
nsresult TryAttach();
|
|
|
|
|
|
|
|
// lock protects access to mListener; so it is not cleared while being used.
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-03-31 21:29:02 -07:00
|
|
|
mozilla::Mutex mLock;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRFileDesc *mFD;
|
|
|
|
PRNetAddr mAddr;
|
|
|
|
nsCOMPtr<nsIServerSocketListener> mListener;
|
|
|
|
nsCOMPtr<nsIEventTarget> mListenerTarget;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAttached;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#endif // nsServerSocket_h__
|