I IDL-ifying the nsProxyObjectManager.

I have updated all users that I found
grepping the source tree.

r=valeski@netscape.com
a=waterson@netscape.com
b=43131

Also checking in changes to the window's embed test which is NOT
hooked up to the build system.
This commit is contained in:
dougt%netscape.com 2000-06-24 00:03:10 +00:00
Родитель bc4cdc5f90
Коммит e1274cde0a
40 изменённых файлов: 247 добавлений и 324 удалений

Просмотреть файл

@ -37,7 +37,7 @@
#include "nsJSProtocolHandler.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIDocShell.h"
#include "nsDOMError.h"
#include "nsIInterfaceRequestor.h"
@ -51,6 +51,8 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
static NS_DEFINE_CID(kJSProtocolHandlerCID, NS_JSPROTOCOLHANDLER_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static const char console_chrome_url[] = "chrome://global/content/console.xul";
static const char console_window_options[] = "chrome,menubar,toolbar,resizable";
@ -255,6 +257,7 @@ public:
return NS_OK;
}
NS_IMETHOD Open(char* *contentType, PRInt32 *contentLength) {
// IMPORTANT CHANGE: We used to just implement nsIInputStream and use
// an input stream channel in the js protocol, but that had the nasty
@ -268,10 +271,14 @@ public:
// the current document.
nsresult rv;
// We do this by proxying back to the main thread.
NS_WITH_SERVICE(nsIProxyObjectManager, proxyObjectManager,
nsIProxyObjectManager::GetCID(), &rv);
NS_WITH_SERVICE(nsIProxyObjectManager,
proxyObjectManager,
kProxyObjectManagerCID,
&rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsEvaluateStringProxy> eval = new nsEvaluateStringProxy();
@ -281,7 +288,7 @@ public:
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIEvaluateStringProxy> evalProxy;
rv = proxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ,
rv = proxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ,
NS_GET_IID(nsIEvaluateStringProxy),
NS_STATIC_CAST(nsISupports*, eval),
PROXY_SYNC | PROXY_ALWAYS,

Просмотреть файл

@ -34,6 +34,7 @@
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsIContentViewerFile.h"
//*****************************************************************************
//*** WebBrowser: Object Management
//*****************************************************************************
@ -57,9 +58,9 @@ WebBrowser::Init(nsNativeWidget widget)
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIBaseWindow> webBrowserWin = do_QueryInterface(mWebBrowser);
mBaseWindow = do_QueryInterface(mWebBrowser);
rv = webBrowserWin->InitWindow( widget,
rv = mBaseWindow->InitWindow( widget,
nsnull,
0,
32,
@ -69,20 +70,25 @@ WebBrowser::Init(nsNativeWidget widget)
mWebBrowser->SetTopLevelWindow(this);
webBrowserWin->Create();
mBaseWindow->Create();
nsCOMPtr <nsIDocShell> rootDocShell;
mWebBrowser->GetDocShell(getter_AddRefs(rootDocShell));
rootDocShell->SetAllowPlugins(PR_TRUE);
webBrowserWin->SetVisibility(PR_TRUE);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
webNav->LoadURI(NS_ConvertASCIItoUCS2("http://www.mozilla.org").GetUnicode());
mBaseWindow->SetVisibility(PR_TRUE);
return rv;
}
nsresult
WebBrowser::GetIWebBrowser(nsIWebBrowser **outBrowser)
{
*outBrowser = mWebBrowser;
NS_IF_ADDREF(*outBrowser);
return NS_OK;
}
nsresult
WebBrowser::GoTo(char* url)
@ -194,10 +200,12 @@ NS_IMETHODIMP WebBrowser::SetChromeMask(PRUint32 aChromeMask)
return NS_OK;
}
extern nsresult CreateNativeWindowWidget(nsIWebBrowser **outBrowser);
NS_IMETHODIMP WebBrowser::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser **webBrowser)
NS_IMETHODIMP WebBrowser::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser **outBrowser)
{
return NS_ERROR_FAILURE;
CreateNativeWindowWidget(outBrowser);
return NS_OK;
}
@ -284,8 +292,7 @@ NS_IMETHODIMP WebBrowser::GetSize(PRInt32* cx, PRInt32* cy)
NS_IMETHODIMP WebBrowser::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
PRInt32 cy, PRBool fRepaint)
{
nsCOMPtr<nsIBaseWindow> webBrowserWin = do_QueryInterface(mWebBrowser);
return webBrowserWin->SetPositionAndSize(x, y,cx, cy,fRepaint);
return mBaseWindow->SetPositionAndSize(x, y,cx, cy,fRepaint);
}
NS_IMETHODIMP WebBrowser::GetPositionAndSize(PRInt32* x, PRInt32* y, PRInt32* cx,
@ -403,4 +410,4 @@ NS_IMETHODIMP WebBrowser::Select(const PRUnichar *dialogTitle, const PRUnichar *
NS_IMETHODIMP WebBrowser::UniversalDialog(const PRUnichar *inTitleMessage, const PRUnichar *inDialogTitle, const PRUnichar *inMsg, const PRUnichar *inCheckboxMsg, const PRUnichar *inButton0Text, const PRUnichar *inButton1Text, const PRUnichar *inButton2Text, const PRUnichar *inButton3Text, const PRUnichar *inEditfield1Msg, const PRUnichar *inEditfield2Msg, PRUnichar **inoutEditfield1Value, PRUnichar **inoutEditfield2Value, const PRUnichar *inIConURL, PRBool *inoutCheckboxState, PRInt32 inNumberButtons, PRInt32 inNumberEditfields, PRInt32 inEditField1Password, PRInt32 *outButtonPressed)
{
return NS_OK;
}
}

Просмотреть файл

@ -56,6 +56,7 @@ public:
nsresult Init(nsNativeWidget widget);
nsresult GoTo(char* url);
nsresult Print(void);
nsresult GetIWebBrowser(nsIWebBrowser **outBrowser);
WebBrowser();
virtual ~WebBrowser();
@ -64,6 +65,8 @@ protected:
nsCOMPtr<nsIWidget> mWindow;
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIBaseWindow> mBaseWindow;
};
#endif /* __WebBrowser__ */

