From e1274cde0a3f24d9c51944e7b0d341b470144a6d Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Sat, 24 Jun 2000 00:03:10 +0000 Subject: [PATCH] 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. --- dom/src/jsurl/nsJSProtocolHandler.cpp | 15 +- embedding/tests/winEmbed/WebBrowser.cpp | 31 +-- embedding/tests/winEmbed/WebBrowser.h | 3 + embedding/tests/winEmbed/makefile.win | 1 + embedding/tests/winEmbed/winEmbed.cpp | 137 ++++++++++---- mailnews/addrbook/src/nsAddrDatabase.cpp | 4 +- mailnews/imap/src/nsImapProtocol.cpp | 8 +- .../import/eudora/src/nsEudoraCompose.cpp | 6 +- .../eudora/src/nsEudoraStringBundle.cpp | 4 +- mailnews/import/oexpress/nsOEStringBundle.cpp | 4 +- .../import/outlook/src/nsOutlookCompose.cpp | 4 +- .../outlook/src/nsOutlookStringBundle.cpp | 4 +- mailnews/import/src/nsImportAddressBooks.cpp | 4 +- mailnews/import/src/nsImportMail.cpp | 8 +- mailnews/import/src/nsImportStringBundle.cpp | 4 +- .../import/text/src/nsTextStringBundle.cpp | 4 +- netwerk/base/src/nsFileTransport.cpp | 4 +- netwerk/base/src/nsNetModRegEntry.cpp | 7 +- netwerk/base/src/nsSocketTransport.cpp | 4 +- netwerk/base/src/nsStreamLoader.cpp | 2 +- .../ftp/src/nsFtpConnectionThread.cpp | 6 +- netwerk/protocol/http/src/nsHTTPChannel.cpp | 9 +- .../http/src/nsHTTPResponseListener.cpp | 5 - profile/pref-migrator/src/nsPrefMigration.cpp | 4 +- xpcom/base/nsConsoleService.cpp | 12 +- xpcom/build/nsXPComInit.cpp | 2 +- xpcom/proxy/public/MANIFEST | 1 - xpcom/proxy/public/Makefile.in | 5 +- xpcom/proxy/public/makefile.win | 9 +- xpcom/proxy/public/nsProxiedService.h | 6 +- xpcom/proxy/public/nsProxyObjectManager.h | 0 xpcom/proxy/src/nsProxyEvent.cpp | 12 +- xpcom/proxy/src/nsProxyEventClass.cpp | 12 +- xpcom/proxy/src/nsProxyEventObject.cpp | 2 +- xpcom/proxy/src/nsProxyEventPrivate.h | 18 +- xpcom/proxy/src/nsProxyObjectManager.cpp | 177 ++---------------- xpcom/proxy/tests/proxytests.cpp | 16 +- xpfe/browser/src/nsBrowserInstance.cpp | 11 +- xpinstall/src/nsSoftwareUpdate.cpp | 2 +- xpinstall/src/nsXPInstallManager.cpp | 4 +- 40 files changed, 247 insertions(+), 324 deletions(-) delete mode 100644 xpcom/proxy/public/nsProxyObjectManager.h diff --git a/dom/src/jsurl/nsJSProtocolHandler.cpp b/dom/src/jsurl/nsJSProtocolHandler.cpp index 64f802657d1..d541d3c6fab 100644 --- a/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -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 eval = new nsEvaluateStringProxy(); @@ -281,7 +288,7 @@ public: if (NS_FAILED(rv)) return rv; nsCOMPtr 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, diff --git a/embedding/tests/winEmbed/WebBrowser.cpp b/embedding/tests/winEmbed/WebBrowser.cpp index 0a318a7a4f9..a1bf69ff385 100644 --- a/embedding/tests/winEmbed/WebBrowser.cpp +++ b/embedding/tests/winEmbed/WebBrowser.cpp @@ -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 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 rootDocShell; mWebBrowser->GetDocShell(getter_AddRefs(rootDocShell)); rootDocShell->SetAllowPlugins(PR_TRUE); - webBrowserWin->SetVisibility(PR_TRUE); - - nsCOMPtr 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 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; -} +} \ No newline at end of file diff --git a/embedding/tests/winEmbed/WebBrowser.h b/embedding/tests/winEmbed/WebBrowser.h index 5f4c7c9144d..5a58f490c95 100644 --- a/embedding/tests/winEmbed/WebBrowser.h +++ b/embedding/tests/winEmbed/WebBrowser.h @@ -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 mWindow; nsCOMPtr mWebBrowser; + nsCOMPtr mBaseWindow; + }; #endif /* __WebBrowser__ */ diff --git a/embedding/tests/winEmbed/makefile.win b/embedding/tests/winEmbed/makefile.win index da19ef5a009..da2cc07c22e 100644 --- a/embedding/tests/winEmbed/makefile.win +++ b/embedding/tests/winEmbed/makefile.win @@ -35,6 +35,7 @@ OBJS = \ LLIBS= \ $(DIST)\lib\baseembed_s.lib \ + $(DIST)\lib\gkgfxwin.lib \ $(DIST)\lib\xpcom.lib \ $(LIBNSPR) \ $(NULL) diff --git a/embedding/tests/winEmbed/winEmbed.cpp b/embedding/tests/winEmbed/winEmbed.cpp index 470438eaa08..1a01dd68ef2 100644 --- a/embedding/tests/winEmbed/winEmbed.cpp +++ b/embedding/tests/winEmbed/winEmbed.cpp @@ -21,19 +21,26 @@ * Doug Turner */ +#include #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 scriptGlobalObject(do_GetInterface(aDocShell)); + + nsCOMPtr domWindow(do_QueryInterface(scriptGlobalObject)); + if (!domWindow) + return NS_ERROR_FAILURE; + + *aDOMWindow = domWindow.get(); + NS_ADDREF(*aDOMWindow); + + return NS_OK; +} + + +#define RUN_EDITOR 1 +nsCOMPtr 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 theBrowser; + + CreateNativeWindowWidget(getter_AddRefs(theBrowser)); + + +#ifndef RUN_EDITOR + nsCOMPtr 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 rootDocShell; + theBrowser->GetDocShell(getter_AddRefs(rootDocShell)); + + nsCOMPtr 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: diff --git a/mailnews/addrbook/src/nsAddrDatabase.cpp b/mailnews/addrbook/src/nsAddrDatabase.cpp index e2a2035a9e3..70fed921901 100644 --- a/mailnews/addrbook/src/nsAddrDatabase.cpp +++ b/mailnews/addrbook/src/nsAddrDatabase.cpp @@ -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 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) { diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index a8608cadfcc..19e702d7944 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -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 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 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 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, diff --git a/mailnews/import/eudora/src/nsEudoraCompose.cpp b/mailnews/import/eudora/src/nsEudoraCompose.cpp index be9d41610c0..4f1a1532b49 100644 --- a/mailnews/import/eudora/src/nsEudoraCompose.cpp +++ b/mailnews/import/eudora/src/nsEudoraCompose.cpp @@ -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; } diff --git a/mailnews/import/eudora/src/nsEudoraStringBundle.cpp b/mailnews/import/eudora/src/nsEudoraStringBundle.cpp index ed78398eb44..368daa5593b 100644 --- a/mailnews/import/eudora/src/nsEudoraStringBundle.cpp +++ b/mailnews/import/eudora/src/nsEudoraStringBundle.cpp @@ -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); } diff --git a/mailnews/import/oexpress/nsOEStringBundle.cpp b/mailnews/import/oexpress/nsOEStringBundle.cpp index 4655f22cde1..3fb1c46b69d 100644 --- a/mailnews/import/oexpress/nsOEStringBundle.cpp +++ b/mailnews/import/oexpress/nsOEStringBundle.cpp @@ -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); } diff --git a/mailnews/import/outlook/src/nsOutlookCompose.cpp b/mailnews/import/outlook/src/nsOutlookCompose.cpp index 32239876d54..2ff596ea0a6 100644 --- a/mailnews/import/outlook/src/nsOutlookCompose.cpp +++ b/mailnews/import/outlook/src/nsOutlookCompose.cpp @@ -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; diff --git a/mailnews/import/outlook/src/nsOutlookStringBundle.cpp b/mailnews/import/outlook/src/nsOutlookStringBundle.cpp index 0b0c211112d..45e4e787ca9 100644 --- a/mailnews/import/outlook/src/nsOutlookStringBundle.cpp +++ b/mailnews/import/outlook/src/nsOutlookStringBundle.cpp @@ -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); } diff --git a/mailnews/import/src/nsImportAddressBooks.cpp b/mailnews/import/src/nsImportAddressBooks.cpp index 6c9a7373c4d..11ae43fe9c1 100644 --- a/mailnews/import/src/nsImportAddressBooks.cpp +++ b/mailnews/import/src/nsImportAddressBooks.cpp @@ -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 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); diff --git a/mailnews/import/src/nsImportMail.cpp b/mailnews/import/src/nsImportMail.cpp index e9695ca4e7b..8ea0f5557e3 100644 --- a/mailnews/import/src/nsImportMail.cpp +++ b/mailnews/import/src/nsImportMail.cpp @@ -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 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--; } diff --git a/mailnews/import/src/nsImportStringBundle.cpp b/mailnews/import/src/nsImportStringBundle.cpp index ce2db9785e3..41402b0803e 100644 --- a/mailnews/import/src/nsImportStringBundle.cpp +++ b/mailnews/import/src/nsImportStringBundle.cpp @@ -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); } diff --git a/mailnews/import/text/src/nsTextStringBundle.cpp b/mailnews/import/text/src/nsTextStringBundle.cpp index b49aa5c71a3..3d3882e75c8 100644 --- a/mailnews/import/text/src/nsTextStringBundle.cpp +++ b/mailnews/import/text/src/nsTextStringBundle.cpp @@ -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); } diff --git a/netwerk/base/src/nsFileTransport.cpp b/netwerk/base/src/nsFileTransport.cpp index 0c9cd4882be..11f48490749 100644 --- a/netwerk/base/src/nsFileTransport.cpp +++ b/netwerk/base/src/nsFileTransport.cpp @@ -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, diff --git a/netwerk/base/src/nsNetModRegEntry.cpp b/netwerk/base/src/nsNetModRegEntry.cpp index d43bc409656..4d1b8fdfe07 100644 --- a/netwerk/base/src/nsNetModRegEntry.cpp +++ b/netwerk/base/src/nsNetModRegEntry.cpp @@ -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, diff --git a/netwerk/base/src/nsSocketTransport.cpp b/netwerk/base/src/nsSocketTransport.cpp index 89d549ce529..834d60c158b 100644 --- a/netwerk/base/src/nsSocketTransport.cpp +++ b/netwerk/base/src/nsSocketTransport.cpp @@ -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, diff --git a/netwerk/base/src/nsStreamLoader.cpp b/netwerk/base/src/nsStreamLoader.cpp index 3e309d6345b..a8465704727 100644 --- a/netwerk/base/src/nsStreamLoader.cpp +++ b/netwerk/base/src/nsStreamLoader.cpp @@ -55,7 +55,7 @@ nsStreamLoader::Init(nsIURI* aURL, if (NS_FAILED(rv2)) return rv2; nsCOMPtr 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; diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 4fedf38bc7a..c6eb4b0bc72 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -810,7 +810,7 @@ nsFtpConnectionThread::S_user() { nsCOMPtr 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 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 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; diff --git a/netwerk/protocol/http/src/nsHTTPChannel.cpp b/netwerk/protocol/http/src/nsHTTPChannel.cpp index 2ba31cb360f..32bf9fbd555 100644 --- a/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -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), diff --git a/netwerk/protocol/http/src/nsHTTPResponseListener.cpp b/netwerk/protocol/http/src/nsHTTPResponseListener.cpp index b8b72bb30b8..44a919a5e8a 100644 --- a/netwerk/protocol/http/src/nsHTTPResponseListener.cpp +++ b/netwerk/protocol/http/src/nsHTTPResponseListener.cpp @@ -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: diff --git a/profile/pref-migrator/src/nsPrefMigration.cpp b/profile/pref-migrator/src/nsPrefMigration.cpp index 83ff8b3176e..d594a71314a 100644 --- a/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/profile/pref-migrator/src/nsPrefMigration.cpp @@ -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 prefProxy; nsCOMPtr 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, diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index 8ec310649f9..986ff16598f 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -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; diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index fd41cefadcc..04d5c6b6e01 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -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" diff --git a/xpcom/proxy/public/MANIFEST b/xpcom/proxy/public/MANIFEST index aebddcefd71..9b7909a54fc 100644 --- a/xpcom/proxy/public/MANIFEST +++ b/xpcom/proxy/public/MANIFEST @@ -3,5 +3,4 @@ # nsProxyEvent.h -nsProxyObjectManager.h nsProxiedService.h diff --git a/xpcom/proxy/public/Makefile.in b/xpcom/proxy/public/Makefile.in index 05e5bb8e12c..a5b435b3089 100644 --- a/xpcom/proxy/public/Makefile.in +++ b/xpcom/proxy/public/Makefile.in @@ -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)) diff --git a/xpcom/proxy/public/makefile.win b/xpcom/proxy/public/makefile.win index c03d8694815..25b57a14bb4 100644 --- a/xpcom/proxy/public/makefile.win +++ b/xpcom/proxy/public/makefile.win @@ -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> diff --git a/xpcom/proxy/public/nsProxiedService.h b/xpcom/proxy/public/nsProxiedService.h index 3ec08c97c14..8c41e46ed6f 100644 --- a/xpcom/proxy/public/nsProxiedService.h +++ b/xpcom/proxy/public/nsProxiedService.h @@ -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, diff --git a/xpcom/proxy/public/nsProxyObjectManager.h b/xpcom/proxy/public/nsProxyObjectManager.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/xpcom/proxy/src/nsProxyEvent.cpp b/xpcom/proxy/src/nsProxyEvent.cpp index de5a219d5f8..7d5cdb30f1c 100644 --- a/xpcom/proxy/src/nsProxyEvent.cpp +++ b/xpcom/proxy/src/nsProxyEvent.cpp @@ -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); } } diff --git a/xpcom/proxy/src/nsProxyEventClass.cpp b/xpcom/proxy/src/nsProxyEventClass.cpp index 9c78ea23e70..946e2937abc 100644 --- a/xpcom/proxy/src/nsProxyEventClass.cpp +++ b/xpcom/proxy/src/nsProxyEventClass.cpp @@ -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)); diff --git a/xpcom/proxy/src/nsProxyEventObject.cpp b/xpcom/proxy/src/nsProxyEventObject.cpp index c0c94ff89f5..abac6dd943c 100644 --- a/xpcom/proxy/src/nsProxyEventObject.cpp +++ b/xpcom/proxy/src/nsProxyEventObject.cpp @@ -25,7 +25,7 @@ #include "prmem.h" #include "nsProxyEvent.h" -#include "nsProxyObjectManager.h" +#include "nsIProxyObjectManager.h" #include "nsProxyEventPrivate.h" #include "nsHashtable.h" diff --git a/xpcom/proxy/src/nsProxyEventPrivate.h b/xpcom/proxy/src/nsProxyEventPrivate.h index b91730e0016..f5b855e21a9 100644 --- a/xpcom/proxy/src/nsProxyEventPrivate.h +++ b/xpcom/proxy/src/nsProxyEventPrivate.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); diff --git a/xpcom/proxy/src/nsProxyObjectManager.cpp b/xpcom/proxy/src/nsProxyObjectManager.cpp index 9c7bbc373ee..f71595b9c91 100644 --- a/xpcom/proxy/src/nsProxyObjectManager.cpp +++ b/xpcom/proxy/src/nsProxyObjectManager.cpp @@ -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 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 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 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 . - - return res; -} -#endif - diff --git a/xpcom/proxy/tests/proxytests.cpp b/xpcom/proxy/tests/proxytests.cpp index 2fa491cf7e9..a941aefd757 100644 --- a/xpcom/proxy/tests/proxytests.cpp +++ b/xpcom/proxy/tests/proxytests.cpp @@ -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); diff --git a/xpfe/browser/src/nsBrowserInstance.cpp b/xpfe/browser/src/nsBrowserInstance.cpp index ac36d3be4ae..10f584f5c17 100644 --- a/xpfe/browser/src/nsBrowserInstance.cpp +++ b/xpfe/browser/src/nsBrowserInstance.cpp @@ -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 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)); diff --git a/xpinstall/src/nsSoftwareUpdate.cpp b/xpinstall/src/nsSoftwareUpdate.cpp index 824a9670922..05389a3f3ca 100644 --- a/xpinstall/src/nsSoftwareUpdate.cpp +++ b/xpinstall/src/nsSoftwareUpdate.cpp @@ -65,7 +65,7 @@ #include "nsIScriptExternalNameSet.h" #include "nsIEventQueueService.h" -#include "nsProxyObjectManager.h" +#include "nsIProxyObjectManager.h" #include "nsProxiedService.h" #include "nsIChromeRegistry.h" diff --git a/xpinstall/src/nsXPInstallManager.cpp b/xpinstall/src/nsXPInstallManager.cpp index 9146a8c1c86..b59aa236278 100644 --- a/xpinstall/src/nsXPInstallManager.cpp +++ b/xpinstall/src/nsXPInstallManager.cpp @@ -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) ); }