Make --disable-ipc work... mac-ppc now builds by default.

This commit is contained in:
Benjamin Smedberg 2009-07-20 15:04:52 -04:00
Родитель 69604af50f
Коммит 3f76d197c8
11 изменённых файлов: 97 добавлений и 30 удалений

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

@ -5333,6 +5333,10 @@ if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
fi
if test -n "$MOZ_IPC"; then
AC_DEFINE(MOZ_IPC)
fi
AC_SUBST(MOZ_IPC)
dnl ========================================================

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

@ -87,8 +87,13 @@
#include "nsThreadUtils.h"
#include "nsIView.h"
#ifdef MOZ_IPC
#include "TabParent.h"
using namespace mozilla;
using namespace mozilla::tabs;
#endif
#ifdef MOZ_WIDGET_GTK2
#include "mozcontainer.h"
@ -96,9 +101,6 @@
#include <gtk/gtk.h>
#endif
using namespace mozilla;
using namespace mozilla::tabs;
class nsAsyncDocShellDestroyer : public nsRunnable
{
public:
@ -209,6 +211,7 @@ nsFrameLoader::ReallyStartLoading()
{
NS_ENSURE_STATE(mURIToLoad && mOwnerContent && mOwnerContent->IsInDoc());
#ifdef MOZ_IPC
if (!mTriedNewProcess) {
TryNewProcess();
mTriedNewProcess = PR_TRUE;
@ -219,6 +222,7 @@ nsFrameLoader::ReallyStartLoading()
mChildProcess->LoadURL(mURIToLoad);
return NS_OK;
}
#endif
// Just to be safe, recheck uri.
nsresult rv = CheckURILoad(mURIToLoad);
@ -1035,6 +1039,7 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
return NS_OK;
}
#ifdef MOZ_IPC
PRBool
nsFrameLoader::TryNewProcess()
{
@ -1153,3 +1158,4 @@ nsFrameLoader::TryNewProcess()
return PR_TRUE;
}
#endif

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

@ -52,24 +52,29 @@
class nsIContent;
class nsIURI;
#ifdef MOZ_IPC
namespace mozilla {
namespace tabs {
class TabParent;
}
}
#endif
class nsFrameLoader : public nsIFrameLoader
{
public:
nsFrameLoader(nsIContent *aOwner) :
mOwnerContent(aOwner),
mDepthTooGreat(PR_FALSE),
mIsTopLevelContent(PR_FALSE),
mDestroyCalled(PR_FALSE),
mNeedsAsyncDestroy(PR_FALSE),
mInSwap(PR_FALSE),
mChildProcess(nsnull),
mTriedNewProcess(PR_FALSE)
nsFrameLoader(nsIContent *aOwner)
: mOwnerContent(aOwner)
, mDepthTooGreat(PR_FALSE)
, mIsTopLevelContent(PR_FALSE)
, mDestroyCalled(PR_FALSE)
, mNeedsAsyncDestroy(PR_FALSE)
, mInSwap(PR_FALSE)
#ifdef MOZ_IPC
, mChildProcess(nsnull)
, mTriedNewProcess(PR_FALSE)
#endif
{}
~nsFrameLoader() {
@ -97,8 +102,10 @@ private:
NS_HIDDEN_(void) GetURL(nsString& aURL);
nsresult CheckURILoad(nsIURI* aURI);
#ifdef MOZ_IPC
// True means new process started; nothing else to do
PRBool TryNewProcess();
#endif
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIURI> mURIToLoad;
@ -109,9 +116,11 @@ private:
PRPackedBool mNeedsAsyncDestroy : 1;
PRPackedBool mInSwap : 1;
#ifdef MOZ_IPC
// XXX leaking
mozilla::tabs::TabParent* mChildProcess;
PRBool mTriedNewProcess;
#endif
};
#endif

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

@ -79,11 +79,11 @@ DIRS += \
base \
src \
locales \
plugins \
$(NULL)
ifdef MOZ_IPC
DIRS += \
plugins \
ipc \
$(NULL)
endif

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

@ -44,13 +44,17 @@ include $(DEPTH)/config/autoconf.mk
MODULE = dom
EXPORTS_NAMESPACES = mozilla mozilla/plugins
EXPORTS_NAMESPACES = mozilla
EXPORTS_mozilla = \
SharedLibrary.h \
SharedPRLibrary.h \
$(NULL)
ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla mozilla/plugins
EXPORTS_mozilla/plugins = \
NPAPIPluginChild.h \
NPAPIPluginParent.h \
@ -78,11 +82,12 @@ CPPSRCS = \
$(NULL)
LOCAL_INCLUDES = \
-I$(topsrcdir)/ipc/chromium/ \
-I$(topsrcdir)/modules/plugin/base/public/ \
-I$(topsrcdir)/modules/plugin/base/src/ \
$(NULL)
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
endif
include $(topsrcdir)/config/rules.mk

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

@ -46,6 +46,8 @@ CHROMIUM_CONFIG_INCLUDED = 1
EXTRA_DEPS += $(topsrcdir)/ipc/chromium/chromium-config.mk
ifdef MOZ_IPC # {
DEFINES += \
-DEXCLUDE_SKIA_DEPENDENCIES \
-DCHROMIUM_MOZILLA_BUILD \
@ -110,3 +112,5 @@ OS_CFLAGS += $(MOZ_GTK2_CFLAGS)
endif # }
endif # }
endif # }

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

@ -89,10 +89,12 @@
#include "nsICookieService.h"
#include "mozilla/SharedPRLibrary.h"
#include "mozilla/plugins/NPAPIPluginParent.h"
using mozilla::SharedPRLibrary;
#ifdef MOZ_IPC
#include "mozilla/plugins/NPAPIPluginParent.h"
using mozilla::plugins::NPAPIPluginParent;
#endif
static PRLock *sPluginThreadAsyncCallLock = nsnull;
static PRCList sPendingAsyncCalls = PR_INIT_STATIC_CLIST(&sPendingAsyncCalls);
@ -305,9 +307,9 @@ nsNPAPIPlugin::nsNPAPIPlugin(NPPluginFuncs* callbacks,
memset((void*) &np_callbacks, 0, sizeof(np_callbacks));
np_callbacks.size = sizeof(np_callbacks);
fShutdownEntry = (NP_PLUGINSHUTDOWN)PR_FindSymbol(aLibrary, "NP_Shutdown");
NP_GETENTRYPOINTS pfnGetEntryPoints = (NP_GETENTRYPOINTS)PR_FindSymbol(aLibrary, "NP_GetEntryPoints");
NP_PLUGININIT pfnInitialize = (NP_PLUGININIT)PR_FindSymbol(aLibrary, "NP_Initialize");
fShutdownEntry = (NP_PLUGINSHUTDOWN)aLibrary->FindSymbol("NP_Shutdown");
NP_GETENTRYPOINTS pfnGetEntryPoints = (NP_GETENTRYPOINTS)aLibrary->FindSymbol("NP_GetEntryPoints");
NP_PLUGININIT pfnInitialize = (NP_PLUGININIT)aLibrary->FindSymbol("NP_Initialize");
if (!pfnGetEntryPoints || !pfnInitialize || !fShutdownEntry) {
NS_WARNING("Not all necessary functions exposed by plugin, it will not load.");
return;
@ -373,10 +375,14 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
callbacks.size = sizeof(callbacks);
SharedLibrary* pluginLib;
#ifdef MOZ_IPC
if (PR_GetEnv("DISABLE_OOP_PLUGINS") || !aFilePath)
pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
else
pluginLib = NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
#else
pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
#endif
NP_PLUGINSHUTDOWN pfnShutdown =
(NP_PLUGINSHUTDOWN) pluginLib->FindFunctionSymbol("NP_Shutdown");
@ -414,10 +420,14 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
#ifdef XP_WIN
SharedLibrary* pluginLib;
#ifdef MOZ_IPC
if (PR_GetEnv("DISABLE_OOP_PLUGINS") || !aFilePath)
pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
else
pluginLib = NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
#else
pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
#endif
// Note: on Windows, we must use the fCallback because plugins may
// change the function table. The Shockwave installer makes changes
@ -539,7 +549,16 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
nsPluginFile pluginFile(pluginPath);
pluginRefNum = pluginFile.OpenPluginResource();
nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, aLibrary, nsnull);
SharedLibrary* pluginLib;
#ifdef MOZ_IPC
if (PR_GetEnv("DISABLE_OOP_PLUGINS") || !aFilePath)
pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
else
pluginLib = NPAPIPluginParent::LoadModule(aFilePath, aLibrary);
#else
pluginLib = new SharedPRLibrary(aFilePath, aLibrary);
#endif
nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, pluginLib, aLibrary, nsnull);
::UseResFile(appRefNum);
if (!plugin)
return NS_ERROR_OUT_OF_MEMORY;

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

@ -207,6 +207,7 @@
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
#endif
#ifdef MOZ_IPC
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/message_loop.h"
@ -215,6 +216,7 @@
using mozilla::ipc::BrowserProcessSubThread;
using mozilla::ipc::GeckoThread;
#endif
// on x86 linux, the current builds of some popular plugins (notably
// flashplayer and real) expect a few builtin symbols from libgcc
@ -2950,10 +2952,12 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
MOZ_SPLASHSCREEN_UPDATE(20);
#ifdef MOZ_IPC
// Set up chromium libs
base::AtExitManager exitManager;
CommandLine::Init(gArgc, gArgv);
MessageLoopForUI mainMessageLoop;
#endif
{
nsXREDirProvider dirProvider;
@ -3412,6 +3416,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
return NS_ERROR_FAILURE;
}
#endif
#ifdef MOZ_IPC
scoped_ptr<base::Thread> ipcThread(
new BrowserProcessSubThread(BrowserProcessSubThread::IO));
base::Thread::Options options;
@ -3420,6 +3425,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
NS_ERROR("Failed to create chromium's IO thread!");
return NS_ERROR_FAILURE;
}
#endif
NS_TIMELINE_ENTER("appStartup->Run");
rv = appStartup->Run();

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

@ -41,12 +41,6 @@
#include "prenv.h"
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/thread.h"
#include "chrome/common/child_process.h"
#include "nsIAppShell.h"
#include "nsIAppStartupNotifier.h"
#include "nsIDirectoryService.h"
@ -64,6 +58,13 @@
#include "nsWidgetsCID.h"
#include "nsXREDirProvider.h"
#ifdef MOZ_IPC
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/thread.h"
#include "chrome/common/child_process.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/ipc/GeckoThread.h"
#include "ScopedXREEmbed.h"
@ -96,6 +97,7 @@ using mozilla::test::TestThreadChild;
using mozilla::Monitor;
using mozilla::MonitorAutoEnter;
#endif
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
@ -229,6 +231,7 @@ XRE_StringToChildProcessType(const char* aProcessTypeString)
return GeckoChildProcess_Invalid;
}
#ifdef MOZ_IPC
nsresult
XRE_InitChildProcess(int aArgc,
char* aArgv[],
@ -546,3 +549,4 @@ XRE_RunIPCTestHarness(int aArgc, char* aArgv[])
NS_ENSURE_SUCCESS(rv, 1);
return 0;
}
#endif

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