Просмотреть файл

@ -35,6 +35,7 @@ OBJS = \
LLIBS= \
$(DIST)\lib\baseembed_s.lib \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\xpcom.lib \
$(LIBNSPR) \
$(NULL)

Просмотреть файл

@ -21,19 +21,26 @@
* Doug Turner <dougt@netscape.com>
*/
#include <stdio.h>
#include "stdafx.h"
#include "resource.h"
class nsIWebBrowser;
#include "nsIDocShell.h"
#include "nsIWebNavigation.h"
#include "nsIEditorShell.h"
#include "nsIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "WebBrowser.h"
WebBrowser *mozBrowser = nsnull;
WebBrowser *mozBrowser = nsnull;
extern nsresult NS_InitEmbedding(const char *aPath);
extern nsresult NS_TermEmbedding();
extern nsresult CreateNativeWindowWidget(nsIWebBrowser **outBrowser);
#define MAX_LOADSTRING 100
@ -45,19 +52,42 @@ TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
// Foward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK OpenURI(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
ConvertDocShellToDOMWindow(nsIDocShell* aDocShell, nsIDOMWindow** aDOMWindow)
{
// TODO: Place code here.
MSG msg;
if (!aDOMWindow)
return NS_ERROR_FAILURE;
*aDOMWindow = nsnull;
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject(do_GetInterface(aDocShell));
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(scriptGlobalObject));
if (!domWindow)
return NS_ERROR_FAILURE;
*aDOMWindow = domWindow.get();
NS_ADDREF(*aDOMWindow);
return NS_OK;
}
#define RUN_EDITOR 1
nsCOMPtr<nsIEditorShell> editor;
int main ()
{
printf("\nYour embedded, man!\n\n");
MSG msg;
HINSTANCE hInstance = GetModuleHandle(NULL);
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_WINEMBED, szWindowClass, MAX_LOADSTRING);
@ -65,11 +95,36 @@ int APIENTRY WinMain(HINSTANCE hInstance,
NS_InitEmbedding(nsnull);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
nsCOMPtr<nsIWebBrowser> theBrowser;
CreateNativeWindowWidget(getter_AddRefs(theBrowser));
#ifndef RUN_EDITOR
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(theBrowser));
webNav->LoadURI(NS_ConvertASCIItoUCS2("http://people.netscape.com/dougt").GetUnicode());
#else
nsresult rv;
editor = do_CreateInstance("component://netscape/editor/editorshell", &rv);
if (NS_FAILED(rv))
return -1;
nsCOMPtr <nsIDocShell> rootDocShell;
theBrowser->GetDocShell(getter_AddRefs(rootDocShell));
nsCOMPtr<nsIDOMWindow> domWindow;
ConvertDocShellToDOMWindow(rootDocShell, getter_AddRefs(domWindow));
editor->Init();
editor->SetEditorType(NS_ConvertASCIItoUCS2("html").GetUnicode());
editor->SetWebShellWindow(domWindow);
editor->SetContentWindow(domWindow);
editor->LoadUrl(NS_ConvertASCIItoUCS2("http://lxr.mozilla.org/").GetUnicode());
#endif
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
@ -78,6 +133,11 @@ int APIENTRY WinMain(HINSTANCE hInstance,
DispatchMessage(&msg);
}
#ifdef RUN_EDITOR
PRBool duh;
editor->SaveDocument(PR_FALSE, PR_FALSE, &duh);
#endif
NS_TermEmbedding();
return msg.wParam;
@ -119,21 +179,20 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
nsresult CreateNativeWindowWidget(nsIWebBrowser **outBrowser)
{
STARTUPINFO StartupInfo;
StartupInfo.dwFlags = 0;
GetStartupInfo( &StartupInfo );
HINSTANCE hInstance = GetModuleHandle(NULL);
int nCmdShow = StartupInfo.dwFlags & STARTF_USESHOWWINDOW ? StartupInfo.wShowWindow : SW_SHOWDEFAULT;
HWND hWnd;
hWnd = CreateWindow( szWindowClass,
szTitle,
@ -149,19 +208,17 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
if (!hWnd)
{
return FALSE;
return NS_ERROR_FAILURE;
}
mozBrowser = new WebBrowser();
if (! mozBrowser)
return FALSE;
return NS_ERROR_FAILURE;
NS_ADDREF(mozBrowser);
if ( NS_FAILED( mozBrowser->Init(hWnd) ) )
return FALSE;
return NS_ERROR_FAILURE;
RECT rect;
GetClientRect(hWnd, &rect);
@ -172,7 +229,10 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
if (outBrowser)
mozBrowser->GetIWebBrowser(outBrowser);
return NS_OK;
}
//
@ -210,8 +270,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case MOZ_Print:
if (mozBrowser)
mozBrowser->Print();
//if (mozBrowser)
// mozBrowser->Print();
editor->SetTextProperty(NS_ConvertASCIItoUCS2("font").GetUnicode(),
NS_ConvertASCIItoUCS2("color").GetUnicode(),
NS_ConvertASCIItoUCS2("BLUE").GetUnicode());
break;
default:

Просмотреть файл

@ -51,7 +51,7 @@
#include "nsXPIDLString.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
@ -3950,7 +3950,7 @@ NS_IMETHODIMP nsAddrDatabase::AddListDirNode(nsIMdbRow * listRow)
char *parentUri = PR_smprintf("%s%s", kDirectoryDataSourceRoot, file);
rv = rdfService->GetResource( parentUri, getter_AddRefs(parentResource));
nsCOMPtr<nsIAbDirectory> parentDir;
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),
parentResource, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( parentDir));
if (parentDir)
{

Просмотреть файл

@ -69,7 +69,7 @@ PRLogModuleInfo *IMAP;
#include "nsIImapIncomingServer.h"
#include "nsIPref.h"
#include "nsImapUtils.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#if 0
#include "nsIHashAlgorithm.h"
@ -454,7 +454,7 @@ nsImapProtocol::SetupSinkProxy()
nsCOMPtr<nsIImapMailFolderSink> aImapMailFolderSink;
res = m_runningUrl->GetImapMailFolderSink(getter_AddRefs(aImapMailFolderSink));
if (NS_SUCCEEDED(res) && aImapMailFolderSink)
res = proxyManager->GetProxyObject(m_sinkEventQueue,
res = proxyManager->GetProxyForObject(m_sinkEventQueue,
NS_GET_IID(nsIImapMailFolderSink),
aImapMailFolderSink,
PROXY_SYNC | PROXY_ALWAYS,
@ -466,7 +466,7 @@ nsImapProtocol::SetupSinkProxy()
nsCOMPtr<nsIImapMessageSink> aImapMessageSink;
res = m_runningUrl->GetImapMessageSink(getter_AddRefs(aImapMessageSink));
if (NS_SUCCEEDED(res) && aImapMessageSink)
res = proxyManager->GetProxyObject(m_sinkEventQueue,
res = proxyManager->GetProxyForObject(m_sinkEventQueue,
NS_GET_IID(nsIImapMessageSink),
aImapMessageSink,
PROXY_SYNC | PROXY_ALWAYS,
@ -504,7 +504,7 @@ nsImapProtocol::SetupSinkProxy()
nsCOMPtr<nsIImapServerSink> aImapServerSink;
res = m_runningUrl->GetImapServerSink(getter_AddRefs(aImapServerSink));
if (NS_SUCCEEDED(res) && aImapServerSink)
res = proxyManager->GetProxyObject( m_sinkEventQueue,
res = proxyManager->GetProxyForObject( m_sinkEventQueue,
NS_GET_IID(nsIImapServerSink),
aImapServerSink,
PROXY_SYNC | PROXY_ALWAYS,

Просмотреть файл

@ -26,7 +26,7 @@
#include "nsIServiceManager.h"
#include "nsIIOService.h"
#include "nsIURI.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "nsMsgBaseCID.h"
@ -226,8 +226,8 @@ nsresult nsEudoraCompose::CreateComponents( void)
if (NS_SUCCEEDED( rv) && m_pMsgSend) {
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgSend),
m_pMsgSend, PROXY_SYNC, (void **)&m_pSendProxy);
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgSend),
m_pMsgSend, PROXY_SYNC, (void**)&m_pSendProxy);
if (NS_FAILED( rv)) {
m_pSendProxy = nsnull;
}

Просмотреть файл

@ -22,7 +22,7 @@
#include "nsIStringBundle.h"
#include "nsEudoraStringBundle.h"
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
@ -63,7 +63,7 @@ nsIStringBundle *nsEudoraStringBundle::GetStringBundleProxy( void)
// create a proxy object if we aren't on the same thread?
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
m_pBundle, PROXY_SYNC | PROXY_ALWAYS, (void **) &strProxy);
}

Просмотреть файл

@ -25,7 +25,7 @@
#include "nsIStringBundle.h"
#include "nsOEStringBundle.h"
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
@ -67,7 +67,7 @@ nsIStringBundle *nsOEStringBundle::GetStringBundleProxy( void)
// create a proxy object if we aren't on the same thread?
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
m_pBundle, PROXY_SYNC | PROXY_ALWAYS, (void **) &strProxy);
}

