--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -943,18 +943,20 @@ pref("toolbar.customization.usesheet", f
// (Turning it on in a no-IPC build will have no effect.)
#ifdef XP_MACOSX
// i386 ipc preferences
pref("dom.ipc.plugins.enabled.i386", false);
pref("dom.ipc.plugins.enabled.i386.flash player.plugin", true);
pref("dom.ipc.plugins.enabled.i386.javaplugin2_npapi.plugin", true);
// x86_64 ipc preferences
pref("dom.ipc.plugins.enabled.x86_64", true);
+#elifdef MOZ_IPC
+pref("dom.ipc.plugins.enabled", true);
#else
-pref("dom.ipc.plugins.enabled", true);
+pref("dom.ipc.plugins.enabled", false);
#endif
#ifdef XP_WIN
#ifndef WINCE
pref("browser.taskbar.previews.enable", false);
pref("browser.taskbar.previews.max", 20);
pref("browser.taskbar.previews.cachetime", 5);
pref("browser.taskbar.lists.enabled", true);
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -89,16 +89,17 @@ DEFINES += -DJAREXT=
endif
ifdef MOZ_ANGLE
DEFINES += -DMOZ_ANGLE=$(MOZ_ANGLE)
DEFINES += -DMOZ_D3DX9_DLL=$(MOZ_D3DX9_DLL)
DEFINES += -DMOZ_D3DCOMPILER_DLL=$(MOZ_D3DCOMPILER_DLL)
endif
+# Don't ifdef MOZ_IPC this because mac ppc needs it too.
include $(topsrcdir)/ipc/app/defs.mk
DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
ifdef MOZ_PKG_MANIFEST_P
MOZ_PKG_MANIFEST = package-manifest
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $< > $@
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -46,21 +46,23 @@
@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
#ifdef XP_MACOSX
@BINPATH@/XUL
#else
@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
#endif
+#ifdef MOZ_IPC
#ifdef XP_MACOSX
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
#else
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
#endif
+#endif
#ifdef WINCE
@BINPATH@/mozce_shunt.dll
#elifdef XP_WIN32
#ifndef MOZ_MEMORY
#if _MSC_VER == 1400
@BINPATH@/Microsoft.VC80.CRT.manifest
@BINPATH@/msvcm80.dll
@BINPATH@/msvcp80.dll
--- a/chrome/src/Makefile.in
+++ b/chrome/src/Makefile.in
@@ -53,19 +53,22 @@ EXPORTS_NAMESPACES = mozilla/chrome
EXPORTS_mozilla/chrome = \
RegistryMessageUtils.h \
$(NULL)
CPPSRCS = \
nsChromeRegistry.cpp \
nsChromeRegistryChrome.cpp \
nsChromeProtocolHandler.cpp \
- nsChromeRegistryContent.cpp \
$(NULL)
+ifdef MOZ_IPC
+CPPSRCS += nsChromeRegistryContent.cpp
+endif
+
EXTRA_DSO_LDOPTS = \
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
endif
--- a/chrome/src/nsChromeRegistry.cpp
+++ b/chrome/src/nsChromeRegistry.cpp
@@ -36,17 +36,19 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsChromeRegistry.h"
#include "nsChromeRegistryChrome.h"
+#ifdef MOZ_IPC
#include "nsChromeRegistryContent.h"
+#endif
#include <string.h>
#include "prio.h"
#include "prprf.h"
#include "nsCOMPtr.h"
#include "nsDOMError.h"
@@ -670,18 +672,20 @@ already_AddRefed<nsChromeRegistry>
nsChromeRegistry::GetSingleton()
{
if (gChromeRegistry) {
NS_ADDREF(gChromeRegistry);
return gChromeRegistry;
}
nsRefPtr<nsChromeRegistry> cr;
+#ifdef MOZ_IPC
if (GeckoProcessType_Content == XRE_GetProcessType())
cr = new nsChromeRegistryContent();
else
+#endif
cr = new nsChromeRegistryChrome();
if (NS_FAILED(cr->Init()))
return NULL;
return cr.forget();
}
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -31,19 +31,21 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/PContentParent.h"
#include "RegistryMessageUtils.h"
#include "nsResProtocolHandler.h"
+#endif
#include "nsChromeRegistryChrome.h"
#if defined(XP_WIN)
#include <windows.h>
#elif defined(XP_MACOSX)
#include <CoreServices/CoreServices.h>
#elif defined(MOZ_WIDGET_GTK2)
@@ -436,16 +438,17 @@ void nsChromeRegistryChrome::UpdateSelec
mozilla::services::GetObserverService();
NS_ASSERTION(obsSvc, "Couldn't get observer service.");
obsSvc->NotifyObservers((nsIChromeRegistry*) this,
"selected-locale-has-changed", nsnull);
}
}
}
+#ifdef MOZ_IPC
static void
SerializeURI(nsIURI* aURI,
SerializedURI& aSerializedURI)
{
if (!aURI)
return;
aURI->GetSpec(aSerializedURI.spec);
@@ -533,16 +536,17 @@ nsChromeRegistryChrome::CollectPackages(
contentURI,
localeURI,
skinURI,
package->flags
};
args->packages.AppendElement(chromePackage);
return (PLDHashOperator)PL_DHASH_NEXT;
}
+#endif
static PRBool
CanLoadResource(nsIURI* aResourceURI)
{
PRBool isLocalResource = PR_FALSE;
(void)NS_URIChainHasFlags(aResourceURI,
nsIProtocolHandler::URI_IS_LOCAL_RESOURCE,
&isLocalResource);
--- a/chrome/src/nsChromeRegistryChrome.h
+++ b/chrome/src/nsChromeRegistryChrome.h
@@ -70,22 +70,26 @@ class nsChromeRegistryChrome : public ns
#ifdef MOZ_XUL
NS_OVERRIDE NS_IMETHOD GetXULOverlays(nsIURI *aURI,
nsISimpleEnumerator **_retval);
NS_OVERRIDE NS_IMETHOD GetStyleOverlays(nsIURI *aURI,
nsISimpleEnumerator **_retval);
#endif
+#ifdef MOZ_IPC
void SendRegisteredChrome(mozilla::dom::PContentParent* aChild);
+#endif
private:
+#ifdef MOZ_IPC
static PLDHashOperator CollectPackages(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 number, void *arg);
+#endif
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
NS_OVERRIDE void UpdateSelectedLocale();
NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath);
NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage,
PRUint32* aFlags);
--- a/chrome/test/Makefile.in
+++ b/chrome/test/Makefile.in
@@ -42,14 +42,16 @@ relativesrcdir = chrome/test
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = test_chrome
XPCSHELL_TESTS = unit \
$(NULL)
+ifdef MOZ_IPC
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += unit_ipc
endif
+endif
include $(topsrcdir)/config/rules.mk
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -97,16 +97,17 @@ MOZ_JS_LIBS = @MOZ_JS_LIBS@
MOZ_DEBUG = @MOZ_DEBUG@
MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@
MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@
MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@
MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@
MOZ_EXTENSIONS = @MOZ_EXTENSIONS@
MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@
+MOZ_IPC = @MOZ_IPC@
MOZ_IPDL_TESTS = @MOZ_IPDL_TESTS@
MOZ_LEAKY = @MOZ_LEAKY@
MOZ_MEMORY = @MOZ_MEMORY@
MOZ_PROFILING = @MOZ_PROFILING@
MOZ_JPROF = @MOZ_JPROF@
MOZ_SHARK = @MOZ_SHARK@
MOZ_CALLGRIND = @MOZ_CALLGRIND@
MOZ_VTUNE = @MOZ_VTUNE@
--- a/configure.in
+++ b/configure.in
@@ -4945,16 +4945,17 @@ MOZ_ARG_HEADER(Application)
BUILD_STATIC_LIBS=
ENABLE_TESTS=1
MOZ_ACTIVEX_SCRIPTING_SUPPORT=
MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING=
MOZ_FEEDS=1
MOZ_INSTALLER=1
+MOZ_IPC=1
MOZ_JAVAXPCOM=
MOZ_JSDEBUGGER=1
MOZ_MATHML=1
MOZ_MORK=
MOZ_MORKREADER=1
MOZ_AUTH_EXTENSION=1
MOZ_NO_ACTIVEX_SUPPORT=1
MOZ_NO_FAST_LOAD=
@@ -5817,16 +5818,31 @@ dnl = JS Debugger XPCOM component (js/js
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(jsd,
[ --disable-jsd Disable JavaScript debug library],
MOZ_JSDEBUGGER=,
MOZ_JSDEBUGGER=1)
dnl ========================================================
+dnl = Disable IPC support for tabs and plugins
+dnl ========================================================
+MOZ_ARG_DISABLE_BOOL(ipc,
+[ --disable-ipc Disable IPC for tabs and plugins (not supported)],
+ MOZ_IPC=,
+ MOZ_IPC=1)
+
+if test -z "$MOZ_IPC"; then
+ AC_MSG_ERROR([--disable-ipc is no longer supported.])
+fi
+
+AC_DEFINE(MOZ_IPC)
+AC_SUBST(MOZ_IPC)
+
+dnl ========================================================
dnl = Enable IPDL's "expensive" unit tests
dnl ========================================================
MOZ_IPDL_TESTS=
MOZ_ARG_ENABLE_BOOL(ipdl-tests,
[ --enable-ipdl-tests Enable expensive IPDL tests],
MOZ_IPDL_TESTS=1,
MOZ_IPDL_TESTS=)
--- a/content/base/src/Makefile.in
+++ b/content/base/src/Makefile.in
@@ -173,19 +173,24 @@ FORCE_STATIC_LIB = 1
EXTRA_COMPONENTS = \
$(srcdir)/nsBadCertHandler.js \
nsBadCertHandler.manifest \
contentSecurityPolicy.js \
contentSecurityPolicy.manifest \
contentAreaDropListener.js \
contentAreaDropListener.manifest \
+ $(NULL)
+
+ifdef MOZ_IPC
+EXTRA_COMPONENTS += \
messageWakeupService.js \
messageWakeupService.manifest \
$(NULL)
+endif
EXTRA_JS_MODULES = \
CSPUtils.jsm \
$(NULL)
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -8345,20 +8345,22 @@ PLDHashOperator UnlockEnumerator(imgIReq
aKey->UnlockImage();
return PL_DHASH_NEXT;
}
nsresult
nsDocument::SetImageLockingState(PRBool aLocked)
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content &&
!nsContentUtils::GetBoolPref("content.image.allow_locking", PR_TRUE)) {
return NS_OK;
}
+#endif // MOZ_IPC
// If there's no change, there's nothing to do.
if (mLockingImages == aLocked)
return NS_OK;
// Otherwise, iterate over our images and perform the appropriate action.
mImageTracker.EnumerateRead(aLocked ? LockEnumerator
: UnlockEnumerator,
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -39,17 +39,19 @@
*
* ***** END LICENSE BLOCK ***** */
/*
* Class for managing loading of a subframe (creation of the docshell,
* handling of loads in it, recursion-checking).
*/
-#include "base/basictypes.h"
+#ifdef MOZ_IPC
+# include "base/basictypes.h"
+#endif
#include "prenv.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMWindow.h"
#include "nsIPresShell.h"
#include "nsIContent.h"
@@ -105,22 +107,25 @@
#include "nsIDOMChromeWindow.h"
#include "nsInProcessTabChildGlobal.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/unused.h"
#include "Layers.h"
+#ifdef MOZ_IPC
#include "ContentParent.h"
#include "TabParent.h"
#include "mozilla/layout/RenderFrameParent.h"
using namespace mozilla;
using namespace mozilla::dom;
+#endif
+
using namespace mozilla::layers;
typedef FrameMetrics::ViewID ViewID;
#include "jsapi.h"
class nsAsyncDocShellDestroyer : public nsRunnable
{
public:
@@ -314,21 +319,23 @@ nsFrameLoader::nsFrameLoader(nsIContent
, mDepthTooGreat(PR_FALSE)
, mIsTopLevelContent(PR_FALSE)
, mDestroyCalled(PR_FALSE)
, mNeedsAsyncDestroy(PR_FALSE)
, mInSwap(PR_FALSE)
, mInShow(PR_FALSE)
, mHideCalled(PR_FALSE)
, mNetworkCreated(aNetworkCreated)
+#ifdef MOZ_IPC
, mDelayRemoteDialogs(PR_FALSE)
, mRemoteBrowserShown(PR_FALSE)
, mRemoteFrame(false)
, mCurrentRemoteFrame(nsnull)
, mRemoteBrowser(nsnull)
+#endif
, mRenderMode(RENDER_MODE_DEFAULT)
{
}
nsFrameLoader*
nsFrameLoader::Create(nsIContent* aOwner, PRBool aNetworkCreated)
{
NS_ENSURE_TRUE(aOwner, nsnull);
@@ -436,30 +443,32 @@ nsFrameLoader::ReallyStartLoadingInterna
{
NS_ENSURE_STATE(mURIToLoad && mOwnerContent && mOwnerContent->IsInDoc());
nsresult rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
return rv;
}
+#ifdef MOZ_IPC
if (mRemoteFrame) {
if (!mRemoteBrowser) {
TryRemoteBrowser();
if (!mRemoteBrowser) {
NS_WARNING("Couldn't create child process for iframe.");
return NS_ERROR_FAILURE;
}
}
// FIXME get error codes from child
mRemoteBrowser->LoadURL(mURIToLoad);
return NS_OK;
}
+#endif
NS_ASSERTION(mDocShell,
"MaybeCreateDocShell succeeded with a null mDocShell");
// Just to be safe, recheck uri.
rv = CheckURILoad(mURIToLoad);
NS_ENSURE_SUCCESS(rv, rv);
@@ -520,38 +529,42 @@ nsFrameLoader::CheckURILoad(nsIURI* aURI
return rv; // We're not
}
// Bail out if this is an infinite recursion scenario
rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
return rv;
}
+#ifdef MOZ_IPC
if (mRemoteFrame) {
return NS_OK;
}
+#endif
return CheckForRecursiveLoad(aURI);
}
NS_IMETHODIMP
nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
{
*aDocShell = nsnull;
// If we have an owner, make sure we have a docshell and return
// that. If not, we're most likely in the middle of being torn down,
// then we just return null.
if (mOwnerContent) {
nsresult rv = MaybeCreateDocShell();
if (NS_FAILED(rv))
return rv;
+#ifdef MOZ_IPC
if (mRemoteFrame) {
NS_WARNING("No docshells for remote frames!");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ASSERTION(mDocShell,
"MaybeCreateDocShell succeeded, but null mDocShell");
}
*aDocShell = mDocShell;
NS_IF_ADDREF(*aDocShell);
return NS_OK;
@@ -758,17 +771,20 @@ nsFrameLoader::Show(PRInt32 marginWidth,
AutoResetInShow resetInShow(this);
mInShow = PR_TRUE;
nsresult rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
return PR_FALSE;
}
- if (!mRemoteFrame) {
+#ifdef MOZ_IPC
+ if (!mRemoteFrame)
+#endif
+ {
if (!mDocShell)
return PR_FALSE;
nsCOMPtr<nsIPresShell> presShell;
mDocShell->GetPresShell(getter_AddRefs(presShell));
if (presShell)
return PR_TRUE;
mDocShell->SetMarginWidth(marginWidth);
@@ -782,19 +798,21 @@ nsFrameLoader::Show(PRInt32 marginWidth,
scrollbarPrefY);
}
}
nsIView* view = frame->EnsureInnerView();
if (!view)
return PR_FALSE;
+#ifdef MOZ_IPC
if (mRemoteFrame) {
return ShowRemoteFrame(GetSubDocumentSize(frame));
}
+#endif
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mDocShell);
NS_ASSERTION(baseWindow, "Found a nsIDocShell that isn't a nsIBaseWindow.");
nsIntSize size;
if (!(frame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// We have a useful size already; use it, since we might get no
// more size updates.
size = GetSubDocumentSize(frame);
@@ -857,16 +875,17 @@ nsFrameLoader::Show(PRInt32 marginWidth,
if (mHideCalled) {
mHideCalled = PR_FALSE;
Hide();
return PR_FALSE;
}
return PR_TRUE;
}
+#ifdef MOZ_IPC
bool
nsFrameLoader::ShowRemoteFrame(const nsIntSize& size)
{
NS_ASSERTION(mRemoteFrame, "ShowRemote only makes sense on remote frames.");
if (!mRemoteBrowser) {
TryRemoteBrowser();
@@ -885,16 +904,17 @@ nsFrameLoader::ShowRemoteFrame(const nsI
EnsureMessageManager();
} else {
mRemoteBrowser->Move(size);
}
return true;
}
+#endif
void
nsFrameLoader::Hide()
{
if (mHideCalled) {
return;
}
if (mInShow) {
@@ -1209,21 +1229,23 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
mInSwap = aOther->mInSwap = PR_FALSE;
return NS_OK;
}
void
nsFrameLoader::DestroyChild()
{
+#ifdef MOZ_IPC
if (mRemoteBrowser) {
mRemoteBrowser->SetOwnerElement(nsnull);
mRemoteBrowser->Destroy();
mRemoteBrowser = nsnull;
}
+#endif
}
NS_IMETHODIMP
nsFrameLoader::Destroy()
{
if (mDestroyCalled) {
return NS_OK;
}
@@ -1300,21 +1322,24 @@ nsFrameLoader::GetDepthTooGreat(PRBool*
*aDepthTooGreat = mDepthTooGreat;
return NS_OK;
}
void
nsFrameLoader::SetOwnerContent(nsIContent* aContent)
{
mOwnerContent = aContent;
+#ifdef MOZ_IPC
if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {
rfp->OwnerContentChanged(aContent);
}
+#endif
}
+#ifdef MOZ_IPC
bool
nsFrameLoader::ShouldUseRemoteProcess()
{
// Check for *disabled* multi-process first: environment, prefs, attribute
// Then check for *enabled* multi-process pref: attribute, prefs
// Default is not-remote.
if (PR_GetEnv("MOZ_DISABLE_OOP_TABS")) {
@@ -1340,32 +1365,37 @@ nsFrameLoader::ShouldUseRemoteProcess()
case 1:
return true;
}
PRBool remoteEnabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.enabled",
PR_FALSE);
return (bool) remoteEnabled;
}
+#endif
nsresult
nsFrameLoader::MaybeCreateDocShell()
{
if (mDocShell) {
return NS_OK;
}
+#ifdef MOZ_IPC
if (mRemoteFrame) {
return NS_OK;
}
+#endif
NS_ENSURE_STATE(!mDestroyCalled);
+#ifdef MOZ_IPC
if (ShouldUseRemoteProcess()) {
mRemoteFrame = true;
return NS_OK;
}
+#endif
// Get our parent docshell off the document of mOwnerContent
// XXXbz this is such a total hack.... We really need to have a
// better setup for doing this.
nsIDocument* doc = mOwnerContent->GetOwnerDoc();
if (!doc || !(doc->IsStaticDocument() || mOwnerContent->IsInDoc())) {
return NS_ERROR_UNEXPECTED;
}
@@ -1504,18 +1534,20 @@ nsFrameLoader::CheckForRecursiveLoad(nsI
{
nsresult rv;
mDepthTooGreat = PR_FALSE;
rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
return rv;
}
+#ifdef MOZ_IPC
NS_ASSERTION(!mRemoteFrame,
"Shouldn't call CheckForRecursiveLoad on remote frames.");
+#endif
if (!mDocShell) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
NS_ASSERTION(treeItem, "docshell must be a treeitem!");
// Check that we're still in the docshell tree.
@@ -1605,23 +1637,25 @@ nsFrameLoader::CheckForRecursiveLoad(nsI
}
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::UpdatePositionAndSize(nsIFrame *aIFrame)
{
+#ifdef MOZ_IPC
if (mRemoteFrame) {
if (mRemoteBrowser) {
nsIntSize size = GetSubDocumentSize(aIFrame);
mRemoteBrowser->Move(size);
}
return NS_OK;
}
+#endif
return UpdateBaseWindowPositionAndSize(aIFrame);
}
nsresult
nsFrameLoader::UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame)
{
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));
@@ -1679,16 +1713,17 @@ nsFrameLoader::GetSubDocumentSize(const
docSizeAppUnits = aIFrame->GetSize();
} else {
docSizeAppUnits = aIFrame->GetContentRect().Size();
}
return nsIntSize(presContext->AppUnitsToDevPixels(docSizeAppUnits.width),
presContext->AppUnitsToDevPixels(docSizeAppUnits.height));
}
+#ifdef MOZ_IPC
bool
nsFrameLoader::TryRemoteBrowser()
{
NS_ASSERTION(!mRemoteBrowser, "TryRemoteBrowser called with a remote browser already?");
nsIDocument* doc = mOwnerContent->GetDocument();
if (!doc) {
return false;
@@ -1758,93 +1793,110 @@ nsFrameLoader::TryRemoteBrowser()
nsCOMPtr<nsIBrowserDOMWindow> browserDOMWin;
rootChromeWin->GetBrowserDOMWindow(getter_AddRefs(browserDOMWin));
mRemoteBrowser->SetBrowserDOMWindow(browserDOMWin);
mChildHost = parent;
}
return true;
}
+#endif
+#ifdef MOZ_IPC
mozilla::dom::PBrowserParent*
nsFrameLoader::GetRemoteBrowser()
{
return mRemoteBrowser;
}
+#endif
NS_IMETHODIMP
nsFrameLoader::ActivateRemoteFrame() {
+#ifdef MOZ_IPC
if (mRemoteBrowser) {
mRemoteBrowser->Activate();
return NS_OK;
}
+#endif
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
float aX,
float aY,
PRInt32 aButton,
PRInt32 aClickCount,
PRInt32 aModifiers,
PRBool aIgnoreRootScrollFrame)
{
+#ifdef MOZ_IPC
if (mRemoteBrowser) {
mRemoteBrowser->SendMouseEvent(aType, aX, aY, aButton,
aClickCount, aModifiers,
aIgnoreRootScrollFrame);
return NS_OK;
}
+#endif
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
PRBool aCapture)
{
+#ifdef MOZ_IPC
if (mRemoteBrowser) {
return mRemoteBrowser->SendActivateFrameEvent(nsString(aType), aCapture) ?
NS_OK : NS_ERROR_NOT_AVAILABLE;
}
+#endif
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsFrameLoader::SendCrossProcessKeyEvent(const nsAString& aType,
PRInt32 aKeyCode,
PRInt32 aCharCode,
PRInt32 aModifiers,
PRBool aPreventDefault)
{
+#ifdef MOZ_IPC
if (mRemoteBrowser) {
mRemoteBrowser->SendKeyEvent(aType, aKeyCode, aCharCode, aModifiers,
aPreventDefault);
return NS_OK;
}
+#endif
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsFrameLoader::GetDelayRemoteDialogs(PRBool* aRetVal)
{
+#ifdef MOZ_IPC
*aRetVal = mDelayRemoteDialogs;
+#else
+ *aRetVal = PR_FALSE;
+#endif
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::SetDelayRemoteDialogs(PRBool aDelay)
{
+#ifdef MOZ_IPC
if (mRemoteBrowser && mDelayRemoteDialogs && !aDelay) {
nsRefPtr<nsIRunnable> ev =
NS_NewRunnableMethod(mRemoteBrowser,
&mozilla::dom::TabParent::HandleDelayedDialogs);
NS_DispatchToCurrentThread(ev);
}
mDelayRemoteDialogs = aDelay;
+#endif
return NS_OK;
}
nsresult
nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
{
nsFrameLoader* dest = static_cast<nsFrameLoader*>(aDest);
dest->MaybeCreateDocShell();
@@ -1865,21 +1917,23 @@ nsFrameLoader::CreateStaticClone(nsIFram
nsCOMPtr<nsIDOMDocument> clonedDOMDoc = do_QueryInterface(clonedDoc);
viewer->SetDOMDocument(clonedDOMDoc);
return NS_OK;
}
bool LoadScript(void* aCallbackData, const nsAString& aURL)
{
+#ifdef MOZ_IPC
mozilla::dom::PBrowserParent* tabParent =
static_cast<nsFrameLoader*>(aCallbackData)->GetRemoteBrowser();
if (tabParent) {
return tabParent->SendLoadRemoteScript(nsString(aURL));
}
+#endif
nsFrameLoader* fl = static_cast<nsFrameLoader*>(aCallbackData);
nsRefPtr<nsInProcessTabChildGlobal> tabChild =
static_cast<nsInProcessTabChildGlobal*>(fl->GetTabChildGlobalAsEventTarget());
if (tabChild) {
tabChild->LoadFrameScript(aURL);
}
return true;
}
@@ -1906,21 +1960,23 @@ public:
nsString mMessage;
nsString mJSON;
};
bool SendAsyncMessageToChild(void* aCallbackData,
const nsAString& aMessage,
const nsAString& aJSON)
{
+#ifdef MOZ_IPC
mozilla::dom::PBrowserParent* tabParent =
static_cast<nsFrameLoader*>(aCallbackData)->GetRemoteBrowser();
if (tabParent) {
return tabParent->SendAsyncMessage(nsString(aMessage), nsString(aJSON));
}
+#endif
nsRefPtr<nsIRunnable> ev =
new nsAsyncMessageToChild(static_cast<nsFrameLoader*>(aCallbackData),
aMessage, aJSON);
NS_DispatchToCurrentThread(ev);
return true;
}
NS_IMETHODIMP
@@ -1935,16 +1991,17 @@ nsFrameLoader::GetMessageManager(nsIChro
NS_IMETHODIMP
nsFrameLoader::GetContentViewsIn(float aXPx, float aYPx,
float aTopSize, float aRightSize,
float aBottomSize, float aLeftSize,
PRUint32* aLength,
nsIContentView*** aResult)
{
+#ifdef MOZ_IPC
nscoord x = nsPresContext::CSSPixelsToAppUnits(aXPx - aLeftSize);
nscoord y = nsPresContext::CSSPixelsToAppUnits(aYPx - aTopSize);
nscoord w = nsPresContext::CSSPixelsToAppUnits(aLeftSize + aRightSize) + 1;
nscoord h = nsPresContext::CSSPixelsToAppUnits(aTopSize + aBottomSize) + 1;
nsRect target(x, y, w, h);
nsIFrame* frame = GetPrimaryFrameOfOwningContent();
@@ -1962,79 +2019,96 @@ nsFrameLoader::GetContentViewsIn(float a
for (PRUint32 i = 0; i < ids.Length(); i++) {
nsIContentView* view = GetCurrentRemoteFrame()->GetContentView(ids[i]);
NS_ABORT_IF_FALSE(view, "Retrieved ID from RenderFrameParent, it should be valid!");
nsRefPtr<nsIContentView>(view).forget(&result[i]);
}
*aResult = result;
*aLength = ids.Length();
+#else
+ *aResult = nsnull;
+ *aLength = 0;
+#endif
return NS_OK;
}
NS_IMETHODIMP
nsFrameLoader::GetRootContentView(nsIContentView** aContentView)
{
+#ifdef MOZ_IPC
RenderFrameParent* rfp = GetCurrentRemoteFrame();
if (!rfp) {
*aContentView = nsnull;
return NS_OK;
}
nsContentView* view = rfp->GetContentView();
NS_ABORT_IF_FALSE(view, "Should always be able to create root scrollable!");
nsRefPtr<nsIContentView>(view).forget(aContentView);
return NS_OK;
+#else
+ return NS_ERROR_NOT_IMPLEMENTED;
+#endif
+
}
nsresult
nsFrameLoader::EnsureMessageManager()
{
NS_ENSURE_STATE(mOwnerContent);
nsresult rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
return rv;
}
- if (!mIsTopLevelContent && !mRemoteFrame) {
+ if (!mIsTopLevelContent
+#ifdef MOZ_IPC
+ && !mRemoteFrame
+#endif
+ ) {
return NS_OK;
}
if (mMessageManager) {
+#ifdef MOZ_IPC
if (ShouldUseRemoteProcess()) {
mMessageManager->SetCallbackData(mRemoteBrowserShown ? this : nsnull);
}
+#endif
return NS_OK;
}
nsIScriptContext* sctx = mOwnerContent->GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(sctx);
JSContext* cx = static_cast<JSContext*>(sctx->GetNativeContext());
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
do_QueryInterface(mOwnerContent->GetOwnerDoc()->GetWindow());
NS_ENSURE_STATE(chromeWindow);
nsCOMPtr<nsIChromeFrameMessageManager> parentManager;
chromeWindow->GetMessageManager(getter_AddRefs(parentManager));
+#ifdef MOZ_IPC
if (ShouldUseRemoteProcess()) {
mMessageManager = new nsFrameMessageManager(PR_TRUE,
nsnull,
SendAsyncMessageToChild,
LoadScript,
mRemoteBrowserShown ? this : nsnull,
static_cast<nsFrameMessageManager*>(parentManager.get()),
cx);
NS_ENSURE_TRUE(mMessageManager, NS_ERROR_OUT_OF_MEMORY);
} else
+#endif
{
mMessageManager = new nsFrameMessageManager(PR_TRUE,
nsnull,
SendAsyncMessageToChild,
LoadScript,
nsnull,
static_cast<nsFrameMessageManager*>(parentManager.get()),
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -56,16 +56,17 @@
class nsIContent;
class nsIURI;
class nsSubDocumentFrame;
class nsIView;
class nsIInProcessContentFrameMessageManager;
class AutoResetInShow;
+#ifdef MOZ_IPC
namespace mozilla {
namespace dom {
class PBrowserParent;
class TabParent;
}
namespace layout {
class RenderFrameParent;
@@ -73,16 +74,17 @@ class RenderFrameParent;
}
#ifdef MOZ_WIDGET_GTK2
typedef struct _GtkWidget GtkWidget;
#endif
#ifdef MOZ_WIDGET_QT
class QX11EmbedContainer;
#endif
+#endif
/**
* Defines a target configuration for this <browser>'s content
* document's view. If the content document's actual view
* doesn't match this nsIContentView, then on paints its pixels
* are transformed to compensate for the difference.
*
* Used to support asynchronous re-paints of content pixels; see
@@ -160,19 +162,21 @@ private:
ViewConfig mConfig;
};
class nsFrameLoader : public nsIFrameLoader,
public nsIContentViewManager
{
friend class AutoResetInShow;
+#ifdef MOZ_IPC
typedef mozilla::dom::PBrowserParent PBrowserParent;
typedef mozilla::dom::TabParent TabParent;
typedef mozilla::layout::RenderFrameParent RenderFrameParent;
+#endif
protected:
nsFrameLoader(nsIContent *aOwner, PRBool aNetworkCreated);
public:
~nsFrameLoader() {
mNeedsAsyncDestroy = PR_TRUE;
if (mMessageManager) {
@@ -237,16 +241,17 @@ public:
/**
* Return the document that owns this, or null if we don't have
* an owner.
*/
nsIDocument* GetOwnerDoc() const
{ return mOwnerContent ? mOwnerContent->GetOwnerDoc() : nsnull; }
+#ifdef MOZ_IPC
PBrowserParent* GetRemoteBrowser();
/**
* The "current" render frame is the one on which the most recent
* remote layer-tree transaction was executed. If no content has
* been drawn yet, or the remote browser doesn't have any drawn
* content for whatever reason, return NULL. The returned render
* frame has an associated shadow layer tree.
@@ -267,24 +272,27 @@ public:
* |aFrame| can be null. If non-null, it must be the remote frame
* on which the most recent layer transaction completed for this's
* <browser>.
*/
void SetCurrentRemoteFrame(RenderFrameParent* aFrame)
{
mCurrentRemoteFrame = aFrame;
}
+#endif
nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
nsIContent* GetOwnerContent() { return mOwnerContent; }
void SetOwnerContent(nsIContent* aContent);
private:
+#ifdef MOZ_IPC
bool ShouldUseRemoteProcess();
+#endif
/**
* If we are an IPC frame, set mRemoteFrame. Otherwise, create and
* initialize mDocShell.
*/
nsresult MaybeCreateDocShell();
nsresult EnsureMessageManager();
NS_HIDDEN_(void) GetURL(nsString& aURL);
@@ -294,21 +302,23 @@ private:
// Updates the subdocument position and size. This gets called only
// when we have our own in-process DocShell.
NS_HIDDEN_(nsresult) UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame);
nsresult CheckURILoad(nsIURI* aURI);
void FireErrorEvent();
nsresult ReallyStartLoadingInternal();
+#ifdef MOZ_IPC
// Return true if remote browser created; nothing else to do
bool TryRemoteBrowser();
// Tell the remote browser that it's now "virtually visible"
bool ShowRemoteFrame(const nsIntSize& size);
+#endif
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIURI> mURIToLoad;
nsIContent *mOwnerContent; // WEAK
public:
// public because a callback needs these.
nsRefPtr<nsFrameMessageManager> mMessageManager;
nsCOMPtr<nsIInProcessContentFrameMessageManager> mChildMessageManager;
@@ -320,23 +330,25 @@ private:
PRPackedBool mInSwap : 1;
PRPackedBool mInShow : 1;
PRPackedBool mHideCalled : 1;
// True when the object is created for an element which the parser has
// created using NS_FROM_PARSER_NETWORK flag. If the element is modified,
// it may lose the flag.
PRPackedBool mNetworkCreated : 1;
+#ifdef MOZ_IPC
PRPackedBool mDelayRemoteDialogs : 1;
PRPackedBool mRemoteBrowserShown : 1;
bool mRemoteFrame;
// XXX leaking
nsCOMPtr<nsIObserver> mChildHost;
RenderFrameParent* mCurrentRemoteFrame;
TabParent* mRemoteBrowser;
+#endif
// See nsIFrameLoader.idl. Short story, if !(mRenderMode &
// RENDER_MODE_ASYNC_SCROLL), all the fields below are ignored in
// favor of what content tells.
PRUint32 mRenderMode;
};
#endif
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -30,18 +30,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "ContentChild.h"
#include "ContentParent.h"
+#endif
#include "jscntxt.h"
#include "nsFrameMessageManager.h"
#include "nsContentUtils.h"
#include "nsIXPConnect.h"
#include "jsapi.h"
#include "jsarray.h"
#include "jsinterp.h"
#include "nsJSUtils.h"
@@ -722,16 +724,17 @@ nsFrameScriptExecutor::Traverse(nsFrameS
nsContentUtils::XPConnect()->NoteJSContext(tmp->mCx, cb);
}
NS_IMPL_ISUPPORTS1(nsScriptCacheCleaner, nsIObserver)
nsFrameMessageManager* nsFrameMessageManager::sChildProcessManager = nsnull;
nsFrameMessageManager* nsFrameMessageManager::sParentProcessManager = nsnull;
+#ifdef MOZ_IPC
bool SendAsyncMessageToChildProcess(void* aCallbackData,
const nsAString& aMessage,
const nsAString& aJSON)
{
mozilla::dom::ContentParent* cp =
mozilla::dom::ContentParent::GetSingleton(PR_FALSE);
NS_WARN_IF_FALSE(cp, "No child process!");
if (cp) {
@@ -761,48 +764,58 @@ bool SendAsyncMessageToParentProcess(voi
mozilla::dom::ContentChild* cc =
mozilla::dom::ContentChild::GetSingleton();
if (cc) {
return cc->SendAsyncMessage(nsString(aMessage), nsString(aJSON));
}
return true;
}
+#endif
+
nsresult
NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
{
NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager,
"Re-creating sParentProcessManager");
+#ifdef MOZ_IPC
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
nsFrameMessageManager* mm = new nsFrameMessageManager(PR_TRUE,
nsnull,
SendAsyncMessageToChildProcess,
nsnull,
&nsFrameMessageManager::sParentProcessManager,
nsnull,
nsnull,
PR_FALSE,
PR_TRUE);
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
nsFrameMessageManager::sParentProcessManager = mm;
return CallQueryInterface(mm, aResult);
+#else
+ return NS_ERROR_NOT_AVAILABLE;
+#endif
}
nsresult
NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
{
NS_ASSERTION(!nsFrameMessageManager::sChildProcessManager,
"Re-creating sChildProcessManager");
+#ifdef MOZ_IPC
NS_ENSURE_TRUE(!IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
nsFrameMessageManager* mm = new nsFrameMessageManager(PR_FALSE,
SendSyncMessageToParentProcess,
SendAsyncMessageToParentProcess,
nsnull,
&nsFrameMessageManager::sChildProcessManager,
nsnull,
nsnull,
PR_FALSE,
PR_TRUE);
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
nsFrameMessageManager::sChildProcessManager = mm;
return CallQueryInterface(mm, aResult);
+#else
+ return NS_ERROR_NOT_AVAILABLE;
+#endif
}
--- a/content/canvas/src/Makefile.in
+++ b/content/canvas/src/Makefile.in
@@ -50,19 +50,24 @@ EXPORTS = \
CustomQS_Canvas2D.h \
CustomQS_WebGL.h \
$(NULL)
CPPSRCS = \
CanvasImageCache.cpp \
CanvasUtils.cpp \
nsCanvasRenderingContext2D.cpp \
+ $(NULL)
+
+ifdef MOZ_IPC
+CPPSRCS += \
DocumentRendererParent.cpp \
DocumentRendererChild.cpp \
$(NULL)
+endif
# Canvas 3D Pieces
ifdef MOZ_WEBGL
CPPSRCS += \
WebGLContext.cpp \
WebGLContextGL.cpp \
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -33,17 +33,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
# include "base/basictypes.h"
+#endif
#include "nsIDOMXULElement.h"
#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#if defined(XP_WIN) || defined(XP_OS2)
@@ -112,26 +114,28 @@
#include "nsFrameLoader.h"
#include "nsBidiPresUtils.h"
#include "Layers.h"
#include "CanvasUtils.h"
#include "nsIMemoryReporter.h"
#include "nsStyleUtil.h"
#include "CanvasImageCache.h"
+#ifdef MOZ_IPC
# include <algorithm>
# include "mozilla/dom/ContentParent.h"
# include "mozilla/ipc/PDocumentRendererParent.h"
# include "mozilla/dom/PBrowserParent.h"
# include "mozilla/ipc/DocumentRendererParent.h"
// windows.h (included by chromium code) defines this, in its infinite wisdom
# undef DrawText
using namespace mozilla::ipc;
+#endif
#ifdef MOZ_SVG
#include "nsSVGEffects.h"
#endif
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::dom;
@@ -1225,29 +1229,33 @@ nsCanvasRenderingContext2D::SetIsOpaque(
}
return NS_OK;
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::SetIsIPC(PRBool isIPC)
{
+#ifdef MOZ_IPC
if (isIPC == mIPC)
return NS_OK;
mIPC = isIPC;
if (mValid) {
/* If we've already been created, let SetDimensions take care of
* recreating our surface
*/
return SetDimensions(mWidth, mHeight);
}
return NS_OK;
+#else
+ return NS_ERROR_NOT_IMPLEMENTED;
+#endif
}
NS_IMETHODIMP
nsCanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter)
{
nsresult rv = NS_OK;
if (!mValid || !mSurface ||
@@ -3754,16 +3762,17 @@ nsCanvasRenderingContext2D::AsyncDrawXUL
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(aElem);
if (!loaderOwner)
return NS_ERROR_FAILURE;
nsRefPtr<nsFrameLoader> frameloader = loaderOwner->GetFrameLoader();
if (!frameloader)
return NS_ERROR_FAILURE;
+#ifdef MOZ_IPC
PBrowserParent *child = frameloader->GetRemoteBrowser();
if (!child) {
nsCOMPtr<nsIDOMWindow> window =
do_GetInterface(frameloader->GetExistingDocShell());
if (!window)
return NS_ERROR_FAILURE;
return DrawWindow(window, aX, aY, aW, aH, aBGColor, flags);
@@ -3801,16 +3810,24 @@ nsCanvasRenderingContext2D::AsyncDrawXUL
DocumentRendererParent *docrender =
static_cast<DocumentRendererParent *>(pdocrender);
docrender->SetCanvasContext(this, mThebes);
}
return NS_OK;
+#else
+ nsCOMPtr<nsIDOMWindow> window =
+ do_GetInterface(frameloader->GetExistingDocShell());
+ if (!window)
+ return NS_ERROR_FAILURE;
+
+ return DrawWindow(window, aX, aY, aW, aH, aBGColor, flags);
+#endif
}
//
// device pixel getting/setting
//
void
nsCanvasRenderingContext2D::EnsureUnpremultiplyTable() {
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -32,18 +32,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
#include "IPC/IPCMessageUtils.h"
+#endif
#include "nsCOMPtr.h"
#include "nsDOMEvent.h"
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIDOMEventTarget.h"
@@ -1363,16 +1365,17 @@ nsDOMEvent::GetPreventDefault(PRBool* aR
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = mEvent && (mEvent->flags & NS_EVENT_FLAG_NO_DEFAULT);
return NS_OK;
}
void
nsDOMEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
{
+#ifdef MOZ_IPC
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("event"));
}
nsString type;
GetType(type);
IPC::WriteParam(aMsg, type);
@@ -1384,21 +1387,23 @@ nsDOMEvent::Serialize(IPC::Message* aMsg
GetCancelable(&cancelable);
IPC::WriteParam(aMsg, cancelable);
PRBool trusted = PR_FALSE;
GetIsTrusted(&trusted);
IPC::WriteParam(aMsg, trusted);
// No timestamp serialization for now!
+#endif
}
PRBool
nsDOMEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
{
+#ifdef MOZ_IPC
nsString type;
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &type), PR_FALSE);
PRBool bubbles = PR_FALSE;
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &bubbles), PR_FALSE);
PRBool cancelable = PR_FALSE;
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &cancelable), PR_FALSE);
@@ -1406,16 +1411,19 @@ nsDOMEvent::Deserialize(const IPC::Messa
PRBool trusted = PR_FALSE;
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &trusted), PR_FALSE);
nsresult rv = InitEvent(type, bubbles, cancelable);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
SetTrusted(trusted);
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,
nsEvent *aEvent)
{
nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent);
--- a/content/events/src/nsDOMNotifyPaintEvent.cpp
+++ b/content/events/src/nsDOMNotifyPaintEvent.cpp
@@ -31,18 +31,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
#include "IPC/IPCMessageUtils.h"
+#endif
#include "nsDOMNotifyPaintEvent.h"
#include "nsContentUtils.h"
#include "nsClientRect.h"
#include "nsPaintRequest.h"
#include "nsIFrame.h"
nsDOMNotifyPaintEvent::nsDOMNotifyPaintEvent(nsPresContext* aPresContext,
nsEvent* aEvent,
@@ -141,16 +143,17 @@ nsDOMNotifyPaintEvent::GetPaintRequests(
r->SetRequest(mInvalidateRequests[i]);
requests->Append(r);
}
requests.forget(aResult);
return NS_OK;
}
+#ifdef MOZ_IPC
void
nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
PRBool aSerializeInterfaceType)
{
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("notifypaintevent"));
}
@@ -182,16 +185,17 @@ nsDOMNotifyPaintEvent::Deserialize(const
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.width), PR_FALSE);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.height), PR_FALSE);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mFlags), PR_FALSE);
mInvalidateRequests.AppendElement(req);
}
return PR_TRUE;
}
+#endif
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,
nsEvent *aEvent,
PRUint32 aEventType,
nsInvalidateRequestList* aInvalidateRequests)
{
nsDOMNotifyPaintEvent* it =
--- a/content/events/src/nsDOMNotifyPaintEvent.h
+++ b/content/events/src/nsDOMNotifyPaintEvent.h
@@ -56,17 +56,19 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMNOTIFYPAINTEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMEVENT
+#ifdef MOZ_IPC
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
+#endif
private:
nsRegion GetRegion();
nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests;
};
#endif // nsDOMNotifyPaintEvent_h_
--- a/content/events/src/nsDOMScrollAreaEvent.cpp
+++ b/content/events/src/nsDOMScrollAreaEvent.cpp
@@ -30,18 +30,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
#include "IPC/IPCMessageUtils.h"
+#endif
#include "nsDOMScrollAreaEvent.h"
#include "nsGUIEvent.h"
#include "nsClientRect.h"
#include "nsDOMClassInfoID.h"
#include "nsIClassInfo.h"
#include "nsIXPCScriptable.h"
@@ -109,16 +111,17 @@ nsDOMScrollAreaEvent::InitScrollAreaEven
nsresult rv = nsDOMUIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
mClientArea.SetRect(aX, aY, aWidth, aHeight);
return NS_OK;
}
+#ifdef MOZ_IPC
void
nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
PRBool aSerializeInterfaceType)
{
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
}
@@ -144,16 +147,17 @@ nsDOMScrollAreaEvent::Deserialize(const
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x), PR_FALSE);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y), PR_FALSE);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width), PR_FALSE);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height), PR_FALSE);
mClientArea.SetRect(x, y, width, height);
return PR_TRUE;
}
+#endif
nsresult
NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
nsPresContext *aPresContext,
nsScrollAreaEvent *aEvent)
{
nsDOMScrollAreaEvent *ev = new nsDOMScrollAreaEvent(aPresContext, aEvent);
--- a/content/events/src/nsDOMScrollAreaEvent.h
+++ b/content/events/src/nsDOMScrollAreaEvent.h
@@ -53,16 +53,18 @@ public:
virtual ~nsDOMScrollAreaEvent();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSCROLLAREAEVENT
NS_FORWARD_TO_NSDOMUIEVENT
+#ifdef MOZ_IPC
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
+#endif
protected:
nsClientRect mClientArea;
};
#endif // nsDOMScrollAreaEvent_h__
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -32,18 +32,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
#include "IPC/IPCMessageUtils.h"
+#endif
#include "nsCOMPtr.h"
#include "nsDOMUIEvent.h"
#include "nsIPresShell.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMNode.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
@@ -387,16 +389,17 @@ nsDOMUIEvent::DuplicatePrivateData()
nsIntPoint screenPoint = GetScreenPoint();
nsresult rv = nsDOMEvent::DuplicatePrivateData();
if (NS_SUCCEEDED(rv)) {
mEvent->refPoint = screenPoint;
}
return rv;
}
+#ifdef MOZ_IPC
void
nsDOMUIEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
{
if (aSerializeInterfaceType) {
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
}
nsDOMEvent::Serialize(aMsg, PR_FALSE);
@@ -408,16 +411,17 @@ nsDOMUIEvent::Serialize(IPC::Message* aM
PRBool
nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
{
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), PR_FALSE);
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), PR_FALSE);
return PR_TRUE;
}
+#endif
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,
nsGUIEvent *aEvent)
{
nsDOMUIEvent* it = new nsDOMUIEvent(aPresContext, aEvent);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -57,18 +57,20 @@ public:
// nsIDOMUIEvent Interface
NS_DECL_NSIDOMUIEVENT
// nsIDOMNSUIEvent Interface
NS_DECL_NSIDOMNSUIEVENT
// nsIPrivateDOMEvent interface
NS_IMETHOD DuplicatePrivateData();
+#ifdef MOZ_IPC
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
+#endif
// Forward to nsDOMEvent
NS_FORWARD_TO_NSDOMEVENT
NS_FORWARD_NSIDOMNSEVENT(nsDOMEvent::)
protected:
// Internal helper functions
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -39,17 +39,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/TabParent.h"
+#endif
#include "nsCOMPtr.h"
#include "nsEventStateManager.h"
#include "nsEventListenerManager.h"
#include "nsIMEStateManager.h"
#include "nsContentEventHandler.h"
#include "nsIContent.h"
#include "nsINodeInfo.h"
@@ -157,17 +159,19 @@
#include "nsICommandParams.h"
#include "mozilla/Services.h"
#include "mozAutoDocUpdate.h"
#ifdef XP_MACOSX
#import <ApplicationServices/ApplicationServices.h>
#endif
+#ifdef MOZ_IPC
using namespace mozilla::dom;
+#endif
//#define DEBUG_DOCSHELL_FOCUS
#define NS_USER_INTERACTION_INTERVAL 5000 // ms
static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
@@ -1329,26 +1333,30 @@ nsEventStateManager::PreHandleEvent(nsPr
if ((msEvent->scrollFlags & nsMouseScrollEvent::kIsHorizontal) ?
mLastLineScrollConsumedX : mLastLineScrollConsumedY) {
*aStatus = nsEventStatus_eConsumeNoDefault;
}
}
break;
case NS_QUERY_SELECTED_TEXT:
{
+#ifdef MOZ_IPC
if (RemoteQueryContentEvent(aEvent))
break;
+#endif
nsContentEventHandler handler(mPresContext);
handler.OnQuerySelectedText((nsQueryContentEvent*)aEvent);
}
break;
case NS_QUERY_TEXT_CONTENT:
{
+#ifdef MOZ_IPC
if (RemoteQueryContentEvent(aEvent))
break;
+#endif
nsContentEventHandler handler(mPresContext);
handler.OnQueryTextContent((nsQueryContentEvent*)aEvent);
}
break;
case NS_QUERY_CARET_RECT:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
@@ -1394,24 +1402,26 @@ nsEventStateManager::PreHandleEvent(nsPr
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryDOMWidgetHittest(static_cast<nsQueryContentEvent*>(aEvent));
}
break;
case NS_SELECTION_SET:
{
+#ifdef MOZ_IPC
nsSelectionEvent *selectionEvent =
static_cast<nsSelectionEvent*>(aEvent);
if (IsTargetCrossProcess(selectionEvent)) {
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendSelectionEvent(*selectionEvent))
selectionEvent->mSucceeded = PR_TRUE;
break;
}
+#endif
nsContentEventHandler handler(mPresContext);
handler.OnSelectionEvent((nsSelectionEvent*)aEvent);
}
break;
case NS_CONTENT_COMMAND_CUT:
case NS_CONTENT_COMMAND_COPY:
case NS_CONTENT_COMMAND_PASTE:
case NS_CONTENT_COMMAND_DELETE:
@@ -1422,16 +1432,17 @@ nsEventStateManager::PreHandleEvent(nsPr
DoContentCommandEvent(static_cast<nsContentCommandEvent*>(aEvent));
}
break;
case NS_CONTENT_COMMAND_SCROLL:
{
DoContentCommandScrollEvent(static_cast<nsContentCommandEvent*>(aEvent));
}
break;
+#ifdef MOZ_IPC
case NS_TEXT_TEXT:
{
nsTextEvent *textEvent = static_cast<nsTextEvent*>(aEvent);
if (IsTargetCrossProcess(textEvent)) {
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendTextEvent(*textEvent)) {
// Cancel local dispatching
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
@@ -1448,16 +1459,17 @@ nsEventStateManager::PreHandleEvent(nsPr
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendCompositionEvent(*compositionEvent)) {
// Cancel local dispatching
aEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
}
}
}
break;
+#endif // MOZ_IPC
}
return NS_OK;
}
static PRInt32
GetAccessModifierMask(nsISupports* aDocShell)
{
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(aDocShell));
@@ -3320,16 +3332,17 @@ nsEventStateManager::PostHandleEvent(nsP
//Reset target frame to null to avoid mistargeting after reentrant event
mCurrentTarget = nsnull;
mCurrentTargetContent = nsnull;
return ret;
}
+#ifdef MOZ_IPC
PRBool
nsEventStateManager::RemoteQueryContentEvent(nsEvent *aEvent)
{
nsQueryContentEvent *queryEvent =
static_cast<nsQueryContentEvent*>(aEvent);
if (!IsTargetCrossProcess(queryEvent)) {
return PR_FALSE;
}
@@ -3349,16 +3362,17 @@ nsEventStateManager::IsTargetCrossProces
{
// Check to see if there is a focused, editable content in chrome,
// in that case, do not forward IME events to content
nsIContent *focusedContent = GetFocusedContent();
if (focusedContent && focusedContent->IsEditable())
return PR_FALSE;
return TabParent::GetIMETabParent() != nsnull;
}
+#endif
NS_IMETHODIMP
nsEventStateManager::NotifyDestroyPresContext(nsPresContext* aPresContext)
{
nsIMEStateManager::OnDestroyPresContext(aPresContext);
return NS_OK;
}
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -344,19 +344,21 @@ protected:
* BeginTrackingDragGesture). aEvent->widget must be
* mCurrentTarget->GetNearestWidget().
*/
void FillInEventFromGestureDown(nsMouseEvent* aEvent);
nsresult DoContentCommandEvent(nsContentCommandEvent* aEvent);
nsresult DoContentCommandScrollEvent(nsContentCommandEvent* aEvent);
+#ifdef MOZ_IPC
PRBool RemoteQueryContentEvent(nsEvent *aEvent);
mozilla::dom::TabParent *GetCrossProcessTarget();
PRBool IsTargetCrossProcess(nsGUIEvent *aEvent);
+#endif
PRInt32 mLockCursor;
nsWeakFrame mCurrentTarget;
nsCOMPtr<nsIContent> mCurrentTargetContent;
nsWeakFrame mLastMouseOverFrame;
nsCOMPtr<nsIContent> mLastMouseOverElement;
nsWeakFrame mLastDragOverFrame;
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -45,19 +45,24 @@ include $(DEPTH)/config/autoconf.mk
MODULE = content
LIBRARY_NAME = gkconhtmlcon_s
LIBXUL_LIBRARY = 1
EXPORTS = \
nsImageMapUtils.h \
nsClientRect.h \
- nsHTMLDNSPrefetch.h \
$(NULL)
+ifdef MOZ_IPC
+EXPORTS += \
+ nsHTMLDNSPrefetch.h \
+ $(NULL)
+endif
+
CPPSRCS = \
nsClientRect.cpp \
nsHTMLDNSPrefetch.cpp \
nsGenericHTMLElement.cpp \
nsFormSubmission.cpp \
nsImageMapUtils.cpp \
nsTextEditorState.cpp \
nsHTMLElement.cpp \
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -548,16 +548,17 @@ nsHTMLCanvasElement::GetContext(const ns
NS_ADDREF (*aContext = mCurrentContext);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
nsISupports **aContext)
{
+#ifdef MOZ_IPC
if(!nsContentUtils::IsCallerTrustedForRead()) {
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
return NS_ERROR_DOM_SECURITY_ERR;
}
// We only support 2d shmem contexts for now.
if (!aContextId.Equals(NS_LITERAL_STRING("2d")))
return NS_ERROR_INVALID_ARG;
@@ -582,16 +583,19 @@ nsHTMLCanvasElement::MozGetIPCContext(co
mCurrentContextId.Assign(aContextId);
} else if (!mCurrentContextId.Equals(aContextId)) {
//XXX eventually allow for more than one active context on a given canvas
return NS_ERROR_INVALID_ARG;
}
NS_ADDREF (*aContext = mCurrentContext);
return NS_OK;
+#else
+ return NS_ERROR_NOT_IMPLEMENTED;
+#endif
}
nsresult
nsHTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
{
if (!mCurrentContext)
return NS_OK;
--- a/content/html/content/src/nsHTMLDNSPrefetch.cpp
+++ b/content/html/content/src/nsHTMLDNSPrefetch.cpp
@@ -31,20 +31,22 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
#include "mozilla/net/NeckoCommon.h"
#include "mozilla/net/NeckoChild.h"
#include "nsURLHelper.h"
+#endif
#include "nsHTMLDNSPrefetch.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsNetUtil.h"
#include "nsIDNSListener.h"
@@ -101,18 +103,20 @@ nsHTMLDNSPrefetch::Initialize()
sDisablePrefetchHTTPSPref =
nsContentUtils::GetBoolPref("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
NS_IF_RELEASE(sDNSService);
nsresult rv;
rv = CallGetService(kDNSServiceCID, &sDNSService);
if (NS_FAILED(rv)) return rv;
+#ifdef MOZ_IPC
if (IsNeckoChild())
NeckoChild::InitNeckoChild();
+#endif
sInitialized = PR_TRUE;
return NS_OK;
}
nsresult
nsHTMLDNSPrefetch::Shutdown()
{
@@ -133,26 +137,28 @@ nsHTMLDNSPrefetch::IsAllowed (nsIDocumen
{
// There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
}
nsresult
nsHTMLDNSPrefetch::Prefetch(Link *aElement, PRUint16 flags)
{
+#ifdef MOZ_IPC
if (IsNeckoChild()) {
// Instead of transporting the Link object to the other process
// we are using the hostname based function here, too. Compared to the
// IPC the performance hit should be negligible.
nsAutoString hostname;
nsresult rv = aElement->GetHostname(hostname);
NS_ENSURE_SUCCESS(rv,rv);
return Prefetch(hostname, flags);
}
+#endif
if (!(sInitialized && sPrefetches && sDNSService && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
return sPrefetches->Add(flags, aElement);
}
nsresult
@@ -171,25 +177,27 @@ nsresult
nsHTMLDNSPrefetch::PrefetchHigh(Link *aElement)
{
return Prefetch(aElement, 0);
}
nsresult
nsHTMLDNSPrefetch::Prefetch(nsAString &hostname, PRUint16 flags)
{
+#ifdef MOZ_IPC
if (IsNeckoChild()) {
// We need to check IsEmpty() because net_IsValidHostName()
// considers empty strings to be valid hostnames
if (!hostname.IsEmpty() &&
net_IsValidHostName(NS_ConvertUTF16toUTF8(hostname))) {
gNeckoChild->SendHTMLDNSPrefetch(nsAutoString(hostname), flags);
}
return NS_OK;
}
+#endif
if (!(sInitialized && sDNSService && sPrefetches && sDNSListener))
return NS_ERROR_NOT_AVAILABLE;
nsCOMPtr<nsICancelable> tmpOutstanding;
return sDNSService->AsyncResolve(NS_ConvertUTF16toUTF8(hostname), flags | nsIDNSService::RESOLVE_SPECULATE,
sDNSListener, nsnull, getter_AddRefs(tmpOutstanding));
}
--- a/content/html/content/src/nsHTMLDNSPrefetch.h
+++ b/content/html/content/src/nsHTMLDNSPrefetch.h
@@ -138,12 +138,14 @@ public:
struct deferred_entry
{
PRUint16 mFlags;
nsWeakPtr mElement;
} mEntries[sMaxDeferred];
};
+#ifdef MOZ_IPC
friend class mozilla::net::NeckoParent;
+#endif
};
#endif
--- a/content/media/nsAudioStream.cpp
+++ b/content/media/nsAudioStream.cpp
@@ -32,22 +32,24 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/PAudioChild.h"
#include "mozilla/dom/AudioChild.h"
#include "mozilla/Monitor.h"
#include "nsXULAppAPI.h"
using namespace mozilla::dom;
+#endif
#include <stdio.h>
#include <math.h>
#include "prlog.h"
#include "prmem.h"
#include "nsAutoPtr.h"
#include "nsAudioStream.h"
#include "nsAlgorithm.h"
@@ -58,17 +60,17 @@ extern "C" {
#include "nsThreadUtils.h"
#if defined(XP_MACOSX)
#define SA_PER_STREAM_VOLUME 1
#endif
// Android's audio backend is not available in content processes, so audio must
// be remoted to the parent chrome process.
-#if defined(ANDROID)
+#if defined(ANDROID) && defined(MOZ_IPC)
#define REMOTE_AUDIO 1
#endif
using mozilla::TimeStamp;
#ifdef PR_LOGGING
PRLogModuleInfo* gAudioStreamLog = nsnull;
#endif
@@ -115,16 +117,17 @@ class nsAudioStreamLocal : public nsAudi
// PR_TRUE if this audio stream is paused.
PRPackedBool mPaused;
// PR_TRUE if this stream has encountered an error.
PRPackedBool mInError;
};
+#ifdef MOZ_IPC
class nsAudioStreamRemote : public nsAudioStream
{
public:
NS_DECL_ISUPPORTS
nsAudioStreamRemote();
~nsAudioStreamRemote();
@@ -286,16 +289,17 @@ class AudioShutdownEvent : public nsRunn
{
if (mAudioChild->IsIPCOpen())
mAudioChild->SendShutdown();
return NS_OK;
}
nsRefPtr<AudioChild> mAudioChild;
};
+#endif // MOZ_IPC
void nsAudioStream::InitLibrary()
{
#ifdef PR_LOGGING
gAudioStreamLog = PR_NewLogModule("nsAudioStream");
#endif
}
@@ -588,16 +592,18 @@ PRInt32 nsAudioStreamLocal::GetMinWriteS
if (r == SA_ERROR_NOT_SUPPORTED)
return 1;
else if (r != SA_SUCCESS || samples > PR_INT32_MAX)
return -1;
return static_cast<PRInt32>(samples);
}
+#ifdef MOZ_IPC
+
nsAudioStreamRemote::nsAudioStreamRemote()
: mAudioChild(NULL),
mFormat(FORMAT_S16_LE),
mRate(0),
mChannels(0),
mBytesPerSample(1),
mPaused(PR_FALSE)
{}
@@ -739,8 +745,10 @@ nsAudioStreamRemote::GetSampleOffset()
return result;
}
PRBool
nsAudioStreamRemote::IsPaused()
{
return mPaused;
}
+
+#endif // MOZ_IPC
--- a/content/media/nsAudioStream.h
+++ b/content/media/nsAudioStream.h
@@ -59,23 +59,24 @@ public:
// Initialize Audio Library. Some Audio backends require initializing the
// library before using it.
static void InitLibrary();
// Shutdown Audio Library. Some Audio backends require shutting down the
// library after using it.
static void ShutdownLibrary();
- // Thread that is shared between audio streams.
+ // Thread, usually for MOZ_IPC handling, that is shared between audio streams.
// This may return null in the child process
nsIThread *GetThread();
// AllocateStream will return either a local stream or a remoted stream
- // depending on where you call it from. If you call this from a child process,
- // you may receive an implementation which forwards to a compositing process.
+ // depending on where you call it from. If MOZ_IPC is enabled, and you
+ // call this from a child process, you may recieve an implementation which
+ // forwards to a compositing process.
static nsAudioStream* AllocateStream();
// Initialize the audio stream. aNumChannels is the number of audio channels
// (1 for mono, 2 for stereo, etc) and aRate is the frequency of the sound
// samples (22050, 44100, etc).
virtual nsresult Init(PRInt32 aNumChannels, PRInt32 aRate, SampleFormat aFormat) = 0;
// Closes the stream. All future use of the stream is an error.
--- a/docshell/base/IHistory.h
+++ b/docshell/base/IHistory.h
@@ -66,17 +66,17 @@ public:
* SetLinkState called on themselves. This function is guaranteed to run to
* completion before aLink is notified. After the node is notified, it will
* be unregistered.
*
* @note SetLinkState must not call RegisterVisitedCallback or
* UnregisterVisitedCallback.
*
* @pre aURI must not be null.
- * @pre aLink may be null only in the parent (chrome) process.
+ * @pre aLink may be null only in the MOZ_IPC parent process.
*
* @param aURI
* The URI to check.
* @param aLink
* The link to update whenever the history status changes. The
* implementation will only hold onto a raw pointer, so if this
* object should be destroyed, be sure to call
* UnregisterVistedCallback first.
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -224,17 +224,19 @@ static NS_DEFINE_CID(kAppShellCID, NS_AP
//#define DEBUG_DOCSHELL_FOCUS
#define DEBUG_PAGE_CACHE
#endif
#include "nsContentErrors.h"
#include "nsIChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
+#endif
using namespace mozilla;
// Number of documents currently loading
static PRInt32 gNumberOfDocumentsLoading = 0;
// Global count of existing docshells.
static PRInt32 gDocShellCount = 0;
@@ -6005,20 +6007,22 @@ nsDocShell::OnRedirectStateChange(nsICha
// here. OnNewURI will do that, so we will cache it.
SaveLastVisit(aNewChannel, oldURI, aRedirectFlags);
}
// check if the new load should go through the application cache.
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(aNewChannel);
if (appCacheChannel) {
+#ifdef MOZ_IPC
// Permission will be checked in the parent process.
if (GeckoProcessType_Default != XRE_GetProcessType())
appCacheChannel->SetChooseApplicationCache(PR_TRUE);
else
+#endif
appCacheChannel->SetChooseApplicationCache(ShouldCheckAppCache(newURI));
}
if (!(aRedirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL) &&
mLoadType & (LOAD_CMD_RELOAD | LOAD_CMD_HISTORY)) {
mLoadType = LOAD_NORMAL_REPLACE;
SetHistoryEntry(&mLSHE, nsnull);
}
@@ -8719,20 +8723,22 @@ nsDocShell::DoURILoad(nsIURI * aURI,
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(channel);
if (appCacheChannel) {
// Any document load should not inherit application cache.
appCacheChannel->SetInheritApplicationCache(PR_FALSE);
// Loads with the correct permissions should check for a matching
// application cache.
+#ifdef MOZ_IPC
// Permission will be checked in the parent process
if (GeckoProcessType_Default != XRE_GetProcessType())
appCacheChannel->SetChooseApplicationCache(PR_TRUE);
else
+#endif
appCacheChannel->SetChooseApplicationCache(
ShouldCheckAppCache(aURI));
}
// Make sure to give the caller a channel if we managed to create one
// This is important for correct error page/session history interaction
if (aRequest)
NS_ADDREF(*aRequest = channel);
--- a/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -78,17 +78,22 @@ endif
DIRS += \
public/coreEvents \
base \
src \
locales \
plugins \
indexedDB \
system \
+ $(NULL)
+
+ifdef MOZ_IPC
+DIRS += \
ipc \
$(NULL)
+endif
ifdef ENABLE_TESTS
DIRS += tests
endif
include $(topsrcdir)/config/rules.mk
--- a/dom/base/Makefile.in
+++ b/dom/base/Makefile.in
@@ -78,17 +78,16 @@ EXPORTS = \
nsIScriptObjectOwner.h \
nsIScriptObjectPrincipal.h \
nsIScriptRuntime.h \
nsIScriptTimeoutHandler.h \
nsPIDOMWindow.h \
nsPIWindowRoot.h \
nsFocusManager.h \
nsWrapperCache.h \
- nsContentPermissionHelper.h \
$(NULL)
CPPSRCS = \
nsBarProps.cpp \
nsDOMException.cpp \
nsDOMWindowUtils.cpp \
nsJSEnvironment.cpp \
nsJSTimeoutHandler.cpp \
@@ -102,27 +101,37 @@ CPPSRCS = \
nsHistory.cpp \
nsMimeTypeArray.cpp \
nsPluginArray.cpp \
nsWindowRoot.cpp \
nsDOMClassInfo.cpp \
nsScriptNameSpaceManager.cpp \
nsDOMScriptObjectFactory.cpp \
nsQueryContentEventResult.cpp \
- nsContentPermissionHelper.cpp \
$(NULL)
+ifdef MOZ_IPC
+EXPORTS += \
+ nsContentPermissionHelper.h \
+ $(NULL)
+CPPSRCS += \
+ nsContentPermissionHelper.cpp \
+ $(NULL)
+endif
+
include $(topsrcdir)/dom/dom-config.mk
ifdef MOZ_JSDEBUGGER
DEFINES += -DMOZ_JSDEBUGGER
endif
+ifdef MOZ_IPC
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(srcdir)/../../js/src/xpconnect/src \
-I$(srcdir)/../../js/src/xpconnect/wrappers \
$(NULL)
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -41,17 +41,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
// Local Includes
#include "nsGlobalWindow.h"
#include "nsScreen.h"
#include "nsHistory.h"
#include "nsBarProps.h"
#include "nsDOMStorage.h"
#include "nsDOMOfflineResourceList.h"
--- a/dom/plugins/Makefile.in
+++ b/dom/plugins/Makefile.in
@@ -45,16 +45,18 @@ include $(DEPTH)/config/autoconf.mk
MODULE = dom
EXPORTS_NAMESPACES = mozilla
EXPORTS_mozilla = \
PluginLibrary.h \
$(NULL)
+ifdef MOZ_IPC
+
EXPORTS_NAMESPACES = mozilla mozilla/plugins
EXPORTS_mozilla/plugins = \
BrowserStreamChild.h \
BrowserStreamParent.h \
ChildAsyncCall.h \
ChildTimer.h \
NPEventOSX.h \
@@ -144,14 +146,15 @@ endif
LOCAL_INCLUDES = \
-I$(topsrcdir)/modules/plugin/base/public/ \
-I$(topsrcdir)/modules/plugin/base/src/ \
-I$(topsrcdir)/xpcom/base/ \
$(NULL)
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(TK_CFLAGS)
DEFINES += -DFORCE_PR_LOG
--- a/dom/src/geolocation/Makefile.in
+++ b/dom/src/geolocation/Makefile.in
@@ -78,15 +78,17 @@ LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_
$(NULL)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
LOCAL_INCLUDES += -I$(topsrcdir)/dom/system/android \
$(NULL)
endif
+ifdef MOZ_IPC
EXPORTS += nsGeoPositionIPCSerialiser.h
+endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_LAYOUT
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -29,16 +29,17 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "nsContentPermissionHelper.h"
#include "nsXULAppAPI.h"
#include "mozilla/dom/PBrowserChild.h"
#include "mozilla/dom/PBrowserParent.h"
#include "mozilla/dom/ContentChild.h"
#include "nsNetUtil.h"
@@ -47,16 +48,17 @@
#include "nsIFrameLoader.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocShellTreeItem.h"
#include "nsIWebProgressListener2.h"
#include "nsDOMEventTargetHelper.h"
#include "TabChild.h"
+#endif
#include "nsGeolocation.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsIDOMWindow.h"
#include "nsDOMClassInfo.h"
#include "nsComponentManagerUtils.h"
#include "nsICategoryManager.h"
@@ -475,24 +477,26 @@ nsGeolocationRequest::Shutdown()
mTimeoutTimer->Cancel();
mTimeoutTimer = nsnull;
}
mCleared = PR_TRUE;
mCallback = nsnull;
mErrorCallback = nsnull;
}
+#ifdef MOZ_IPC
bool nsGeolocationRequest::Recv__delete__(const bool& allow)
{
if (allow)
(void) Allow();
else
(void) Cancel();
return true;
}
+#endif
////////////////////////////////////////////////////
// nsGeolocationService
////////////////////////////////////////////////////
NS_INTERFACE_MAP_BEGIN(nsGeolocationService)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIGeolocationUpdate)
NS_INTERFACE_MAP_ENTRY(nsIGeolocationUpdate)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_END
@@ -672,21 +676,23 @@ nsGeolocationService::StartDevice()
if (!sGeoEnabled)
return NS_ERROR_NOT_AVAILABLE;
// we do not want to keep the geolocation devices online
// indefinitely. Close them down after a reasonable period of
// inactivivity
SetDisconnectTimer();
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendAddGeolocationListener();
return NS_OK;
}
+#endif
// Start them up!
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs)
return NS_ERROR_FAILURE;
for (PRInt32 i = 0; i < mProviders.Count(); i++) {
mProviders[i]->Startup();
@@ -715,21 +721,23 @@ nsGeolocationService::SetDisconnectTimer
void
nsGeolocationService::StopDevice()
{
if(mDisconnectTimer) {
mDisconnectTimer->Cancel();
mDisconnectTimer = nsnull;
}
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
ContentChild* cpc = ContentChild::GetSingleton();
cpc->SendRemoveGeolocationListener();
return; // bail early
}
+#endif
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs)
return;
for (PRInt32 i = 0; i < mProviders.Count(); i++) {
mProviders[i]->Shutdown();
obs->NotifyObservers(mProviders[i],
@@ -1040,16 +1048,17 @@ nsGeolocation::WindowOwnerStillExists()
}
return PR_TRUE;
}
bool
nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mOwner);
if (!window)
return true;
// because owner implements nsITabChild, we can assume that it is
// the one and only TabChild.
TabChild* child = GetTabChildFrom(window->GetDocShell());
@@ -1061,16 +1070,17 @@ nsGeolocation::RegisterRequestWithPrompt
request->AddRef();
nsCString type = NS_LITERAL_CSTRING("geolocation");
child->SendPContentPermissionRequestConstructor(request, type, IPC::URI(mURI));
request->Sendprompt();
return true;
}
+#endif
if (nsContentUtils::GetBoolPref("geo.prompt.testing", PR_FALSE))
{
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(nsContentUtils::GetBoolPref("geo.prompt.testing.allow", PR_FALSE), request);
NS_DispatchToMainThread(ev);
return true;
}
--- a/dom/src/geolocation/nsGeolocation.h
+++ b/dom/src/geolocation/nsGeolocation.h
@@ -32,19 +32,21 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsGeoLocation_h
#define nsGeoLocation_h
+#ifdef MOZ_IPC
#include "mozilla/dom/PContentPermissionRequestChild.h"
// Microsoft's API Name hackery sucks
#undef CreateEvent
+#endif
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsCOMArray.h"
#include "nsTArray.h"
#include "nsITimer.h"
#include "nsIObserver.h"
#include "nsIURI.h"
@@ -60,25 +62,29 @@
#include "nsIDOMGeoPositionOptions.h"
#include "nsIDOMNavigatorGeolocation.h"
#include "nsPIDOMWindow.h"
#include "nsIGeolocationProvider.h"
#include "nsIContentPermissionPrompt.h"
+#ifdef MOZ_IPC
#include "PCOMContentPermissionRequestChild.h"
+#endif
class nsGeolocationService;
class nsGeolocation;
class nsGeolocationRequest
: public nsIContentPermissionRequest
, public nsITimerCallback
+#ifdef MOZ_IPC
, public PCOMContentPermissionRequestChild
+#endif
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
NS_DECL_NSITIMERCALLBACK
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGeolocationRequest, nsIContentPermissionRequest)
@@ -96,18 +102,20 @@ class nsGeolocationRequest
void SendLocation(nsIDOMGeoPosition* location);
void MarkCleared();
PRBool IsActive() {return !mCleared;}
PRBool Allowed() {return mAllowed;}
void SetTimeoutTimer();
~nsGeolocationRequest();
+#ifdef MOZ_IPC
bool Recv__delete__(const bool& allow);
void IPDLRelease() { Release(); }
+#endif
private:
void NotifyError(PRInt16 errorCode);
PRPackedBool mAllowed;
PRPackedBool mCleared;
PRPackedBool mIsFirstUpdate;
PRPackedBool mIsWatchPositionRequest;
--- a/dom/src/notification/nsDesktopNotification.cpp
+++ b/dom/src/notification/nsDesktopNotification.cpp
@@ -31,23 +31,25 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsDesktopNotification.h"
+#ifdef MOZ_IPC
#include "nsContentPermissionHelper.h"
#include "nsXULAppAPI.h"
#include "mozilla/dom/PBrowserChild.h"
#include "TabChild.h"
using namespace mozilla::dom;
+#endif
/* ------------------------------------------------------------------------ */
/* AlertServiceObserver */
/* ------------------------------------------------------------------------ */
NS_IMPL_ISUPPORTS1(AlertServiceObserver, nsIObserver)
/* ------------------------------------------------------------------------ */
@@ -122,16 +124,17 @@ nsDOMDesktopNotification::nsDOMDesktopNo
nsContentUtils::GetBoolPref("notification.prompt.testing.allow", PR_TRUE)) {
mAllow = PR_TRUE;
return;
}
nsRefPtr<nsDesktopNotificationRequest> request = new nsDesktopNotificationRequest(this);
// if we are in the content process, then remote it to the parent.
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
// if for some reason mOwner is null, just silently
// bail. The user will not see a notification, and that
// is fine.
if (!mOwner)
return;
@@ -144,16 +147,17 @@ nsDOMDesktopNotification::nsDOMDesktopNo
request->AddRef();
nsCString type = NS_LITERAL_CSTRING("desktop-notification");
child->SendPContentPermissionRequestConstructor(request, type, IPC::URI(mURI));
request->Sendprompt();
return;
}
+#endif
// otherwise, dispatch it
NS_DispatchToMainThread(request);
}
nsDOMDesktopNotification::~nsDOMDesktopNotification()
{
--- a/dom/src/notification/nsDesktopNotification.h
+++ b/dom/src/notification/nsDesktopNotification.h
@@ -32,17 +32,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDesktopNotification_h
#define nsDesktopNotification_h
+#ifdef MOZ_IPC
#include "PCOMContentPermissionRequestChild.h"
+#endif
+
#include "nsDOMClassInfo.h"
#include "nsIJSContextStack.h"
#include "nsIAlertsService.h"
#include "nsIDOMDesktopNotification.h"
#include "nsIDOMEventTarget.h"
@@ -147,18 +150,20 @@ protected:
PRBool mAllow;
PRBool mShowHasBeenCalled;
};
/*
* Simple Request
*/
class nsDesktopNotificationRequest : public nsIContentPermissionRequest,
- public nsRunnable,
- public PCOMContentPermissionRequestChild
+ public nsRunnable
+#ifdef MOZ_IPC
+ , public PCOMContentPermissionRequestChild
+#endif
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
nsDesktopNotificationRequest(nsDOMDesktopNotification* notification)
: mDesktopNotification(notification) {}
@@ -172,25 +177,28 @@ class nsDesktopNotificationRequest : pub
}
return NS_OK;
}
~nsDesktopNotificationRequest()
{
}
+#ifdef MOZ_IPC
+
bool Recv__delete__(const bool& allow)
{
if (allow)
(void) Allow();
else
(void) Cancel();
return true;
}
void IPDLRelease() { Release(); }
+#endif
nsRefPtr<nsDOMDesktopNotification> mDesktopNotification;
};
class AlertServiceObserver: public nsIObserver
{
public:
NS_DECL_ISUPPORTS
--- a/dom/src/offline/nsDOMOfflineResourceList.cpp
+++ b/dom/src/offline/nsDOMOfflineResourceList.cpp
@@ -52,19 +52,24 @@
#include "nsContentUtils.h"
#include "nsIJSContextStack.h"
#include "nsEventDispatcher.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIObserverService.h"
#include "nsIScriptGlobalObject.h"
#include "nsIWebNavigation.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
#define IS_CHILD_PROCESS() \
(GeckoProcessType_Default != XRE_GetProcessType())
+#else
+#define IS_CHILD_PROCESS() \
+ (false)
+#endif
// Event names
#define CHECKING_STR "checking"
#define ERROR_STR "error"
#define NOUPDATE_STR "noupdate"
#define DOWNLOADING_STR "downloading"
#define PROGRESS_STR "progress"
--- a/dom/src/storage/Makefile.in
+++ b/dom/src/storage/Makefile.in
@@ -50,21 +50,23 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
nsDOMStorage.cpp \
$(NULL)
ifdef MOZ_STORAGE
CPPSRCS += nsDOMStorageDBWrapper.cpp nsDOMStoragePersistentDB.cpp nsDOMStorageMemoryDB.cpp
+ifdef MOZ_IPC
CPPSRCS += StorageChild.cpp StorageParent.cpp
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = StorageChild.h StorageParent.h
endif
+endif
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
LOCAL_INCLUDES = \
-I$(topsrcdir)/dom/base \
-I$(topsrcdir)/content/events/src
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -35,20 +35,22 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "StorageChild.h"
#include "StorageParent.h"
#include "nsXULAppAPI.h"
using mozilla::dom::StorageChild;
+#endif
#include "prnetdb.h"
#include "nsCOMPtr.h"
#include "nsDOMError.h"
#include "nsDOMClassInfo.h"
#include "nsUnicharUtils.h"
#include "nsIDocument.h"
#include "nsDOMStorage.h"
@@ -264,19 +266,21 @@ nsDOMStorageManager::Initialize()
if (!gStorageManager->mStorages.Init()) {
delete gStorageManager;
gStorageManager = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(gStorageManager);
+#ifdef MOZ_IPC
// No observers needed in non-chrome
if (XRE_GetProcessType() != GeckoProcessType_Default)
return NS_OK;
+#endif
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (!os)
return NS_OK;
os->AddObserver(gStorageManager, "cookie-changed", PR_FALSE);
os->AddObserver(gStorageManager, "offline-app-removed", PR_FALSE);
os->AddObserver(gStorageManager, NS_PRIVATE_BROWSING_SWITCH_TOPIC, PR_FALSE);
@@ -1346,32 +1350,37 @@ DOMStorageImpl::Clear(bool aCallerSecure
}
nsDOMStorage::nsDOMStorage()
: mStorageType(nsPIDOMStorage::Unknown)
, mEventBroadcaster(nsnull)
{
mSecurityChecker = this;
+#ifdef MOZ_IPC
if (XRE_GetProcessType() != GeckoProcessType_Default)
mStorageImpl = new StorageChild(this);
else
- mStorageImpl = new DOMStorageImpl(this);
+#endif
+ mStorageImpl = new DOMStorageImpl(this);
}
nsDOMStorage::nsDOMStorage(nsDOMStorage& aThat)
: mStorageType(aThat.mStorageType)
, mEventBroadcaster(nsnull)
{
mSecurityChecker = this;
+#ifdef MOZ_IPC
if (XRE_GetProcessType() != GeckoProcessType_Default) {
StorageChild* other = static_cast<StorageChild*>(aThat.mStorageImpl.get());
mStorageImpl = new StorageChild(this, *other);
- } else {
+ } else
+#endif
+ {
DOMStorageImpl* other = static_cast<DOMStorageImpl*>(aThat.mStorageImpl.get());
mStorageImpl = new DOMStorageImpl(this, *other);
}
}
nsDOMStorage::~nsDOMStorage()
{
}
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -1224,17 +1224,20 @@ NS_IMETHODIMP nsWebBrowser::Create()
// that always gets called (even for subframes) for any bubbling event.
if (!mInitInfo->sessionHistory) {
mInitInfo->sessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
mDocShellAsNav->SetSessionHistory(mInitInfo->sessionHistory);
- if (XRE_GetProcessType() == GeckoProcessType_Default) {
+#ifdef MOZ_IPC
+ if (XRE_GetProcessType() == GeckoProcessType_Default)
+#endif
+ {
// Hook up global history. Do not fail if we can't - just warn.
rv = EnableGlobalHistory(mShouldEnableHistory);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "EnableGlobalHistory() failed");
}
NS_ENSURE_SUCCESS(mDocShellAsWin->Create(), NS_ERROR_FAILURE);
// Hook into the OnSecurityChange() notification for lock/unlock icon
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -32,19 +32,21 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/unused.h"
+#endif
#include "nsPermissionManager.h"
#include "nsPermission.h"
#include "nsCRT.h"
#include "nsNetUtil.h"
#include "nsCOMArray.h"
#include "nsArrayEnumerator.h"
#include "nsTArray.h"
#include "nsReadableUtils.h"
@@ -56,16 +58,17 @@
#include "mozIStorageStatement.h"
#include "mozIStorageConnection.h"
#include "mozStorageHelper.h"
#include "mozStorageCID.h"
#include "nsXULAppAPI.h"
static nsPermissionManager *gPermissionManager = nsnull;
+#ifdef MOZ_IPC
using mozilla::dom::ContentParent;
using mozilla::dom::ContentChild;
using mozilla::unused; // ha!
static PRBool
IsChildProcess()
{
return XRE_GetProcessType() == GeckoProcessType_Content;
@@ -100,16 +103,17 @@ ParentProcess()
ContentParent* cpc = ContentParent::GetSingleton();
if (!cpc)
NS_RUNTIMEABORT("Content Process is NULL!");
return cpc;
}
return nsnull;
}
+#endif
#define ENSURE_NOT_CHILD_PROCESS_(onError) \
PR_BEGIN_MACRO \
if (IsChildProcess()) { \
NS_ERROR("Cannot perform action in content process!"); \
onError \
} \
PR_END_MACRO
@@ -165,17 +169,19 @@ static const char kPermissionsFileName[]
static const char kHostpermFileName[] = "hostperm.1";
static const char kPermissionChangeNotification[] = PERM_CHANGE_NOTIFICATION;
NS_IMPL_ISUPPORTS3(nsPermissionManager, nsIPermissionManager, nsIObserver, nsISupportsWeakReference)
nsPermissionManager::nsPermissionManager()
: mLargestID(0)
+#ifdef MOZ_IPC
, mUpdateChildProcess(PR_FALSE)
+#endif
{
}
nsPermissionManager::~nsPermissionManager()
{
RemoveAllFromMemory();
}
@@ -222,30 +228,32 @@ nsPermissionManager::Init()
}
mObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
if (NS_SUCCEEDED(rv)) {
mObserverService->AddObserver(this, "profile-before-change", PR_TRUE);
mObserverService->AddObserver(this, "profile-do-change", PR_TRUE);
}
+#ifdef MOZ_IPC
if (IsChildProcess()) {
// Get the permissions from the parent process
InfallibleTArray<IPC::Permission> perms;
ChildProcess()->SendReadPermissions(&perms);
for (PRUint32 i = 0; i < perms.Length(); i++) {
const IPC::Permission &perm = perms[i];
AddInternal(perm.host, perm.type, perm.capability, 0, perm.expireType,
perm.expireTime, eNotify, eNoDBOperation);
}
// Stop here; we don't need the DB in the child process
return NS_OK;
}
+#endif
// ignore failure here, since it's non-fatal (we can run fine without
// persistent storage - e.g. if there's no profile).
// XXX should we tell the user about this?
InitDB(PR_FALSE);
return NS_OK;
}
@@ -427,17 +435,19 @@ nsPermissionManager::CreateTable()
NS_IMETHODIMP
nsPermissionManager::Add(nsIURI *aURI,
const char *aType,
PRUint32 aPermission,
PRUint32 aExpireType,
PRInt64 aExpireTime)
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aType);
NS_ENSURE_TRUE(aExpireType == nsIPermissionManager::EXPIRE_NEVER ||
aExpireType == nsIPermissionManager::EXPIRE_TIME ||
aExpireType == nsIPermissionManager::EXPIRE_SESSION,
NS_ERROR_INVALID_ARG);
@@ -461,25 +471,27 @@ nsPermissionManager::AddInternal(const n
const nsAFlatCString &aType,
PRUint32 aPermission,
PRInt64 aID,
PRUint32 aExpireType,
PRInt64 aExpireTime,
NotifyOperationType aNotifyOperation,
DBOperationType aDBOperation)
{
+#ifdef MOZ_IPC
if (!IsChildProcess()) {
// In the parent, send the update now, if the child is ready
if (mUpdateChildProcess) {
IPC::Permission permission((aHost),
(aType),
aPermission, aExpireType, aExpireTime);
unused << ParentProcess()->SendAddPermission(permission);
}
}
+#endif
if (!gHostArena) {
gHostArena = new PLArenaPool;
if (!gHostArena)
return NS_ERROR_OUT_OF_MEMORY;
PL_INIT_ARENA_POOL(gHostArena, "PermissionHostArena", HOST_ARENA_SIZE);
}
@@ -610,17 +622,19 @@ nsPermissionManager::AddInternal(const n
return NS_OK;
}
NS_IMETHODIMP
nsPermissionManager::Remove(const nsACString &aHost,
const char *aType)
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
NS_ENSURE_ARG_POINTER(aType);
// AddInternal() handles removal, just let it do the work
return AddInternal(PromiseFlatCString(aHost),
nsDependentCString(aType),
nsIPermissionManager::UNKNOWN_ACTION,
0,
@@ -628,17 +642,19 @@ nsPermissionManager::Remove(const nsACSt
0,
eNotify,
eWriteToDB);
}
NS_IMETHODIMP
nsPermissionManager::RemoveAll()
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
nsresult rv = RemoveAllInternal();
NotifyObservers(nsnull, NS_LITERAL_STRING("cleared").get());
return rv;
}
nsresult
nsPermissionManager::RemoveAllInternal()
@@ -785,30 +801,34 @@ AddPermissionsToList(nsHostEntry *entry,
data->array->AppendObject(perm);
}
return PL_DHASH_NEXT;
}
NS_IMETHODIMP nsPermissionManager::GetEnumerator(nsISimpleEnumerator **aEnum)
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
// roll an nsCOMArray of all our permissions, then hand out an enumerator
nsCOMArray<nsIPermission> array;
nsGetEnumeratorData data(&array, &mTypeArray);
mHostTable.EnumerateEntries(AddPermissionsToList, &data);
return NS_NewArrayEnumerator(aEnum, array);
}
NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
// The profile is about to change,
// or is going away because the application is shutting down.
if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
// clear the permissions file
RemoveAllInternal();
} else {
@@ -895,17 +915,19 @@ nsPermissionManager::NotifyObservers(nsI
mObserverService->NotifyObservers(aPermission,
kPermissionChangeNotification,
aData);
}
nsresult
nsPermissionManager::Read()
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
nsresult rv;
// delete expired permissions before we read in the db
{
// this deletion has its own scope so the write lock is released when done.
nsCOMPtr<mozIStorageStatement> stmtDeleteExpired;
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
@@ -963,17 +985,19 @@ nsPermissionManager::Read()
return NS_OK;
}
static const char kMatchTypeHost[] = "host";
nsresult
nsPermissionManager::Import()
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS;
+#endif
nsresult rv;
nsCOMPtr<nsIFile> permissionsFile;
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(permissionsFile));
if (NS_FAILED(rv)) return rv;
rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(kHostpermFileName));
@@ -1069,17 +1093,19 @@ nsPermissionManager::UpdateDB(OperationT
mozIStorageStatement* aStmt,
PRInt64 aID,
const nsACString &aHost,
const nsACString &aType,
PRUint32 aPermission,
PRUint32 aExpireType,
PRInt64 aExpireTime)
{
+#ifdef MOZ_IPC
ENSURE_NOT_CHILD_PROCESS_NORET;
+#endif
nsresult rv;
// no statement is ok - just means we don't have a profile
if (!aStmt)
return;
switch (aOp) {
--- a/extensions/cookie/nsPermissionManager.h
+++ b/extensions/cookie/nsPermissionManager.h
@@ -246,25 +246,27 @@ private:
nsTHashtable<nsHostEntry> mHostTable;
// a unique, monotonically increasing id used to identify each database entry
PRInt64 mLargestID;
// An array to store the strings identifying the different types.
nsTArray<nsCString> mTypeArray;
+#ifdef MOZ_IPC
// Whether we should update the child process with every change to a
// permission. This is set to true once the child is ready to receive
// such updates.
PRBool mUpdateChildProcess;
public:
void ChildRequestPermissions()
{
mUpdateChildProcess = PR_TRUE;
}
+#endif
};
// {4F6B5E00-0C36-11d5-A535-0010A401EB10}
#define NS_PERMISSIONMANAGER_CID \
{ 0x4f6b5e00, 0xc36, 0x11d5, { 0xa5, 0x35, 0x0, 0x10, 0xa4, 0x1, 0xeb, 0x10 } }
#endif /* nsPermissionManager_h__ */
--- a/extensions/cookie/test/Makefile.in
+++ b/extensions/cookie/test/Makefile.in
@@ -91,15 +91,17 @@ MODULE = test_cookies
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_BROWSER_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
XPCSHELL_TESTS = unit
+ifdef MOZ_IPC
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += unit_ipc
endif
+endif
include $(topsrcdir)/config/rules.mk
--- a/gfx/Makefile.in
+++ b/gfx/Makefile.in
@@ -54,19 +54,23 @@ endif
# be built first so the order is reversed.
ifndef BUILD_STATIC_LIBS
DIRS += ycbcr
endif
DIRS += angle
-DIRS += src qcms layers harfbuzz/src ots/src thebes src/thebes ipc
+DIRS += src qcms layers harfbuzz/src ots/src thebes src/thebes
ifdef BUILD_STATIC_LIBS
DIRS += ycbcr
endif
+ifdef MOZ_IPC
+DIRS += ipc
+endif
+
ifdef ENABLE_TESTS
TOOL_DIRS += tests
endif
include $(topsrcdir)/config/rules.mk
--- a/gfx/ipc/Makefile.in
+++ b/gfx/ipc/Makefile.in
@@ -37,16 +37,18 @@
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
+ifdef MOZ_IPC
+
MODULE = gfxipc
LIBRARY_NAME = gfxipc_s
FORCE_STATIC_LIB = 1
LIBXUL_LIBRARY = 1
EXPORT_LIBRARY = 1
EXPORTS_NAMESPACES = mozilla/gfx
@@ -66,11 +68,13 @@ CPPSRCS += \
SharedDIBWin.cpp \
SharedDIBSurface.cpp \
$(NULL)
endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
+
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -33,17 +33,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-#include "mozilla/layers/ShadowLayers.h"
+#ifdef MOZ_IPC
+# include "mozilla/layers/ShadowLayers.h"
+#endif // MOZ_IPC
#include "ImageLayers.h"
#include "Layers.h"
#include "gfxPlatform.h"
#include "ReadbackLayer.h"
#include "gfxUtils.h"
using namespace mozilla::layers;
@@ -234,16 +236,17 @@ Layer::CanUseOpaqueSurface()
// doesn't need an alpha channel, we can use an opaque surface for this
// layer too. Any transparent areas must be covered by something else
// in the container.
ContainerLayer* parent = GetParent();
return parent && parent->GetFirstChild() == this &&
parent->CanUseOpaqueSurface();
}
+#ifdef MOZ_IPC
// NB: eventually these methods will be defined unconditionally, and
// can be moved into Layers.h
const nsIntRect*
Layer::GetEffectiveClipRect()
{
if (ShadowLayer* shadow = AsShadowLayer()) {
return shadow->GetShadowClipRect();
}
@@ -254,16 +257,23 @@ const nsIntRegion&
Layer::GetEffectiveVisibleRegion()
{
if (ShadowLayer* shadow = AsShadowLayer()) {
return shadow->GetShadowVisibleRegion();
}
return GetVisibleRegion();
}
+#else
+
+const nsIntRect* Layer::GetEffectiveClipRect() { return GetClipRect(); }
+const nsIntRegion& Layer::GetEffectiveVisibleRegion() { return GetVisibleRegion(); }
+
+#endif // MOZ_IPC
+
gfx3DMatrix
Layer::SnapTransform(const gfx3DMatrix& aTransform,
const gfxRect& aSnapRect,
gfxMatrix* aResidualTransform)
{
if (aResidualTransform) {
*aResidualTransform = gfxMatrix();
}
@@ -346,18 +356,20 @@ Layer::CalculateScissorRect(bool aInterm
"Attempting to scissor out of bounds!");
return scissorRect;
}
const gfx3DMatrix&
Layer::GetLocalTransform()
{
+#ifdef MOZ_IPC
if (ShadowLayer* shadow = AsShadowLayer())
return shadow->GetShadowTransform();
+#endif
return mTransform;
}
float
Layer::GetEffectiveOpacity()
{
float opacity = GetOpacity();
for (ContainerLayer* c = GetParent(); c && !c->UseIntermediateSurface();
@@ -685,16 +697,17 @@ LayerManager::InitLog()
/*static*/ bool
LayerManager::IsLogEnabled()
{
NS_ABORT_IF_FALSE(!!sLog,
"layer manager must be created before logging is allowed");
return PR_LOG_TEST(sLog, PR_LOG_DEBUG);
}
+# ifdef MOZ_IPC
static nsACString&
PrintInfo(nsACString& aTo, ShadowLayer* aShadowLayer)
{
if (!aShadowLayer) {
return aTo;
}
if (const nsIntRect* clipRect = aShadowLayer->GetShadowClipRect()) {
AppendToString(aTo, *clipRect, " [shadow-clip=", "]");
@@ -702,16 +715,22 @@ PrintInfo(nsACString& aTo, ShadowLayer*
if (!aShadowLayer->GetShadowTransform().IsIdentity()) {
AppendToString(aTo, aShadowLayer->GetShadowTransform(), " [shadow-transform=", "]");
}
if (!aShadowLayer->GetShadowVisibleRegion().IsEmpty()) {
AppendToString(aTo, aShadowLayer->GetShadowVisibleRegion(), " [shadow-visible=", "]");
}
return aTo;
}
+# else
+static nsACString& PrintInfo(nsACString& aTo, ShadowLayer* aShadowLayer)
+{
+ return aTo;
+}
+# endif // MOZ_IPC
#else // !MOZ_LAYERS_HAVE_LOG
void Layer::Dump(FILE* aFile, const char* aPrefix) {}
void Layer::DumpSelf(FILE* aFile, const char* aPrefix) {}
void Layer::Log(const char* aPrefix) {}
void Layer::LogSelf(const char* aPrefix) {}
nsACString&
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -39,21 +39,24 @@ DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = \
$(srcdir) \
$(srcdir)/basic \
$(srcdir)/opengl \
$(srcdir)/d3d9 \
$(srcdir)/d3d10 \
- $(srcdir)/ipc \
$(NULL)
include $(DEPTH)/config/autoconf.mk
+ifdef MOZ_IPC
+VPATH += $(srcdir)/ipc
+endif
+
MODULE = thebes
LIBRARY_NAME = layers
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
DEFINES += -DIMPL_THEBES
ifdef MOZ_DEBUG
DEFINES += -DD3D_DEBUG_INFO
@@ -119,16 +122,17 @@ CPPSRCS += \
ImageLayerD3D10.cpp \
ColorLayerD3D10.cpp \
CanvasLayerD3D10.cpp \
ReadbackManagerD3D10.cpp \
$(NULL)
endif
endif
+ifdef MOZ_IPC #{
EXPORTS_NAMESPACES = IPC mozilla/layers
EXPORTS_IPC = ShadowLayerUtils.h
EXPORTS_mozilla/layers =\
ShadowLayers.h \
ShadowLayersChild.h \
ShadowLayersParent.h \
$(NULL)
@@ -140,26 +144,30 @@ CPPSRCS += \
ShadowLayersParent.cpp \
$(NULL)
ifdef MOZ_X11 #{
EXPORTS_mozilla/layers += ShadowLayerUtilsX11.h
CPPSRCS += ShadowLayerUtilsX11.cpp
endif #}
+endif #}
+
# Enable GLES2.0 under maemo
ifdef MOZ_X11
ifdef MOZ_PLATFORM_MAEMO
DEFINES += -DUSE_GLES2
endif
endif
include $(topsrcdir)/config/rules.mk
+ifdef MOZ_IPC
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
LayerManagerOGLShaders.h: LayerManagerOGLShaders.txt genshaders.py $(GLOBAL_DEPS)
$(PYTHON) $(srcdir)/opengl/genshaders.py $< $@
LayerManagerOGL.$(OBJ_SUFFIX): LayerManagerOGLShaders.h
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -31,22 +31,24 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-#include "gfxSharedImageSurface.h"
-
-#include "mozilla/layers/PLayerChild.h"
-#include "mozilla/layers/PLayersChild.h"
-#include "mozilla/layers/PLayersParent.h"
-#include "ipc/ShadowLayerChild.h"
+#ifdef MOZ_IPC
+# include "gfxSharedImageSurface.h"
+
+# include "mozilla/layers/PLayerChild.h"
+# include "mozilla/layers/PLayersChild.h"
+# include "mozilla/layers/PLayersParent.h"
+# include "ipc/ShadowLayerChild.h"
+#endif
#include "BasicLayers.h"
#include "ImageLayers.h"
#include "nsTArray.h"
#include "nsGUIEvent.h"
#include "nsIRenderingContext.h"
#include "gfxContext.h"
@@ -1602,16 +1604,18 @@ BasicLayerManager::CreateCanvasLayer()
already_AddRefed<ReadbackLayer>
BasicLayerManager::CreateReadbackLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
nsRefPtr<ReadbackLayer> layer = new BasicReadbackLayer(this);
return layer.forget();
}
+#ifdef MOZ_IPC
+
class BasicShadowableThebesLayer;
class BasicShadowableLayer : public ShadowableLayer
{
public:
BasicShadowableLayer()
{
MOZ_COUNT_CTOR(BasicShadowableLayer);
}
@@ -2885,11 +2889,12 @@ BasicShadowLayerManager::Hold(Layer* aLa
PRBool
BasicShadowLayerManager::IsCompositingCheap()
{
// Whether compositing is cheap depends on the parent backend.
return mShadowManager &&
LayerManager::IsCompositingCheap(GetParentBackendType());
}
+#endif // MOZ_IPC
}
}
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -40,17 +40,19 @@
#include "Layers.h"
#include "gfxContext.h"
#include "gfxCachedTempSurface.h"
#include "nsAutoRef.h"
#include "nsThreadUtils.h"
+#ifdef MOZ_IPC
#include "mozilla/layers/ShadowLayers.h"
+#endif
class nsIWidget;
namespace mozilla {
namespace layers {
class BasicShadowableLayer;
class ShadowThebesLayer;
@@ -64,17 +66,21 @@ class ReadbackProcessor;
* This is a cairo/Thebes-only, main-thread-only implementation of layers.
*
* In each transaction, the client sets up the layer tree and then during
* the drawing phase, each ThebesLayer is painted directly into the target
* context (with appropriate clipping and Push/PopGroups performed
* between layers).
*/
class THEBES_API BasicLayerManager :
+#ifdef MOZ_IPC
public ShadowLayerManager
+#else
+ public LayerManager
+#endif
{
public:
/**
* Construct a BasicLayerManager which will have no default
* target context. SetDefaultTarget or BeginTransactionWithTarget
* must be called for any rendering to happen. ThebesLayers will not
* be retained.
*/
@@ -224,16 +230,17 @@ protected:
gfxCachedTempSurface mCachedSurface;
BufferMode mDoubleBuffering;
PRPackedBool mUsingDefaultTarget;
bool mTransactionIncomplete;
};
+#ifdef MOZ_IPC
class BasicShadowLayerManager : public BasicLayerManager,
public ShadowLayerForwarder
{
typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
public:
BasicShadowLayerManager(nsIWidget* aWidget);
virtual ~BasicShadowLayerManager();
@@ -272,16 +279,17 @@ public:
private:
/**
* Forward transaction results to the parent context.
*/
void ForwardTransaction();
LayerRefArray mKeepAlive;
};
+#endif // MOZ_IPC
}
}
/**
* We need to be able to hold a reference to a gfxASurface from Image
* subclasses. This is potentially a problem since Images can be addrefed
* or released off the main thread. We can ensure that we never AddRef
--- a/gfx/layers/opengl/CanvasLayerOGL.cpp
+++ b/gfx/layers/opengl/CanvasLayerOGL.cpp
@@ -30,17 +30,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
# include "gfxSharedImageSurface.h"
+#endif
#include "CanvasLayerOGL.h"
#include "gfxImageSurface.h"
#include "gfxContext.h"
#include "GLContextProvider.h"
#ifdef XP_WIN
@@ -246,16 +248,18 @@ CanvasLayerOGL::RenderLayer(int aPreviou
if (useGLContext) {
gl()->UnbindTex2DOffscreen(mCanvasGLContext);
}
mUpdatedRect.Empty();
}
+#ifdef MOZ_IPC
+
ShadowCanvasLayerOGL::ShadowCanvasLayerOGL(LayerManagerOGL* aManager)
: ShadowCanvasLayer(aManager, nsnull)
, LayerOGL(aManager)
{
mImplData = static_cast<LayerOGL*>(this);
}
ShadowCanvasLayerOGL::~ShadowCanvasLayerOGL()
@@ -333,8 +337,10 @@ ShadowCanvasLayerOGL::RenderLayer(int aP
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0), mTexImage->GetSize()));
program->SetLayerTransform(GetEffectiveTransform());
program->SetLayerOpacity(GetEffectiveOpacity());
program->SetRenderOffset(aOffset);
program->SetTextureUnit(0);
mOGLManager->BindAndDrawQuad(program);
}
+
+#endif // MOZ_IPC
--- a/gfx/layers/opengl/CanvasLayerOGL.h
+++ b/gfx/layers/opengl/CanvasLayerOGL.h
@@ -33,18 +33,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_CANVASLAYEROGL_H
#define GFX_CANVASLAYEROGL_H
+#ifdef MOZ_IPC
# include "mozilla/layers/PLayers.h"
# include "mozilla/layers/ShadowLayers.h"
+#endif // MOZ_IPC
#include "LayerManagerOGL.h"
#include "gfxASurface.h"
namespace mozilla {
namespace layers {
class THEBES_API CanvasLayerOGL :
@@ -82,16 +84,17 @@ protected:
nsIntRect mUpdatedRect;
PRPackedBool mDelayedUpdates;
PRPackedBool mGLBufferIsPremultiplied;
PRPackedBool mNeedsYFlip;
};
+#ifdef MOZ_IPC
// NB: eventually we'll have separate shadow canvas2d and shadow
// canvas3d layers, but currently they look the same from the
// perspective of the compositor process
class ShadowCanvasLayerOGL : public ShadowCanvasLayer,
public LayerOGL
{
typedef gl::TextureImage TextureImage;
@@ -122,12 +125,13 @@ private:
nsRefPtr<TextureImage> mTexImage;
// XXX FIXME holding to free
nsRefPtr<gfxSharedImageSurface> mDeadweight;
};
+#endif // MOZ_IPC
} /* layers */
} /* mozilla */
#endif /* GFX_IMAGELAYEROGL_H */
--- a/gfx/layers/opengl/ColorLayerOGL.cpp
+++ b/gfx/layers/opengl/ColorLayerOGL.cpp
@@ -75,18 +75,20 @@ RenderColorLayer(ColorLayer* aLayer, Lay
void
ColorLayerOGL::RenderLayer(int,
const nsIntPoint& aOffset)
{
return RenderColorLayer(this, mOGLManager, aOffset);
}
+#ifdef MOZ_IPC
void
ShadowColorLayerOGL::RenderLayer(int,
const nsIntPoint& aOffset)
{
return RenderColorLayer(this, mOGLManager, aOffset);
}
+#endif // MOZ_IPC
} /* layers */
} /* mozilla */
--- a/gfx/layers/opengl/ColorLayerOGL.h
+++ b/gfx/layers/opengl/ColorLayerOGL.h
@@ -33,18 +33,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_COLORLAYEROGL_H
#define GFX_COLORLAYEROGL_H
+#ifdef MOZ_IPC
# include "mozilla/layers/PLayers.h"
# include "mozilla/layers/ShadowLayers.h"
+#endif // MOZ_IPC
#include "LayerManagerOGL.h"
namespace mozilla {
namespace layers {
class THEBES_API ColorLayerOGL : public ColorLayer,
public LayerOGL
@@ -62,16 +64,17 @@ public:
virtual Layer* GetLayer() { return this; }
virtual void Destroy() { mDestroyed = PR_TRUE; }
virtual void RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset);
};
+#ifdef MOZ_IPC
class ShadowColorLayerOGL : public ShadowColorLayer,
public LayerOGL
{
public:
ShadowColorLayerOGL(LayerManagerOGL *aManager)
: ShadowColorLayer(aManager, NULL)
, LayerOGL(aManager)
{
@@ -82,12 +85,13 @@ public:
// LayerOGL Implementation
virtual Layer* GetLayer() { return this; }
virtual void Destroy() { mDestroyed = PR_TRUE; }
virtual void RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset);
};
+#endif // MOZ_IPC
} /* layers */
} /* mozilla */
#endif /* GFX_COLORLAYEROGL_H */
--- a/gfx/layers/opengl/ContainerLayerOGL.cpp
+++ b/gfx/layers/opengl/ContainerLayerOGL.cpp
@@ -338,16 +338,18 @@ ContainerLayerOGL::GetFirstChildOGL()
void
ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset)
{
ContainerRender(this, aPreviousFrameBuffer, aOffset, mOGLManager);
}
+#ifdef MOZ_IPC
+
ShadowContainerLayerOGL::ShadowContainerLayerOGL(LayerManagerOGL *aManager)
: ShadowContainerLayer(aManager, NULL)
, LayerOGL(aManager)
{
mImplData = static_cast<LayerOGL*>(this);
}
ShadowContainerLayerOGL::~ShadowContainerLayerOGL()
@@ -384,11 +386,13 @@ ShadowContainerLayerOGL::GetFirstChildOG
void
ShadowContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset)
{
ContainerRender(this, aPreviousFrameBuffer, aOffset, mOGLManager);
}
+#endif // MOZ_IPC
+
} /* layers */
} /* mozilla */
--- a/gfx/layers/opengl/ContainerLayerOGL.h
+++ b/gfx/layers/opengl/ContainerLayerOGL.h
@@ -33,18 +33,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_CONTAINERLAYEROGL_H
#define GFX_CONTAINERLAYEROGL_H
+#ifdef MOZ_IPC
# include "mozilla/layers/PLayers.h"
# include "mozilla/layers/ShadowLayers.h"
+#endif
#include "Layers.h"
#include "LayerManagerOGL.h"
namespace mozilla {
namespace layers {
template<class Container>
@@ -93,16 +95,17 @@ public:
const nsIntPoint& aOffset);
virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
DefaultComputeEffectiveTransforms(aTransformToSurface);
}
};
+#ifdef MOZ_IPC
class ShadowContainerLayerOGL : public ShadowContainerLayer,
public LayerOGL
{
template<class Container>
friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
@@ -131,13 +134,14 @@ public:
virtual void RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset);
virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
DefaultComputeEffectiveTransforms(aTransformToSurface);
}
};
+#endif // MOZ_IPC
} /* layers */
} /* mozilla */
#endif /* GFX_CONTAINERLAYEROGL_H */
--- a/gfx/layers/opengl/ImageLayerOGL.cpp
+++ b/gfx/layers/opengl/ImageLayerOGL.cpp
@@ -31,17 +31,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
# include "gfxSharedImageSurface.h"
+#endif
#include "ImageLayerOGL.h"
#include "gfxImageSurface.h"
#include "yuv_convert.h"
#include "GLContextProvider.h"
#include "MacIOSurfaceImageOGL.h"
using namespace mozilla::gl;
@@ -738,16 +740,18 @@ CairoImageOGL::SetData(const CairoImage:
mSize = aData.mSize;
mLayerProgram =
gl->UploadSurfaceToTexture(aData.mSurface,
nsIntRect(0,0, mSize.width, mSize.height),
tex);
}
+#ifdef MOZ_IPC
+
ShadowImageLayerOGL::ShadowImageLayerOGL(LayerManagerOGL* aManager)
: ShadowImageLayer(aManager, nsnull)
, LayerOGL(aManager)
{
mImplData = static_cast<LayerOGL*>(this);
}
ShadowImageLayerOGL::~ShadowImageLayerOGL()
@@ -828,11 +832,13 @@ ShadowImageLayerOGL::RenderLayer(int aPr
program->SetLayerTransform(GetEffectiveTransform());
program->SetLayerOpacity(GetEffectiveOpacity());
program->SetRenderOffset(aOffset);
program->SetTextureUnit(0);
mOGLManager->BindAndDrawQuad(program);
}
+#endif // MOZ_IPC
+
} /* layers */
} /* mozilla */
--- a/gfx/layers/opengl/ImageLayerOGL.h
+++ b/gfx/layers/opengl/ImageLayerOGL.h
@@ -33,18 +33,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_IMAGELAYEROGL_H
#define GFX_IMAGELAYEROGL_H
+#ifdef MOZ_IPC
# include "mozilla/layers/PLayers.h"
# include "mozilla/layers/ShadowLayers.h"
+#endif // MOZ_IPC
#include "LayerManagerOGL.h"
#include "ImageLayers.h"
#include "yuv_convert.h"
#include "mozilla/Mutex.h"
namespace mozilla {
namespace layers {
@@ -227,16 +229,17 @@ public:
void SetData(const Data &aData);
GLTexture mTexture;
gfxIntSize mSize;
gl::ShaderProgramType mLayerProgram;
};
+#ifdef MOZ_IPC
class ShadowImageLayerOGL : public ShadowImageLayer,
public LayerOGL
{
typedef gl::TextureImage TextureImage;
public:
ShadowImageLayerOGL(LayerManagerOGL* aManager);
virtual ~ShadowImageLayerOGL();
@@ -263,12 +266,13 @@ private:
nsRefPtr<TextureImage> mTexImage;
// XXX FIXME holding to free
nsRefPtr<gfxSharedImageSurface> mDeadweight;
};
+#endif
} /* layers */
} /* mozilla */
#endif /* GFX_IMAGELAYEROGL_H */
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -32,17 +32,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
# include "mozilla/layers/PLayers.h"
+#endif // MOZ_IPC
#include "LayerManagerOGL.h"
#include "ThebesLayerOGL.h"
#include "ContainerLayerOGL.h"
#include "ImageLayerOGL.h"
#include "ColorLayerOGL.h"
#include "CanvasLayerOGL.h"
@@ -963,16 +965,18 @@ void LayerOGL::ApplyFilter(gfxPattern::G
if (aFilter != gfxPattern::FILTER_GOOD) {
NS_WARNING("Unsupported filter type!");
}
gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
}
}
+#ifdef MOZ_IPC
+
already_AddRefed<ShadowThebesLayer>
LayerManagerOGL::CreateShadowThebesLayer()
{
if (LayerManagerOGL::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowThebesLayerOGL>(new ShadowThebesLayerOGL(this)).forget();
@@ -1013,11 +1017,25 @@ LayerManagerOGL::CreateShadowCanvasLayer
{
if (LayerManagerOGL::mDestroyed) {
NS_WARNING("Call on destroyed layer manager");
return nsnull;
}
return nsRefPtr<ShadowCanvasLayerOGL>(new ShadowCanvasLayerOGL(this)).forget();
}
+#else
+
+already_AddRefed<ShadowThebesLayer>
+LayerManagerOGL::CreateShadowThebesLayer() { return nsnull; }
+already_AddRefed<ShadowContainerLayer>
+LayerManagerOGL::CreateShadowContainerLayer() { return nsnull; }
+already_AddRefed<ShadowImageLayer>
+LayerManagerOGL::CreateShadowImageLayer() { return nsnull; }
+already_AddRefed<ShadowColorLayer>
+LayerManagerOGL::CreateShadowColorLayer() { return nsnull; }
+already_AddRefed<ShadowCanvasLayer>
+LayerManagerOGL::CreateShadowCanvasLayer() { return nsnull; }
+
+#endif // MOZ_IPC
} /* layers */
} /* mozilla */
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -37,17 +37,19 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_LAYERMANAGEROGL_H
#define GFX_LAYERMANAGEROGL_H
#include "Layers.h"
+#ifdef MOZ_IPC
#include "mozilla/layers/ShadowLayers.h"
+#endif
#ifdef XP_WIN
#include <windows.h>
#endif
/**
* We don't include GLDefs.h here since we don't want to drag in all defines
* in for all our users.
@@ -77,17 +79,21 @@ class ShadowImageLayer;
class ShadowCanvasLayer;
class ShadowColorLayer;
/**
* This is the LayerManager used for OpenGL 2.1. For now this will render on
* the main thread.
*/
class THEBES_API LayerManagerOGL :
+#ifdef MOZ_IPC
public ShadowLayerManager
+#else
+ public LayerManager
+#endif
{
typedef mozilla::gl::GLContext GLContext;
typedef mozilla::gl::ShaderProgramType ProgramType;
public:
LayerManagerOGL(nsIWidget *aWidget);
virtual ~LayerManagerOGL();
--- a/gfx/layers/opengl/ThebesLayerOGL.cpp
+++ b/gfx/layers/opengl/ThebesLayerOGL.cpp
@@ -31,18 +31,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
# include "mozilla/layers/PLayers.h"
# include "mozilla/layers/ShadowLayers.h"
+#endif
#include "ThebesLayerBuffer.h"
#include "ThebesLayerOGL.h"
#include "gfxUtils.h"
#include "gfxTeeSurface.h"
namespace mozilla {
namespace layers {
@@ -771,16 +773,18 @@ ThebesLayerOGL::GetLayer()
PRBool
ThebesLayerOGL::IsEmpty()
{
return !mBuffer;
}
+#ifdef MOZ_IPC
+
class ShadowBufferOGL : public ThebesLayerBufferOGL
{
public:
ShadowBufferOGL(ShadowThebesLayerOGL* aLayer)
: ThebesLayerBufferOGL(aLayer, aLayer)
{}
virtual PaintState BeginPaint(ContentType aContentType, float, float) {
@@ -943,11 +947,13 @@ ShadowThebesLayerOGL::RenderLayer(int aP
mOGLManager->MakeCurrent();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
mBuffer->RenderTo(aOffset, mOGLManager);
}
+#endif // MOZ_IPC
+
} /* layers */
} /* mozilla */
--- a/gfx/layers/opengl/ThebesLayerOGL.h
+++ b/gfx/layers/opengl/ThebesLayerOGL.h
@@ -33,18 +33,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_THEBESLAYEROGL_H
#define GFX_THEBESLAYEROGL_H
-#include "mozilla/layers/PLayers.h"
-#include "mozilla/layers/ShadowLayers.h"
+#ifdef MOZ_IPC
+# include "mozilla/layers/PLayers.h"
+# include "mozilla/layers/ShadowLayers.h"
+#endif
#include "Layers.h"
#include "LayerManagerOGL.h"
#include "gfxImageSurface.h"
#include "GLContext.h"
namespace mozilla {
@@ -79,16 +81,17 @@ public:
private:
friend class BasicBufferOGL;
PRBool CreateSurface();
nsRefPtr<Buffer> mBuffer;
};
+#ifdef MOZ_IPC
class ShadowThebesLayerOGL : public ShadowThebesLayer,
public LayerOGL
{
public:
ShadowThebesLayerOGL(LayerManagerOGL *aManager);
virtual ~ShadowThebesLayerOGL();
// ShadowThebesLayer impl
@@ -109,12 +112,13 @@ public:
Layer* GetLayer();
virtual PRBool IsEmpty();
virtual void RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset);
private:
nsRefPtr<ShadowBufferOGL> mBuffer;
};
+#endif // MOZ_IPC
} /* layers */
} /* mozilla */
#endif /* GFX_THEBESLAYEROGL_H */
--- a/gfx/thebes/Makefile.in
+++ b/gfx/thebes/Makefile.in
@@ -42,18 +42,23 @@ EXPORTS = \
gfxUserFontSet.h \
GLDefs.h \
GLContext.h \
GLContextSymbols.h \
GLContextProvider.h \
GLContextProviderImpl.h \
nsCoreAnimationSupport.h \
EGLUtils.h \
+ $(NULL)
+
+ifdef MOZ_IPC
+EXPORTS += \
gfxSharedImageSurface.h \
$(NULL)
+endif
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
EXPORTS += \
gfxAndroidPlatform.h \
gfxFT2Fonts.h \
gfxFT2FontBase.h \
$(NULL)
endif
@@ -175,17 +180,16 @@ CPPSRCS = \
gfxTextRunWordCache.cpp \
gfxUserFontSet.cpp \
gfxUtils.cpp \
gfxUnicodeProperties.cpp \
gfxScriptItemizer.cpp \
gfxHarfBuzzShaper.cpp \
GLContext.cpp \
GLContextProviderOSMesa.cpp \
- gfxSharedImageSurface.cpp \
$(NULL)
# Are we targeting x86 or x64? If so, build gfxAlphaRecoverySSE2.cpp.
# The file uses SSE2 intrinsics, so it needs special compile flags on some
# compilers.
ifneq (,$(INTEL_ARCHITECTURE))
CPPSRCS += gfxAlphaRecoverySSE2.cpp
@@ -194,16 +198,22 @@ gfxAlphaRecoverySSE2.$(OBJ_SUFFIX): CXXF
endif
ifdef SOLARIS_SUNPRO_CXX
gfxAlphaRecoverySSE2.$(OBJ_SUFFIX): OS_CXXFLAGS += -xarch=sse2 -xO4
endif
endif
+ifdef MOZ_IPC
+CPPSRCS += \
+ gfxSharedImageSurface.cpp \
+ $(NULL)
+endif
+
SHARED_LIBRARY_LIBS += \
../layers/$(LIB_PREFIX)layers.$(LIB_SUFFIX) \
$(NULL)
ifndef MOZ_ENABLE_LIBXUL
EXTRA_DSO_LIBS = gkgfx ycbcr
ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
--- a/gfx/thebes/gfxAndroidPlatform.cpp
+++ b/gfx/thebes/gfxAndroidPlatform.cpp
@@ -30,18 +30,20 @@
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentChild.h"
#include "nsXULAppAPI.h"
+#endif
#include <android/log.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include "gfxAndroidPlatform.h"
@@ -166,18 +168,20 @@ public:
PL_DHashClearEntryStub,
PL_DHashFinalizeStub,
NULL};
if (!PL_DHashTableInit(&mMap, &ops, nsnull,
sizeof(FNCMapEntry), 0)) {
mMap.ops = nsnull;
LOG("initializing the map failed");
}
+#ifdef MOZ_IPC
NS_ABORT_IF_FALSE(XRE_GetProcessType() == GeckoProcessType_Default,
"StartupCacheFontNameCache should only be used in chrome procsess");
+#endif
mCache = mozilla::scache::StartupCache::GetSingleton();
Init();
}
void Init()
{
if (!mMap.ops)
return;
--- a/ipc/chromium/chromium-config.mk
+++ b/ipc/chromium/chromium-config.mk
@@ -41,16 +41,18 @@ endif
ifdef CHROMIUM_CONFIG_INCLUDED
$(error Must not include chromium-config.mk twice.)
endif
CHROMIUM_CONFIG_INCLUDED = 1
EXTRA_DEPS += $(topsrcdir)/ipc/chromium/chromium-config.mk
+ifdef MOZ_IPC # {
+
DEFINES += \
-DEXCLUDE_SKIA_DEPENDENCIES \
-DCHROMIUM_MOZILLA_BUILD \
$(NULL)
LOCAL_INCLUDES += \
-I$(topsrcdir)/ipc/chromium/src \
-I$(topsrcdir)/ipc/glue \
@@ -101,8 +103,9 @@ DEFINES += \
$(NULL)
# NB: to stop gcc warnings about exporting template instantiation
OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
endif # }
endif # }
+endif # }
\ No newline at end of file
--- a/js/src/xpconnect/shell/xpcshell.cpp
+++ b/js/src/xpconnect/shell/xpcshell.cpp
@@ -673,16 +673,18 @@ Clear(JSContext *cx, uintN argc, jsval *
} else {
JS_ReportError(cx, "'clear' requires an object");
return JS_FALSE;
}
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
+#ifdef MOZ_IPC
+
static JSBool
SendCommand(JSContext* cx,
uintN argc,
jsval* vp)
{
if (argc == 0) {
JS_ReportError(cx, "Function takes at least one argument!");
return JS_FALSE;
@@ -717,16 +719,18 @@ GetChildGlobalObject(JSContext* cx,
JSObject* global;
if (XRE_GetChildGlobalObject(cx, &global)) {
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(global));
return JS_TRUE;
}
return JS_FALSE;
}
+#endif // MOZ_IPC
+
/*
* JSContext option name to flag map. The option names are in alphabetical
* order for better reporting.
*/
static const struct {
const char *name;
uint32 flag;
} js_options[] = {
@@ -851,18 +855,20 @@ static JSFunctionSpec glob_functions[] =
{"gczeal", GCZeal, 1,0},
#endif
{"clear", Clear, 1,0},
{"options", Options, 0,0},
JS_FN("parent", Parent, 1,0),
#ifdef DEBUG
{"dumpHeap", DumpHeap, 5,0},
#endif
+#ifdef MOZ_IPC
{"sendCommand", SendCommand, 1,0},
{"getChildGlobalObject", GetChildGlobalObject, 0,0},
+#endif
#ifdef MOZ_CALLGRIND
{"startCallgrind", js_StartCallgrind, 0,0},
{"stopCallgrind", js_StopCallgrind, 0,0},
{"dumpCallgrind", js_DumpCallgrind, 1,0},
#endif
{nsnull,nsnull,0,0}
};
@@ -2008,18 +2014,20 @@ main(int argc, char **argv)
cxstack->Pop(&oldcx);
NS_ASSERTION(oldcx == cx, "JS thread context push/pop mismatch");
cxstack = nsnull;
JS_GC(cx);
} //this scopes the JSAutoCrossCompartmentCall
JS_DestroyContext(cx);
} // this scopes the nsCOMPtrs
+#ifdef MOZ_IPC
if (!XRE_ShutdownTestShell())
NS_ERROR("problem shutting down testshell");
+#endif
#ifdef MOZ_CRASHREPORTER
// Get the crashreporter service while XPCOM is still active.
// This is a special exception: it will remain usable after NS_ShutdownXPCOM().
nsCOMPtr<nsICrashReporter> crashReporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
#endif
--- a/layout/Makefile.in
+++ b/layout/Makefile.in
@@ -47,23 +47,26 @@ MODULE = layout
PARALLEL_DIRS = \
style \
base \
generic \
forms \
tables \
xul/base/public \
xul/base/src \
- ipc \
$(NULL)
ifdef NS_PRINTING
PARALLEL_DIRS += printing
endif
+ifdef MOZ_IPC
+PARALLEL_DIRS += ipc
+endif
+
ifdef MOZ_MATHML
PARALLEL_DIRS += \
mathml \
$(NULL)
endif
ifdef MOZ_SVG
PARALLEL_DIRS += svg/base/src
--- a/layout/base/Makefile.in
+++ b/layout/base/Makefile.in
@@ -143,17 +143,19 @@ CPPSRCS += \
nsBidi.cpp \
$(NULL)
endif
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
+ifdef MOZ_IPC
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
LOCAL_INCLUDES += \
-I$(srcdir) \
-I$(srcdir)/../style \
-I$(srcdir)/../generic \
-I$(srcdir)/../forms \
-I$(srcdir)/../tables \
-I$(srcdir)/../printing \
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1696,16 +1696,18 @@ nsDisplayOwnLayer::~nsDisplayOwnLayer()
already_AddRefed<Layer>
nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager) {
nsRefPtr<Layer> layer = aBuilder->LayerBuilder()->
BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mList);
return layer.forget();
}
+#ifdef MOZ_IPC
+
nsDisplayScrollLayer::nsDisplayScrollLayer(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
nsIFrame* aForFrame,
nsIFrame* aViewportFrame)
: nsDisplayOwnLayer(aBuilder, aForFrame, aList)
, mViewportFrame(aViewportFrame)
{
#ifdef NS_BUILD_REFCNT_LOGGING
@@ -1775,16 +1777,18 @@ nsDisplayScrollLayer::ComputeVisibility(
#ifdef NS_BUILD_REFCNT_LOGGING
nsDisplayScrollLayer::~nsDisplayScrollLayer()
{
MOZ_COUNT_DTOR(nsDisplayScrollLayer);
}
#endif
+#endif
+
nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsDisplayItem* aItem,
const nsRect& aRect)
: nsDisplayWrapList(aBuilder, aFrame, aItem) {
MOZ_COUNT_CTOR(nsDisplayClip);
mClip = SnapBounds(aBuilder->IsSnappingEnabled() && !aBuilder->IsInTransform(),
aBuilder->CurrentPresContext(), aRect);
}
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -1764,16 +1764,17 @@ public:
virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem)
{
// Don't allow merging, each sublist must have its own layer
return PR_FALSE;
}
NS_DISPLAY_DECL_NAME("OwnLayer", TYPE_OWN_LAYER)
};
+#ifdef MOZ_IPC
/**
* This creates a layer for the given list of items, whose visibility is
* determined by the displayport for the given frame instead of what is
* passed in to ComputeVisibility.
*
* Here in content, we can use this to render more content than is actually
* visible. Then, the compositing process can manipulate the generated layer
* through transformations so that asynchronous scrolling can be implemented.
@@ -1811,16 +1812,17 @@ public:
{
// Force this as a layer so we can scroll asynchronously.
// This causes incorrect rendering for rounded clips!
return mozilla::LAYER_ACTIVE_FORCE;
}
private:
nsIFrame* mViewportFrame;
};
+#endif
/**
* nsDisplayClip can clip a list of items, but we take a single item
* initially and then later merge other items into it when we merge
* adjacent matching nsDisplayClips
*/
class nsDisplayClip : public nsDisplayWrapList {
public:
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -73,21 +73,27 @@ CPPSRCS = \
$(NULL)
EXPORTS = \
nsLayoutCID.h \
nsContentDLF.h \
nsLayoutStatics.h \
$(NULL)
+ifdef MOZ_IPC
+GKIPCLIB=../ipc/$(LIB_PREFIX)gkipc_s.$(LIB_SUFFIX)
+else
+GKIPCLIB=$(NULL)
+endif
+
SHARED_LIBRARY_LIBS = \
../base/$(LIB_PREFIX)gkbase_s.$(LIB_SUFFIX) \
../forms/$(LIB_PREFIX)gkforms_s.$(LIB_SUFFIX) \
../generic/$(LIB_PREFIX)gkgeneric_s.$(LIB_SUFFIX) \
- ../ipc/$(LIB_PREFIX)gkipc_s.$(LIB_SUFFIX) \
+ $(GKIPCLIB) \
../style/$(LIB_PREFIX)gkstyle_s.$(LIB_SUFFIX) \
../tables/$(LIB_PREFIX)gktable_s.$(LIB_SUFFIX) \
../xul/base/src/$(LIB_PREFIX)gkxulbase_s.$(LIB_SUFFIX) \
$(DEPTH)/content/base/src/$(LIB_PREFIX)gkconbase_s.$(LIB_SUFFIX) \
$(DEPTH)/content/canvas/src/$(LIB_PREFIX)gkconcvs_s.$(LIB_SUFFIX) \
$(DEPTH)/content/events/src/$(LIB_PREFIX)gkconevents_s.$(LIB_SUFFIX) \
$(DEPTH)/content/html/content/src/$(LIB_PREFIX)gkconhtmlcon_s.$(LIB_SUFFIX) \
$(DEPTH)/content/html/document/src/$(LIB_PREFIX)gkconhtmldoc_s.$(LIB_SUFFIX) \
@@ -289,18 +295,20 @@ ifeq ($(OS_ARCH),Darwin)
OS_LIBS += -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -framework IOKit
endif
endif
ifdef MOZ_NATIVE_LIBVPX
EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS)
endif
+ifdef MOZ_IPC
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += -I$(srcdir)/../base \
-I$(srcdir)/../generic \
-I$(srcdir)/../forms \
-I$(srcdir)/../tables \
-I$(srcdir)/../style \
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -31,17 +31,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
#include "xpcmodule.h"
#include "mozilla/ModuleUtils.h"
#include "nsLayoutStatics.h"
#include "nsContentCID.h"
#include "nsContentDLF.h"
#include "nsContentPolicyUtils.h"
#include "nsDataDocumentContentPolicy.h"
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -50,17 +50,19 @@
#include <QWidget>
#include <QKeyEvent>
#ifdef MOZ_X11
#include <QX11Info>
#endif
#undef slots
#endif
+#ifdef MOZ_IPC
#include "mozilla/plugins/PluginMessageUtils.h"
+#endif
#ifdef MOZ_X11
#include <cairo-xlib.h>
#include "gfxXlibSurface.h"
/* X headers suck */
enum { XKeyPress = KeyPress };
#ifdef KeyPress
#undef KeyPress
@@ -233,17 +235,19 @@ using mozilla::DefaultXDisplay;
static PRLogModuleInfo *nsObjectFrameLM = PR_NewLogModule("nsObjectFrame");
#endif /* PR_LOGGING */
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
#define MAC_CARBON_PLUGINS
#endif
using namespace mozilla;
+#ifdef MOZ_IPC
using namespace mozilla::plugins;
+#endif
using namespace mozilla::layers;
// special class for handeling DOM context menu events because for
// some reason it starves other mouse events if implemented on the
// same class
class nsPluginDOMContextMenuListener : public nsIDOMContextMenuListener
{
public:
@@ -2346,27 +2350,29 @@ nsObjectFrame::PaintPlugin(nsDisplayList
NPWindow *window;
mInstanceOwner->GetWindow(window);
if (window->type == NPWindowTypeDrawable) {
// the offset of the DC
nsPoint origin;
gfxWindowsNativeDrawing nativeDraw(ctx, frameGfxRect);
+#ifdef MOZ_IPC
if (nativeDraw.IsDoublePass()) {
// OOP plugin specific: let the shim know before we paint if we are doing a
// double pass render. If this plugin isn't oop, the register window message
// will be ignored.
NPEvent pluginEvent;
pluginEvent.event = DoublePassRenderingEvent();
pluginEvent.wParam = 0;
pluginEvent.lParam = 0;
if (pluginEvent.event)
inst->HandleEvent(&pluginEvent, nsnull);
}
+#endif
do {
HDC hdc = nativeDraw.BeginNativeDrawing();
if (!hdc)
return;
RECT dest;
nativeDraw.TransformToNativeRect(frameGfxRect, dest);
RECT dirty;
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -38,18 +38,20 @@
*
* ***** END LICENSE BLOCK ***** */
/*
* rendering object for replaced elements that contain a document, such
* as <frame>, <iframe>, and some <object>s
*/
+#ifdef MOZ_IPC
#include "mozilla/layout/RenderFrameParent.h"
using mozilla::layout::RenderFrameParent;
+#endif
#include "nsSubDocumentFrame.h"
#include "nsCOMPtr.h"
#include "nsGenericHTMLElement.h"
#include "nsIDocShell.h"
#include "nsIDocShellLoadInfo.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
@@ -270,23 +272,25 @@ nsSubDocumentFrame::BuildDisplayList(nsD
return NS_OK;
nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
NS_ENSURE_SUCCESS(rv, rv);
if (!mInnerView)
return NS_OK;
+#ifdef MOZ_IPC
nsFrameLoader* frameLoader = FrameLoader();
if (frameLoader) {
RenderFrameParent* rfp = frameLoader->GetCurrentRemoteFrame();
if (rfp) {
return rfp->BuildDisplayList(aBuilder, this, aDirtyRect, aLists);
}
}
+#endif
nsIView* subdocView = mInnerView->GetFirstChild();
if (!subdocView)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell = nsnull;
nsIFrame* subdocRootFrame =
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -33,18 +33,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentChild.h"
#include "nsXULAppAPI.h"
+#endif
#include "nsPrefBranch.h"
#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIDirectoryService.h"
#include "nsString.h"
@@ -67,30 +69,32 @@ struct EnumerateData {
nsTArray<nsCString> *pref_list;
};
// Prototypes
static PLDHashOperator
pref_enumChild(PLDHashTable *table, PLDHashEntryHdr *heh,
PRUint32 i, void *arg);
+#ifdef MOZ_IPC
using mozilla::dom::ContentChild;
static ContentChild*
GetContentChild()
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
ContentChild* cpc = ContentChild::GetSingleton();
if (!cpc) {
NS_RUNTIMEABORT("Content Protocol is NULL! We're going to crash!");
}
return cpc;
}
return nsnull;
}
+#endif // MOZ_IPC
/*
* Constructor/Destructor
*/
nsPrefBranch::nsPrefBranch(const char *aPrefRoot, PRBool aDefaultBranch)
{
mPrefRoot = aPrefRoot;
@@ -161,59 +165,65 @@ NS_IMETHODIMP nsPrefBranch::GetBoolPref(
{
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_GetBoolPref(pref, _retval, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::SetBoolPref(const char *aPrefName, PRInt32 aValue)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_SetBoolPref(pref, aValue, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::GetCharPref(const char *aPrefName, char **_retval)
{
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_CopyCharPref(pref, _retval, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::SetCharPref(const char *aPrefName, const char *aValue)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
NS_ENSURE_ARG(aValue);
const char *pref = getPrefName(aPrefName);
return PREF_SetCharPref(pref, aValue, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::GetIntPref(const char *aPrefName, PRInt32 *_retval)
{
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_GetIntPref(pref, _retval, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::SetIntPref(const char *aPrefName, PRInt32 aValue)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_SetIntPref(pref, aValue, mIsDefault);
}
NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID & aType, void **_retval)
{
@@ -263,38 +273,42 @@ NS_IMETHODIMP nsPrefBranch::GetComplexVa
// if we can't get the pref, there's no point in being here
rv = GetCharPref(aPrefName, getter_Copies(utf8String));
if (NS_FAILED(rv)) {
return rv;
}
if (aType.Equals(NS_GET_IID(nsILocalFile))) {
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot get nsILocalFile pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = file->SetPersistentDescriptor(utf8String);
if (NS_SUCCEEDED(rv)) {
file.forget(reinterpret_cast<nsILocalFile**>(_retval));
return NS_OK;
}
}
return rv;
}
if (aType.Equals(NS_GET_IID(nsIRelativeFilePref))) {
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot get nsIRelativeFilePref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
nsACString::const_iterator keyBegin, strEnd;
utf8String.BeginReading(keyBegin);
utf8String.EndReading(strEnd);
// The pref has the format: [fromKey]a/b/c
if (*keyBegin++ != '[')
return NS_ERROR_FAILURE;
@@ -338,20 +352,22 @@ NS_IMETHODIMP nsPrefBranch::GetComplexVa
}
NS_WARNING("nsPrefBranch::GetComplexValue - Unsupported interface type");
return NS_NOINTERFACE;
}
NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
nsresult rv = NS_NOINTERFACE;
if (aType.Equals(NS_GET_IID(nsILocalFile))) {
nsCOMPtr<nsILocalFile> file = do_QueryInterface(aValue);
if (!file)
@@ -427,20 +443,22 @@ NS_IMETHODIMP nsPrefBranch::SetComplexVa
}
NS_WARNING("nsPrefBranch::SetComplexValue - Unsupported interface type");
return NS_NOINTERFACE;
}
NS_IMETHODIMP nsPrefBranch::ClearUserPref(const char *aPrefName)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_ClearUserPref(pref);
}
NS_IMETHODIMP nsPrefBranch::PrefHasUserValue(const char *aPrefName, PRBool *_retval)
{
@@ -448,64 +466,72 @@ NS_IMETHODIMP nsPrefBranch::PrefHasUserV
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
*_retval = PREF_HasUserPref(pref);
return NS_OK;
}
NS_IMETHODIMP nsPrefBranch::LockPref(const char *aPrefName)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot lock pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_LockPref(pref, PR_TRUE);
}
NS_IMETHODIMP nsPrefBranch::PrefIsLocked(const char *aPrefName, PRBool *_retval)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot check lock pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG_POINTER(_retval);
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
*_retval = PREF_PrefIsLocked(pref);
return NS_OK;
}
NS_IMETHODIMP nsPrefBranch::UnlockPref(const char *aPrefName)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot unlock pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aPrefName);
const char *pref = getPrefName(aPrefName);
return PREF_LockPref(pref, PR_FALSE);
}
/* void resetBranch (in string startingAt); */
NS_IMETHODIMP nsPrefBranch::ResetBranch(const char *aStartingAt)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsPrefBranch::DeleteBranch(const char *aStartingAt)
{
+#ifdef MOZ_IPC
if (GetContentChild()) {
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NS_ENSURE_ARG(aStartingAt);
const char *pref = getPrefName(aStartingAt);
return PREF_DeleteBranch(pref);
}
NS_IMETHODIMP nsPrefBranch::GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray)
{
--- a/modules/libpref/src/nsPrefService.cpp
+++ b/modules/libpref/src/nsPrefService.cpp
@@ -32,18 +32,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentChild.h"
#include "nsXULAppAPI.h"
+#endif
#include "nsPrefService.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsICategoryManager.h"
#include "nsCategoryManagerUtils.h"
#include "nsNetUtil.h"
#include "nsIFile.h"
@@ -134,28 +136,30 @@ nsresult nsPrefService::Init()
nsresult rv;
rv = PREF_Init();
NS_ENSURE_SUCCESS(rv, rv);
rv = pref_InitInitialObjects();
NS_ENSURE_SUCCESS(rv, rv);
+#ifdef MOZ_IPC
using mozilla::dom::ContentChild;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
InfallibleTArray<PrefTuple> array;
ContentChild::GetSingleton()->SendReadPrefsArray(&array);
// Store the array
nsTArray<PrefTuple>::size_type index = array.Length();
while (index-- > 0) {
pref_SetPrefTuple(array[index], PR_TRUE);
}
return NS_OK;
}
+#endif
nsXPIDLCString lockFileName;
/*
* The following is a small hack which will allow us to only load the library
* which supports the netscape.cfg file if the preference is defined. We
* test for the existence of the pref, set in the all.js (mozilla) or
* all-ns.js (netscape 6), and if it exists we startup the pref config
* category which will do the rest.
@@ -179,18 +183,20 @@ nsresult nsPrefService::Init()
observerService->AddObserver(this, "load-extension-defaults", PR_TRUE);
return(rv);
}
NS_IMETHODIMP nsPrefService::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content)
return NS_ERROR_NOT_AVAILABLE;
+#endif
nsresult rv = NS_OK;
if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
if (mCurrentFile) {
mCurrentFile->Remove(PR_FALSE);
mCurrentFile = nsnull;
@@ -208,20 +214,22 @@ NS_IMETHODIMP nsPrefService::Observe(nsI
pref_InitInitialObjects();
}
return rv;
}
NS_IMETHODIMP nsPrefService::ReadUserPrefs(nsIFile *aFile)
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
NS_ERROR("cannot load prefs from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
nsresult rv;
if (nsnull == aFile) {
rv = UseDefaultPrefFile();
UseUserPrefFile();
NotifyServiceObservers(NS_PREFSERVICE_READ_TOPIC_ID);
@@ -229,47 +237,53 @@ NS_IMETHODIMP nsPrefService::ReadUserPre
} else {
rv = ReadAndOwnUserPrefFile(aFile);
}
return rv;
}
NS_IMETHODIMP nsPrefService::ResetPrefs()
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
NS_ERROR("cannot set prefs from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
NotifyServiceObservers(NS_PREFSERVICE_RESET_TOPIC_ID);
PREF_CleanupPrefs();
nsresult rv = PREF_Init();
NS_ENSURE_SUCCESS(rv, rv);
return pref_InitInitialObjects();
}
NS_IMETHODIMP nsPrefService::ResetUserPrefs()
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
NS_ERROR("cannot set prefs from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
PREF_ClearAllUserPrefs();
return NS_OK;
}
NS_IMETHODIMP nsPrefService::SavePrefFile(nsIFile *aFile)
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
NS_ERROR("cannot save prefs from content process");
return NS_ERROR_NOT_AVAILABLE;
}
+#endif
return SavePrefFileInternal(aFile);
}
/* part of nsIPrefServiceInternal */
NS_IMETHODIMP nsPrefService::ReadExtensionPrefs(nsILocalFile *aFile)
{
nsresult rv;
--- a/modules/libpref/test/Makefile.in
+++ b/modules/libpref/test/Makefile.in
@@ -43,14 +43,16 @@ VPATH = @srcdir@
relativesrcdir = modules/libpref/test
include $(DEPTH)/config/autoconf.mk
MODULE = test_libpref
XPCSHELL_TESTS = unit
+ifdef MOZ_IPC
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += unit_ipc
endif
+endif
include $(topsrcdir)/config/rules.mk
--- a/modules/plugin/base/src/Makefile.in
+++ b/modules/plugin/base/src/Makefile.in
@@ -114,17 +114,19 @@ EXTRA_DSO_LDOPTS = \
$(MOZ_JS_LIBS) \
$(NULL)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
EXTRA_DSO_LDOPTS += $(TK_LIBS)
endif
include $(topsrcdir)/config/config.mk
+ifdef MOZ_IPC
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,version)
endif
CXXFLAGS += $(TK_CFLAGS)
EXTRA_DSO_LDOPTS += $(TK_LIBS)
--- a/modules/plugin/base/src/nsJSNPRuntime.cpp
+++ b/modules/plugin/base/src/nsJSNPRuntime.cpp
@@ -31,17 +31,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
// FIXME(bug 332648): Give me a real API please!
#include "jscntxt.h"
#include "nsJSNPRuntime.h"
#include "nsNPAPIPlugin.h"
#include "nsNPAPIPluginInstance.h"
#include "nsIScriptGlobalObject.h"
@@ -52,19 +54,21 @@
#include "nsIJSContextStack.h"
#include "nsIXPConnect.h"
#include "nsIDOMElement.h"
#include "prmem.h"
#include "nsIContent.h"
using namespace mozilla::plugins::parent;
+#ifdef MOZ_IPC
#include "mozilla/plugins/PluginScriptableObjectParent.h"
using mozilla::plugins::PluginScriptableObjectParent;
using mozilla::plugins::ParentNPObject;
+#endif
// Hash of JSObject wrappers that wraps JSObjects as NPObjects. There
// will be one wrapper per JSObject per plugin instance, i.e. if two
// plugins access the JSObject x, two wrappers for x will be
// created. This is needed to be able to properly drop the wrappers
// when a plugin is torn down in case there's a leak in the plugin (we
// don't want to leak the world just because a plugin leaks an
// NPObject).
@@ -88,17 +92,21 @@ static nsIJSContextStack *sContextStack;
static nsTArray<NPObject*>* sDelayedReleases;
namespace {
inline bool
NPObjectIsOutOfProcessProxy(NPObject *obj)
{
+#ifdef MOZ_IPC
return obj->_class == PluginScriptableObjectParent::GetClass();
+#else
+ return false;
+#endif
}
} // anonymous namespace
// Helper class that reports any JS exceptions that were thrown while
// the plugin executed JS.
class AutoJSExceptionReporter
@@ -1323,16 +1331,17 @@ NPObjWrapper_GetProperty(JSContext *cx,
PRBool hasProperty, hasMethod;
NPVariant npv;
VOID_TO_NPVARIANT(npv);
NPIdentifier identifier = JSIdToNPIdentifier(id);
+#ifdef MOZ_IPC
if (NPObjectIsOutOfProcessProxy(npobj)) {
PluginScriptableObjectParent* actor =
static_cast<ParentNPObject*>(npobj)->parent;
// actor may be null if the plugin crashed.
if (!actor)
return JS_FALSE;
@@ -1354,16 +1363,17 @@ NPObjWrapper_GetProperty(JSContext *cx,
_releasevariantvalue(&npv);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
}
}
return JS_TRUE;
}
+#endif
hasProperty = npobj->_class->hasProperty(npobj, identifier);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
hasMethod = npobj->_class->hasMethod(npobj, identifier);
if (!ReportExceptionIfPending(cx))
return JS_FALSE;
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -35,17 +35,19 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_WIDGET_QT
#include <QX11Info>
#endif
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
#include "prtypes.h"
#include "prmem.h"
#include "prenv.h"
#include "prclist.h"
#include "jscntxt.h"
@@ -107,18 +109,20 @@
#include "nsNetUtil.h"
#include "mozilla/PluginLibrary.h"
using mozilla::PluginLibrary;
#include "mozilla/PluginPRLibrary.h"
using mozilla::PluginPRLibrary;
+#ifdef MOZ_IPC
#include "mozilla/plugins/PluginModuleParent.h"
using mozilla::plugins::PluginModuleParent;
+#endif
#ifdef MOZ_X11
#include "mozilla/X11Util.h"
#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -256,23 +260,27 @@ nsNPAPIPlugin::~nsNPAPIPlugin()
#if defined(XP_MACOSX) && !defined(__LP64__)
void
nsNPAPIPlugin::SetPluginRefNum(short aRefNum)
{
mPluginRefNum = aRefNum;
}
#endif
+#ifdef MOZ_IPC
void
nsNPAPIPlugin::PluginCrashed(const nsAString& pluginDumpID,
const nsAString& browserDumpID)
{
nsRefPtr<nsPluginHost> host = dont_AddRef(nsPluginHost::GetInst());
host->PluginCrashed(this, pluginDumpID, browserDumpID);
}
+#endif
+
+#ifdef MOZ_IPC
#if defined(XP_MACOSX) && defined(__i386__)
static PRInt32 OSXVersion()
{
static PRInt32 gOSXVersion = 0x0;
if (gOSXVersion == 0x0) {
OSErr err = ::Gestalt(gestaltSystemVersion, (SInt32*)&gOSXVersion);
if (err != noErr) {
@@ -447,26 +455,30 @@ nsNPAPIPlugin::RunPluginOOP(const nsPlug
#else
prefs->GetBoolPref("dom.ipc.plugins.enabled", &oopPluginsEnabled);
#endif
}
return oopPluginsEnabled;
}
+#endif // MOZ_IPC
+
inline PluginLibrary*
GetNewPluginLibrary(nsPluginTag *aPluginTag)
{
if (!aPluginTag) {
return nsnull;
}
+#ifdef MOZ_IPC
if (nsNPAPIPlugin::RunPluginOOP(aPluginTag)) {
return PluginModuleParent::LoadModule(aPluginTag->mFullPath.get());
}
+#endif
return new PluginPRLibrary(aPluginTag->mFullPath.get(), aPluginTag->mLibrary);
}
// Creates an nsNPAPIPlugin object. One nsNPAPIPlugin object exists per plugin (not instance).
nsresult
nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
{
*aResult = nsnull;
--- a/modules/plugin/base/src/nsNPAPIPlugin.h
+++ b/modules/plugin/base/src/nsNPAPIPlugin.h
@@ -91,24 +91,26 @@ public:
PluginLibrary* GetLibrary();
// PluginFuncs() can't fail but results are only valid if GetLibrary() succeeds
NPPluginFuncs* PluginFuncs();
#if defined(XP_MACOSX) && !defined(__LP64__)
void SetPluginRefNum(short aRefNum);
#endif
+#ifdef MOZ_IPC
// The IPC mechanism notifies the nsNPAPIPlugin if the plugin
// crashes and is no longer usable. pluginDumpID/browserDumpID are
// the IDs of respective minidumps that were written, or empty if no
// minidump was written.
void PluginCrashed(const nsAString& pluginDumpID,
const nsAString& browserDumpID);
static PRBool RunPluginOOP(const nsPluginTag *aPluginTag);
+#endif
protected:
#if defined(XP_MACOSX) && !defined(__LP64__)
short mPluginRefNum;
#endif
NPPluginFuncs mPluginFuncs;
--- a/modules/plugin/base/src/nsPluginHost.cpp
+++ b/modules/plugin/base/src/nsPluginHost.cpp
@@ -1736,17 +1736,21 @@ static nsresult ConvertToNative(nsIUnico
aNativeString.SetLength(outLen);
return NS_OK;
}
static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
nsNPAPIPlugin **aOutNPAPIPlugin)
{
// If this is an in-process plugin we'll need to load it here if we haven't already.
+#ifdef MOZ_IPC
if (!nsNPAPIPlugin::RunPluginOOP(aPluginTag)) {
+#else
+ if (!aPluginTag->mLibrary) {
+#endif
if (aPluginTag->mFullPath.IsEmpty())
return NS_ERROR_FAILURE;
nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
file->InitWithPath(NS_ConvertUTF8toUTF16(aPluginTag->mFullPath));
nsPluginFile pluginFile(file);
PRLibrary* pluginLibrary = NULL;
if (NS_FAILED(pluginFile.LoadPlugin(&pluginLibrary)) || !pluginLibrary)
@@ -4078,16 +4082,17 @@ NS_IMETHODIMP nsPluginHost::Notify(nsITi
iter.GetNext()->SendIdleEvent();
}
return NS_OK;
}
#endif
return NS_ERROR_FAILURE;
}
+#ifdef MOZ_IPC
#ifdef XP_WIN
// Re-enable any top level browser windows that were disabled by modal dialogs
// displayed by the crashed plugin.
static void
CheckForDisabledWindows()
{
nsCOMPtr<nsIWindowMediator> wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
if (!wm)
@@ -4187,16 +4192,17 @@ nsPluginHost::PluginCrashed(nsNPAPIPlugi
// instance of this plugin we reload it (launch a new plugin process).
crashedPluginTag->mEntryPoint = nsnull;
#ifdef XP_WIN
CheckForDisabledWindows();
#endif
}
+#endif
nsNPAPIPluginInstance*
nsPluginHost::FindInstance(const char *mimetype)
{
for (PRUint32 i = 0; i < mInstances.Length(); i++) {
nsNPAPIPluginInstance* instance = mInstances[i];
const char* mt;
--- a/modules/plugin/base/src/nsPluginHost.h
+++ b/modules/plugin/base/src/nsPluginHost.h
@@ -171,19 +171,21 @@ public:
static nsresult GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt **aPrompt);
static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, PRBool isVisible);
void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame);
+#ifdef MOZ_IPC
void PluginCrashed(nsNPAPIPlugin* plugin,
const nsAString& pluginDumpID,
const nsAString& browserDumpID);
+#endif
nsNPAPIPluginInstance *FindInstance(const char *mimetype);
nsNPAPIPluginInstance *FindStoppedInstance(const char * url);
nsNPAPIPluginInstance *FindOldestStoppedInstance();
PRUint32 StoppedInstanceCount();
nsTArray< nsRefPtr<nsNPAPIPluginInstance> > *InstanceArray();
--- a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp
+++ b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp
@@ -716,23 +716,27 @@ nsresult nsPluginNativeWindowWin::Subcla
NS_WARNING("The new procedure is our widget procedure?");
}
#endif
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)PluginWndProc);
return NS_OK;
}
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
+#ifdef MOZ_IPC
// Out of process plugins must not have the WS_CLIPCHILDREN style set on their
// parent windows or else synchronous paints (via UpdateWindow() and others)
// will cause deadlocks.
if (::GetPropW(hWnd, L"PluginInstanceParentProperty"))
style &= ~WS_CLIPCHILDREN;
else
style |= WS_CLIPCHILDREN;
+#else
+ style |= WS_CLIPCHILDREN;
+#endif
SetWindowLongPtr(hWnd, GWL_STYLE, style);
mPluginWinProc = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)PluginWndProc);
if (!mPluginWinProc)
return NS_ERROR_FAILURE;
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
--- a/modules/plugin/base/src/nsPluginsDirDarwin.cpp
+++ b/modules/plugin/base/src/nsPluginsDirDarwin.cpp
@@ -40,18 +40,20 @@
/*
nsPluginsDirDarwin.cpp
Mac OS X implementation of the nsPluginsDir/nsPluginsFile classes.
by Patrick C. Beard.
*/
+#ifdef MOZ_IPC
#include "GeckoChildProcessHost.h"
#include "base/process_util.h"
+#endif
#include "prlink.h"
#include "prnetdb.h"
#include "nsXPCOM.h"
#include "nsPluginsDir.h"
#include "nsNPAPIPlugin.h"
#include "nsPluginsDirUtils.h"
@@ -453,16 +455,17 @@ static PRBool IsCompatibleArch(nsIFile *
PRBool isPluginFile = PR_FALSE;
CFBundleRef pluginBundle = ::CFBundleCreate(kCFAllocatorDefault, pluginURL);
if (pluginBundle) {
UInt32 packageType, packageCreator;
::CFBundleGetPackageInfo(pluginBundle, &packageType, &packageCreator);
if (packageType == 'BRPL' || packageType == 'IEPL' || packageType == 'NSPL') {
+#ifdef MOZ_IPC
// Get path to plugin as a C string.
char executablePath[PATH_MAX];
executablePath[0] = '\0';
if (!::CFURLGetFileSystemRepresentation(pluginURL, true, (UInt8*)&executablePath, PATH_MAX)) {
executablePath[0] = '\0';
}
uint32 pluginLibArchitectures;
@@ -470,16 +473,19 @@ static PRBool IsCompatibleArch(nsIFile *
if (NS_FAILED(rv)) {
return PR_FALSE;
}
uint32 containerArchitectures = mozilla::ipc::GeckoChildProcessHost::GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
// Consider the plugin architecture valid if there is any overlap in the masks.
isPluginFile = !!(containerArchitectures & pluginLibArchitectures);
+#else
+ isPluginFile = !!::CFBundlePreflightExecutable(pluginBundle, NULL);
+#endif
}
::CFRelease(pluginBundle);
}
::CFRelease(pluginURL);
return isPluginFile;
}
--- a/netwerk/Makefile.in
+++ b/netwerk/Makefile.in
@@ -49,19 +49,31 @@ DIRS = \
cookie \
dns \
socket \
mime \
streamconv \
cache \
protocol \
system \
- ipc \
$(NULL)
+ifdef MOZ_IPC
+DIRS += \
+ ipc \
+ $(NULL)
+else
+# Non-IPC builds need NeckoCommon.h
+EXPORTS_NAMESPACES = mozilla/net
+
+EXPORTS_mozilla/net = \
+ ipc/NeckoCommon.h \
+ $(NULL)
+endif
+
ifdef NECKO_WIFI
DIRS += wifi
endif
DIRS += \
build \
locales \
$(NULL)
--- a/netwerk/base/public/Makefile.in
+++ b/netwerk/base/public/Makefile.in
@@ -138,21 +138,25 @@ XPIDLSRCS = \
nsIProxiedChannel.idl \
nsIRandomGenerator.idl \
nsIStrictTransportSecurityService.idl \
nsIURIWithPrincipal.idl \
nsIURIClassifier.idl \
nsIRedirectResultListener.idl \
mozIThirdPartyUtil.idl \
nsISerializationHelper.idl \
+ $(NULL)
+
+ifdef MOZ_IPC
+XPIDLSRCS += \
nsIChildChannel.idl \
nsIParentChannel.idl \
nsIParentRedirectingChannel.idl \
- nsIRedirectChannelRegistrar.idl \
- $(NULL)
+ nsIRedirectChannelRegistrar.idl
+endif
ifdef MOZ_TOOLKIT_SEARCH
XPIDLSRCS += nsIBrowserSearchService.idl
endif
EXPORTS = \
netCore.h \
nsNetError.h \
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -104,17 +104,19 @@
#include "nsIWritablePropertyBag2.h"
#include "nsIIDNService.h"
#include "nsIChannelEventSink.h"
#include "nsIChannelPolicy.h"
#include "nsISocketProviderService.h"
#include "nsISocketProvider.h"
#include "mozilla/Services.h"
+#ifdef MOZ_IPC
#include "nsIRedirectChannelRegistrar.h"
+#endif
#ifdef MOZILLA_INTERNAL_API
inline already_AddRefed<nsIIOService>
do_GetIOService(nsresult* error = 0)
{
already_AddRefed<nsIIOService> ret = mozilla::services::GetIOService();
if (error)
@@ -1777,31 +1779,33 @@ NS_IsInternalSameURIRedirect(nsIChannel
if (!oldURI || !newURI) {
return PR_FALSE;
}
PRBool res;
return NS_SUCCEEDED(oldURI->Equals(newURI, &res)) && res;
}
+#ifdef MOZ_IPC
inline nsresult
NS_LinkRedirectChannels(PRUint32 channelId,
nsIParentChannel *parentChannel,
nsIChannel** _result)
{
nsresult rv;
nsCOMPtr<nsIRedirectChannelRegistrar> registrar =
do_GetService("@mozilla.org/redirectchannelregistrar;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
return registrar->LinkChannels(channelId,
parentChannel,
_result);
}
+#endif // MOZ_IPC
/**
* Helper function to create a random URL string that's properly formed
* but guaranteed to be invalid.
*/
#define NS_FAKE_SCHEME "http://"
#define NS_FAKE_TLD ".invalid"
inline nsresult
--- a/netwerk/base/src/Makefile.in
+++ b/netwerk/base/src/Makefile.in
@@ -42,17 +42,19 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = necko
LIBRARY_NAME = neckobase_s
LIBXUL_LIBRARY = 1
-EXPORTS = nsURLHelper.h
+ifdef MOZ_IPC
+ EXPORTS = nsURLHelper.h
+endif
CPPSRCS = \
nsTransportUtils.cpp \
nsAsyncStreamCopier.cpp \
nsAsyncRedirectVerifyHelper.cpp \
nsAuthInformationHolder.cpp \
nsBaseChannel.cpp \
nsBaseContentStream.cpp \
@@ -85,19 +87,22 @@ CPPSRCS = \
nsUnicharStreamLoader.cpp \
nsURIChecker.cpp \
nsURLHelper.cpp \
nsURLParsers.cpp \
nsNetStrings.cpp \
nsBase64Encoder.cpp \
nsSerializationHelper.cpp \
nsDNSPrefetch.cpp \
- RedirectChannelRegistrar.cpp \
$(NULL)
+ifdef MOZ_IPC
+ CPPSRCS += RedirectChannelRegistrar.cpp
+endif
+
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
CPPSRCS += nsURLHelperOS2.cpp
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
CPPSRCS += nsURLHelperWin.cpp
CPPSRCS += nsNativeConnectionHelper.cpp
ifneq ($(OS_ARCH), WINCE)
CPPSRCS += nsAutodialWin.cpp
--- a/netwerk/base/src/nsBufferedStreams.cpp
+++ b/netwerk/base/src/nsBufferedStreams.cpp
@@ -30,18 +30,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "IPC/IPCMessageUtils.h"
#include "mozilla/net/NeckoMessageUtils.h"
+#endif
#include "nsBufferedStreams.h"
#include "nsStreamUtils.h"
#include "nsCRT.h"
#include "nsNetCID.h"
#include "nsIClassInfoImpl.h"
#ifdef DEBUG_brendan
@@ -484,41 +486,47 @@ nsBufferedInputStream::GetUnbufferedStre
*aStream = mStream;
NS_IF_ADDREF(*aStream);
return NS_OK;
}
PRBool
nsBufferedInputStream::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
using IPC::ReadParam;
PRUint32 bufferSize;
IPC::InputStream inputStream;
if (!ReadParam(aMsg, aIter, &bufferSize) ||
!ReadParam(aMsg, aIter, &inputStream))
return PR_FALSE;
nsCOMPtr<nsIInputStream> stream(inputStream);
nsresult rv = Init(stream, bufferSize);
if (NS_FAILED(rv))
return PR_FALSE;
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
void
nsBufferedInputStream::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
using IPC::WriteParam;
WriteParam(aMsg, mBufferSize);
IPC::InputStream inputStream(Source());
WriteParam(aMsg, inputStream);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
// nsBufferedOutputStream
NS_IMPL_ADDREF_INHERITED(nsBufferedOutputStream, nsBufferedStream)
NS_IMPL_RELEASE_INHERITED(nsBufferedOutputStream, nsBufferedStream)
// This QI uses NS_INTERFACE_MAP_ENTRY_CONDITIONAL to check for
--- a/netwerk/base/src/nsFileStreams.cpp
+++ b/netwerk/base/src/nsFileStreams.cpp
@@ -30,17 +30,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "IPC/IPCMessageUtils.h"
+#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
#include <unistd.h>
#elif defined(XP_WIN)
#include <windows.h>
#elif defined(XP_OS2)
#define INCL_DOSERRORS
#include <os2.h>
@@ -434,16 +436,17 @@ nsFileInputStream::Seek(PRInt32 aWhence,
}
return nsFileStream::Seek(aWhence, aOffset);
}
PRBool
nsFileInputStream::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
using IPC::ReadParam;
nsCString path;
PRBool followLinks;
PRInt32 flags;
if (!ReadParam(aMsg, aIter, &path) ||
!ReadParam(aMsg, aIter, &followLinks) ||
!ReadParam(aMsg, aIter, &flags))
@@ -456,31 +459,36 @@ nsFileInputStream::Read(const IPC::Messa
// IO flags = -1 means readonly, and
// permissions are unimportant since we're reading
rv = Init(file, -1, -1, flags);
if (NS_FAILED(rv))
return PR_FALSE;
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
void
nsFileInputStream::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
using IPC::WriteParam;
nsCString path;
mFile->GetNativePath(path);
WriteParam(aMsg, path);
nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(mFile);
PRBool followLinks;
localFile->GetFollowLinks(&followLinks);
WriteParam(aMsg, followLinks);
WriteParam(aMsg, mBehaviorFlags);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
// nsPartialFileInputStream
// Don't forward to nsFileInputStream as we don't want to QI to
// nsIFileInputStream
NS_IMPL_ISUPPORTS_INHERITED3(nsPartialFileInputStream,
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -257,18 +257,20 @@ nsIOService::Init()
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Was unable to allocate. No gBufferCache.");
CallQueryInterface(recyclingAllocator, &gBufferCache);
}
NS_TIME_FUNCTION_MARK("Set up the recycling allocator");
gIOService = this;
+#ifdef MOZ_IPC
// go into managed mode if we can, and chrome process
if (XRE_GetProcessType() == GeckoProcessType_Default)
+#endif
mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID);
if (!mNetworkLinkService)
// We can't really determine if the machine has a usable network connection,
// so let's cross our fingers!
mManageOfflineStatus = PR_FALSE;
if (mManageOfflineStatus)
@@ -723,24 +725,26 @@ nsIOService::SetOffline(PRBool offline)
mSettingOffline = PR_TRUE;
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
NS_ASSERTION(observerService, "The observer service should not be null");
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Default) {
if (observerService) {
(void)observerService->NotifyObservers(nsnull,
NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, offline ?
NS_LITERAL_STRING("true").get() :
NS_LITERAL_STRING("false").get());
}
}
+#endif
while (mSetOfflineValue != mOffline) {
offline = mSetOfflineValue;
nsresult rv;
if (offline && !mOffline) {
NS_NAMED_LITERAL_STRING(offlineString, NS_IOSERVICE_OFFLINE);
mOffline = PR_TRUE; // indicate we're trying to shutdown
--- a/netwerk/base/src/nsMIMEInputStream.cpp
+++ b/netwerk/base/src/nsMIMEInputStream.cpp
@@ -36,18 +36,20 @@
*
* ***** END LICENSE BLOCK ***** */
/**
* The MIME stream separates headers and a datastream. It also allows
* automatic creation of the content-length header.
*/
+#ifdef MOZ_IPC
#include "IPC/IPCMessageUtils.h"
#include "mozilla/net/NeckoMessageUtils.h"
+#endif
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsIMultiplexInputStream.h"
#include "nsIMIMEInputStream.h"
#include "nsISeekableStream.h"
#include "nsIStringStream.h"
#include "nsString.h"
@@ -324,16 +326,17 @@ nsMIMEInputStreamConstructor(nsISupports
NS_RELEASE(inst);
return rv;
}
PRBool
nsMIMEInputStream::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
using IPC::ReadParam;
if (!ReadParam(aMsg, aIter, &mHeaders) ||
!ReadParam(aMsg, aIter, &mContentLength) ||
!ReadParam(aMsg, aIter, &mStartedReading))
return PR_FALSE;
// nsMIMEInputStream::Init() already appended mHeaderStream & mCLStream
@@ -353,24 +356,29 @@ nsMIMEInputStream::Read(const IPC::Messa
if (NS_FAILED(rv))
return PR_FALSE;
}
if (!ReadParam(aMsg, aIter, &mAddContentLength))
return PR_FALSE;
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
void
nsMIMEInputStream::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
using IPC::WriteParam;
WriteParam(aMsg, mHeaders);
WriteParam(aMsg, mContentLength);
WriteParam(aMsg, mStartedReading);
IPC::InputStream inputStream(mData);
WriteParam(aMsg, inputStream);
WriteParam(aMsg, mAddContentLength);
+#endif
}
--- a/netwerk/base/src/nsSimpleNestedURI.cpp
+++ b/netwerk/base/src/nsSimpleNestedURI.cpp
@@ -31,18 +31,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "IPCMessageUtils.h"
#include "mozilla/net/NeckoMessageUtils.h"
+#endif
#include "nsSimpleNestedURI.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS_INHERITED1(nsSimpleNestedURI, nsSimpleURI, nsINestedURI)
@@ -88,35 +90,40 @@ nsSimpleNestedURI::Write(nsIObjectOutput
return rv;
}
// nsIIPCSerializable
PRBool
nsSimpleNestedURI::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
if (!nsSimpleURI::Read(aMsg, aIter))
return PR_FALSE;
IPC::URI uri;
if (!ReadParam(aMsg, aIter, &uri))
return PR_FALSE;
mInnerURI = uri;
return PR_TRUE;
+#endif
+ return PR_FALSE;
}
void
nsSimpleNestedURI::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
nsSimpleURI::Write(aMsg);
IPC::URI uri(mInnerURI);
WriteParam(aMsg, uri);
+#endif
}
// nsINestedURI
NS_IMETHODIMP
nsSimpleNestedURI::GetInnerURI(nsIURI** uri)
{
NS_ENSURE_TRUE(mInnerURI, NS_ERROR_NOT_INITIALIZED);
--- a/netwerk/base/src/nsSimpleURI.cpp
+++ b/netwerk/base/src/nsSimpleURI.cpp
@@ -33,17 +33,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "IPCMessageUtils.h"
+#endif
#include "nsSimpleURI.h"
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "prmem.h"
#include "prprf.h"
@@ -119,32 +121,38 @@ nsSimpleURI::Write(nsIObjectOutputStream
}
////////////////////////////////////////////////////////////////////////////////
// nsIIPCSerializable methods:
PRBool
nsSimpleURI::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
bool isMutable;
if (!ReadParam(aMsg, aIter, &isMutable) ||
!ReadParam(aMsg, aIter, &mScheme) ||
!ReadParam(aMsg, aIter, &mPath))
return PR_FALSE;
mMutable = isMutable;
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
void
nsSimpleURI::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
WriteParam(aMsg, bool(mMutable));
WriteParam(aMsg, mScheme);
WriteParam(aMsg, mPath);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
// nsIURI methods:
NS_IMETHODIMP
nsSimpleURI::GetSpec(nsACString &result)
{
--- a/netwerk/base/src/nsStandardURL.cpp
+++ b/netwerk/base/src/nsStandardURL.cpp
@@ -33,17 +33,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "IPCMessageUtils.h"
+#endif
#include "nsStandardURL.h"
#include "nsDependentSubstring.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsEscape.h"
#include "nsILocalFile.h"
#include "nsIObjectInputStream.h"
@@ -856,29 +858,31 @@ nsStandardURL::WriteSegment(nsIBinaryOut
if (NS_FAILED(rv)) return rv;
rv = stream->Write32(PRUint32(seg.mLen));
if (NS_FAILED(rv)) return rv;
return NS_OK;
}
+#ifdef MOZ_IPC
bool
nsStandardURL::ReadSegment(const IPC::Message *aMsg, void **aIter, URLSegment &seg)
{
return (IPC::ReadParam(aMsg, aIter, &seg.mPos) &&
IPC::ReadParam(aMsg, aIter, &seg.mLen));
}
void
nsStandardURL::WriteSegment(IPC::Message *aMsg, const URLSegment &seg)
{
IPC::WriteParam(aMsg, seg.mPos);
IPC::WriteParam(aMsg, seg.mLen);
}
+#endif
/* static */ void
nsStandardURL::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
{
PRBool val;
LOG(("nsStandardURL::PrefsChanged [pref=%s]\n", pref));
@@ -2806,16 +2810,17 @@ nsStandardURL::Write(nsIObjectOutputStre
//---------------------------------------------------------------------------
// nsStandardURL::nsIIPCSerializable
//---------------------------------------------------------------------------
PRBool
nsStandardURL::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
using IPC::ReadParam;
NS_PRECONDITION(!mHostA, "Shouldn't have cached ASCII host");
NS_PRECONDITION(mSpecEncoding == eEncoding_Unknown,
"Shouldn't have spec encoding here");
NS_PRECONDITION(!mFile, "Shouldn't have cached file");
PRUint32 urlType;
@@ -2868,21 +2873,25 @@ nsStandardURL::Read(const IPC::Message *
}
mHostEncoding = hostEncoding;
mMutable = isMutable;
mSupportsFileURL = supportsFileURL;
// mSpecEncoding and mHostA are just caches that can be recovered as needed.
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
void
nsStandardURL::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
using IPC::WriteParam;
WriteParam(aMsg, mURLType);
WriteParam(aMsg, mPort);
WriteParam(aMsg, mDefaultPort);
WriteParam(aMsg, mSpec);
WriteSegment(aMsg, mScheme);
WriteSegment(aMsg, mAuthority);
@@ -2897,16 +2906,17 @@ nsStandardURL::Write(IPC::Message *aMsg)
WriteSegment(aMsg, mParam);
WriteSegment(aMsg, mQuery);
WriteSegment(aMsg, mRef);
WriteParam(aMsg, mOriginCharset);
WriteParam(aMsg, bool(mMutable));
WriteParam(aMsg, bool(mSupportsFileURL));
WriteParam(aMsg, mHostEncoding);
// mSpecEncoding and mHostA are just caches that can be recovered as needed.
+#endif
}
//----------------------------------------------------------------------------
// nsStandardURL::nsIClassInfo
//----------------------------------------------------------------------------
NS_IMETHODIMP
nsStandardURL::GetInterfaces(PRUint32 *count, nsIID * **array)
--- a/netwerk/base/src/nsStandardURL.h
+++ b/netwerk/base/src/nsStandardURL.h
@@ -223,19 +223,21 @@ private:
void ShiftFromParam(PRInt32 diff) { mParam.mPos += diff; ShiftFromQuery(diff); }
void ShiftFromQuery(PRInt32 diff) { mQuery.mPos += diff; ShiftFromRef(diff); }
void ShiftFromRef(PRInt32 diff) { mRef.mPos += diff; }
// fastload helper functions
nsresult ReadSegment(nsIBinaryInputStream *, URLSegment &);
nsresult WriteSegment(nsIBinaryOutputStream *, const URLSegment &);
+#ifdef MOZ_IPC
// ipc helper functions
bool ReadSegment(const IPC::Message *, void **, URLSegment &);
void WriteSegment(IPC::Message *, const URLSegment &);
+#endif
static void PrefsChanged(nsIPrefBranch *prefs, const char *pref);
// mSpec contains the normalized version of the URL spec (UTF-8 encoded).
nsCString mSpec;
PRInt32 mDefaultPort;
PRInt32 mPort;
--- a/netwerk/build/Makefile.in
+++ b/netwerk/build/Makefile.in
@@ -59,19 +59,22 @@ SHARED_LIBRARY_LIBS = \
../socket/$(LIB_PREFIX)neckosocket_s.$(LIB_SUFFIX) \
../streamconv/src/$(LIB_PREFIX)nkconv_s.$(LIB_SUFFIX) \
../streamconv/converters/$(LIB_PREFIX)nkcnvts_s.$(LIB_SUFFIX) \
../mime/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \
../cache/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \
../protocol/about/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \
$(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \
../protocol/$(d)/$(LIB_PREFIX)nk$(d)_s.$(LIB_SUFFIX)) \
- ../ipc/$(LIB_PREFIX)neckoipc_s.$(LIB_SUFFIX) \
$(NULL)
+ifdef MOZ_IPC
+SHARED_LIBRARY_LIBS += ../ipc/$(LIB_PREFIX)neckoipc_s.$(LIB_SUFFIX)
+endif
+
ifeq ($(OS_ARCH),WINNT)
SHARED_LIBRARY_LIBS += \
../system/win32/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
endif
ifeq ($(OS_ARCH),WINCE)
SHARED_LIBRARY_LIBS += \
../system/wince/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -32,18 +32,20 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "necko-config.h"
+#ifdef MOZ_IPC
#define ALLOW_LATE_NSHTTP_H_INCLUDE 1
#include "base/basictypes.h"
+#endif
#include "nsCOMPtr.h"
#include "nsIClassInfoImpl.h"
#include "mozilla/ModuleUtils.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsICategoryManager.h"
#include "nsSocketProviderService.h"
@@ -120,19 +122,21 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFil
NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsLoadGroup, Init)
#include "nsEffectiveTLDService.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsEffectiveTLDService, Init)
#include "nsSerializationHelper.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSerializationHelper)
+#ifdef MOZ_IPC
#include "RedirectChannelRegistrar.h"
typedef mozilla::net::RedirectChannelRegistrar RedirectChannelRegistrar;
NS_GENERIC_FACTORY_CONSTRUCTOR(RedirectChannelRegistrar)
+#endif
///////////////////////////////////////////////////////////////////////////////
extern nsresult
net_NewIncrementalDownload(nsISupports *, const nsIID &, void **);
#define NS_INCREMENTALDOWNLOAD_CLASSNAME \
"nsIncrementalDownload"
@@ -747,17 +751,19 @@ NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERV
#elif defined(MOZ_ENABLE_LIBCONIC)
NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
#elif defined(MOZ_ENABLE_QTNETWORK)
NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
#elif defined(ANDROID)
NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_SERIALIZATION_HELPER_CID);
+#ifdef MOZ_IPC
NS_DEFINE_NAMED_CID(NS_REDIRECTCHANNELREGISTRAR_CID);
+#endif
static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_IOSERVICE_CID, false, NULL, nsIOServiceConstructor },
{ &kNS_STREAMTRANSPORTSERVICE_CID, false, NULL, nsStreamTransportServiceConstructor },
{ &kNS_SOCKETTRANSPORTSERVICE_CID, false, NULL, nsSocketTransportServiceConstructor },
{ &kNS_SERVERSOCKET_CID, false, NULL, nsServerSocketConstructor },
{ &kNS_SOCKETPROVIDERSERVICE_CID, false, NULL, nsSocketProviderService::Create },
{ &kNS_DNSSERVICE_CID, false, NULL, nsDNSServiceConstructor },
@@ -876,17 +882,19 @@ static const mozilla::Module::CIDEntry k
#elif defined(MOZ_ENABLE_LIBCONIC)
{ &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsMaemoNetworkLinkServiceConstructor },
#elif defined(MOZ_ENABLE_QTNETWORK)
{ &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsQtNetworkLinkServiceConstructor },
#elif defined(ANDROID)
{ &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsAndroidNetworkLinkServiceConstructor },
#endif
{ &kNS_SERIALIZATION_HELPER_CID, false, NULL, nsSerializationHelperConstructor },
+#ifdef MOZ_IPC
{ &kNS_REDIRECTCHANNELREGISTRAR_CID, false, NULL, RedirectChannelRegistrarConstructor },
+#endif
{ NULL }
};
static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
{ NS_IOSERVICE_CONTRACTID, &kNS_IOSERVICE_CID },
{ NS_NETUTIL_CONTRACTID, &kNS_IOSERVICE_CID },
{ NS_STREAMTRANSPORTSERVICE_CONTRACTID, &kNS_STREAMTRANSPORTSERVICE_CID },
{ NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &kNS_SOCKETTRANSPORTSERVICE_CID },
@@ -1012,17 +1020,19 @@ static const mozilla::Module::ContractID
#elif defined(MOZ_ENABLE_LIBCONIC)
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
#elif defined(MOZ_ENABLE_QTNETWORK)
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
#elif defined(ANDROID)
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
#endif
{ NS_SERIALIZATION_HELPER_CONTRACTID, &kNS_SERIALIZATION_HELPER_CID },
+#ifdef MOZ_IPC
{ NS_REDIRECTCHANNELREGISTRAR_CONTRACTID, &kNS_REDIRECTCHANNELREGISTRAR_CID },
+#endif
{ NULL }
};
static const mozilla::Module kNeckoModule = {
mozilla::Module::kVersion,
kNeckoCIDs,
kNeckoContracts,
kNeckoCategories,
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -71,17 +71,19 @@
#include "nsDeleteDir.h"
#include "nsIPrivateBrowsingService.h"
#include "nsNetCID.h"
#include <math.h> // for log()
#include "mozilla/Services.h"
#include "mozilla/FunctionTimer.h"
+#ifdef MOZ_IPC
#include "mozilla/net/NeckoCommon.h"
+#endif
/******************************************************************************
* nsCacheProfilePrefObserver
*****************************************************************************/
#ifdef XP_MAC
#pragma mark nsCacheProfilePrefObserver
#endif
@@ -1028,19 +1030,21 @@ nsresult
nsCacheService::Init()
{
NS_TIME_FUNCTION;
NS_ASSERTION(!mInitialized, "nsCacheService already initialized.");
if (mInitialized)
return NS_ERROR_ALREADY_INITIALIZED;
+#ifdef MOZ_IPC
if (mozilla::net::IsNeckoChild()) {
return NS_ERROR_UNEXPECTED;
}
+#endif
if (mLock == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
CACHE_LOG_INIT();
nsresult rv = NS_NewThread(getter_AddRefs(mCacheIOThread));
if (NS_FAILED(rv)) {
--- a/netwerk/cookie/Makefile.in
+++ b/netwerk/cookie/Makefile.in
@@ -67,16 +67,17 @@ LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
CPPSRCS = \
nsCookie.cpp \
nsCookieService.cpp \
$(NULL)
XPCSHELL_TESTS += test/unit
+ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla/net
EXPORTS_mozilla/net = \
CookieServiceParent.h \
CookieServiceChild.h \
$(NULL)
CPPSRCS += \
@@ -84,15 +85,16 @@ CPPSRCS += \
CookieServiceChild.cpp \
$(NULL)
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += test/unit_ipc
endif
endif
+endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
DEFINES += -DIMPL_NS_NET
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -40,18 +40,20 @@
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
// this next define has to appear before the include of prlog.h
#define FORCE_PR_LOG // Allow logging in the release build
#endif
+#ifdef MOZ_IPC
#include "mozilla/net/CookieServiceChild.h"
#include "mozilla/net/NeckoCommon.h"
+#endif
#include "nsCookieService.h"
#include "nsIServiceManager.h"
#include "nsIIOService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
@@ -556,26 +558,30 @@ NS_IMPL_ISUPPORTS1(CloseCookieDBListener
/******************************************************************************
* nsCookieService impl:
* singleton instance ctor/dtor methods
******************************************************************************/
nsICookieService*
nsCookieService::GetXPCOMSingleton()
{
+#ifdef MOZ_IPC
if (IsNeckoChild())
return CookieServiceChild::GetSingleton();
+#endif
return GetSingleton();
}
nsCookieService*
nsCookieService::GetSingleton()
{
+#ifdef MOZ_IPC
NS_ASSERTION(!IsNeckoChild(), "not a parent process");
+#endif
if (gCookieService) {
NS_ADDREF(gCookieService);
return gCookieService;
}
// Create a new singleton nsCookieService.
// We AddRef only once since XPCOM has rules about the ordering of module
--- a/netwerk/cookie/nsCookieService.h
+++ b/netwerk/cookie/nsCookieService.h
@@ -74,17 +74,19 @@ class mozIThirdPartyUtil;
class ReadCookieDBListener;
struct nsCookieAttributes;
struct nsListIter;
struct nsEnumerationData;
namespace mozilla {
namespace net {
+#ifdef MOZ_IPC
class CookieServiceParent;
+#endif
}
}
// hash entry class
class nsCookieEntry : public PLDHashEntryHdr
{
public:
// Hash methods
@@ -312,12 +314,14 @@ class nsCookieService : public nsICookie
// friends!
friend PLDHashOperator purgeCookiesCallback(nsCookieEntry *aEntry, void *aArg);
friend class DBListenerErrorHandler;
friend class ReadCookieDBListener;
friend class CloseCookieDBListener;
static nsCookieService* GetSingleton();
+#ifdef MOZ_IPC
friend class mozilla::net::CookieServiceParent;
+#endif
};
#endif // nsCookieService_h__
--- a/netwerk/protocol/about/nsAboutProtocolHandler.cpp
+++ b/netwerk/protocol/about/nsAboutProtocolHandler.cpp
@@ -31,18 +31,20 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "IPCMessageUtils.h"
#include "mozilla/net/NeckoMessageUtils.h"
+#endif
#include "nsAboutProtocolHandler.h"
#include "nsIURI.h"
#include "nsIIOService.h"
#include "nsCRT.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIAboutModule.h"
@@ -324,35 +326,40 @@ nsNestedAboutURI::Write(nsIObjectOutputS
return NS_OK;
}
// nsIIPCSerializable
PRBool
nsNestedAboutURI::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
if (!nsSimpleNestedURI::Read(aMsg, aIter))
return PR_FALSE;
IPC::URI uri;
if (!ReadParam(aMsg, aIter, &uri))
return PR_FALSE;
mBaseURI = uri;
return PR_TRUE;
+#endif
+ return PR_FALSE;
}
void
nsNestedAboutURI::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
nsSimpleNestedURI::Write(aMsg);
IPC::URI uri(mBaseURI);
WriteParam(aMsg, uri);
+#endif
}
// nsSimpleURI
/* virtual */ nsSimpleURI*
nsNestedAboutURI::StartClone()
{
// Sadly, we can't make use of nsSimpleNestedURI::StartClone here.
NS_ENSURE_TRUE(mInnerURI, nsnull);
--- a/netwerk/protocol/ftp/Makefile.in
+++ b/netwerk/protocol/ftp/Makefile.in
@@ -51,31 +51,38 @@ GRE_MODULE = 1
FORCE_STATIC_LIB = 1
EXPORTS = ftpCore.h
XPIDLSRCS = \
nsIFTPChannel.idl \
$(NULL)
+ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla/net
EXPORTS_mozilla/net += \
FTPChannelParent.h \
FTPChannelChild.h \
$(NULL)
+endif
CPPSRCS = \
nsFtpProtocolHandler.cpp \
nsFTPChannel.cpp \
nsFtpConnectionThread.cpp \
nsFtpControlConnection.cpp \
+ $(NULL)
+
+ifdef MOZ_IPC
+CPPSRCS += \
FTPChannelParent.cpp \
FTPChannelChild.cpp \
$(NULL)
+endif
# Use -g for Irix mipspro builds as workaround for bug 92099
ifneq (,$(filter IRIX IRIX64,$(OS_ARCH)))
ifndef GNU_CC
MODULE_OPTIMIZE_FLAGS=-O -g
endif
endif
--- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
+++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp
@@ -44,19 +44,21 @@
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 03/27/2000 IBM Corp. Added PR_CALLBACK for Optlink
* use in OS2
*/
+#ifdef MOZ_IPC
#include "mozilla/net/NeckoChild.h"
#include "mozilla/net/FTPChannelChild.h"
using namespace mozilla::net;
+#endif
#include "nsFtpProtocolHandler.h"
#include "nsFTPChannel.h"
#include "nsIURL.h"
#include "nsIStandardURL.h"
#include "nsCRT.h"
#include "nsIComponentManager.h"
#include "nsIInterfaceRequestor.h"
@@ -128,18 +130,20 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsFtpProto
nsIProtocolHandler,
nsIProxiedProtocolHandler,
nsIObserver,
nsISupportsWeakReference)
nsresult
nsFtpProtocolHandler::Init()
{
+#ifdef MOZ_IPC
if (IsNeckoChild())
NeckoChild::InitNeckoChild();
+#endif // MOZ_IPC
if (mIdleTimeout == -1) {
nsresult rv;
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
rv = branch->GetIntPref(IDLE_TIMEOUT_PREF, &mIdleTimeout);
if (NS_FAILED(rv))
@@ -245,19 +249,21 @@ nsFtpProtocolHandler::NewChannel(nsIURI*
}
NS_IMETHODIMP
nsFtpProtocolHandler::NewProxiedChannel(nsIURI* uri, nsIProxyInfo* proxyInfo,
nsIChannel* *result)
{
NS_ENSURE_ARG_POINTER(uri);
nsRefPtr<nsBaseChannel> channel;
+#ifdef MOZ_IPC
if (IsNeckoChild())
channel = new FTPChannelChild(uri);
else
+#endif
channel = new nsFtpChannel(uri, proxyInfo);
nsresult rv = channel->Init();
if (NS_FAILED(rv)) {
return rv;
}
channel.forget(result);
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1252,17 +1252,21 @@ HttpBaseChannel::GetEntityID(nsACString&
void
HttpBaseChannel::AddCookiesToRequest()
{
if (mLoadFlags & LOAD_ANONYMOUS) {
return;
}
bool useCookieService =
+#ifdef MOZ_IPC
(XRE_GetProcessType() == GeckoProcessType_Default);
+#else
+ PR_TRUE;
+#endif
nsXPIDLCString cookie;
if (useCookieService) {
nsICookieService *cs = gHttpHandler->GetCookieService();
if (cs) {
cs->GetCookieStringFromHttp(mURI,
nsnull,
this, getter_Copies(cookie));
}
--- a/netwerk/protocol/http/Makefile.in
+++ b/netwerk/protocol/http/Makefile.in
@@ -68,28 +68,30 @@ XPIDLSRCS = \
nsIHttpAuthenticableChannel.idl \
nsIHttpChannelChild.idl \
$(NULL)
EXPORTS_mozilla/net = \
HttpBaseChannel.h \
$(NULL)
+ifdef MOZ_IPC
EXPORTS_mozilla/net += \
HttpChannelParent.h \
HttpChannelChild.h \
PHttpChannelParams.h \
$(NULL)
EXPORTS = \
nsHttpResponseHead.h \
nsHttpHeaderArray.h \
nsHttp.h \
nsHttpAtomList.h \
$(NULL)
+endif
CPPSRCS = \
nsHttp.cpp \
nsHttpHeaderArray.cpp \
nsHttpConnectionInfo.cpp \
nsHttpConnection.cpp \
nsHttpConnectionMgr.cpp \
nsHttpRequestHead.cpp \
@@ -102,20 +104,25 @@ CPPSRCS = \
nsHttpNTLMAuth.cpp \
nsHttpTransaction.cpp \
nsHttpHandler.cpp \
HttpBaseChannel.cpp \
nsHttpChannel.cpp \
nsHttpPipeline.cpp \
nsHttpActivityDistributor.cpp \
nsHttpChannelAuthProvider.cpp \
+ $(NULL)
+
+ifdef MOZ_IPC
+CPPSRCS += \
HttpChannelParent.cpp \
HttpChannelChild.cpp \
HttpChannelParentListener.cpp \
$(NULL)
+endif
LOCAL_INCLUDES = \
-I$(srcdir)/../../base/src \
-I$(topsrcdir)/xpcom/ds \
-I$(topsrcdir)/content/base/src \
-I$(topsrcdir)/content/events/src \
$(NULL)
--- a/netwerk/protocol/http/nsHttp.h
+++ b/netwerk/protocol/http/nsHttp.h
@@ -39,31 +39,33 @@
#ifndef nsHttp_h__
#define nsHttp_h__
#if defined(MOZ_LOGGING)
#define FORCE_PR_LOG
#endif
+#ifdef MOZ_IPC
// e10s mess: IPDL-generatd headers include chromium which both #includes
// prlog.h, and #defines LOG in conflict with this file.
// Solution: (as described in bug 545995)
// 1) ensure that this file is #included before any IPDL-generated files and
// anything else that #includes prlog.h, so that we can make sure prlog.h
// sees FORCE_PR_LOG if needed.
// 2) #include IPDL boilerplate, and then undef LOG so our LOG wins.
// 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h
// multiple times; allow it to define ALLOW_LATE_NSHTTP_H_INCLUDE to bypass
// check.
#if defined(PR_LOG) && !defined(ALLOW_LATE_NSHTTP_H_INCLUDE)
#error "If nsHttp.h #included it must come before any IPDL-generated files or other files that #include prlog.h"
#endif
#include "mozilla/net/NeckoChild.h"
#undef LOG
+#endif // MOZ_IPC
#include "plstr.h"
#include "prlog.h"
#include "prtime.h"
#include "nsISupportsUtils.h"
#include "nsPromiseFlatString.h"
#include "nsURLHelper.h"
#include "netCore.h"
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -40,17 +40,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
#include "nsHttpChannel.h"
#include "nsHttpHandler.h"
#include "nsIApplicationCacheService.h"
#include "nsIApplicationCacheContainer.h"
#include "nsIAuthInformation.h"
#include "nsIStringBundle.h"
#include "nsIIDNService.h"
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -75,17 +75,19 @@
#include "nsQuickSort.h"
#include "nsNetUtil.h"
#include "nsIOService.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "nsSocketTransportService2.h"
#include "nsIXULAppInfo.h"
+#ifdef MOZ_IPC
#include "mozilla/net/NeckoChild.h"
+#endif
#if defined(XP_UNIX)
#include <sys/utsname.h>
#endif
#if defined(XP_WIN)
#include <windows.h>
#endif
@@ -96,17 +98,19 @@
#if defined(XP_OS2)
#define INCL_DOSMISC
#include <os2.h>
#endif
//-----------------------------------------------------------------------------
using namespace mozilla::net;
+#ifdef MOZ_IPC
#include "mozilla/net/HttpChannelChild.h"
+#endif
#include "mozilla/FunctionTimer.h"
#ifdef DEBUG
// defined by the socket transport service while active
extern PRThread *gSocketThread;
#endif
@@ -239,18 +243,20 @@ nsHttpHandler::Init()
return rv;
mIOService = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
NS_WARNING("unable to continue without io service");
return rv;
}
+#ifdef MOZ_IPC
if (IsNeckoChild())
NeckoChild::InitNeckoChild();
+#endif // MOZ_IPC
InitUserAgentComponents();
// monitor some preference changes
nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefBranch) {
prefBranch->AddObserver(HTTP_PREF_PREFIX, this, PR_TRUE);
prefBranch->AddObserver(UA_PREF_PREFIX, this, PR_TRUE);
@@ -1472,36 +1478,42 @@ nsHttpHandler::NewProxiedChannel(nsIURI
NS_ENSURE_ARG(proxyInfo);
}
PRBool https;
nsresult rv = uri->SchemeIs("https", &https);
if (NS_FAILED(rv))
return rv;
+#ifdef MOZ_IPC
if (IsNeckoChild()) {
httpChannel = new HttpChannelChild();
- } else {
+ } else
+#endif
+ {
httpChannel = new nsHttpChannel();
}
// select proxy caps if using a non-transparent proxy. SSL tunneling
// should not use proxy settings.
PRInt8 caps;
if (proxyInfo && !nsCRT::strcmp(proxyInfo->Type(), "http") && !https)
caps = mProxyCapabilities;
else
caps = mCapabilities;
if (https) {
// enable pipelining over SSL if requested
if (mPipeliningOverSSL)
caps |= NS_HTTP_ALLOW_PIPELINING;
- if (!IsNeckoChild()) {
+#ifdef MOZ_IPC
+ if (!IsNeckoChild())
+#endif
+ {
// HACK: make sure PSM gets initialized on the main thread.
net_EnsurePSMInit();
}
}
rv = httpChannel->Init(uri, caps, proxyInfo);
if (NS_FAILED(rv))
return rv;
--- a/netwerk/protocol/http/nsHttpResponseHead.h
+++ b/netwerk/protocol/http/nsHttpResponseHead.h
@@ -145,12 +145,14 @@ private:
nsCString mStatusText;
PRInt64 mContentLength;
nsCString mContentType;
nsCString mContentCharset;
PRPackedBool mCacheControlNoStore;
PRPackedBool mCacheControlNoCache;
PRPackedBool mPragmaNoCache;
+#ifdef MOZ_IPC
friend struct IPC::ParamTraits<nsHttpResponseHead>;
+#endif
};
#endif // nsHttpResponseHead_h__
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -33,17 +33,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
#include "nsIOService.h"
#include "nsHttpHandler.h"
#include "nsHttpTransaction.h"
#include "nsHttpConnection.h"
#include "nsHttpRequestHead.h"
#include "nsHttpResponseHead.h"
#include "nsHttpChunkedDecoder.h"
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -33,17 +33,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "mozilla/chrome/RegistryMessageUtils.h"
+#endif
#include "nsResProtocolHandler.h"
#include "nsAutoLock.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
#include "nsILocalFile.h"
#include "prenv.h"
@@ -250,16 +252,17 @@ nsResProtocolHandler::Init(nsIFile *aOmn
NS_ENSURE_SUCCESS(rv, rv);
// resource://gre-resources/ points to jar:omni.jar!/chrome/toolkit/res/
SetSubstitution(kGRE_RESOURCES, uri);
return NS_OK;
}
#endif
+#ifdef MOZ_IPC
static PLDHashOperator
EnumerateSubstitution(const nsACString& aKey,
nsIURI* aURI,
void* aArg)
{
nsTArray<ResourceMapping>* resources =
static_cast<nsTArray<ResourceMapping>*>(aArg);
SerializedURI uri;
@@ -275,16 +278,17 @@ EnumerateSubstitution(const nsACString&
return (PLDHashOperator)PL_DHASH_NEXT;
}
void
nsResProtocolHandler::CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources)
{
mSubstitutions.EnumerateRead(&EnumerateSubstitution, &aResources);
}
+#endif
//----------------------------------------------------------------------------
// nsResProtocolHandler::nsISupports
//----------------------------------------------------------------------------
NS_IMPL_THREADSAFE_ISUPPORTS3(nsResProtocolHandler,
nsIResProtocolHandler,
nsIProtocolHandler,
--- a/netwerk/protocol/res/nsResProtocolHandler.h
+++ b/netwerk/protocol/res/nsResProtocolHandler.h
@@ -66,17 +66,19 @@ public:
NS_DECL_NSIPROTOCOLHANDLER
NS_DECL_NSIRESPROTOCOLHANDLER
nsResProtocolHandler();
virtual ~nsResProtocolHandler();
nsresult Init();
+#ifdef MOZ_IPC
void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources);
+#endif
private:
nsresult Init(nsIFile *aOmniJar);
nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution);
nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions;
nsCOMPtr<nsIIOService> mIOService;
friend class nsResURL;
--- a/netwerk/protocol/wyciwyg/Makefile.in
+++ b/netwerk/protocol/wyciwyg/Makefile.in
@@ -43,35 +43,44 @@ include $(DEPTH)/config/autoconf.mk
MODULE = necko
LIBRARY_NAME = nkwyciwyg_s
LIBXUL_LIBRARY = 1
XPIDL_MODULE = necko_wyciwyg
GRE_MODULE = 1
FORCE_STATIC_LIB = 1
+ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla/net
+endif
XPIDLSRCS = \
nsIWyciwygChannel.idl \
$(NULL)
+ifdef MOZ_IPC
EXPORTS_mozilla/net += \
WyciwygChannelParent.h \
WyciwygChannelChild.h \
$(NULL)
+endif
CPPSRCS = \
nsWyciwyg.cpp \
nsWyciwygChannel.cpp \
nsWyciwygProtocolHandler.cpp \
- WyciwygChannelParent.cpp \
- WyciwygChannelChild.cpp \
$(NULL)
+ifdef MOZ_IPC
+CPPSRCS += \
+ WyciwygChannelParent.cpp \
+ WyciwygChannelChild.cpp \
+ $(NULL)
+endif
+
LOCAL_INCLUDES = \
-I$(srcdir)/../../base/src \
$(NULL)
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
--- a/netwerk/protocol/wyciwyg/nsWyciwyg.h
+++ b/netwerk/protocol/wyciwyg/nsWyciwyg.h
@@ -37,31 +37,33 @@
#ifndef nsWyciwyg_h__
#define nsWyciwyg_h__
#if defined(MOZ_LOGGING)
#define FORCE_PR_LOG
#endif
+#ifdef MOZ_IPC
// e10s mess: IPDL-generatd headers include chromium which both #includes
// prlog.h, and #defines LOG in conflict with this file.
// Solution: (as described in bug 545995)
// 1) ensure that this file is #included before any IPDL-generated files and
// anything else that #includes prlog.h, so that we can make sure prlog.h
// sees FORCE_PR_LOG if needed.
// 2) #include IPDL boilerplate, and then undef LOG so our LOG wins.
// 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h
// multiple times; allow it to define ALLOW_LATE_NSHTTP_H_INCLUDE to bypass
// check.
#if defined(PR_LOG) && !defined(ALLOW_LATE_NSHTTP_H_INCLUDE)
#error "If nsWyciwyg.h #included it must come before any IPDL-generated files or other files that #include prlog.h"
#endif
#include "mozilla/net/NeckoChild.h"
#undef LOG
+#endif // MOZ_IPC
#include "plstr.h"
#include "prlog.h"
#include "prtime.h"
#if defined(PR_LOGGING)
//
// Log module for HTTP Protocol logging...
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -364,16 +364,24 @@ nsWyciwygChannel::Open(nsIInputStream **
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsWyciwygChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx)
{
LOG(("nsWyciwygChannel::AsyncOpen [this=%x]\n", this));
+#ifndef MOZ_IPC
+ // The only places creating wyciwyg: channels should be
+ // HTMLDocument::OpenCommon and session history. Both should be setting an
+ // owner.
+ NS_PRECONDITION(mOwner, "Must have a principal");
+ NS_ENSURE_STATE(mOwner);
+#endif
+
NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS);
NS_ENSURE_ARG_POINTER(listener);
nsCAutoString spec;
mURI->GetSpec(spec);
// open a cache entry for this channel...
nsresult rv = OpenCacheEntry(spec, nsICache::ACCESS_READ);
--- a/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygProtocolHandler.cpp
@@ -42,20 +42,24 @@
#include "nsWyciwygProtocolHandler.h"
#include "nsIURL.h"
#include "nsIComponentManager.h"
#include "nsNetCID.h"
#include "nsServiceManagerUtils.h"
#include "plstr.h"
#include "nsNetUtil.h"
+#ifdef MOZ_IPC
#include "mozilla/net/NeckoChild.h"
+#endif
+#ifdef MOZ_IPC
using namespace mozilla::net;
#include "mozilla/net/WyciwygChannelChild.h"
+#endif
////////////////////////////////////////////////////////////////////////////////
nsWyciwygProtocolHandler::nsWyciwygProtocolHandler()
{
#if defined(PR_LOGGING)
if (!gWyciwygLog)
gWyciwygLog = PR_NewLogModule("nsWyciwygChannel");
@@ -114,36 +118,40 @@ nsWyciwygProtocolHandler::NewURI(const n
NS_ADDREF(*result);
return rv;
}
NS_IMETHODIMP
nsWyciwygProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
{
+#ifdef MOZ_IPC
if (mozilla::net::IsNeckoChild())
mozilla::net::NeckoChild::InitNeckoChild();
+#endif // MOZ_IPC
NS_ENSURE_ARG_POINTER(url);
nsresult rv;
nsCOMPtr<nsIWyciwygChannel> channel;
+#ifdef MOZ_IPC
if (IsNeckoChild()) {
NS_ENSURE_TRUE(gNeckoChild != nsnull, NS_ERROR_FAILURE);
WyciwygChannelChild *wcc = static_cast<WyciwygChannelChild *>(
gNeckoChild->SendPWyciwygChannelConstructor());
if (!wcc)
return NS_ERROR_OUT_OF_MEMORY;
channel = wcc;
rv = wcc->Init(url);
if (NS_FAILED(rv))
PWyciwygChannelChild::Send__delete__(wcc);
} else
+#endif
{
// If original channel used https, make sure PSM is initialized
// (this may be first channel to load during a session restore)
nsCAutoString path;
rv = url->GetPath(path);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 slashIndex = path.FindChar('/', 2);
if (slashIndex == kNotFound)
--- a/netwerk/test/Makefile.in
+++ b/netwerk/test/Makefile.in
@@ -93,20 +93,22 @@ include $(topsrcdir)/config/config.mk
LIBS = $(EXTRA_DSO_LIBS) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)
DEFINES += $(TK_CFLAGS)
XPCSHELL_TESTS = unit
+ifdef MOZ_IPC
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += unit_ipc
endif
+endif
include $(topsrcdir)/config/rules.mk
check::
$(RUN_TEST_PROGRAM) $(DIST)/bin/TestCookie$(BIN_SUFFIX)
_RES_FILES = urlparse.dat \
urlparse_unx.dat \
--- a/security/manager/ssl/src/Makefile.in
+++ b/security/manager/ssl/src/Makefile.in
@@ -98,23 +98,26 @@ CPPSRCS = \
nsSmartCardMonitor.cpp \
nsSmartCardEvent.cpp \
nsStreamCipher.cpp \
nsKeyModule.cpp \
nsIdentityChecking.cpp \
nsDataSignatureVerifier.cpp \
nsRandomGenerator.cpp \
NSSErrorsService.cpp \
- nsNSSCertificateFakeTransport.cpp \
$(NULL)
ifdef MOZ_XUL
CPPSRCS += nsCertTree.cpp
endif
+ifdef MOZ_IPC
+CPPSRCS += nsNSSCertificateFakeTransport.cpp
+endif
+
CSRCS += md4.c
EXTRA_DEPS = $(NSS_DEP_LIBS)
DEFINES += -DNSS_ENABLE_ECC
# Use local includes because they are inserted before INCLUDES
--- a/security/manager/ssl/src/nsNSSCertificate.cpp
+++ b/security/manager/ssl/src/nsNSSCertificate.cpp
@@ -69,17 +69,19 @@
#include "nsISupportsPrimitives.h"
#include "nsUnicharUtils.h"
#include "nsThreadUtils.h"
#include "nsCertVerificationThread.h"
#include "nsIObjectOutputStream.h"
#include "nsIObjectInputStream.h"
#include "nsIProgrammingLanguage.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
+#endif
#include "nspr.h"
extern "C" {
#include "pk11func.h"
#include "certdb.h"
#include "cert.h"
#include "secerr.h"
#include "nssb64.h"
@@ -120,32 +122,36 @@ NS_IMPL_THREADSAFE_ISUPPORTS7(nsNSSCerti
nsISMimeCert,
nsISerializable,
nsIClassInfo)
/* static */
nsNSSCertificate*
nsNSSCertificate::Create(CERTCertificate *cert)
{
+#ifdef MOZ_IPC
if (GeckoProcessType_Default != XRE_GetProcessType()) {
NS_ERROR("Trying to initialize nsNSSCertificate in a non-chrome process!");
return nsnull;
}
+#endif
if (cert)
return new nsNSSCertificate(cert);
else
return new nsNSSCertificate();
}
nsNSSCertificate*
nsNSSCertificate::ConstructFromDER(char *certDER, int derLen)
{
+#ifdef MOZ_IPC
// On non-chrome process prevent instantiation
if (GeckoProcessType_Default != XRE_GetProcessType())
return nsnull;
+#endif
nsNSSCertificate* newObject = nsNSSCertificate::Create();
if (newObject && !newObject->InitFromDER(certDER, derLen)) {
delete newObject;
newObject = nsnull;
}
return newObject;
@@ -176,17 +182,17 @@ nsNSSCertificate::InitFromDER(char *cert
}
nsNSSCertificate::nsNSSCertificate(CERTCertificate *cert) :
mCert(nsnull),
mPermDelete(PR_FALSE),
mCertType(CERT_TYPE_NOT_YET_INITIALIZED),
mCachedEVStatus(ev_status_unknown)
{
-#if defined(DEBUG)
+#if defined(MOZ_IPC) && defined(DEBUG)
if (GeckoProcessType_Default != XRE_GetProcessType())
NS_ERROR("Trying to initialize nsNSSCertificate in a non-chrome process!");
#endif
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown())
return;
@@ -195,18 +201,20 @@ nsNSSCertificate::nsNSSCertificate(CERTC
}
nsNSSCertificate::nsNSSCertificate() :
mCert(nsnull),
mPermDelete(PR_FALSE),
mCertType(CERT_TYPE_NOT_YET_INITIALIZED),
mCachedEVStatus(ev_status_unknown)
{
+#ifdef MOZ_IPC
if (GeckoProcessType_Default != XRE_GetProcessType())
NS_ERROR("Trying to initialize nsNSSCertificate in a non-chrome process!");
+#endif
}
nsNSSCertificate::~nsNSSCertificate()
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown())
return;
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -115,17 +115,19 @@
#include "secmime.h"
#include "ocsp.h"
#include "cms.h"
#include "nssckbi.h"
#include "base64.h"
#include "secerr.h"
#include "sslerr.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
+#endif
#ifdef XP_WIN
#include "nsILocalFileWin.h"
#endif
extern "C" {
#include "pkcs12.h"
#include "p12plcy.h"
@@ -285,30 +287,32 @@ PRBool nsPSMInitPanic::isPanic = PR_FALS
// We must ensure that the nsNSSComponent has been loaded before
// creating any other components.
PRBool EnsureNSSInitialized(EnsureNSSOperator op)
{
if (nsPSMInitPanic::GetPanic())
return PR_FALSE;
+#ifdef MOZ_IPC
if (GeckoProcessType_Default != XRE_GetProcessType())
{
if (op == nssEnsureOnChromeOnly)
{
// If the component needs PSM/NSS initialized only on the chrome process,
// pretend we successfully initiated it but in reality we bypass it.
// It's up to the programmer to check for process type in such components
// and take care not to call anything that needs NSS/PSM initiated.
return PR_TRUE;
}
NS_ERROR("Trying to initialize PSM/NSS in a non-chrome process!");
return PR_FALSE;
}
+#endif
static PRBool loading = PR_FALSE;
static PRInt32 haveLoaded = 0;
switch (op)
{
// In following 4 cases we are protected by monitor of XPCOM component
// manager - we are inside of do_GetService call for nss component, so it is
--- a/security/manager/ssl/src/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
@@ -375,17 +375,19 @@ nsNSSSocketInfo::EnsureDocShellDependent
// If the docshell wants the lock icon, you'll get the ssl error pages, too.
// This is helpful to distinguish from all other contexts, like mail windows,
// or any other SSL connections running in the background.
// We must query it now and remember, because fatal SSL errors will come
// with a socket close, and the socket transport might detach the callbacks
// instance prior to our error reporting.
nsISecureBrowserUI* secureUI = nsnull;
+#ifdef MOZ_IPC
CallGetInterface(proxiedCallbacks.get(), &secureUI);
+#endif
nsCOMPtr<nsIDocShell> docshell;
nsCOMPtr<nsIDocShellTreeItem> item(do_GetInterface(proxiedCallbacks));
if (item)
{
nsCOMPtr<nsIDocShellTreeItem> proxiedItem;
nsCOMPtr<nsIDocShellTreeItem> rootItem;
--- a/security/manager/ssl/src/nsNSSModule.cpp
+++ b/security/manager/ssl/src/nsNSSModule.cpp
@@ -75,19 +75,24 @@
#include "nsDataSignatureVerifier.h"
#include "nsCertOverrideService.h"
#include "nsRandomGenerator.h"
#include "nsRecentBadCerts.h"
#include "nsSSLStatus.h"
#include "nsNSSIOLayer.h"
#include "NSSErrorsService.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
#define NS_IS_PROCESS_DEFAULT \
(GeckoProcessType_Default == XRE_GetProcessType())
+#else
+#define NS_IS_PROCESS_DEFAULT \
+ (true)
+#endif
#define NS_NSS_INSTANTIATE(ensureOperator, _InstanceClass) \
PR_BEGIN_MACRO \
_InstanceClass * inst; \
inst = new _InstanceClass(); \
if (NULL == inst) { \
if (ensureOperator == nssLoadingComponent) \
EnsureNSSInitialized(nssInitFailed); \
@@ -218,19 +223,23 @@ NS_NSS_GENERIC_FACTORY_CONSTRUCTOR_INIT(
// All other classes must have this set to PR_FALSE.
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsSSLSocketProvider)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsTLSSocketProvider)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsSecretDecoderRing)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPK11TokenDB)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPKCS11ModuleDB)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nssEnsure, PSMContentListener, init)
+#ifdef MOZ_IPC
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR_BYPROCESS(nssEnsureOnChromeOnly,
nsNSSCertificate,
nsNSSCertificateFakeTransport)
+#else
+NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsNSSCertificate)
+#endif
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsNSSCertificateDB)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsNSSCertCache)
#ifdef MOZ_XUL
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCertTree)
#endif
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCrypto)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPkcs11)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCMSSecureMessage)
--- a/toolkit/components/contentprefs/tests/Makefile.in
+++ b/toolkit/components/contentprefs/tests/Makefile.in
@@ -44,16 +44,18 @@ relativesrcdir = toolkit/components/cont
include $(DEPTH)/config/autoconf.mk
MODULE = test_toolkit_contentprefs
ifdef MOZ_PHOENIX
XPCSHELL_TESTS = unit
+ifdef MOZ_IPC
# FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += unit_ipc
endif
+endif
endif
include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/places/tests/cpp/test_IHistory.cpp
+++ b/toolkit/components/places/tests/cpp/test_IHistory.cpp
@@ -588,16 +588,17 @@ test_new_visit_adds_place_guid()
do_check_eq(place.guid.Length(), 12);
run_next_test();
}
////////////////////////////////////////////////////////////////////////////////
//// IPC-only Tests
+#ifdef MOZ_IPC
void
test_two_null_links_same_uri()
{
// Tests that we do not crash when we have had two NULL Links passed to
// RegisterVisitedCallback and then the visit occurs (bug 607469). This only
// happens in IPC builds.
nsCOMPtr<nsIURI> testURI(new_test_uri());
@@ -610,16 +611,17 @@ test_two_null_links_same_uri()
rv = history->VisitURI(testURI, NULL, mozilla::IHistory::TOP_LEVEL);
do_check_success(rv);
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
finisher->WaitForNotification();
run_next_test();
}
+#endif // MOZ_IPC
////////////////////////////////////////////////////////////////////////////////
//// Test Harness
/**
* Note: for tests marked "Order Important!", please see the test for details.
*/
Test gTests[] = {
@@ -636,15 +638,17 @@ Test gTests[] = {
TEST(test_visituri_updates),
TEST(test_visituri_preserves_shown_and_typed),
TEST(test_visituri_creates_visit),
TEST(test_visituri_transition_typed),
TEST(test_visituri_transition_embed),
TEST(test_new_visit_adds_place_guid),
// The rest of these tests are tests that are only run in IPC builds.
+#ifdef MOZ_IPC
TEST(test_two_null_links_same_uri),
+#endif // MOZ_IPC
};
const char* file = __FILE__;
#define TEST_NAME "IHistory"
#define TEST_FILE file
#include "places_test_harness_tail.h"
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -40,23 +40,27 @@
#include "nsExceptionHandler.h"
#if defined(XP_WIN32)
#ifdef WIN32_LEAN_AND_MEAN
#undef WIN32_LEAN_AND_MEAN
#endif
#include "nsIWindowsRegKey.h"
-#include "client/windows/crash_generation/crash_generation_server.h"
+#if defined(MOZ_IPC)
+# include "client/windows/crash_generation/crash_generation_server.h"
+#endif
#include "client/windows/handler/exception_handler.h"
#include <DbgHelp.h>
#include <string.h>
#elif defined(XP_MACOSX)
-#include "client/mac/crash_generation/client_info.h"
-#include "client/mac/crash_generation/crash_generation_server.h"
+#if defined(MOZ_IPC)
+# include "client/mac/crash_generation/client_info.h"
+# include "client/mac/crash_generation/crash_generation_server.h"
+#endif
#include "client/mac/handler/exception_handler.h"
#include <string>
#include <Carbon/Carbon.h>
#include <CoreFoundation/CoreFoundation.h>
#include <crt_externs.h>
#include <fcntl.h>
#include <mach/mach.h>
#include <sys/types.h>
@@ -64,18 +68,20 @@
#include <unistd.h>
#include "mac_utils.h"
#elif defined(XP_LINUX)
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIINIParser.h"
#include "common/linux/linux_libc_support.h"
#include "common/linux/linux_syscall_support.h"
-#include "client/linux/crash_generation/client_info.h"
-#include "client/linux/crash_generation/crash_generation_server.h"
+#if defined(MOZ_IPC)
+# include "client/linux/crash_generation/client_info.h"
+# include "client/linux/crash_generation/crash_generation_server.h"
+#endif
#include "client/linux/handler/exception_handler.h"
#include "client/linux/minidump_writer/linux_dumper.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#elif defined(XP_SOLARIS)
#include "client/solaris/handler/exception_handler.h"
@@ -101,22 +107,24 @@
#include "nsIXULAppInfo.h"
#include <map>
#include <vector>
#if defined(XP_MACOSX)
CFStringRef reporterClientAppID = CFSTR("org.mozilla.crashreporter");
#endif
+#if defined(MOZ_IPC)
#include "nsIUUIDGenerator.h"
using google_breakpad::CrashGenerationServer;
using google_breakpad::ClientInfo;
using mozilla::Mutex;
using mozilla::MutexAutoLock;
+#endif // MOZ_IPC
namespace CrashReporter {
#ifdef XP_WIN32
typedef wchar_t XP_CHAR;
typedef std::wstring xpstring;
#define CONVERT_UTF16_TO_XP_CHAR(x) x
#define CONVERT_XP_CHAR_TO_UTF16(x) x
@@ -196,16 +204,17 @@ static const char kAvailableVirtualMemor
static const int kAvailableVirtualMemoryParameterLen =
sizeof(kAvailableVirtualMemoryParameter)-1;
// this holds additional data sent via the API
static AnnotationTable* crashReporterAPIData_Hash;
static nsCString* crashReporterAPIData = nsnull;
static nsCString* notesField = nsnull;
+#if defined(MOZ_IPC)
// OOP crash reporting
static CrashGenerationServer* crashServer; // chrome process has this
# if defined(XP_WIN) || defined(XP_MACOSX)
// If crash reporting is disabled, we hand out this "null" pipe to the
// child process and don't attempt to connect to a parent server.
static const char kNullNotifyPipe[] = "-";
static char* childCrashNotifyPipe;
@@ -227,16 +236,18 @@ static ChildMinidumpMap* pidToMinidump;
static const char* kSubprocessBlacklist[] = {
"FramePoisonBase",
"FramePoisonSize",
"StartupTime",
"URL"
};
+#endif // MOZ_IPC
+
#ifdef XP_MACOSX
static cpu_type_t pref_cpu_types[2] = {
#if defined(__i386__)
CPU_TYPE_X86,
#elif defined(__x86_64__)
CPU_TYPE_X86_64,
#elif defined(__ppc__)
CPU_TYPE_POWERPC,
@@ -1012,17 +1023,19 @@ nsresult SetupExtraData(nsILocalFile* aA
if (filename.Length() < XP_PATH_MAX)
strncpy(lastCrashTimeFilename, filename.get(), filename.Length());
#endif
return NS_OK;
}
+#ifdef MOZ_IPC
static void OOPDeinit();
+#endif
nsresult UnsetExceptionHandler()
{
delete gExceptionHandler;
// do this here in the unlikely case that we succeeded in allocating
// our strings but failed to allocate gExceptionHandler.
if (crashReporterAPIData_Hash) {
@@ -1049,17 +1062,19 @@ nsresult UnsetExceptionHandler()
posix_spawnattr_destroy(&spawnattr);
#endif
if (!gExceptionHandler)
return NS_ERROR_NOT_INITIALIZED;
gExceptionHandler = nsnull;
+#ifdef MOZ_IPC
OOPDeinit();
+#endif
return NS_OK;
}
static void ReplaceChar(nsCString& str, const nsACString& character,
const nsACString& replacement)
{
nsCString::const_iterator start, end;
@@ -1623,16 +1638,18 @@ WriteExtraData(nsILocalFile* extraFile,
bool
AppendExtraData(nsILocalFile* extraFile, const AnnotationTable& data)
{
return WriteExtraData(extraFile, data, Blacklist());
}
+#if defined(MOZ_IPC)
+
static bool
WriteExtraForMinidump(nsILocalFile* minidump,
const Blacklist& blacklist,
nsILocalFile** extraFile)
{
nsCOMPtr<nsILocalFile> extra;
if (!GetExtraFileForMinidump(minidump, getter_AddRefs(extra)))
return false;
@@ -2091,16 +2108,18 @@ CreatePairedMinidumps(ProcessHandle chil
bool
UnsetRemoteExceptionHandler()
{
delete gExceptionHandler;
gExceptionHandler = NULL;
return true;
}
+#endif // MOZ_IPC
+
#if defined(__ANDROID__)
void AddLibraryMapping(const char* library_name,
const char* file_id,
uintptr_t start_address,
size_t mapping_length,
size_t file_offset)
{
if (!gExceptionHandler) {
@@ -2118,16 +2137,17 @@ void AddLibraryMapping(const char* libra
gExceptionHandler->AddMappingInfo(library_name,
guid,
start_address,
mapping_length,
file_offset);
}
}
+#ifdef MOZ_IPC
void AddLibraryMappingForChild(PRUint32 childPid,
const char* library_name,
const char* file_id,
uintptr_t start_address,
size_t mapping_length,
size_t file_offset)
{
if (child_library_mappings.find(childPid) == child_library_mappings.end())
@@ -2148,10 +2168,11 @@ void AddLibraryMappingForChild(PRUint32
void RemoveLibraryMappingsForChild(PRUint32 childPid)
{
MappingMap::iterator iter = child_library_mappings.find(childPid);
if (iter != child_library_mappings.end())
child_library_mappings.erase(iter);
}
#endif
+#endif
} // namespace CrashReporter
--- a/toolkit/crashreporter/nsExceptionHandler.h
+++ b/toolkit/crashreporter/nsExceptionHandler.h
@@ -84,16 +84,17 @@ bool AppendExtraData(nsILocalFile* extra
nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo);
#endif
#ifdef XP_MACOSX
nsresult AppendObjCExceptionInfoToAppNotes(void *inException);
#endif
nsresult GetSubmitReports(PRBool* aSubmitReport);
nsresult SetSubmitReports(PRBool aSubmitReport);
+#ifdef MOZ_IPC
// Out-of-process crash reporter API.
// Return true iff a dump was found for |childPid|, and return the
// path in |dump|. The caller owns the last reference to |dump| if it
// is non-NULL.
bool TakeMinidumpForChild(PRUint32 childPid,
nsILocalFile** dump NS_OUTPARAM);
@@ -150,32 +151,35 @@ bool SetRemoteExceptionHandler(const nsA
bool CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd);
// Child-side API
bool SetRemoteExceptionHandler();
#endif // XP_WIN32
bool UnsetRemoteExceptionHandler();
+#endif // MOZ_IPC
#if defined(__ANDROID__)
// Android builds use a custom library loader, so /proc/<pid>/maps
// will just show anonymous mappings for all the non-system
// shared libraries. This API is to work around that by providing
// info about the shared libraries that are mapped into these anonymous
// mappings.
void AddLibraryMapping(const char* library_name,
const char* file_id,
uintptr_t start_address,
size_t mapping_length,
size_t file_offset);
+#if defined(MOZ_IPC)
void AddLibraryMappingForChild(PRUint32 childPid,
const char* library_name,
const char* file_id,
uintptr_t start_address,
size_t mapping_length,
size_t file_offset);
void RemoveLibraryMappingsForChild(PRUint32 childPid);
#endif
+#endif
}
#endif /* nsExceptionHandler_h__ */
--- a/toolkit/library/dlldeps-xul.cpp
+++ b/toolkit/library/dlldeps-xul.cpp
@@ -46,14 +46,16 @@ void xxxNeverCalledXUL()
XRE_NotifyProfile();
XRE_TermEmbedding();
XRE_CreateAppData(nsnull, nsnull);
XRE_ParseAppData(nsnull, nsnull);
XRE_FreeAppData(nsnull);
XRE_ChildProcessTypeToString(GeckoProcessType_Default);
XRE_StringToChildProcessType("");
XRE_GetProcessType();
+#ifdef MOZ_IPC
XRE_InitChildProcess(0, nsnull, GeckoProcessType_Default);
XRE_InitParentProcess(0, nsnull, nsnull, nsnull);
XRE_RunAppShell();
XRE_ShutdownChildProcess();
XRE_SendTestShellCommand(nsnull, nsnull, nsnull);
+#endif
}
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -86,16 +86,17 @@ RESFILE = xulrunos2.res
RCFLAGS += -i $(topsrcdir)/widget/src/os2
endif
LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/os2
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
endif
# dependent libraries
+ifdef MOZ_IPC
STATIC_LIBS += \
jsipc_s \
domipc_s \
domplugins_s \
mozipc_s \
mozipdlgen_s \
ipcshell_s \
gfxipc_s \
@@ -105,24 +106,28 @@ ifdef MOZ_IPDL_TESTS
STATIC_LIBS += ipdlunittest_s
endif
ifeq (Linux,$(OS_ARCH))
ifneq (Android,$(OS_TARGET))
OS_LIBS += -lrt
endif
endif
+endif
STATIC_LIBS += \
xpcom_core \
ucvutil_s \
gkgfx \
- chromium_s \
$(NULL)
+ifdef MOZ_IPC
+STATIC_LIBS += chromium_s
+endif
+
ifndef WINCE
STATIC_LIBS += \
mozreg_s \
$(NULL)
endif
# component libraries
COMPONENT_LIBS += \
@@ -142,19 +147,22 @@ COMPONENT_LIBS += \
nsappshell \
txmgr \
commandlines \
toolkitcomps \
pipboot \
pipnss \
appcomps \
composer \
- jetpack_s \
$(NULL)
+ifdef MOZ_IPC
+COMPONENT_LIBS += jetpack_s
+endif
+
ifdef BUILD_CTYPES
COMPONENT_LIBS += \
jsctypes \
$(NULL)
endif
COMPONENT_LIBS += jsperf
--- a/toolkit/library/nsStaticXULComponents.cpp
+++ b/toolkit/library/nsStaticXULComponents.cpp
@@ -122,17 +122,17 @@
#endif
#ifdef ENABLE_LAYOUTDEBUG
#define LAYOUT_DEBUG_MODULE MODULE(nsLayoutDebugModule)
#else
#define LAYOUT_DEBUG_MODULE
#endif
-#if defined(ENABLE_JETPACK_SERVICE)
+#if defined(MOZ_IPC) && defined(ENABLE_JETPACK_SERVICE)
#define JETPACK_MODULES \
MODULE(jetpack)
#else
#define JETPACK_MODULES
#endif
#ifdef MOZ_PLUGINS
#define PLUGINS_MODULES \
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -276,17 +276,19 @@ DIST_FILES = \
NON_DIST_FILES = \
classes.dex \
$(NULL)
UPLOAD_EXTRA_FILES += gecko-unsigned-unaligned.apk
include $(topsrcdir)/ipc/app/defs.mk
+ifdef MOZ_IPC
DIST_FILES += $(MOZ_CHILD_PROCESS_NAME)
+endif
ifdef MOZ_THUMB2
ABI_DIR = armeabi-v7a
else
ABI_DIR = armeabi
endif
PKG_SUFFIX = .apk
--- a/toolkit/toolkit-tiers.mk
+++ b/toolkit/toolkit-tiers.mk
@@ -98,17 +98,19 @@ tier_platform_dirs += gfx/qcms
ifeq ($(OS_ARCH),WINCE)
tier_platform_dirs += modules/lib7z
endif
#
# "gecko" - core components
#
+ifdef MOZ_IPC
tier_platform_dirs += ipc js/ipc js/jetpack
+endif
tier_platform_dirs += \
js/src/xpconnect \
intl/chardet \
$(NULL)
ifdef MOZ_ENABLE_GTK2
ifdef MOZ_X11
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -51,18 +51,20 @@
#if defined(MOZ_WIDGET_QT)
#include <QtGui/QApplication>
#include <QtCore/QScopedPointer>
#include <QtGui/QApplication>
#include <QtGui/QInputContextFactory>
#include <QtGui/QInputContext>
#endif // MOZ_WIDGET_QT
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentParent.h"
using mozilla::dom::ContentParent;
+#endif
#include "nsAppRunner.h"
#include "nsUpdateDriver.h"
#ifdef XP_MACOSX
#include "MacLaunchHelper.h"
#include "MacApplicationDelegate.h"
#include "MacAutoreleasePool.h"
@@ -202,17 +204,19 @@ using mozilla::dom::ContentParent;
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
#include "nsIPrefService.h"
#endif
+#ifdef MOZ_IPC
#include "base/command_line.h"
+#endif
#include "mozilla/FunctionTimer.h"
#ifdef ANDROID
#include "AndroidBridge.h"
#endif
#ifdef WINCE
@@ -769,23 +773,27 @@ nsXULAppInfo::GetProcessType(PRUint32* a
NS_ENSURE_ARG_POINTER(aResult);
*aResult = XRE_GetProcessType();
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::EnsureContentProcess()
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() != GeckoProcessType_Default)
return NS_ERROR_NOT_AVAILABLE;
ContentParent* c = ContentParent::GetSingleton();
if (!c)
return NS_ERROR_NOT_AVAILABLE;
return NS_OK;
+#else
+ return NS_ERROR_NOT_AVAILABLE;
+#endif
}
NS_IMETHODIMP
nsXULAppInfo::InvalidateCachesOnRestart()
{
nsCOMPtr<nsIFile> file;
nsresult rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DIR_STARTUP,
getter_AddRefs(file));
@@ -3841,16 +3849,18 @@ XRE_main(int argc, char* argv[], const n
return NS_FAILED(rv) ? 1 : 0;
}
nsresult
XRE_InitCommandLine(int aArgc, char* aArgv[])
{
nsresult rv = NS_OK;
+#if defined(MOZ_IPC)
+
#if defined(OS_WIN)
CommandLine::Init(aArgc, aArgv);
#else
// these leak on error, but that's OK: we'll just exit()
char** canonArgs = new char*[aArgc];
// get the canonical version of the binary's path
@@ -3874,16 +3884,17 @@ XRE_InitCommandLine(int aArgc, char* aAr
NS_ASSERTION(!CommandLine::IsInitialized(), "Bad news!");
CommandLine::Init(aArgc, canonArgs);
for (int i = 0; i < aArgc; ++i)
free(canonArgs[i]);
delete[] canonArgs;
#endif
+#endif
#ifdef MOZ_OMNIJAR
const char *omnijarPath = nsnull;
ArgResult ar = CheckArg("omnijar", PR_FALSE, &omnijarPath);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument -omnijar requires an omnijar path\n");
return NS_ERROR_FAILURE;
}
@@ -3901,25 +3912,31 @@ XRE_InitCommandLine(int aArgc, char* aAr
return rv;
}
nsresult
XRE_DeinitCommandLine()
{
nsresult rv = NS_OK;
+#if defined(MOZ_IPC)
CommandLine::Terminate();
+#endif
return rv;
}
GeckoProcessType
XRE_GetProcessType()
{
+#ifdef MOZ_IPC
return mozilla::startup::sChildProcessType;
+#else
+ return GeckoProcessType_Default;
+#endif
}
void
SetupErrorHandling(const char* progname)
{
#ifdef XP_WIN
/* On Windows XPSP3 and Windows Vista if DEP is configured off-by-default
we still want DEP protection: enable it explicitly and programmatically.
--- a/toolkit/xre/nsAppRunner.h
+++ b/toolkit/xre/nsAppRunner.h
@@ -177,21 +177,23 @@ void SetAllocatedString(const char *&str
template<class T>
void SetStrongPtr(T *&ptr, T* newvalue)
{
NS_IF_RELEASE(ptr);
ptr = newvalue;
NS_IF_ADDREF(ptr);
}
+#ifdef MOZ_IPC
namespace mozilla {
namespace startup {
extern GeckoProcessType sChildProcessType;
}
}
+#endif
/**
* Set up platform specific error handling such as suppressing DLL load dialog
* and the JIT debugger on Windows, and install unix signal handlers.
*/
void SetupErrorHandling(const char* progname);
#endif // nsAppRunner_h__
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -34,17 +34,19 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#if defined(MOZ_WIDGET_QT)
#include "nsQAppInstance.h"
#endif
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
#include "nsXULAppAPI.h"
#include <stdlib.h>
#if defined(MOZ_WIDGET_GTK2)
#include <glib.h>
#endif
@@ -72,16 +74,17 @@
#include "nsExceptionHandler.h"
#include "nsString.h"
#include "nsThreadUtils.h"
#include "nsJSUtils.h"
#include "nsWidgetsCID.h"
#include "nsXREDirProvider.h"
#include "mozilla/Omnijar.h"
+#ifdef MOZ_IPC
#if defined(XP_MACOSX)
#include "chrome/common/mach_ipc_mac.h"
#endif
#include "nsX11ErrorHandler.h"
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/process_util.h"
@@ -127,16 +130,17 @@ using mozilla::dom::ContentChild;
using mozilla::jsipc::PContextWrapperParent;
using mozilla::jsipc::ContextWrapperParent;
using mozilla::ipc::TestShellParent;
using mozilla::ipc::TestShellCommandParent;
using mozilla::ipc::XPCShellEnvironment;
using mozilla::startup::sChildProcessType;
+#endif
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#ifdef XP_WIN
static const PRUnichar kShellLibraryName[] = L"shell32.dll";
#endif
nsresult
@@ -240,16 +244,17 @@ XRE_StringToChildProcessType(const char*
++i) {
if (!strcmp(kGeckoProcessTypeString[i], aProcessTypeString)) {
return static_cast<GeckoProcessType>(i);
}
}
return GeckoProcessType_Invalid;
}
+#ifdef MOZ_IPC
namespace mozilla {
namespace startup {
GeckoProcessType sChildProcessType = GeckoProcessType_Default;
}
}
#if defined(MOZ_CRASHREPORTER)
// FIXME/bug 539522: this out-of-place function is stuck here because
@@ -763,8 +768,11 @@ XRE_ShutdownTestShell()
#ifdef MOZ_X11
void
XRE_InstallX11ErrorHandler()
{
InstallX11ErrorHandler();
}
#endif
+
+#endif // MOZ_IPC
+
--- a/toolkit/xre/nsSigHandlers.cpp
+++ b/toolkit/xre/nsSigHandlers.cpp
@@ -48,17 +48,19 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include "prthread.h"
#include "plstr.h"
#include "prenv.h"
#include "nsDebug.h"
-#include "nsXULAppAPI.h"
+#ifdef MOZ_IPC
+# include "nsXULAppAPI.h"
+#endif
#if defined(LINUX)
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <stdlib.h> // atoi
#include <ucontext.h>
#endif
@@ -66,19 +68,21 @@
#if defined(SOLARIS)
#include <sys/resource.h>
#include <ucontext.h>
#endif
static char _progname[1024] = "huh?";
static unsigned int _gdb_sleep_duration = 300;
+#ifdef MOZ_IPC
// NB: keep me up to date with the same variable in
// ipc/chromium/chrome/common/ipc_channel_posix.cc
static const int kClientChannelFd = 3;
+#endif
#if defined(LINUX) && defined(DEBUG) && \
(defined(__i386) || defined(__x86_64) || defined(PPC))
#define CRAWL_STACK_ON_SIGSEGV
#endif
#if defined(CRAWL_STACK_ON_SIGSEGV)
@@ -118,23 +122,25 @@ ah_crap_handler(int signum)
sleep(_gdb_sleep_duration);
printf("Done sleeping...\n");
_exit(signum);
}
+#ifdef MOZ_IPC
void
child_ah_crap_handler(int signum)
{
if (!getenv("MOZ_DONT_UNBLOCK_PARENT_ON_CHILD_CRASH"))
close(kClientChannelFd);
ah_crap_handler(signum);
}
+#endif
#endif // CRAWL_STACK_ON_SIGSEGV
#ifdef MOZ_WIDGET_GTK2
// Need this include for version test below.
#include <glib.h>
#endif
@@ -254,18 +260,20 @@ void InstallSignalHandlers(const char *P
if (1 == sscanf(gdbSleep, "%u", &s)) {
_gdb_sleep_duration = s;
}
}
#if defined(CRAWL_STACK_ON_SIGSEGV)
if (!getenv("XRE_NO_WINDOWS_CRASH_DIALOG")) {
void (*crap_handler)(int) =
+#ifdef MOZ_IPC
GeckoProcessType_Default != XRE_GetProcessType() ?
child_ah_crap_handler :
+#endif
ah_crap_handler;
signal(SIGSEGV, crap_handler);
signal(SIGILL, crap_handler);
signal(SIGABRT, crap_handler);
}
#endif // CRAWL_STACK_ON_SIGSEGV
#ifdef SA_SIGINFO
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -33,18 +33,20 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsX11ErrorHandler.h"
+#ifdef MOZ_IPC
#include "mozilla/plugins/PluginProcessChild.h"
using mozilla::plugins::PluginProcessChild;
+#endif
#include "prenv.h"
#include "nsXULAppAPI.h"
#include "nsExceptionHandler.h"
#include "nsDebug.h"
#include "mozilla/X11Util.h"
#include <X11/Xlib.h>
@@ -153,24 +155,26 @@ X11Error(Display *display, XErrorEvent *
}
}
#ifdef MOZ_CRASHREPORTER
switch (XRE_GetProcessType()) {
case GeckoProcessType_Default:
CrashReporter::AppendAppNotesToCrashReport(notes);
break;
+#ifdef MOZ_IPC
case GeckoProcessType_Plugin:
if (CrashReporter::GetEnabled()) {
// This is assuming that X operations are performed on the plugin
// thread. If plugins are using X on another thread, then we'll need to
// handle that differently.
PluginProcessChild::AppendNotesToCrashReport(notes);
}
break;
+#endif
default:
; // crash report notes not supported.
}
#endif
#ifdef DEBUG
// The resource id is unlikely to be useful in a crash report without
// context of other ids, but add it to the debug console output.
--- a/uriloader/exthandler/Makefile.in
+++ b/uriloader/exthandler/Makefile.in
@@ -80,22 +80,24 @@ CMMSRCS = nsOSHelperAppService.mm \
nsLocalHandlerAppMac.mm \
$(NULL)
else
OSHELPER = nsOSHelperAppService.cpp
endif
LOCAL_INCLUDES = -I$(srcdir)
+ifdef MOZ_IPC
LOCAL_INCLUDES += -I$(topsrcdir)/dom/base \
-I$(topsrcdir)/dom/ipc \
-I$(topsrcdir)/content/base/src \
-I$(topsrcdir)/content/events/src \
-I$(topsrcdir)/netwerk/base/src \
-I$(topsrcdir)/netwerk/protocol/http
+endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
OSHELPER += nsGNOMERegistry.cpp
OSHELPER += nsMIMEInfoUnix.cpp
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
OSHELPER += nsMIMEInfoAndroid.cpp
@@ -143,20 +145,24 @@ XPIDLSRCS = \
$(NULL)
CPPSRCS = \
nsExternalHelperAppService.cpp \
nsExternalProtocolHandler.cpp \
nsMIMEInfoImpl.cpp \
nsLocalHandlerApp.cpp \
$(OSHELPER) \
- ExternalHelperAppChild.cpp \
- ExternalHelperAppParent.cpp \
$(NULL)
+ifdef MOZ_IPC
+CPPSRCS += \
+ ExternalHelperAppChild.cpp \
+ ExternalHelperAppParent.cpp
+endif
+
ifdef MOZ_ENABLE_DBUS
CPPSRCS += nsDBusHandlerApp.cpp
LOCAL_INCLUDES += $(TK_CFLAGS) $(MOZ_DBUS_CFLAGS)
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_LIBS)
endif
ifdef MOZ_ENABLE_MEEGOTOUCHSHARE
OSHELPER += nsMeegoExternalSharingAppService.cpp
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -41,19 +41,21 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG
#endif
+#ifdef MOZ_IPC
#include "base/basictypes.h"
#include "mozilla/dom/ContentChild.h"
#include "nsXULAppAPI.h"
+#endif
#include "nsExternalHelperAppService.h"
#include "nsCExternalHandlerService.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsIFile.h"
#include "nsIFileURL.h"
#include "nsIChannel.h"
@@ -132,22 +134,24 @@
#include "nsLocalHandlerApp.h"
#include "nsIRandomGenerator.h"
#include "plbase64.h"
#include "prmem.h"
#include "nsIPrivateBrowsingService.h"
+#ifdef MOZ_IPC
#include "ContentChild.h"
#include "nsXULAppAPI.h"
#include "nsPIDOMWindow.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocShellTreeItem.h"
#include "ExternalHelperAppChild.h"
+#endif
#ifdef ANDROID
#include "AndroidBridge.h"
#endif
// Buffer file writes in 32kb chunks
#define BUFFERED_OUTPUT_SIZE (1024 * 32)
@@ -697,16 +701,17 @@ NS_IMETHODIMP nsExternalHelperAppService
nsresult rv;
// Get the file extension and name that we will need later
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
nsCOMPtr<nsIURI> uri;
if (channel)
channel->GetURI(getter_AddRefs(uri));
+#ifdef MOZ_IPC
PRInt64 contentLength = GetContentLengthAsInt64(aRequest);
if (XRE_GetProcessType() == GeckoProcessType_Content) {
// We need to get a hold of a ContentChild so that we can begin forwarding
// this data to the parent. In the HTTP case, this is unfortunate, since
// we're actually passing data from parent->child->parent wastefully, but
// the Right Fix will eventually be to short-circuit those channels on the
// parent side based on some sort of subscription concept.
using mozilla::dom::ContentChild;
@@ -741,16 +746,17 @@ NS_IMETHODIMP nsExternalHelperAppService
reason, aForceSave);
if (!handler)
return NS_ERROR_OUT_OF_MEMORY;
childListener->SetHandler(handler);
return NS_OK;
}
+#endif // MOZ_IPC
if (channel) {
// Check if we have a POST request, in which case we don't want to use
// the url's extension
PRBool allowURLExt = PR_TRUE;
nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(channel);
if (httpChan) {
nsCAutoString requestMethod;
@@ -980,20 +986,22 @@ static const char kExternalProtocolPrefP
static const char kExternalProtocolDefaultPref[] = "network.protocol-handler.external-default";
NS_IMETHODIMP
nsExternalHelperAppService::LoadURI(nsIURI *aURI,
nsIInterfaceRequestor *aWindowContext)
{
NS_ENSURE_ARG_POINTER(aURI);
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mozilla::dom::ContentChild::GetSingleton()->SendLoadURIExternal(aURI);
return NS_OK;
}
+#endif
nsCAutoString spec;
aURI->GetSpec(spec);
if (spec.Find("%00") != -1)
return NS_ERROR_MALFORMED_URI;
spec.ReplaceSubstring("\"", "%22");
@@ -1646,20 +1654,22 @@ NS_IMETHODIMP nsExternalAppHandler::OnSt
}
}
}
}
encChannel->SetApplyConversion( applyConversion );
}
+#ifdef MOZ_IPC
// At this point, the child process has done everything it can usefully do
// for OnStartRequest.
if (XRE_GetProcessType() == GeckoProcessType_Content)
return NS_OK;
+#endif
rv = SetUpTempFile(aChannel);
if (NS_FAILED(rv)) {
mCanceled = PR_TRUE;
request->Cancel(rv);
nsAutoString path;
if (mTempFile)
mTempFile->GetPath(path);
@@ -1892,17 +1902,20 @@ void nsExternalAppHandler::SendStatusCha
if(NS_SUCCEEDED(bundle->FormatStringFromName(msgId.get(), strings, 1, getter_Copies(msgText))))
{
if (mWebProgressListener)
{
// We have a listener, let it handle the error.
mWebProgressListener->OnStatusChange(nsnull, (type == kReadError) ? aRequest : nsnull, rv, msgText);
}
else
- if (XRE_GetProcessType() == GeckoProcessType_Default) {
+#ifdef MOZ_IPC
+ if (XRE_GetProcessType() == GeckoProcessType_Default)
+#endif
+ {
// We don't have a listener. Simply show the alert ourselves.
nsCOMPtr<nsIPrompt> prompter(do_GetInterface(mWindowContext));
nsXPIDLString title;
bundle->FormatStringFromName(NS_LITERAL_STRING("title").get(),
strings,
1,
getter_Copies(title));
if (prompter)
--- a/uriloader/exthandler/tests/Makefile.in
+++ b/uriloader/exthandler/tests/Makefile.in
@@ -46,20 +46,22 @@ DIRS += mochitest \
$(NULL)
include $(DEPTH)/config/autoconf.mk
MODULE = test_uriloader_exthandler
XPCSHELL_TESTS = unit
+ifdef MOZ_IPC
#FIXME/bug 575918: out-of-process xpcshell is broken on OS X
ifneq ($(OS_ARCH),Darwin)
XPCSHELL_TESTS += unit_ipc
endif
+endif
CPPSRCS = \
WriteArgument.cpp \
$(NULL)
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
include $(topsrcdir)/config/config.mk
--- a/uriloader/prefetch/Makefile.in
+++ b/uriloader/prefetch/Makefile.in
@@ -41,31 +41,37 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = prefetch
LIBRARY_NAME = prefetch_s
LIBXUL_LIBRARY = 1
+ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla/docshell
EXPORTS_mozilla/docshell += \
OfflineCacheUpdateParent.h \
OfflineCacheUpdateChild.h \
$(NULL)
+endif
CPPSRCS = \
nsPrefetchService.cpp \
nsOfflineCacheUpdate.cpp \
nsOfflineCacheUpdateService.cpp \
OfflineCacheUpdateGlue.cpp \
+ $(NULL)
+
+ifdef MOZ_IPC
+CPPSRCS += \
OfflineCacheUpdateChild.cpp \
- OfflineCacheUpdateParent.cpp \
- $(NULL)
+ OfflineCacheUpdateParent.cpp
+endif
XPIDLSRCS = \
nsIPrefetchService.idl \
nsIOfflineCacheUpdate.idl \
$(NULL)
EXPORTS = \
nsCPrefetchService.h \
--- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp
+++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp
@@ -375,17 +375,19 @@ OfflineCacheUpdateChild::RemoveObserver(
return NS_OK;
}
NS_IMETHODIMP
OfflineCacheUpdateChild::Schedule()
{
LOG(("OfflineCacheUpdateChild::Schedule [%p]", this));
+#ifdef MOZ_IPC
NS_ASSERTION(mWindow, "Window must be provided to the offline cache update child");
+#endif
nsCOMPtr<nsPIDOMWindow> piWindow =
do_QueryInterface(mWindow);
mWindow = nsnull;
nsIDocShell *docshell = piWindow->GetDocShell();
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(docshell);
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -67,17 +67,19 @@
#include "nsNetUtil.h"
#include "nsServiceManagerUtils.h"
#include "nsStreamUtils.h"
#include "nsThreadUtils.h"
#include "nsProxyRelease.h"
#include "prlog.h"
#include "nsIAsyncVerifyRedirectCallback.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
+#endif
static const PRUint32 kRescheduleLimit = 3;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
// set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5
@@ -1951,18 +1953,20 @@ nsOfflineCacheUpdate::AddURI(nsIURI *aUR
mAddedItems = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsOfflineCacheUpdate::AddDynamicURI(nsIURI *aURI)
{
+#if defined(MOZ_IPC)
if (GeckoProcessType_Default != XRE_GetProcessType())
return NS_ERROR_NOT_IMPLEMENTED;
+#endif
// If this is a partial update and the resource is already in the
// cache, we should only mark the entry, not fetch it again.
if (mPartialUpdate) {
nsCAutoString key;
GetCacheKey(aURI, key);
PRUint32 types;
--- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
@@ -31,19 +31,21 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "OfflineCacheUpdateChild.h"
#include "OfflineCacheUpdateParent.h"
#include "nsXULAppAPI.h"
+#endif
#include "OfflineCacheUpdateGlue.h"
#include "nsOfflineCacheUpdate.h"
#include "nsCPrefetchService.h"
#include "nsCURILoader.h"
#include "nsIApplicationCacheContainer.h"
#include "nsIApplicationCacheChannel.h"
#include "nsIApplicationCacheService.h"
@@ -72,18 +74,20 @@
#include "nsStreamUtils.h"
#include "nsThreadUtils.h"
#include "nsProxyRelease.h"
#include "prlog.h"
#include "nsIAsyncVerifyRedirectCallback.h"
static nsOfflineCacheUpdateService *gOfflineCacheUpdateService = nsnull;
+#ifdef MOZ_IPC
typedef mozilla::docshell::OfflineCacheUpdateParent OfflineCacheUpdateParent;
typedef mozilla::docshell::OfflineCacheUpdateChild OfflineCacheUpdateChild;
+#endif
typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue;
#if defined(PR_LOGGING)
//
// To enable logging (see prlog.h for full details):
//
// set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5
// set NSPR_LOG_FILE=offlineupdate.log
@@ -465,20 +469,23 @@ nsOfflineCacheUpdateService::FindUpdate(
nsresult
nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI,
nsIURI *aDocumentURI,
nsIDOMDocument *aDocument,
nsIDOMWindow* aWindow,
nsIOfflineCacheUpdate **aUpdate)
{
nsCOMPtr<nsIOfflineCacheUpdate> update;
+#ifdef MOZ_IPC
if (GeckoProcessType_Default != XRE_GetProcessType()) {
update = new OfflineCacheUpdateChild(aWindow);
}
- else {
+ else
+#endif
+ {
update = new OfflineCacheUpdateGlue();
}
nsresult rv;
rv = update->Init(aManifestURI, aDocumentURI, aDocument);
NS_ENSURE_SUCCESS(rv, rv);
--- a/widget/public/nsGUIEvent.h
+++ b/widget/public/nsGUIEvent.h
@@ -55,22 +55,24 @@
#include "nsPIDOMEventTarget.h"
#include "nsWeakPtr.h"
#include "nsIWidget.h"
#include "nsTArray.h"
#include "nsTraceRefcnt.h"
#include "nsITransferable.h"
#include "nsIVariant.h"
+#ifdef MOZ_IPC
namespace mozilla {
namespace dom {
class PBrowserParent;
class PBrowserChild;
}
}
+#endif // MOZ_IPC
#ifdef ACCESSIBILITY
class nsAccessible;
#endif
class nsIRenderingContext;
class nsIMenuItem;
class nsIContent;
class nsIURI;
@@ -536,19 +538,21 @@ protected:
refPoint(0, 0),
time(0),
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
userType(0)
{
MOZ_COUNT_CTOR(nsEvent);
}
+#ifdef MOZ_IPC
nsEvent()
{
}
+#endif // MOZ_IPC
public:
nsEvent(PRBool isTrusted, PRUint32 msg)
: eventStructType(NS_EVENT),
message(msg),
refPoint(0, 0),
time(0),
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
@@ -591,20 +595,22 @@ class nsGUIEvent : public nsEvent
{
protected:
nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 structType)
: nsEvent(isTrusted, msg, structType),
widget(w), pluginEvent(nsnull)
{
}
+#ifdef MOZ_IPC
nsGUIEvent()
: pluginEvent(nsnull)
{
}
+#endif // MOZ_IPC
public:
nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
: nsEvent(isTrusted, msg, NS_GUI_EVENT),
widget(w), pluginEvent(nsnull)
{
}
@@ -760,19 +766,21 @@ class nsInputEvent : public nsGUIEvent
protected:
nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w,
PRUint8 structType)
: nsGUIEvent(isTrusted, msg, w, structType),
isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
{
}
+#ifdef MOZ_IPC
nsInputEvent()
{
}
+#endif // MOZ_IPC
public:
nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
: nsGUIEvent(isTrusted, msg, w, NS_INPUT_EVENT),
isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
{
}
@@ -1060,26 +1068,28 @@ struct nsTextRange
nsTextRangeStyle mRangeStyle;
};
typedef nsTextRange* nsTextRangeArray;
class nsTextEvent : public nsInputEvent
{
+#ifdef MOZ_IPC
private:
friend class mozilla::dom::PBrowserParent;
friend class mozilla::dom::PBrowserChild;
nsTextEvent()
{
}
public:
PRUint32 seqno;
+#endif // MOZ_IPC
public:
nsTextEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
: nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
rangeCount(0), rangeArray(nsnull), isChar(PR_FALSE)
{
}
@@ -1089,26 +1099,28 @@ public:
// case there will be no range of type NS_TEXTRANGE_CARETPOSITION in the
// array.
nsTextRangeArray rangeArray;
PRBool isChar;
};
class nsCompositionEvent : public nsInputEvent
{
+#ifdef MOZ_IPC
private:
friend class mozilla::dom::PBrowserParent;
friend class mozilla::dom::PBrowserChild;
nsCompositionEvent()
{
}
public:
PRUint32 seqno;
+#endif // MOZ_IPC
public:
nsCompositionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
: nsInputEvent(isTrusted, msg, w, NS_COMPOSITION_EVENT)
{
}
};
@@ -1217,25 +1229,27 @@ public:
panDirection(ePanNone),
displayPanFeedback(PR_FALSE)
{
}
};
class nsQueryContentEvent : public nsGUIEvent
{
+#ifdef MOZ_IPC
private:
friend class mozilla::dom::PBrowserParent;
friend class mozilla::dom::PBrowserChild;
nsQueryContentEvent()
{
mReply.mContentsRoot = nsnull;
mReply.mFocusedWidget = nsnull;
}
+#endif // MOZ_IPC
public:
nsQueryContentEvent(PRBool aIsTrusted, PRUint32 aMsg, nsIWidget *aWidget) :
nsGUIEvent(aIsTrusted, aMsg, aWidget, NS_QUERY_CONTENT_EVENT),
mSucceeded(PR_FALSE), mWasAsync(PR_FALSE)
{
}
@@ -1319,26 +1333,28 @@ public:
}
PRPackedBool fromRaise;
PRPackedBool isRefocus;
};
class nsSelectionEvent : public nsGUIEvent
{
+#ifdef MOZ_IPC
private:
friend class mozilla::dom::PBrowserParent;
friend class mozilla::dom::PBrowserChild;
nsSelectionEvent()
{
}
public:
PRUint32 seqno;
+#endif // MOZ_IPC
public:
nsSelectionEvent(PRBool aIsTrusted, PRUint32 aMsg, nsIWidget *aWidget) :
nsGUIEvent(aIsTrusted, aMsg, aWidget, NS_SELECTION_EVENT),
mExpandToClusterBoundary(PR_TRUE), mSucceeded(PR_FALSE)
{
}
--- a/widget/public/nsIWidget.h
+++ b/widget/public/nsIWidget.h
@@ -69,19 +69,21 @@ class imgIContainer;
class gfxASurface;
class nsIContent;
class ViewWrapper;
namespace mozilla {
namespace layers {
class LayerManager;
}
+#ifdef MOZ_IPC
namespace dom {
class PBrowserChild;
}
+#endif
}
/**
* Callback function that processes events.
*
* The argument is actually a subtype (subclass) of nsEvent which carries
* platform specific information about the event. Platform specific code
* knows how to deal with it.
@@ -241,18 +243,20 @@ struct IMEContext {
};
/**
* The base class for all the widgets. It provides the interface for
* all basic and necessary functionality.
*/
class nsIWidget : public nsISupports {
+#ifdef MOZ_IPC
protected:
typedef mozilla::dom::PBrowserChild PBrowserChild;
+#endif
public:
typedef mozilla::layers::LayerManager LayerManager;
// Used in UpdateThemeGeometries.
struct ThemeGeometry {
// The -moz-appearance value for the themed widget
PRUint8 mWidgetType;
@@ -1376,31 +1380,37 @@ class nsIWidget : public nsISupports {
* Return true if this process shouldn't use platform widgets, and
* so should use PuppetWidgets instead. If this returns true, the
* result of creating and using a platform widget is undefined,
* and likely to end in crashes or other buggy behavior.
*/
static bool
UsePuppetWidgets()
{
+#ifdef MOZ_IPC
return XRE_GetProcessType() == GeckoProcessType_Content;
+#else
+ return PR_FALSE;
+#endif
}
+#ifdef MOZ_IPC
/**
* Allocate and return a "puppet widget" that doesn't directly
* correlate to a platform widget; platform events and data must
* be fed to it. Currently used in content processes. NULL is
* returned if puppet widgets aren't supported in this build
* config, on this platform, or for this process type.
*
* This function is called "Create" to match CreateInstance().
* The returned widget must still be nsIWidget::Create()d.
*/
static already_AddRefed<nsIWidget>
CreatePuppetWidget(PBrowserChild *aTabChild);
+#endif
/**
* Reparent this widget's native widget.
* @param aNewParent the native widget of aNewParent is the new native
* parent widget
*/
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) = 0;
protected:
--- a/widget/src/android/AndroidBridge.cpp
+++ b/widget/src/android/AndroidBridge.cpp
@@ -32,17 +32,19 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <android/log.h>
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
+#endif
#include <pthread.h>
#include <prthread.h>
#include "nsXPCOMStrings.h"
#include "AndroidBridge.h"
#include "nsAppShell.h"
#include "nsOSHelperAppService.h"
--- a/widget/src/android/nsWidgetFactory.cpp
+++ b/widget/src/android/nsWidgetFactory.cpp
@@ -53,18 +53,20 @@
#include "nsClipboardHelper.h"
#include "nsTransferable.h"
#include "nsPrintOptionsAndroid.h"
#include "nsPrintSession.h"
#include "nsDeviceContextAndroid.h"
#include "nsFilePicker.h"
#include "nsHTMLFormatConverter.h"
#include "nsIMEPicker.h"
+#ifdef MOZ_IPC
#include "nsFilePickerProxy.h"
#include "nsXULAppAPI.h"
+#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerAndroid)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceAndroid)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
@@ -84,24 +86,26 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxI
}
static nsresult
nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
*aResult = nsnull;
if (aOuter != nsnull) {
- return NS_ERROR_NO_AGGREGATION;
+ return NS_ERROR_NO_AGGREGATION;
}
nsCOMPtr<nsIFilePicker> picker;
-
- if (XRE_GetProcessType() == GeckoProcessType_Content)
- picker = new nsFilePickerProxy();
- else
- picker = new nsFilePicker;
+
+#ifdef MOZ_IPC
+ if (XRE_GetProcessType() == GeckoProcessType_Content)
+ picker = new nsFilePickerProxy();
+ else
+#endif
+ picker = new nsFilePicker;
return picker->QueryInterface(aIID, aResult);
}
NS_DEFINE_NAMED_CID(NS_TOOLKIT_CID);
NS_DEFINE_NAMED_CID(NS_APPSHELL_CID);
NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
NS_DEFINE_NAMED_CID(NS_CHILD_CID);
--- a/widget/src/android/nsWindow.cpp
+++ b/widget/src/android/nsWindow.cpp
@@ -35,23 +35,25 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <android/log.h>
#include <math.h>
+#ifdef MOZ_IPC
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/unused.h"
using mozilla::dom::ContentParent;
using mozilla::dom::ContentChild;
using mozilla::unused;
+#endif
#include "nsAppShell.h"
#include "nsIdleService.h"
#include "nsWindow.h"
#include "nsIObserverService.h"
#include "nsIDeviceContext.h"
#include "nsIRenderingContext.h"
@@ -77,16 +79,17 @@ using mozilla::unused;
using namespace mozilla;
NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
// The dimensions of the current android view
static gfxIntSize gAndroidBounds;
static gfxIntSize gAndroidScreenBounds;
+#ifdef MOZ_IPC
class ContentCreationNotifier;
static nsCOMPtr<ContentCreationNotifier> gContentCreationNotifier;
// A helper class to send updates when content processes
// are created. Currently an update for the screen size is sent.
class ContentCreationNotifier : public nsIObserver
{
NS_DECL_ISUPPORTS
@@ -111,16 +114,17 @@ class ContentCreationNotifier : public n
}
return NS_OK;
}
};
NS_IMPL_ISUPPORTS1(ContentCreationNotifier,
nsIObserver)
+#endif
static PRBool gMenu;
static PRBool gMenuConsumed;
// All the toplevel windows that have been created; these are in
// stacking order, so the window at gAndroidBounds[0] is the topmost
// one.
static nsTArray<nsWindow*> gTopLevelWindows;
@@ -762,16 +766,17 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
if (newScreenWidth == gAndroidScreenBounds.width &&
newScreenHeight == gAndroidScreenBounds.height)
break;
gAndroidScreenBounds.width = newScreenWidth;
gAndroidScreenBounds.height = newScreenHeight;
+#ifdef MOZ_IPC
if (XRE_GetProcessType() != GeckoProcessType_Default)
break;
// Tell the content process the new screen size.
ContentParent *cp = ContentParent::GetSingleton(PR_FALSE);
if (cp)
unused << cp->SendScreenSizeChanged(gAndroidScreenBounds);
@@ -786,16 +791,17 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
nsCOMPtr<ContentCreationNotifier> notifier = new ContentCreationNotifier;
if (NS_SUCCEEDED(obs->AddObserver(notifier, "ipc:content-created", PR_FALSE))) {
if (NS_SUCCEEDED(obs->AddObserver(notifier, "xpcom-shutdown", PR_FALSE)))
gContentCreationNotifier = notifier;
else
obs->RemoveObserver(notifier, "ipc:content-created");
}
+#endif
}
case AndroidGeckoEvent::MOTION_EVENT: {
win->UserActivity();
if (!gTopLevelWindows.IsEmpty()) {
nsIntPoint pt(ae->P0());
pt.x = NS_MIN(NS_MAX(pt.x, 0), gAndroidBounds.width - 1);
pt.y = NS_MIN(NS_MAX(pt.y, 0), gAndroidBounds.height - 1);
@@ -1064,19 +1070,21 @@ nsWindow::InitEvent(nsGUIEvent& event, n
}
event.time = PR_Now() / 1000;
}
gfxIntSize
nsWindow::GetAndroidScreenBounds()
{
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content) {
return ContentChild::GetSingleton()->GetScreenSize();
}
+#endif
return gAndroidScreenBounds;
}
void *
nsWindow::GetNativeData(PRUint32 aDataType)
{
switch (aDataType) {
// used by GLContextProviderEGL, NULL is EGL_DEFAULT_DISPLAY
--- a/widget/src/gtk2/nsWindow.h
+++ b/widget/src/gtk2/nsWindow.h
@@ -35,17 +35,19 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsWindow_h__
#define __nsWindow_h__
-#include "mozilla/ipc/SharedMemorySysV.h"
+#ifdef MOZ_IPC
+# include "mozilla/ipc/SharedMemorySysV.h"
+#endif
#include "nsAutoPtr.h"
#include "mozcontainer.h"
#include "nsWeakReference.h"
#include "nsIDragService.h"
#include "nsITimer.h"
--- a/widget/src/qt/nsWidgetFactory.cpp
+++ b/widget/src/qt/nsWidgetFactory.cpp
@@ -62,18 +62,20 @@
#include "nsBidiKeyboard.h"
#include "nsNativeThemeQt.h"
#ifdef NS_PRINTING
#include "nsDeviceContextSpecQt.h"
#include "nsPrintSession.h"
#include "nsPrintOptionsQt.h"
#include "nsPrintDialogQt.h"
#endif
+#ifdef MOZ_IPC
#include "nsFilePickerProxy.h"
#include "nsXULAppAPI.h"
+#endif
// from nsWindow.cpp
extern PRBool gDisableNativeTheme;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPopupWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
@@ -93,19 +95,21 @@ nsFilePickerConstructor(nsISupports *aOu
void **aResult)
{
*aResult = nsnull;
if (aOuter != nsnull) {
return NS_ERROR_NO_AGGREGATION;
}
nsCOMPtr<nsIFilePicker> picker;
+#ifdef MOZ_IPC
if (XRE_GetProcessType() == GeckoProcessType_Content)
picker = new nsFilePickerProxy();
else
+#endif
picker = new nsFilePicker;
return picker->QueryInterface(aIID, aResult);
}
#ifdef NS_PRINTING
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecQt)
--- a/widget/src/shared/nsShmImage.h
+++ b/widget/src/shared/nsShmImage.h
@@ -36,17 +36,19 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __mozilla_widget_nsShmImage_h__
#define __mozilla_widget_nsShmImage_h__
-#include "mozilla/ipc/SharedMemorySysV.h"
+#ifdef MOZ_IPC
+# include "mozilla/ipc/SharedMemorySysV.h"
+#endif
#if defined(MOZ_X11) && defined(MOZ_HAVE_SHAREDMEMORYSYSV)
# define MOZ_HAVE_SHMIMAGE
#endif
#ifdef MOZ_HAVE_SHMIMAGE
#include "nsIWidget.h"
--- a/widget/src/windows/Makefile.in
+++ b/widget/src/windows/Makefile.in
@@ -136,18 +136,20 @@ LOCAL_INCLUDES = \
$(NULL)
FORCE_STATIC_LIB = 1
ifdef WINCE
EXTRA_DSO_LDOPTS += ddraw.lib
endif
+ifdef MOZ_IPC
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
ifdef ENABLE_TESTS
TOOL_DIRS += tests
endif
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(MOZ_CAIRO_CFLAGS)
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -99,17 +99,19 @@
**
** BLOCK: Includes
**
** Include headers.
**
**************************************************************
**************************************************************/
+#ifdef MOZ_IPC
#include "mozilla/ipc/RPCChannel.h"
+#endif
#include "nsWindow.h"
#include <windows.h>
#include <process.h>
#include <commctrl.h>
#include <unknwn.h>
@@ -305,20 +307,22 @@ TriStateBool nsWindow::sHasBogusPopupsDr
#ifdef ACCESSIBILITY
BOOL nsWindow::sIsAccessibilityOn = FALSE;
// Accessibility wm_getobject handler
HINSTANCE nsWindow::sAccLib = 0;
LPFNLRESULTFROMOBJECT
nsWindow::sLresultFromObject = 0;
#endif // ACCESSIBILITY
+#ifdef MOZ_IPC
// Used in OOPP plugin focus processing.
const PRUnichar* kOOPPPluginFocusEventId = L"OOPP Plugin Focus Widget Event";
PRUint32 nsWindow::sOOPPPluginFocusEvent =
RegisterWindowMessageW(kOOPPPluginFocusEventId);
+#endif
MSG nsWindow::sRedirectedKeyDown;
/**************************************************************
*
* SECTION: globals variables
*
**************************************************************/
@@ -4386,16 +4390,18 @@ PRBool nsWindow::ConvertStatus(nsEventSt
/**************************************************************
*
* SECTION: IPC
*
* IPC related helpers.
*
**************************************************************/
+#ifdef MOZ_IPC
+
// static
bool
nsWindow::IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult)
{
switch(aMsg) {
case WM_SETFOCUS:
case WM_KILLFOCUS:
case WM_ENABLE:
@@ -4495,16 +4501,18 @@ nsWindow::IPCWindowProcHandler(UINT& msg
}
if (handled &&
(InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
ReplyMessage(dwResult);
}
}
+#endif // MOZ_IPC
+
/**************************************************************
**************************************************************
**
** BLOCK: Native events
**
** Main Windows message handlers and OnXXX handlers for
** Windows event handling.
**
@@ -4585,18 +4593,20 @@ LRESULT CALLBACK nsWindow::WindowProcInt
WNDPROC prevWindowProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
return ::CallWindowProcW(prevWindowProc, hWnd, msg, wParam, lParam);
}
}
// Get the window which caused the event and ask it to process the message
nsWindow *someWindow = GetNSWindowPtr(hWnd);
+#ifdef MOZ_IPC
if (someWindow)
someWindow->IPCWindowProcHandler(msg, wParam, lParam);
+#endif
// create this here so that we store the last rolled up popup until after
// the event has been processed.
nsAutoRollup autoRollup;
LRESULT popupHandlingResult;
if (DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult))
return popupHandlingResult;
@@ -5771,30 +5781,32 @@ PRBool nsWindow::ProcessMessage(UINT msg
if (msg == WM_USER_TSF_TEXTCHANGE) {
nsTextStore::OnTextChangeMsg();
}
#endif //NS_ENABLE_TSF
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
if (msg == nsAppShell::GetTaskbarButtonCreatedMessage())
SetHasTaskbarIconBeenCreated();
#endif
+#ifdef MOZ_IPC
if (msg == sOOPPPluginFocusEvent) {
if (wParam == 1) {
// With OOPP, the plugin window exists in another process and is a child of
// this window. This window is a placeholder plugin window for the dom. We
// receive this event when the child window receives focus. (sent from
// PluginInstanceParent.cpp)
::SendMessage(mWnd, WM_MOUSEACTIVATE, 0, 0); // See nsPluginNativeWindowWin.cpp
} else {
// WM_KILLFOCUS was received by the child process.
if (sJustGotDeactivate) {
DispatchFocusToTopLevelWindow(NS_DEACTIVATE);
}
}
}
+#endif
}
break;
}
//*aRetValue = result;
if (mWnd) {
return result;
}
@@ -6750,19 +6762,21 @@ PRBool nsWindow::OnMouseWheel(UINT msg,
if (!scrollEvent.delta) {
// We store the wheel delta, and it will be used next wheel message, so,
// we consume this message actually. We shouldn't call next wndproc.
result = PR_TRUE;
return PR_FALSE; // break
}
+#ifdef MOZ_IPC
// The event may go to a plug-in which already dispatched this message.
// Then, the event can cause deadlock. We should unlock the sender here.
::ReplyMessage(isVertical ? 0 : TRUE);
+#endif
// Assume the Control key is down if the Elantech touchpad has sent the
// mis-ordered WM_KEYDOWN/WM_MOUSEWHEEL messages. (See the comment in
// OnKeyUp.)
PRBool isControl;
if (mAssumeWheelIsZoomUntil &&
static_cast<DWORD>(::GetMessageTime()) < mAssumeWheelIsZoomUntil) {
isControl = PR_TRUE;
@@ -7914,21 +7928,23 @@ PRBool nsWindow::HandleScrollingPlugins(
nsWindow* parentWindow = GetNSWindowPtr(parentWnd);
if (parentWindow) {
// We have a child window - quite possibly a plugin window.
// However, not all plugins are created equal - some will handle this
// message themselves, some will forward directly back to us, while
// others will call DefWndProc, which itself still forwards back to us.
// So if we have sent it once, we need to handle it ourself.
+#ifdef MOZ_IPC
// XXX The message shouldn't come from the plugin window at here.
// But the message might come from it due to some bugs. If it happens,
// SendMessage causes deadlock. For safety, we should unlock the
// sender here.
::ReplyMessage(aMsg == WM_MOUSEHWHEEL ? TRUE : 0);
+#endif
// First time we have seen this message.
// Call the child - either it will consume it, or
// it will wind it's way back to us,triggering the destWnd case above
// either way,when the call returns,we are all done with the message,
sIsProcessing = PR_TRUE;
::SendMessageW(destWnd, aMsg, aWParam, aLParam);
sIsProcessing = PR_FALSE;
@@ -7996,19 +8012,21 @@ PRBool nsWindow::OnScroll(UINT aMsg, WPA
case SB_PAGEUP:
scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
case SB_LINEUP:
scrollevent.delta = -1;
break;
default:
return PR_FALSE;
}
+#ifdef MOZ_IPC
// The event may go to a plug-in which already dispatched this message.
// Then, the event can cause deadlock. We should unlock the sender here.
::ReplyMessage(0);
+#endif
scrollevent.isShift = IS_VK_DOWN(NS_VK_SHIFT);
scrollevent.isControl = IS_VK_DOWN(NS_VK_CONTROL);
scrollevent.isMeta = PR_FALSE;
scrollevent.isAlt = IS_VK_DOWN(NS_VK_ALT);
InitEvent(scrollevent);
if (nsnull != mEventCallback)
{
DispatchWindowEvent(&scrollevent);
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -469,18 +469,20 @@ private:
nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; }
void ResizeTranslucentWindow(PRInt32 aNewWidth, PRInt32 aNewHeight, PRBool force = PR_FALSE);
nsresult UpdateTranslucentWindow();
void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode);
void UpdateGlass();
protected:
#endif // MOZ_XUL
+#ifdef MOZ_IPC
static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
+#endif // MOZ_IPC
/**
* Misc.
*/
UINT MapFromNativeToDOM(UINT aNativeKeyCode);
void StopFlashing();
static PRBool IsTopLevelMouseExit(HWND aWnd);
static void SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray, PRUint32 aModifiers);
@@ -544,17 +546,19 @@ protected:
static const char* sDefaultMainWindowClass;
static PRBool sUseElantechGestureHacks;
static bool sAllowD3D9;
// Always use the helper method to read this property. See bug 603793.
static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor;
static bool HasBogusPopupsDropShadowOnMultiMonitor();
+#ifdef MOZ_IPC
static PRUint32 sOOPPPluginFocusEvent;
+#endif
// Non-client margin settings
// Pre-calculated outward offset applied to default frames
nsIntMargin mNonClientOffset;
// Margins set by the owner
nsIntMargin mNonClientMargins;
// Indicates custom frames are enabled
--- a/widget/src/windows/nsWindowGfx.cpp
+++ b/widget/src/windows/nsWindowGfx.cpp
@@ -48,18 +48,20 @@
**
** BLOCK: Includes
**
** Include headers.
**
**************************************************************
**************************************************************/
+#ifdef MOZ_IPC
#include "mozilla/plugins/PluginInstanceParent.h"
using mozilla::plugins::PluginInstanceParent;
+#endif
#include "nsWindowGfx.h"
#include <windows.h>
#include "nsIRegion.h"
#include "gfxImageSurface.h"
#include "gfxWindowsSurface.h"
#include "gfxWindowsPlatform.h"
#include "nsGfxCIID.h"
@@ -244,16 +246,17 @@ EnsureSharedSurfaceSize(gfxIntSize size)
sSharedSurfaceData = (PRUint8 *)malloc(WORDSSIZE(sSharedSurfaceSize) * 4);
}
return (sSharedSurfaceData != nsnull);
}
PRBool nsWindow::OnPaint(HDC aDC, PRUint32 aNestingLevel)
{
+#ifdef MOZ_IPC
// We never have reentrant paint events, except when we're running our RPC
// windows event spin loop. If we don't trap for this, we'll try to paint,
// but view manager will refuse to paint the surface, resulting is black
// flashes on the plugin rendering surface.
if (mozilla::ipc::RPCChannel::IsSpinLoopActive() && mPainting)
return PR_FALSE;
if (mWindowType == eWindowType_plugin) {
@@ -277,23 +280,26 @@ PRBool nsWindow::OnPaint(HDC aDC, PRUint
PluginInstanceParent* instance = reinterpret_cast<PluginInstanceParent*>(
::GetPropW(mWnd, L"PluginInstanceParentProperty"));
if (instance) {
instance->CallUpdateWindow();
ValidateRect(mWnd, NULL);
return PR_TRUE;
}
}
+#endif
+#ifdef MOZ_IPC
// We never have reentrant paint events, except when we're running our RPC
// windows event spin loop. If we don't trap for this, we'll try to paint,
// but view manager will refuse to paint the surface, resulting is black
// flashes on the plugin rendering surface.
if (mozilla::ipc::RPCChannel::IsSpinLoopActive() && mPainting)
return PR_FALSE;
+#endif
nsPaintEvent willPaintEvent(PR_TRUE, NS_WILL_PAINT, this);
willPaintEvent.willSendDidPaint = PR_TRUE;
DispatchWindowEvent(&willPaintEvent);
PRBool result = PR_TRUE;
PAINTSTRUCT ps;
nsEventStatus eventStatus = nsEventStatus_eIgnore;
--- a/widget/src/xpwidgets/Makefile.in
+++ b/widget/src/xpwidgets/Makefile.in
@@ -66,19 +66,24 @@ CPPSRCS = \
nsPrintSettingsImpl.cpp \
nsPrintSession.cpp \
nsWidgetAtoms.cpp \
nsIdleService.cpp \
nsClipboardPrivacyHandler.cpp \
GfxInfoWebGL.cpp \
GfxDriverInfo.cpp \
GfxInfoBase.cpp \
+ $(NULL)
+
+ifdef MOZ_IPC
+CPPSRCS += \
PuppetWidget.cpp \
nsFilePickerProxy.cpp \
$(NULL)
+endif
ifneq (,$(filter os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
CPPSRCS += nsBaseClipboard.cpp
endif
ifneq (,$(filter qt gtk2 os2 cocoa windows android,$(MOZ_WIDGET_TOOLKIT)))
CPPSRCS += nsBaseFilePicker.cpp
endif
@@ -97,12 +102,14 @@ LOCAL_INCLUDES += \
-I$(srcdir)/../shared \
-I$(srcdir) \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/config.mk
+ifdef MOZ_IPC
include $(topsrcdir)/ipc/chromium/chromium-config.mk
+endif
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(TK_CFLAGS)
--- a/widget/src/xpwidgets/nsBaseAppShell.cpp
+++ b/widget/src/xpwidgets/nsBaseAppShell.cpp
@@ -37,17 +37,19 @@
* ***** END LICENSE BLOCK ***** */
#include "nsBaseAppShell.h"
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Services.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
// next thread event for at most this many ticks:
#define THREAD_EVENT_STARVATION_LIMIT PR_MillisecondsToInterval(20)
NS_IMPL_THREADSAFE_ISUPPORTS3(nsBaseAppShell, nsIAppShell, nsIThreadObserver,
nsIObserver)
@@ -181,30 +183,37 @@ nsBaseAppShell::DoProcessNextNativeEvent
NS_IMETHODIMP
nsBaseAppShell::Run(void)
{
NS_ENSURE_STATE(!mRunning); // should not call Run twice
mRunning = PR_TRUE;
nsIThread *thread = NS_GetCurrentThread();
+#ifdef MOZ_IPC
MessageLoop::current()->Run();
+#else
+ while (!mExiting)
+ NS_ProcessNextEvent(thread);
+#endif
NS_ProcessPendingEvents(thread);
mRunning = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsBaseAppShell::Exit(void)
{
+#ifdef MOZ_IPC
if (mRunning && !mExiting) {
MessageLoop::current()->Quit();
}
+#endif
mExiting = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsBaseAppShell::FavorPerformanceHint(PRBool favorPerfOverStarvation,
PRUint32 starvationDelay)
{
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -896,17 +896,21 @@ LayerManager* nsBaseWidget::GetLayerMana
if (aAllowRetaining) {
*aAllowRetaining = (usedLayerManager == mLayerManager);
}
return usedLayerManager;
}
BasicLayerManager* nsBaseWidget::CreateBasicLayerManager()
{
+#if !defined(MOZ_IPC)
+ return new BasicLayerManager(this);
+#else
return new BasicShadowLayerManager(this);
+#endif
}
//-------------------------------------------------------------------------
//
// Return the toolkit this widget was created on
//
//-------------------------------------------------------------------------
nsIToolkit* nsBaseWidget::GetToolkit()
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -48,23 +48,25 @@
#include "prlink.h"
#include <stdlib.h>
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include <math.h>
#include "nsStackWalk.h"
#include "nsString.h"
+#ifdef MOZ_IPC
#include "nsXULAppAPI.h"
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
#else
#include <unistd.h>
#endif
+#endif
#ifdef NS_TRACE_MALLOC
#include "nsTraceMalloc.h"
#endif
#include "mozilla/BlockingResourceBase.h"
#ifdef HAVE_DLOPEN
@@ -349,18 +351,22 @@ public:
}
static PRBool HaveLeaks(nsTraceRefcntStats* stats) {
return ((stats->mAddRefs != stats->mReleases) ||
(stats->mCreates != stats->mDestroys));
}
PRBool PrintDumpHeader(FILE* out, const char* msg, nsTraceRefcntImpl::StatisticsType type) {
+#ifdef MOZ_IPC
fprintf(out, "\n== BloatView: %s, %s process %d\n", msg,
XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
+#else
+ fprintf(out, "\n== BloatView: %s\n", msg);
+#endif
nsTraceRefcntStats& stats =
(type == nsTraceRefcntImpl::NEW_STATS) ? mNewStats : mAllStats;
if (gLogLeaksOnly && !HaveLeaks(&stats))
return PR_FALSE;
fprintf(out,
"\n" \
" |<----------------Class--------------->|<-----Bytes------>|<----------------Objects---------------->|<--------------References-------------->|\n" \
@@ -657,28 +663,30 @@ static PRBool InitLog(const char* envVar
*result = stderr;
fprintf(stdout, "### %s defined -- logging %s to stderr\n",
envVar, msg);
return PR_TRUE;
}
else {
FILE *stream;
nsCAutoString fname(value);
+#ifdef MOZ_IPC
if (XRE_GetProcessType() != GeckoProcessType_Default) {
bool hasLogExtension =
fname.RFind(".log", PR_TRUE, -1, 4) == kNotFound ? false : true;
if (hasLogExtension)
fname.Cut(fname.Length() - 4, 4);
fname.AppendLiteral("_");
fname.Append((char*)XRE_ChildProcessTypeToString(XRE_GetProcessType()));
fname.AppendLiteral("_pid");
fname.AppendInt((PRUint32)getpid());
if (hasLogExtension)
fname.AppendLiteral(".log");
}
+#endif
stream = ::fopen(fname.get(), "w" FOPEN_NO_INHERIT);
if (stream != NULL) {
*result = stream;
fprintf(stdout, "### %s defined -- logging %s to %s\n",
envVar, msg, fname.get());
}
else {
fprintf(stdout, "### %s defined -- unable to log %s to %s\n",
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -32,17 +32,19 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#ifdef MOZ_IPC
#include "base/basictypes.h"
+#endif
#include "mozilla/XPCOM.h"
#include "nsXULAppAPI.h"
#include "nsXPCOMPrivate.h"
#include "nsXPCOMCIDInternal.h"
#include "nsStaticComponents.h"
@@ -144,16 +146,17 @@ extern nsresult nsStringInputStreamConst
#include "nsChromeRegistry.h"
#include "nsChromeProtocolHandler.h"
#ifdef MOZ_ENABLE_LIBXUL
#include "mozilla/scache/StartupCache.h"
#endif
+#ifdef MOZ_IPC
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/message_loop.h"
#include "mozilla/ipc/BrowserProcessSubThread.h"
using base::AtExitManager;
using mozilla::ipc::BrowserProcessSubThread;
@@ -161,16 +164,17 @@ using mozilla::ipc::BrowserProcessSubThr
namespace {
static AtExitManager* sExitManager;
static MessageLoop* sMessageLoop;
static bool sCommandLineWasInitialized;
static BrowserProcessSubThread* sIOThread;
} /* anonymous namespace */
+#endif
// Registry Factory creation function defined in nsRegistry.cpp
// We hook into this function locally to create and register the registry
// Since noone outside xpcom needs to know about this and nsRegistry.cpp
// does not have a local include file, we are putting this definition
// here rather than in nsIRegistry.h
extern nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
extern nsresult NS_CategoryManagerGetFactory( nsIFactory** );
@@ -363,16 +367,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
// We are not shutting down
gXPCOMShuttingDown = PR_FALSE;
NS_TIME_FUNCTION_MARK("Next: log init");
NS_LogInit();
+#ifdef MOZ_IPC
NS_TIME_FUNCTION_MARK("Next: IPC init");
// Set up chromium libs
NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
if (!AtExitManager::AlreadyRegistered()) {
sExitManager = new AtExitManager();
NS_ENSURE_STATE(sExitManager);
@@ -390,16 +395,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
NS_ENSURE_TRUE(ioThread.get(), NS_ERROR_OUT_OF_MEMORY);
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_IO;
NS_ENSURE_TRUE(ioThread->StartWithOptions(options), NS_ERROR_FAILURE);
sIOThread = ioThread.release();
}
+#endif
NS_TIME_FUNCTION_MARK("Next: thread manager init");
// Establish the main thread here.
rv = nsThreadManager::get()->Init();
if (NS_FAILED(rv)) return rv;
NS_TIME_FUNCTION_MARK("Next: timer startup");
@@ -476,16 +482,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
rv = file->Append(NS_LITERAL_STRING("omni.jar"));
if (NS_SUCCEEDED(rv))
omnijar = do_QueryInterface(file);
if (NS_SUCCEEDED(rv))
mozilla::SetOmnijar(omnijar);
}
#endif
+#ifdef MOZ_IPC
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
NS_TIME_FUNCTION_MARK("Next: IPC command line init");
#ifdef OS_WIN
CommandLine::Init(0, nsnull);
#else
nsCOMPtr<nsIFile> binaryFile;
nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
@@ -499,16 +506,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
nsCString binaryPath;
rv = binaryFile->GetNativePath(binaryPath);
NS_ENSURE_SUCCESS(rv, rv);
static char const *const argv = { strdup(binaryPath.get()) };
CommandLine::Init(1, &argv);
#endif
}
+#endif
NS_ASSERTION(nsComponentManagerImpl::gComponentManager == NULL, "CompMgr not null at init");
NS_TIME_FUNCTION_MARK("Next: component manager init");
// Create the Component/Service Manager
nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
NS_ADDREF(nsComponentManagerImpl::gComponentManager);
@@ -742,32 +750,34 @@ ShutdownXPCOM(nsIServiceManager* servMgr
#endif
ShutdownSpecialSystemDirectory();
NS_PurgeAtomTable();
NS_IF_RELEASE(gDebug);
+#ifdef MOZ_IPC
if (sIOThread) {
delete sIOThread;
sIOThread = nsnull;
}
if (sMessageLoop) {
delete sMessageLoop;
sMessageLoop = nsnull;
}
if (sCommandLineWasInitialized) {
CommandLine::Terminate();
sCommandLineWasInitialized = false;
}
if (sExitManager) {
delete sExitManager;
sExitManager = nsnull;
}
+#endif
#ifdef MOZ_OMNIJAR
mozilla::SetOmnijar(nsnull);
#endif
NS_LogTerm();
return NS_OK;
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -598,18 +598,20 @@ ParseManifestCommon(NSLocationType aType
stApp == eBad ||
stAppVersion == eBad ||
stOs == eBad ||
stOsVersion == eBad ||
stABI == eBad)
continue;
if (directive->regfunc) {
+#ifdef MOZ_IPC
if (GeckoProcessType_Default != XRE_GetProcessType())
continue;
+#endif
if (!nsChromeRegistry::gChromeRegistry) {
nsCOMPtr<nsIChromeRegistry> cr =
mozilla::services::GetChromeRegistryService();
if (!nsChromeRegistry::gChromeRegistry) {
LogMessageWithContext(aFile, aPath, line,
"Chrome registry isn't available yet.");
continue;
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -36,18 +36,20 @@
*
* ***** END LICENSE BLOCK ***** */
/**
* The multiplex stream concatenates a list of input streams into a single
* stream.
*/
+#ifdef MOZ_IPC
#include "IPC/IPCMessageUtils.h"
#include "mozilla/net/NeckoMessageUtils.h"
+#endif
#include "nsMultiplexInputStream.h"
#include "nsIMultiplexInputStream.h"
#include "nsISeekableStream.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsInt64.h"
#include "nsIIPCSerializable.h"
@@ -425,16 +427,17 @@ nsMultiplexInputStreamConstructor(nsISup
NS_RELEASE(inst);
return rv;
}
PRBool
nsMultiplexInputStream::Read(const IPC::Message *aMsg, void **aIter)
{
+#ifdef MOZ_IPC
using IPC::ReadParam;
PRUint32 count;
if (!ReadParam(aMsg, aIter, &count))
return PR_FALSE;
for (PRUint32 i = 0; i < count; i++) {
IPC::InputStream inputStream;
@@ -448,27 +451,32 @@ nsMultiplexInputStream::Read(const IPC::
}
if (!ReadParam(aMsg, aIter, &mCurrentStream) ||
!ReadParam(aMsg, aIter, &mStartedReadingCurrent) ||
!ReadParam(aMsg, aIter, &mStatus))
return PR_FALSE;
return PR_TRUE;
+#else
+ return PR_FALSE;
+#endif
}
void
nsMultiplexInputStream::Write(IPC::Message *aMsg)
{
+#ifdef MOZ_IPC
using IPC::WriteParam;
PRUint32 count = mStreams.Count();
WriteParam(aMsg, count);
for (PRUint32 i = 0; i < count; i++) {
IPC::InputStream inputStream(mStreams.ObjectAt(i));
WriteParam(aMsg, inputStream);
}
WriteParam(aMsg, mCurrentStream);
WriteParam(aMsg, mStartedReadingCurrent);
WriteParam(aMsg, mStatus);
+#endif
}
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -47,17 +47,19 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Based on original code from nsIStringStream.cpp
*/
+#ifdef MOZ_IPC
#include "IPC/IPCMessageUtils.h"
+#endif
#include "nsStringStream.h"
#include "nsStreamUtils.h"
#include "nsReadableUtils.h"
#include "nsISeekableStream.h"
#include "nsISupportsPrimitives.h&