@ -41,7 +41,9 @@
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZ_IPC
#include "base/message_loop.h"
#endif
// When processing the next thread event, the appshell may process native
// events (if not in performance mode), which can result in suppressing the
@ -166,9 +168,16 @@ nsBaseAppShell::Run(void)
NS_ENSURE_STATE(!mRunning); // should not call Run twice
mRunning = PR_TRUE;
MessageLoop::current()->Run();
nsIThread *thread = NS_GetCurrentThread();
NS_ProcessPendingEvents(NS_GetCurrentThread());
#ifdef MOZ_IPC
MessageLoop::current()->Run();
#else
while (!mExiting)
NS_ProcessNextEvent(thread);
#endif
NS_ProcessPendingEvents(thread);
mRunning = PR_FALSE;
return NS_OK;
@ -177,9 +186,11 @@ nsBaseAppShell::Run(void)
NS_IMETHODIMP
nsBaseAppShell::Exit(void)
{
#ifdef MOZ_IPC
if (mRunning && !mExiting) {
MessageLoop::current()->Quit();
}
#endif
mExiting = PR_TRUE;
return NS_OK;
}

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

@ -418,7 +418,6 @@ XRE_API(nsresult,
XRE_API(void,
XRE_FreeAppData, (nsXREAppData *aAppData))
enum GeckoChildProcessType {
GeckoChildProcess_Default,