Просмотреть файл

@ -26,7 +26,7 @@
#include "nsIServiceManager.h"
#include "nsIIOService.h"
#include "nsIURI.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "nsMsgBaseCID.h"
@ -226,7 +226,7 @@ nsresult nsOutlookCompose::CreateComponents( void)
if (NS_SUCCEEDED( rv) && m_pMsgSend) {
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgSend),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgSend),
m_pMsgSend, PROXY_SYNC, (void **)&m_pSendProxy);
if (NS_FAILED( rv)) {
m_pSendProxy = nsnull;

Просмотреть файл

@ -25,7 +25,7 @@
#include "nsIStringBundle.h"
#include "nsOutlookStringBundle.h"
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
@ -67,7 +67,7 @@ nsIStringBundle *nsOutlookStringBundle::GetStringBundleProxy( void)
// create a proxy object if we aren't on the same thread?
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
m_pBundle, PROXY_SYNC | PROXY_ALWAYS, (void **) &strProxy);
}

Просмотреть файл

@ -48,7 +48,7 @@
#include "nsIAbDirectory.h"
#include "nsImportStringBundle.h"
#include "nsTextFormatter.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "ImportDebug.h"
@ -812,7 +812,7 @@ nsIAddrDatabase *GetAddressBook( const PRUnichar *name, PRBool makeNew)
char *parentUri = PR_smprintf( "%s", kDirectoryDataSourceRoot);
rv = rdfService->GetResource( parentUri, getter_AddRefs(parentResource));
nsCOMPtr<nsIAbDirectory> parentDir;
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),
parentResource, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( parentDir));
if (parentUri)
PR_smprintf_free(parentUri);

