Allow Gecko to build and run on Mac OS X with MOZ_IPC defined. b=552862 r=cjones

This commit is contained in:
Josh Aas 2010-03-17 14:38:28 -04:00
Родитель 3d9ec1c0ea
Коммит 233398d8c6
9 изменённых файлов: 47 добавлений и 26 удалений

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

@ -906,7 +906,11 @@ pref("toolbar.customization.usesheet", true);
pref("toolbar.customization.usesheet", false);
#endif
#ifdef XP_MACOSX
pref("dom.ipc.plugins.enabled", false);
#else
pref("dom.ipc.plugins.enabled", true);
#endif
#ifdef XP_WIN
#ifndef WINCE

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

@ -5469,9 +5469,6 @@ dnl ========================================================
dnl = Disable IPC support for tabs and plugins
dnl ========================================================
case "${target}" in
*-apple-darwin*)
MOZ_IPC=
;;
*-wince*)
MOZ_IPC=
;;

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

@ -41,17 +41,18 @@
#include "npapi.h"
#include "IPC/IPCMessageUtils.h"
#warning This is only a stub implementation IMPLEMENT ME
namespace mozilla {
namespace plugins {
struct NPRemoteEvent {
NPEvent event;
NPCocoaEvent event;
};
}
}
} // namespace plugins
} // namespace mozilla
namespace IPC {
@ -71,6 +72,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteEvent>
static void Log(const paramType& aParam, std::wstring* aLog)
{
aLog->append(L"(NPCocoaEvent)");
}
};

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

@ -450,8 +450,13 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
event.event.xgraphicsexpose.drawable));
#endif
#ifdef OS_MACOSX
// Mac OS X does not define an NPEvent structure. It defines more specific types.
NPCocoaEvent evcopy = event.event;
#else
// Make a copy since we may modify values.
NPEvent evcopy = event.event;
#endif
#ifdef OS_WIN
// Painting for win32. SharedSurfacePaint handles everything.
@ -608,7 +613,13 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
}
#elif defined(OS_MACOSX)
# warning This is only a stub implementation IMPLEMENT ME
mWindow.x = aWindow.x;
mWindow.y = aWindow.y;
mWindow.width = aWindow.width;
mWindow.height = aWindow.height;
mWindow.clipRect = aWindow.clipRect;
mWindow.type = aWindow.type;
#else
# error Implement me for your OS

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

@ -214,8 +214,10 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle*
HWND id;
#elif defined(MOZ_X11)
XID id;
#elif defined(XP_MACOSX)
intptr_t id;
#else
return false;
#warning Implement me
#endif
*result = mNPNIface->getvalue(mNPP, NPNVnetscapeWindow, &id);
@ -524,7 +526,11 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
{
PLUGIN_LOG_DEBUG_FUNCTION;
#if defined(XP_MACOSX)
NPCocoaEvent* npevent = reinterpret_cast<NPCocoaEvent*>(event);
#else
NPEvent* npevent = reinterpret_cast<NPEvent*>(event);
#endif
NPRemoteEvent npremoteevent;
npremoteevent.event = *npevent;
int16_t handled = 0;

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

@ -128,6 +128,8 @@ struct NPRemoteWindow
typedef HWND NativeWindowHandle;
#elif defined(MOZ_X11)
typedef XID NativeWindowHandle;
#elif defined(XP_MACOSX)
typedef intptr_t NativeWindowHandle; // never actually used, will always be 0
#else
#error Need NativeWindowHandle for this platform
#endif

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

@ -77,9 +77,9 @@ static QApplication *gQApp = nsnull;
PluginModuleChild::PluginModuleChild() :
mLibrary(0),
mInitializeFunc(0),
mShutdownFunc(0)
#ifdef OS_WIN
mShutdownFunc(0),
mInitializeFunc(0)
#if defined(OS_WIN) || defined(OS_MACOSX)
, mGetEntryPointsFunc(0)
#elif defined(MOZ_WIDGET_GTK2)
, mNestedLoopTimerId(0)
@ -169,7 +169,7 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
(NP_PLUGINUNIXINIT) PR_FindFunctionSymbol(mLibrary, "NP_Initialize");
NS_ASSERTION(mInitializeFunc, "couldn't find NP_Initialize()");
#elif defined(OS_WIN)
#elif defined(OS_WIN) || defined(OS_MACOSX)
mShutdownFunc =
(NP_PLUGINSHUTDOWN)PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
@ -180,9 +180,6 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
mInitializeFunc =
(NP_PLUGININIT)PR_FindFunctionSymbol(mLibrary, "NP_Initialize");
NS_ENSURE_TRUE(mInitializeFunc, false);
#elif defined(OS_MACOSX)
# warning IMPLEMENT ME
#else
# error Please copy the initialization code from nsNPAPIPlugin.cpp
@ -1501,21 +1498,19 @@ PluginModuleChild::AnswerNP_Initialize(NPError* _retval)
*_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
return true;
#elif defined(OS_WIN)
#elif defined(OS_WIN) || defined(OS_MACOSX)
nsresult rv = mGetEntryPointsFunc(&mFunctions);
if (NS_FAILED(rv)) {
return false;
}
#ifdef OS_WIN
NS_ASSERTION(HIBYTE(mFunctions.version) >= NP_VERSION_MAJOR,
"callback version is less than NP version");
#endif
*_retval = mInitializeFunc(&sBrowserFuncs);
return true;
#elif defined(OS_MACOSX)
# warning IMPLEMENT ME
return false;
#else
# error Please implement me for your platform
#endif

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

@ -184,14 +184,14 @@ private:
nsCString mUserAgent;
// we get this from the plugin
#ifdef OS_POSIX
NP_PLUGINSHUTDOWN mShutdownFunc;
#ifdef OS_LINUX
NP_PLUGINUNIXINIT mInitializeFunc;
#elif OS_WIN
#elif defined(OS_WIN) || defined(OS_MACOSX)
NP_PLUGININIT mInitializeFunc;
NP_GETENTRYPOINTS mGetEntryPointsFunc;
#endif
NP_PLUGINSHUTDOWN mShutdownFunc;
NPPluginFuncs mFunctions;
NPSavedData mSavedData;

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

@ -25,7 +25,11 @@ TransportDIB::~TransportDIB() {
// static
TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) {
TransportDIB* dib = new TransportDIB;
#ifdef CHROMIUM_MOZILLA_BUILD
if (!dib->shared_memory_.Create("", false /* read write */,
#else
if (!dib->shared_memory_.Create(L"", false /* read write */,
#endif
false /* do not open existing */, size)) {
delete dib;
return NULL;