mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
removing files that are no longer compiled.
This commit is contained in:
parent
3686d6833a
commit
ef96caa6fb
@ -1,95 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* The nsINetModuleMgr singleton service allows external module to register
|
||||
* themselves with the networking library to receive events they want to
|
||||
* receive.
|
||||
*
|
||||
* An external module that is interested in being notified when a particular
|
||||
* networking level event occurs would register with this service, and
|
||||
* implement the appropriate interface(s) that correspond to the events they
|
||||
* want to receive. These interfaces are defined by networking internal
|
||||
* components (for example, http would define a notification interface that
|
||||
* the external cookies module would implement).
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISimpleEnumerator.idl"
|
||||
#include "nsINetNotify.idl"
|
||||
|
||||
interface nsIEventQueue;
|
||||
|
||||
%{ C++
|
||||
|
||||
// {4EBDAFE0-13BA-11d3-A15A-0050041CAF44}
|
||||
#define NS_NETMODULEMGR_CID \
|
||||
{ 0x4ebdafe0, 0x13ba, 0x11d3, { 0xa1, 0x5a, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } }
|
||||
|
||||
// The list of available CONTRACTIDS to register for notification on.
|
||||
#define NS_NETWORK_MODULE_MANAGER_HTTP_REQUEST_CONTRACTID "@mozilla.org/network/moduleMgr/http/request;1"
|
||||
#define NS_NETWORK_MODULE_MANAGER_HTTP_RESPONSE_CONTRACTID "@mozilla.org/network/moduleMgr/http/response;1"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(ff9ead40-0ef2-11d3-9de6-0010a4053fd0)]
|
||||
interface nsINetModuleMgr : nsISupports {
|
||||
|
||||
// Register the external module to receive notifications.
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// aTopic: The internal component that the external module wants to monitor.
|
||||
// aNotify: The external module interface methods to be called when an event is fired.
|
||||
//
|
||||
// RETURNS: nsresult
|
||||
void registerModule(in string aTopic, in nsINetNotify aNotify);
|
||||
|
||||
// Unregister the external module. Removes the nsINetModuleMgr binding between
|
||||
// internal component and external module.
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// aTopic: The internal component being monitored.
|
||||
// aNotify: The external modules notification module.
|
||||
//
|
||||
// RETURNS: nsresult
|
||||
void unregisterModule(in string aTopic, in nsINetNotify aNotify);
|
||||
|
||||
// Enumerates all the registered modules for the specified topic.
|
||||
//
|
||||
// ARGUMENTS:
|
||||
// aTopic: the component to get all the notifiers for.
|
||||
// aEnumerator: the array of notifiers.
|
||||
void enumerateModules(in string aTopic, out nsISimpleEnumerator aEnumerator);
|
||||
};
|
@ -1,43 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(4A3019E0-1CF3-11d3-A15B-0050041CAF44)]
|
||||
interface nsINetNotify : nsISupports {
|
||||
|
||||
};
|
@ -1,214 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsNetModRegEntry.h"
|
||||
#include "nsCRT.h"
|
||||
#include "plstr.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsISupports
|
||||
//////////////////////////////
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsNetModRegEntry, nsINetModRegEntry)
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsINetModRegEntry
|
||||
//////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetSyncProxy(nsINetNotify **aNotify)
|
||||
{
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
|
||||
if (mSyncProxy)
|
||||
{
|
||||
*aNotify = mSyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = BuildProxy(PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*aNotify = mSyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetAsyncProxy(nsINetNotify **aNotify)
|
||||
{
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
|
||||
if (mAsyncProxy)
|
||||
{
|
||||
*aNotify = mAsyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = BuildProxy(PR_FALSE);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*aNotify = mAsyncProxy;
|
||||
NS_ADDREF(*aNotify);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::GetTopic(char **topic)
|
||||
{
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
|
||||
if (mTopic)
|
||||
{
|
||||
*topic = (char *) nsMemory::Clone(mTopic, strlen(mTopic) + 1);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModRegEntry::Equals(nsINetModRegEntry* aEntry, PRBool *_retVal)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
*_retVal = PR_FALSE;
|
||||
|
||||
char* topic;
|
||||
|
||||
rv = aEntry->GetTopic(&topic);
|
||||
if (NS_FAILED(rv) || !topic)
|
||||
return rv;
|
||||
|
||||
if (!PL_strcmp(topic, mTopic))
|
||||
{
|
||||
nsCOMPtr<nsINetNotify> aSyncProxy;
|
||||
aEntry->GetSyncProxy(getter_AddRefs(aSyncProxy));
|
||||
|
||||
// mSyncProxy may not be initialized yet.
|
||||
nsCOMPtr<nsINetNotify> mySyncProxy;
|
||||
GetSyncProxy(getter_AddRefs(mySyncProxy));
|
||||
|
||||
if(aSyncProxy == mySyncProxy)
|
||||
{
|
||||
*_retVal = PR_TRUE;
|
||||
}
|
||||
}
|
||||
nsMemory::Free(topic);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//// nsNetModRegEntry
|
||||
//////////////////////////////
|
||||
|
||||
nsNetModRegEntry::nsNetModRegEntry(const char *aTopic,
|
||||
nsINetNotify *aNotify,
|
||||
nsresult *result)
|
||||
{
|
||||
mTopic = new char [PL_strlen(aTopic) + 1];
|
||||
PL_strcpy(mTopic, aTopic);
|
||||
|
||||
mAsyncProxy = nsnull;
|
||||
mSyncProxy = nsnull;
|
||||
mRealNotifier = aNotify;
|
||||
|
||||
nsCOMPtr<nsIEventQueueService> eventQService =
|
||||
do_GetService(kEventQueueServiceCID, result);
|
||||
|
||||
if (NS_FAILED(*result)) return;
|
||||
|
||||
*result = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQ));
|
||||
|
||||
mMonitor = nsAutoMonitor::NewMonitor("nsNetModRegEntry");
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNetModRegEntry::BuildProxy(PRBool sync)
|
||||
{
|
||||
if (mEventQ == nsnull)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult result;
|
||||
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyManager =
|
||||
do_GetService(kProxyObjectManagerCID, &result);
|
||||
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if (sync)
|
||||
{
|
||||
result = proxyManager->GetProxyForObject( mEventQ,
|
||||
NS_GET_IID(nsINetNotify),
|
||||
mRealNotifier,
|
||||
PROXY_SYNC | PROXY_ALWAYS,
|
||||
getter_AddRefs(mSyncProxy));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = proxyManager->GetProxyForObject( mEventQ,
|
||||
NS_GET_IID(nsINetNotify),
|
||||
mRealNotifier,
|
||||
PROXY_ASYNC | PROXY_ALWAYS,
|
||||
getter_AddRefs(mAsyncProxy));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsNetModRegEntry::~nsNetModRegEntry()
|
||||
{
|
||||
delete [] mTopic;
|
||||
nsAutoMonitor::DestroyMonitor(mMonitor);
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef ___nsNetModRegEntry_h___
|
||||
#define ___nsNetModRegEntry_h___
|
||||
|
||||
#include "nsINetModRegEntry.h"
|
||||
#include "prlock.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsNetModRegEntry : public nsINetModRegEntry {
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetModRegEntry
|
||||
NS_IMETHOD GetSyncProxy(nsINetNotify * *aSyncProxy);
|
||||
NS_IMETHOD GetAsyncProxy(nsINetNotify * *aAsyncProxy);
|
||||
NS_IMETHOD GetTopic(char * *aTopic);
|
||||
NS_IMETHOD Equals(nsINetModRegEntry* aEntry, PRBool *_retVal);
|
||||
|
||||
// nsNetModRegEntry
|
||||
nsNetModRegEntry(const char *aTopic, nsINetNotify *aNotify, nsresult *result);
|
||||
virtual ~nsNetModRegEntry();
|
||||
|
||||
protected:
|
||||
char *mTopic;
|
||||
nsCOMPtr<nsINetNotify> mRealNotifier;
|
||||
nsCOMPtr<nsINetNotify> mSyncProxy;
|
||||
nsCOMPtr<nsINetNotify> mAsyncProxy;
|
||||
nsCOMPtr<nsIEventQueue> mEventQ;
|
||||
|
||||
nsresult BuildProxy(PRBool sync);
|
||||
|
||||
PRMonitor* mMonitor;
|
||||
};
|
||||
|
||||
#endif //___nsNetModRegEntry_h___
|
@ -1,209 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsNetModuleMgr.h"
|
||||
#include "nsArrayEnumerator.h" // for nsArrayEnumerator
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
nsNetModuleMgr* nsNetModuleMgr::gManager;
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsISupports
|
||||
///////////////////////////////////
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsNetModuleMgr, nsINetModuleMgr)
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsINetModuleMgr
|
||||
///////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::RegisterModule(const char *aTopic, nsINetNotify *aNotify)
|
||||
{
|
||||
nsresult rv;
|
||||
PRInt32 cnt;
|
||||
|
||||
// XXX before registering an object for a particular topic
|
||||
// XXX QI the nsINetNotify interface passed in for the interfaces
|
||||
// XXX supported by the topic.
|
||||
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
nsNetModRegEntry *newEntry = new nsNetModRegEntry(aTopic, aNotify, &rv);
|
||||
if (!newEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
delete newEntry;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINetModRegEntry> newEntryI = do_QueryInterface(newEntry, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete newEntry;
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Check for a previous registration
|
||||
cnt = mEntries.Count();
|
||||
for (PRInt32 i = 0; i < cnt; i++)
|
||||
{
|
||||
nsINetModRegEntry* curEntry = mEntries[i];
|
||||
|
||||
PRBool same = PR_FALSE;
|
||||
rv = newEntryI->Equals(curEntry, &same);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// if we've already got this one registered, yank it, and replace it with the new one
|
||||
if (same) {
|
||||
mEntries.RemoveObjectAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mEntries.AppendObject(newEntryI))
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::UnregisterModule(const char *aTopic, nsINetNotify *aNotify)
|
||||
{
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsINetModRegEntry> tmpEntryI;
|
||||
nsNetModRegEntry *tmpEntry = new nsNetModRegEntry(aTopic, aNotify, &rv);
|
||||
if (!tmpEntry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = tmpEntry->QueryInterface(NS_GET_IID(nsINetModRegEntry), getter_AddRefs(tmpEntryI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 cnt;
|
||||
cnt = mEntries.Count();
|
||||
for (PRInt32 i = 0; i < cnt; i++) {
|
||||
nsINetModRegEntry* curEntry = mEntries[i];
|
||||
|
||||
PRBool same = PR_FALSE;
|
||||
rv = tmpEntryI->Equals(curEntry, &same);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (same) {
|
||||
mEntries.RemoveObjectAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetModuleMgr::EnumerateModules(const char *aTopic, nsISimpleEnumerator **aEnumerator) {
|
||||
|
||||
nsresult rv;
|
||||
// get all the entries for this topic
|
||||
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
|
||||
PRInt32 cnt = mEntries.Count();
|
||||
|
||||
// create the new array
|
||||
nsCOMArray<nsINetModRegEntry> topicEntries;
|
||||
|
||||
// run through the main entry array looking for topic matches.
|
||||
for (PRInt32 i = 0; i < cnt; i++) {
|
||||
nsINetModRegEntry* entry = mEntries[i];
|
||||
|
||||
nsXPIDLCString topic;
|
||||
rv = entry->GetTopic(getter_Copies(topic));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (0 == PL_strcmp(aTopic, topic)) {
|
||||
// found a match, add it to the list
|
||||
if (!topicEntries.AppendObject(entry))
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> enumerator;
|
||||
rv = NS_NewArrayEnumerator(getter_AddRefs(enumerator), topicEntries);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aEnumerator = enumerator;
|
||||
NS_ADDREF(*aEnumerator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
//// nsNetModuleMgr
|
||||
///////////////////////////////////
|
||||
|
||||
nsNetModuleMgr::nsNetModuleMgr() {
|
||||
mMonitor = nsAutoMonitor::NewMonitor("nsNetModuleMgr");
|
||||
}
|
||||
|
||||
nsNetModuleMgr::~nsNetModuleMgr() {
|
||||
nsAutoMonitor::DestroyMonitor(mMonitor);
|
||||
gManager = nsnull;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsNetModuleMgr::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
if (! gManager) {
|
||||
gManager = new nsNetModuleMgr();
|
||||
if (! gManager)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(gManager);
|
||||
nsresult rv = gManager->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(gManager);
|
||||
|
||||
return rv;
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef ___nsNetModuleMgr_h__
|
||||
#define ___nsNetModuleMgr_h__
|
||||
|
||||
#include "nsINetModuleMgr.h"
|
||||
#include "nsNetModRegEntry.h"
|
||||
#include "prlock.h"
|
||||
#include "nspr.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class nsNetModuleMgr : public nsINetModuleMgr {
|
||||
protected:
|
||||
static nsNetModuleMgr* gManager;
|
||||
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINetModuleMgr
|
||||
NS_DECL_NSINETMODULEMGR
|
||||
|
||||
// nsNetModuleMgr
|
||||
nsNetModuleMgr();
|
||||
virtual ~nsNetModuleMgr();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
|
||||
nsCOMArray<nsINetModRegEntry> mEntries;
|
||||
PRMonitor* mMonitor;
|
||||
};
|
||||
|
||||
|
||||
#endif // ___nsNetModuleMgr_h__
|
File diff suppressed because it is too large
Load Diff
@ -1,195 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsDNSService_h__
|
||||
#define nsDNSService_h__
|
||||
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#if defined(XP_MAC)
|
||||
#include <OSUtils.h>
|
||||
#include <Files.h>
|
||||
#include <OpenTransport.h>
|
||||
#include <OpenTptInternet.h>
|
||||
#elif defined (XP_WIN)
|
||||
#include <windows.h>
|
||||
#include <Winsock2.h>
|
||||
#endif
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIIDNService.h"
|
||||
#include "prclist.h"
|
||||
#include "prcvar.h"
|
||||
#include "pldhash.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DNS_TIMING 1
|
||||
#endif
|
||||
|
||||
class nsIDNSListener;
|
||||
class nsDNSLookup;
|
||||
|
||||
/******************************************************************************
|
||||
* nsDNSService
|
||||
*****************************************************************************/
|
||||
class nsDNSService : public nsIDNSService,
|
||||
public nsIRunnable,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIRUNNABLE
|
||||
NS_DECL_NSIDNSSERVICE
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
// nsDNSService methods:
|
||||
nsDNSService();
|
||||
virtual ~nsDNSService();
|
||||
|
||||
// Define a Create method to be used with a factory:
|
||||
static NS_METHOD Create(nsISupports * outer,
|
||||
const nsIID & iid,
|
||||
void ** result);
|
||||
|
||||
static void Lock();
|
||||
static void Unlock();
|
||||
|
||||
// Attempts to reinitialize the dns resolver. This method must be called
|
||||
// within the nsDNSService lock.
|
||||
// Returns true if the dns resolves has been reset, otherwise false.
|
||||
static PRBool Reset();
|
||||
|
||||
void EnqueuePendingQ(nsDNSLookup * lookup);
|
||||
nsDNSLookup * DequeuePendingQ();
|
||||
|
||||
static PRInt32 ExpirationInterval();
|
||||
|
||||
static nsDNSService * gService;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Internal Methods
|
||||
*/
|
||||
nsresult LateInit();
|
||||
nsresult InstallPrefObserver();
|
||||
nsresult RemovePrefObserver();
|
||||
nsDNSLookup * FindOrCreateLookup(const char * hostName);
|
||||
void EvictLookup(nsDNSLookup * lookup);
|
||||
void EvictLookupsIfNecessary(PRInt32 targetCount);
|
||||
void AddToEvictionQ(nsDNSLookup * lookup);
|
||||
void AbortLookups();
|
||||
nsresult ShutdownInternal();
|
||||
|
||||
/**
|
||||
* Data members
|
||||
*/
|
||||
static PRBool gNeedLateInitialization;
|
||||
static PLDHashTableOps gHashTableOps;
|
||||
|
||||
nsWeakPtr mPrefService;
|
||||
|
||||
PRLock * mDNSServiceLock;
|
||||
PRCondVar * mDNSCondVar;
|
||||
PLDHashTable mHashTable;
|
||||
PRCList mPendingQ;
|
||||
PRCList mEvictionQ;
|
||||
PRInt32 mEvictionQCount;
|
||||
PRInt32 mMaxCachedLookups;
|
||||
PRInt32 mExpirationInterval;
|
||||
|
||||
char * mMyIPAddress;
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
PRUint32 mState;
|
||||
nsCOMPtr<nsIIDNService> mIDNConverter;
|
||||
|
||||
PRIntervalTime mLastReset;
|
||||
PRIntervalTime mResetMaxInterval;
|
||||
PRBool mCacheNeedsClearing;
|
||||
|
||||
enum {
|
||||
DNS_NOT_INITIALIZED = 0,
|
||||
DNS_ONLINE = 1,
|
||||
DNS_OFFLINE = 2,
|
||||
DNS_SHUTTING_DOWN = 3,
|
||||
DNS_SHUTDOWN = 4
|
||||
};
|
||||
|
||||
#if defined(XP_MAC)
|
||||
friend pascal void nsDnsServiceNotifierRoutine(void * contextPtr,
|
||||
OTEventCode code,
|
||||
OTResult result,
|
||||
void * cookie);
|
||||
public:
|
||||
InetSvcRef mServiceRef;
|
||||
OTNotifyUPP nsDnsServiceNotifierRoutineUPP;
|
||||
#if TARGET_CARBON
|
||||
OTClientContextPtr mClientContext;
|
||||
#endif /* TARGET_CARBON */
|
||||
private:
|
||||
#endif /* XP_MAC */
|
||||
|
||||
#if defined(XP_WIN)
|
||||
public:
|
||||
|
||||
PRUint32 AllocMsgID(void);
|
||||
HWND mDNSWindow;
|
||||
|
||||
// This should really be private but making public to be accessible
|
||||
// by nsDNSEventProc helper function due to MSVC/GCC mismatch (bug 134113)
|
||||
LRESULT ProcessLookup( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
private:
|
||||
void FreeMsgID(PRUint32 msgID);
|
||||
|
||||
PRUint32 mMsgIDBitVector[4];
|
||||
#endif /* XP_WIN */
|
||||
|
||||
|
||||
#ifdef DNS_TIMING
|
||||
friend class nsDNSRequest;
|
||||
|
||||
double mCount;
|
||||
double mTimes;
|
||||
double mSquaredTimes;
|
||||
FILE * mOut;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* nsDNSService_h__ */
|
@ -1,69 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Gagan Saksena <gagan@netscape.com> (original author)
|
||||
* Darin Fisher <darin@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* The internal networking library http interface. External modules
|
||||
* desiring to receive notification of internal http events implement this
|
||||
* interface, and pass it into the nsINetModuleMgr Register and Unregister
|
||||
* methods.
|
||||
*/
|
||||
|
||||
#include "nsINetNotify.idl"
|
||||
|
||||
interface nsIHttpChannel;
|
||||
|
||||
[scriptable, uuid(5a6dec35-fb37-4460-85bb-1c572521d0cf)]
|
||||
interface nsIHttpNotify : nsINetNotify
|
||||
{
|
||||
/**
|
||||
* Before an HTTP request is sent to the server, this method is called.
|
||||
* The implementor of this method can then chose to set any additional
|
||||
* headers for this request before the request is actually sent to the
|
||||
* server. The HTTP protocol interpreter blocks on this call until it
|
||||
* returns.
|
||||
*/
|
||||
void onModifyRequest(in nsIHttpChannel httpChannel);
|
||||
|
||||
/**
|
||||
* After an HTTP server response is received, this method is called
|
||||
* syncronously. The implementor can interrogate the nsIHttpChannel as
|
||||
* it deems necessary. The HTTP protocol interpreter blocks on this call
|
||||
* until it returns.
|
||||
*/
|
||||
void onExamineResponse(in nsIHttpChannel httpChannel);
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user