Просмотреть файл

@ -35,7 +35,7 @@
#include "nsIImportMailboxDescriptor.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsXPIDLString.h"
#include "nsIFileSpec.h"
@ -783,7 +783,7 @@ ImportMailThread( void *stuff)
// Initialize the curFolder proxy object
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
curFolder, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( curProxy));
IMPORT_LOG1( "Proxy result for curFolder: 0x%lx\n", (long) rv);
@ -821,7 +821,7 @@ ImportMailThread( void *stuff)
break;
}
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
subFolder, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( curProxy));
if (NS_FAILED( rv)) {
nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error, bundle);
@ -836,7 +836,7 @@ ImportMailThread( void *stuff)
while ((newDepth < depth) && NS_SUCCEEDED( rv)) {
nsCOMPtr<nsIFolder> parFolder;
curProxy->GetParent( getter_AddRefs( parFolder));
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIMsgFolder),
parFolder, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( curProxy));
depth--;
}

Просмотреть файл

@ -25,7 +25,7 @@
#include "nsIStringBundle.h"
#include "nsImportStringBundle.h"
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
@ -66,7 +66,7 @@ nsIStringBundle *nsImportStringBundle::GetStringBundleProxy( void)
// create a proxy object if we aren't on the same thread?
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
m_pBundle, PROXY_SYNC | PROXY_ALWAYS, (void **) &strProxy);
}

Просмотреть файл

@ -22,7 +22,7 @@
#include "nsIStringBundle.h"
#include "nsTextStringBundle.h"
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIURI.h"
/* This is the next generation string retrieval call */
@ -64,7 +64,7 @@ nsIStringBundle *nsTextStringBundle::GetStringBundleProxy( void)
// create a proxy object if we aren't on the same thread?
NS_WITH_SERVICE( nsIProxyObjectManager, proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIStringBundle),
m_pBundle, PROXY_SYNC | PROXY_ALWAYS, (void **) &strProxy);
}

Просмотреть файл

@ -27,7 +27,7 @@
#include "netCore.h"
#include "nsIFileStreams.h"
#include "nsCOMPtr.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsNetUtil.h"
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
@ -1072,7 +1072,7 @@ nsFileTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCa
proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = proxyMgr->GetProxyObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
rv = proxyMgr->GetProxyForObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink),
sink,
PROXY_ASYNC | PROXY_ALWAYS,

Просмотреть файл

@ -21,11 +21,12 @@
*/
#include "nsNetModRegEntry.h"
#include "nsCRT.h"
#include "plstr.h"
#include "nsMemory.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
@ -159,7 +160,7 @@ nsNetModRegEntry::BuildProxy(PRBool sync)
if (sync)
{
result = proxyManager->GetProxyObject( mEventQ,
result = proxyManager->GetProxyForObject( mEventQ,
NS_GET_IID(nsINetNotify),
mRealNotifier,
PROXY_SYNC | PROXY_ALWAYS,
@ -167,7 +168,7 @@ nsNetModRegEntry::BuildProxy(PRBool sync)
}
else
{
result = proxyManager->GetProxyObject( mEventQ,
result = proxyManager->GetProxyForObject( mEventQ,
NS_GET_IID(nsINetNotify),
mRealNotifier,
PROXY_ASYNC | PROXY_ALWAYS,

Просмотреть файл

@ -36,7 +36,7 @@
#include "nsISocketProviderService.h"
#include "nsStdURL.h"
#include "nsIInterfaceRequestor.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsXPIDLString.h"
#include "nsNetUtil.h"
@ -2179,7 +2179,7 @@ nsSocketTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
NS_WITH_SERVICE(nsIProxyObjectManager,
proxyMgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = proxyMgr->GetProxyObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
rv = proxyMgr->GetProxyForObject(NS_UI_THREAD_EVENTQ, // primordial thread - should change?
NS_GET_IID(nsIProgressEventSink),
sink,
PROXY_ASYNC | PROXY_ALWAYS,

Просмотреть файл

@ -55,7 +55,7 @@ nsStreamLoader::Init(nsIURI* aURL,
if (NS_FAILED(rv2)) return rv2;
nsCOMPtr<nsIStreamLoaderObserver> pObserver;
rv2 = pIProxyObjectManager->GetProxyObject(NS_CURRENT_EVENTQ,
rv2 = pIProxyObjectManager->GetProxyForObject(NS_CURRENT_EVENTQ,
NS_GET_IID(nsIStreamLoaderObserver), observer,
PROXY_ASYNC | PROXY_ALWAYS, getter_AddRefs(pObserver));
if (NS_FAILED(rv2)) return rv2;

Просмотреть файл

@ -810,7 +810,7 @@ nsFtpConnectionThread::S_user() {
nsCOMPtr<nsIPrompt> proxyprompter;
rv = pIProxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ,
rv = pIProxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ,
NS_GET_IID(nsIPrompt), mPrompter,
PROXY_SYNC, getter_AddRefs(proxyprompter));
PRUnichar *user = nsnull, *passwd = nsnull;
@ -887,7 +887,7 @@ nsFtpConnectionThread::S_pass() {
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPrompt> proxyprompter;
rv = pIProxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ,
rv = pIProxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ,
NS_GET_IID(nsIPrompt), mPrompter,
PROXY_SYNC, getter_AddRefs(proxyprompter));
PRUnichar *passwd = nsnull;
@ -952,7 +952,7 @@ nsFtpConnectionThread::R_pass() {
if (NS_FAILED(rv)) return FTP_ERROR;
nsCOMPtr<nsIWalletService> pWalletService;
rv = pIProxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ,
rv = pIProxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ,
NS_GET_IID(nsIWalletService), walletService,
PROXY_SYNC, getter_AddRefs(pWalletService));
if (NS_FAILED(rv)) return FTP_ERROR;

Просмотреть файл

@ -40,7 +40,6 @@
#include "nsNetUtil.h"
#include "nsIHttpNotify.h"
#include "nsINetModRegEntry.h"
#include "nsProxyObjectManager.h"
#include "nsIServiceManager.h"
#include "nsINetModuleMgr.h"
#include "nsIEventQueueService.h"
@ -60,20 +59,14 @@
#include "nsIPref.h"
#include "nsIAuthenticator.h"
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
#include "nsProxiedService.h"
static NS_DEFINE_IID(kProxyObjectManagerIID, NS_IPROXYEVENT_MANAGER_IID);
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kNetModuleMgrCID, NS_NETMODULEMGR_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
#if defined(PR_LOGGING)
extern PRLogModuleInfo* gHTTPLog;
#endif /* PR_LOGGING */
static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL, nsHTTPHandler* i_Handler):
mResponse(nsnull),

Просмотреть файл

@ -38,7 +38,6 @@
#include "nsHTTPAtoms.h"
#include "nsIHttpNotify.h"
#include "nsINetModRegEntry.h"
#include "nsProxyObjectManager.h"
#include "nsIServiceManager.h"
#include "nsINetModuleMgr.h"
#include "nsIEventQueueService.h"
@ -274,10 +273,6 @@ nsHTTPServerListener::~nsHTTPServerListener()
NS_IF_RELEASE(mResponse) ;
}
static NS_DEFINE_IID(kProxyObjectManagerIID, NS_IPROXYEVENT_MANAGER_IID) ;
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID) ;
static NS_DEFINE_CID(kNetModuleMgrCID, NS_NETMODULEMGR_CID) ;
////////////////////////////////////////////////////////////////////////////////
// nsIStreamListener methods:

Просмотреть файл

@ -279,7 +279,7 @@ nsPrefMigration::getPrefService()
if(NS_FAILED(rv))
return rv;
return pIProxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ,
return pIProxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ,
NS_GET_IID(nsIPref),
pIMyService,
PROXY_SYNC,
@ -370,7 +370,7 @@ extern "C" void ProfileMigrationController(void *data)
nsCOMPtr<nsIPrefMigration> prefProxy;
nsCOMPtr<nsIPrefMigration> migratorInterface = do_QueryInterface(interfaceM);
rv = pIProxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ,
rv = pIProxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ,
NS_GET_IID(nsIPrefMigration),
migratorInterface,
PROXY_SYNC,

Просмотреть файл

@ -28,7 +28,7 @@
#include "nsMemory.h"
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsConsoleService.h"
#include "nsConsoleMessage.h"
@ -253,11 +253,11 @@ nsConsoleService::RegisterListener(nsIConsoleListener *listener) {
*
* Would it be better to catch that case and leave the listener unproxied?
*/
rv = proxyManager->GetProxyObject(NS_CURRENT_EVENTQ,
NS_GET_IID(nsIConsoleListener),
listener,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(proxiedListener));
rv = proxyManager->GetProxyForObject(NS_CURRENT_EVENTQ,
NS_GET_IID(nsIConsoleListener),
listener,
PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(proxiedListener));
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -48,7 +48,7 @@
#include "nsEventQueueService.h"
#include "nsEventQueue.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxyEventPrivate.h" // access to the impl of nsProxyObjectManager for the generic factory registration.
#include "xptinfo.h"

Просмотреть файл

@ -3,5 +3,4 @@
#
nsProxyEvent.h
nsProxyObjectManager.h
nsProxiedService.h

Просмотреть файл

@ -31,11 +31,12 @@ XPIDL_MODULE = proxyObjInst
EXPORTS = \
nsProxyEvent.h \
nsProxyObjectManager.h \
nsProxiedService.h \
$(NULL)
XPIDLSRCS = nsIProxyCreateInstance.idl
XPIDLSRCS = nsIProxyCreateInstance.idl \
nsIProxyObjectManager.idl \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

Просмотреть файл

@ -27,13 +27,14 @@ MODULE=xpcom
EXPORTS = \
nsProxyEvent.h \
nsProxyObjectManager.h \
nsProxiedService.h \
nsProxiedService.h \
$(NULL)
XPIDL_MODULE = proxyObjInst
XPIDLSRCS = \
XPIDL_MODULE = proxyObject
XPIDLSRCS = \
.\nsIProxyCreateInstance.idl \
.\nsIProxyObjectManager.idl \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -25,7 +25,7 @@
#define __nsProxiedServiceManager_h_
#include "nsIServiceManager.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
////////////////////////////////////////////////////////////////////////////////
// NS_WITH_PROXIED_SERVICE: macro to make using services that need to be proxied
@ -40,7 +40,7 @@
// if(NS_FAILED(rv))
// return;
// nsIMyService pIProxiedObject = NULL;
// rv = pIProxyObjectManager->GetProxyObject(pIProxyQueue,
// rv = pIProxyObjectManager->GetProxyForObject(pIProxyQueue,
// NS_GET_IID(nsIMyService),
// pIMyService, PROXY_SYNC,
// (void**)&pIProxiedObject);
@ -96,7 +96,7 @@ class nsProxiedService
PRInt32 proxyType = PROXY_SYNC;
if (always) proxyType |= PROXY_ALWAYS;
*rv = pIProxyObjectManager->GetProxyObject(pIProxyQueue,
*rv = pIProxyObjectManager->GetProxyForObject(pIProxyQueue,
aIID,
mService,
proxyType,

Просмотреть файл

Просмотреть файл

@ -35,7 +35,7 @@
#include "nsProxyEvent.h"
#include "nsProxyEventPrivate.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "pratom.h"
#include "prmem.h"
@ -665,11 +665,11 @@ AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTC
if ( NS_SUCCEEDED( rv ) )
{
rv = manager->GetProxyObject(eventQ,
*iid,
anInterface,
GetProxyType(),
(void**) &aProxyObject);
rv = manager->GetProxyForObject(eventQ,
*iid,
anInterface,
GetProxyType(),
(void **) &aProxyObject);
}
}

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsProxyEvent.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxyEventPrivate.h"
#include "nsRepository.h"
@ -260,11 +260,11 @@ nsProxyEventClass::CallQueryInterfaceOnProxy(nsProxyEventObject* self, REFNSIID
return NS_ERROR_FAILURE;
}
rv = manager->GetProxyObject(self->GetQueue(),
aIID,
self->GetRealObject(),
self->GetProxyType(),
(void**)&aIdentificationObject);
rv = manager->GetProxyForObject(self->GetQueue(),
aIID,
self->GetRealObject(),
self->GetProxyType(),
(void**) &aIdentificationObject);
}
NS_IF_RELEASE((*aInstancePtr));

Просмотреть файл

@ -25,7 +25,7 @@
#include "prmem.h"
#include "nsProxyEvent.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxyEventPrivate.h"
#include "nsHashtable.h"

Просмотреть файл

@ -34,7 +34,7 @@
#include "nsIEventQueue.h"
#include "nsProxyEvent.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
class nsProxyEventObject;
class nsProxyEventClass;
@ -159,20 +159,8 @@ class nsProxyObjectManager: public nsIProxyObjectManager
public:
NS_DECL_ISUPPORTS
NS_IMETHOD GetProxyObject(nsIEventQueue *destQueue,
REFNSIID aIID,
nsISupports* aObj,
PRInt32 proxyType,
void** aProxyObject);
NS_IMETHOD GetProxyObject(nsIEventQueue *destQueue,
const nsCID &aClass,
nsISupports *aDelegate,
const nsIID &aIID,
PRInt32 proxyType,
void** aProxyObject);
NS_DECL_NSIPROXYOBJECTMANAGER
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsProxyEvent.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxyEventPrivate.h"
#include "nsIProxyCreateInstance.h"
@ -143,7 +143,11 @@ nsProxyObjectManager::Create(nsISupports* outer, const nsIID& aIID, void* *aInst
NS_IMETHODIMP
nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue, REFNSIID aIID, nsISupports* aObj, PRInt32 proxyType, void** aProxyObject)
nsProxyObjectManager::GetProxyForObject(nsIEventQueue *destQueue,
REFNSIID aIID,
nsISupports* aObj,
PRInt32 proxyType,
void** aProxyObject)
{
nsresult rv;
nsCOMPtr<nsIEventQueue> postQ;
@ -185,13 +189,14 @@ nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue, REFNSIID aIID, ns
NS_IMETHODIMP
nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue,
const nsCID &aClass,
nsISupports *aDelegate,
const nsIID &aIID,
PRInt32 proxyType,
void** aProxyObject)
nsProxyObjectManager::GetProxy( nsIEventQueue *destQueue,
const nsCID &aClass,
nsISupports *aDelegate,
const nsIID &aIID,
PRInt32 proxyType,
void** aProxyObject)
{
*aProxyObject = nsnull;
// 1. Create a proxy for creating an instance on another thread.
@ -202,7 +207,11 @@ nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue,
if (ciObject == nsnull)
return NS_ERROR_NULL_POINTER;
nsresult rv = GetProxyObject(destQueue, NS_GET_IID(nsIProxyCreateInstance), ciObject, PROXY_SYNC, (void**)&ciProxy);
nsresult rv = GetProxyForObject(destQueue,
NS_GET_IID(nsIProxyCreateInstance),
ciObject,
PROXY_SYNC,
(void**)&ciProxy);
if (NS_FAILED(rv))
{
@ -235,163 +244,17 @@ nsProxyObjectManager::GetProxyObject(nsIEventQueue *destQueue,
// 5. Now create a proxy object for the requested object.
rv = GetProxyObject(destQueue, aIID, aObj, proxyType, aProxyObject);
rv = GetProxyForObject(destQueue, aIID, aObj, proxyType, aProxyObject);
// 6. release ownership of aObj so that aProxyObject owns it.
NS_RELEASE(aObj);
// 7. return the error returned from GetProxyObject. Either way, we our out of here.
// 7. return the error returned from GetProxyForObject. Either way, we our out of here.
return rv;
}
/////////////////////////////////////////////////////////////////////////
// nsProxyEventFactory
/////////////////////////////////////////////////////////////////////////
nsProxyEventFactory::nsProxyEventFactory(void)
{
NS_INIT_REFCNT();
}
nsProxyEventFactory::~nsProxyEventFactory(void)
{
}
NS_IMPL_ISUPPORTS1(nsProxyEventFactory,nsIFactory)
NS_IMETHODIMP
nsProxyEventFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
if (aResult == nsnull)
{
return NS_ERROR_NULL_POINTER;
}
*aResult = nsnull;
nsProxyObjectManager *inst = nsProxyObjectManager::GetInstance();
if (inst == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsresult result = inst->QueryInterface(aIID, aResult);
if (NS_FAILED(result))
{
*aResult = nsnull;
}
NS_ADDREF(inst); // Are we sure that we need to addref???
return result;
}
NS_IMETHODIMP
nsProxyEventFactory::LockFactory(PRBool aLock)
{
// not implemented.
return NS_ERROR_NOT_IMPLEMENTED;
}
#if 0
////////////////////////////////////////////////////////////////////////////////
// DLL Entry Points:
////////////////////////////////////////////////////////////////////////////////
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
extern "C" NS_EXPORT PRBool
NSCanUnload(nsISupports* aServMgr)
{
return 0;
}
extern "C" NS_EXPORT nsresult
NSRegisterSelf(nsISupports* aServMgr, const char *path)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
NS_GET_IID(nsIComponentManager),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
#ifdef NS_DEBUG
printf("*** nsProxyObjectManager is being registered. Hold on to your seat...\n");
#endif
rv = compMgr->RegisterComponent(kProxyObjectManagerCID, nsnull, nsnull, path, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
extern "C" NS_EXPORT nsresult
NSUnregisterSelf(nsISupports* aServMgr, const char *path)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
if (NS_FAILED(rv)) return rv;
nsIComponentManager* compMgr;
rv = servMgr->GetService(kComponentManagerCID,
NS_GET_IID(nsIComponentManager),
(nsISupports**)&compMgr);
if (NS_FAILED(rv)) return rv;
#ifdef NS_DEBUG
printf("*** nsProxyObjectManager is being unregistered. Na na na na hey hey\n");
#endif
rv = compMgr->UnregisterComponent(kProxyObjectManagerCID, path);
if (NS_FAILED(rv)) goto done;
done:
(void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
return rv;
}
extern "C" NS_EXPORT nsresult
NSGetFactory(nsISupports* aServMgr,
const nsCID &aClass,
const char *aClassName,
const char *aProgID,
nsIFactory **aFactory)
{
if (aFactory == nsnull)
{
return NS_ERROR_NULL_POINTER;
}
*aFactory = nsnull;
nsProxyEventFactory *inst = nsnull;
if (aClass.Equals(kProxyObjectManagerCID) )
inst = new nsProxyEventFactory();
else
return NS_ERROR_ILLEGAL_VALUE;
if (inst == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(inst); // Stabilize
nsresult res = inst->QueryInterface(NS_GET_IID(nsIFactory), (void**) aFactory);
NS_RELEASE(inst); // Destabilize and avoid leaks. Note we also avoid delete <interface pointer>.
return res;
}
#endif

Просмотреть файл

@ -34,7 +34,7 @@
#include "nsITestProxy.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIEventQueueService.h"
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
@ -150,7 +150,7 @@ printf("calling back to caller!\n\n");
PR_ASSERT(manager);
manager->GetProxyObject((nsIEventQueue*)p1, NS_GET_IID(nsITestProxy), this, PROXY_SYNC, (void**)&proxyObject);
manager->GetProxyForObject((nsIEventQueue*)p1, NS_GET_IID(nsITestProxy), this, PROXY_SYNC, (void**)&proxyObject);
proxyObject->Test3(nsnull, nsnull);
printf("Deleting Proxy Object\n");
@ -210,9 +210,9 @@ void TestCase_TwoClassesOneInterface(void *arg)
PR_ASSERT(foo2);
manager->GetProxyObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
manager->GetProxyObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo2, PROXY_SYNC, (void**)&proxyObject2);
manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo2, PROXY_SYNC, (void**)&proxyObject2);
@ -277,7 +277,7 @@ void TestCase_NestedLoop(void *arg)
PR_ASSERT(foo);
manager->GetProxyObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
if (proxyObject)
{
@ -334,7 +334,7 @@ void TestCase_2(void *arg)
nsITestProxy *proxyObject;
manager->GetProxyObject(argsStruct->queue,
manager->GetProxy(argsStruct->queue,
NS_GET_IID(nsITestProxy), // should be CID!
nsnull,
NS_GET_IID(nsITestProxy),
@ -367,7 +367,7 @@ void TestCase_nsISupports(void *arg)
PR_ASSERT(foo);
manager->GetProxyObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
manager->GetProxyForObject(argsStruct->queue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
if (proxyObject != nsnull)
{
@ -444,7 +444,7 @@ static void PR_CALLBACK EventLoop( void *arg )
PR_ASSERT(foo);
manager->GetProxyObject(gEventQueue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
manager->GetProxyForObject(gEventQueue, NS_GET_IID(nsITestProxy), foo, PROXY_SYNC, (void**)&proxyObject);
PRInt32 a;
proxyObject->Test(1, 2, &a);

Просмотреть файл

@ -116,14 +116,15 @@
#include "nsIContentViewerFile.h"
#include "nsINameSpaceManager.h"
#include "nsFileStream.h"
#include "nsIProxyObjectManager.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kDocumentCharsetInfoCID, NS_DOCUMENTCHARSETINFO_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
// Stuff to implement find/findnext
#include "nsIFindComponent.h"
@ -172,7 +173,7 @@ FindNamedXULElement(nsIDocShell * aShell, const char *aId, nsCOMPtr<nsIDOMElemen
//*****************************************************************************
#ifdef ENABLE_PAGE_CYCLER
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsITimer.h"
static void TimesUp(nsITimer *aTimer, void *aClosure);
@ -251,10 +252,10 @@ public:
StopTimer();
NS_WITH_SERVICE(nsIAppShellService, appShellServ, kAppShellServiceCID, &rv);
if(NS_FAILED(rv)) return rv;
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager, nsIProxyObjectManager::GetCID(), &rv);
NS_WITH_SERVICE(nsIProxyObjectManager, pIProxyObjectManager, kProxyObjectManagerCID, &rv);
if(NS_FAILED(rv)) return rv;
nsCOMPtr<nsIAppShellService> appShellProxy;
rv = pIProxyObjectManager->GetProxyObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIAppShellService),
rv = pIProxyObjectManager->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIAppShellService),
appShellServ, PROXY_ASYNC | PROXY_ALWAYS,
getter_AddRefs(appShellProxy));

Просмотреть файл

@ -65,7 +65,7 @@
#include "nsIScriptExternalNameSet.h"
#include "nsIEventQueueService.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "nsIChromeRegistry.h"

Просмотреть файл

@ -50,7 +50,7 @@
#include "nsInstallProgressDialog.h"
#include "nsInstallResources.h"
#include "nsSpecialSystemDirectory.h"
#include "nsProxyObjectManager.h"
#include "nsIProxyObjectManager.h"
#include "nsIDOMWindow.h"
#include "nsDirectoryService.h"
#include "nsFileLocations.h"
@ -200,7 +200,7 @@ nsXPInstallManager::InitManager(nsXPITriggerInfo* aTriggers, PRUint32 aChromeTyp
NS_WITH_SERVICE( nsIProxyObjectManager, pmgr, kProxyObjectManagerCID, &rv);
if (NS_SUCCEEDED(rv))
{
rv = pmgr->GetProxyObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIXPIProgressDlg),
rv = pmgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIXPIProgressDlg),
Idlg, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs(mDlg) );
}