mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Rename IPDL's RPC to Interrupt (bug 910020, r=bent).
--HG-- rename : ipc/ipdl/test/cxx/PTestRPCErrorCleanup.ipdl => ipc/ipdl/test/cxx/PTestInterruptErrorCleanup.ipdl rename : ipc/ipdl/test/cxx/PTestRPCRaces.ipdl => ipc/ipdl/test/cxx/PTestInterruptRaces.ipdl rename : ipc/ipdl/test/cxx/PTestRPCShutdownRace.ipdl => ipc/ipdl/test/cxx/PTestInterruptShutdownRace.ipdl rename : ipc/ipdl/test/cxx/PTestRacyRPCReplies.ipdl => ipc/ipdl/test/cxx/PTestRacyInterruptReplies.ipdl rename : ipc/ipdl/test/cxx/TestRPCErrorCleanup.cpp => ipc/ipdl/test/cxx/TestInterruptErrorCleanup.cpp rename : ipc/ipdl/test/cxx/TestRPCErrorCleanup.h => ipc/ipdl/test/cxx/TestInterruptErrorCleanup.h rename : ipc/ipdl/test/cxx/TestRPCRaces.cpp => ipc/ipdl/test/cxx/TestInterruptRaces.cpp rename : ipc/ipdl/test/cxx/TestRPCRaces.h => ipc/ipdl/test/cxx/TestInterruptRaces.h rename : ipc/ipdl/test/cxx/TestRPCShutdownRace.cpp => ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp rename : ipc/ipdl/test/cxx/TestRPCShutdownRace.h => ipc/ipdl/test/cxx/TestInterruptShutdownRace.h rename : ipc/ipdl/test/cxx/TestRacyRPCReplies.cpp => ipc/ipdl/test/cxx/TestRacyInterruptReplies.cpp rename : ipc/ipdl/test/cxx/TestRacyRPCReplies.h => ipc/ipdl/test/cxx/TestRacyInterruptReplies.h rename : ipc/ipdl/test/ipdl/error/rpcMessageCompress.ipdl => ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl rename : ipc/ipdl/test/ipdl/error/tooWeakRPCAsync.ipdl => ipc/ipdl/test/ipdl/error/tooWeakInterruptAsync.ipdl rename : ipc/ipdl/test/ipdl/ok/rpcProtocol.ipdl => ipc/ipdl/test/ipdl/ok/intrProtocol.ipdl
This commit is contained in:
parent
73ed891def
commit
437f6053a9
@ -17,7 +17,7 @@ struct RemoteVoice {
|
||||
bool localService;
|
||||
};
|
||||
|
||||
rpc protocol PSpeechSynthesis
|
||||
intr protocol PSpeechSynthesis
|
||||
{
|
||||
manager PContent;
|
||||
manages PSpeechSynthesisRequest;
|
||||
|
@ -9,7 +9,7 @@ include protocol PSpeechSynthesis;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
rpc protocol PSpeechSynthesisRequest
|
||||
intr protocol PSpeechSynthesisRequest
|
||||
{
|
||||
manager PSpeechSynthesis;
|
||||
|
||||
|
@ -58,7 +58,7 @@ using mozilla::CSSToScreenScale;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
rpc protocol PBrowser
|
||||
intr protocol PBrowser
|
||||
{
|
||||
manager PContent;
|
||||
|
||||
@ -81,7 +81,7 @@ parent:
|
||||
|
||||
Event(RemoteDOMEvent aEvent);
|
||||
|
||||
rpc CreateWindow() returns (PBrowser window);
|
||||
intr CreateWindow() returns (PBrowser window);
|
||||
|
||||
sync SyncMessage(nsString aMessage, ClonedMessageData aData, CpowEntry[] aCpows)
|
||||
returns (nsString[] retval);
|
||||
|
@ -181,7 +181,7 @@ struct PrefSetting {
|
||||
MaybePrefValue userValue;
|
||||
};
|
||||
|
||||
rpc protocol PContent
|
||||
intr protocol PContent
|
||||
{
|
||||
parent opens PCompositor;
|
||||
parent opens PImageBridge;
|
||||
|
@ -18,7 +18,7 @@ struct Mapping {
|
||||
size_t file_offset;
|
||||
};
|
||||
|
||||
protocol PCrashReporter {
|
||||
intr protocol PCrashReporter {
|
||||
manager PContent or PPluginModule;
|
||||
parent:
|
||||
AnnotateCrashReport(nsCString key, nsCString data);
|
||||
|
@ -66,7 +66,7 @@ COMMessageFilter::MessagePending(HTASK htaskCallee,
|
||||
DWORD dwTickCount,
|
||||
DWORD dwPendingType)
|
||||
{
|
||||
mPlugin->FlushPendingRPCQueue();
|
||||
mPlugin->FlushPendingInterruptQueue();
|
||||
if (mPreviousFilter)
|
||||
return mPreviousFilter->MessagePending(htaskCallee, dwTickCount,
|
||||
dwPendingType);
|
||||
|
@ -20,7 +20,7 @@ namespace plugins {
|
||||
* NPBrowserStream represents a NPStream sent from the browser to the plugin.
|
||||
*/
|
||||
|
||||
rpc protocol PBrowserStream
|
||||
intr protocol PBrowserStream
|
||||
{
|
||||
manager PPluginInstance;
|
||||
|
||||
@ -37,7 +37,7 @@ child:
|
||||
async __delete__();
|
||||
|
||||
parent:
|
||||
rpc NPN_RequestRead(IPCByteRanges ranges)
|
||||
intr NPN_RequestRead(IPCByteRanges ranges)
|
||||
returns (NPError result);
|
||||
async NPN_DestroyStream(NPReason reason);
|
||||
async StreamDestroyed();
|
||||
|
@ -76,7 +76,7 @@ struct NPRemoteAsyncSurface
|
||||
uintptr_t hostPtr;
|
||||
};
|
||||
|
||||
rpc protocol PPluginInstance
|
||||
intr protocol PPluginInstance
|
||||
{
|
||||
manager PPluginModule;
|
||||
|
||||
@ -88,34 +88,34 @@ rpc protocol PPluginInstance
|
||||
manages PPluginSurface;
|
||||
|
||||
child:
|
||||
rpc __delete__();
|
||||
intr __delete__();
|
||||
|
||||
rpc NPP_SetWindow(NPRemoteWindow window);
|
||||
intr NPP_SetWindow(NPRemoteWindow window);
|
||||
|
||||
rpc NPP_GetValue_NPPVpluginWantsAllNetworkStreams()
|
||||
intr NPP_GetValue_NPPVpluginWantsAllNetworkStreams()
|
||||
returns (bool value, NPError result);
|
||||
|
||||
// this message is not used on non-X platforms
|
||||
rpc NPP_GetValue_NPPVpluginNeedsXEmbed()
|
||||
intr NPP_GetValue_NPPVpluginNeedsXEmbed()
|
||||
returns (bool value, NPError result);
|
||||
|
||||
rpc NPP_GetValue_NPPVpluginScriptableNPObject()
|
||||
intr NPP_GetValue_NPPVpluginScriptableNPObject()
|
||||
returns (nullable PPluginScriptableObject value, NPError result);
|
||||
|
||||
rpc NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
|
||||
rpc NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
|
||||
intr NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
|
||||
intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
|
||||
returns (nsCString plug_id, NPError result);
|
||||
|
||||
rpc NPP_HandleEvent(NPRemoteEvent event)
|
||||
intr NPP_HandleEvent(NPRemoteEvent event)
|
||||
returns (int16_t handled);
|
||||
// special cases where we need to a shared memory buffer
|
||||
rpc NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer)
|
||||
intr NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer)
|
||||
returns (int16_t handled, Shmem rtnbuffer);
|
||||
// special cases where we need an iosurface
|
||||
rpc NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid)
|
||||
intr NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid)
|
||||
returns (int16_t handled);
|
||||
// special cases of HandleEvent to make mediating races simpler
|
||||
rpc Paint(NPRemoteEvent event)
|
||||
intr Paint(NPRemoteEvent event)
|
||||
returns (int16_t handled);
|
||||
// this is only used on windows to forward WM_WINDOWPOSCHANGE
|
||||
async WindowPosChanged(NPRemoteEvent event);
|
||||
@ -142,37 +142,37 @@ child:
|
||||
|
||||
async NPP_DidComposite();
|
||||
|
||||
rpc NPP_Destroy()
|
||||
intr NPP_Destroy()
|
||||
returns (NPError rv);
|
||||
|
||||
parent:
|
||||
rpc NPN_GetValue_NPNVWindowNPObject()
|
||||
intr NPN_GetValue_NPNVWindowNPObject()
|
||||
returns (nullable PPluginScriptableObject value, NPError result);
|
||||
rpc NPN_GetValue_NPNVPluginElementNPObject()
|
||||
intr NPN_GetValue_NPNVPluginElementNPObject()
|
||||
returns (nullable PPluginScriptableObject value, NPError result);
|
||||
rpc NPN_GetValue_NPNVprivateModeBool()
|
||||
intr NPN_GetValue_NPNVprivateModeBool()
|
||||
returns (bool value, NPError result);
|
||||
rpc NPN_GetValue_NPNVnetscapeWindow()
|
||||
intr NPN_GetValue_NPNVnetscapeWindow()
|
||||
returns (NativeWindowHandle value, NPError result);
|
||||
rpc NPN_GetValue_NPNVdocumentOrigin()
|
||||
intr NPN_GetValue_NPNVdocumentOrigin()
|
||||
returns (nsCString value, NPError result);
|
||||
rpc NPN_GetValue_DrawingModelSupport(NPNVariable model)
|
||||
intr NPN_GetValue_DrawingModelSupport(NPNVariable model)
|
||||
returns (bool value);
|
||||
|
||||
rpc NPN_SetValue_NPPVpluginWindow(bool windowed)
|
||||
intr NPN_SetValue_NPPVpluginWindow(bool windowed)
|
||||
returns (NPError result);
|
||||
rpc NPN_SetValue_NPPVpluginTransparent(bool transparent)
|
||||
intr NPN_SetValue_NPPVpluginTransparent(bool transparent)
|
||||
returns (NPError result);
|
||||
rpc NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor)
|
||||
intr NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor)
|
||||
returns (NPError result);
|
||||
rpc NPN_SetValue_NPPVpluginDrawingModel(int drawingModel)
|
||||
intr NPN_SetValue_NPPVpluginDrawingModel(int drawingModel)
|
||||
returns (OptionalShmem remoteImageData, CrossProcessMutexHandle mutex, NPError result);
|
||||
rpc NPN_SetValue_NPPVpluginEventModel(int eventModel)
|
||||
intr NPN_SetValue_NPPVpluginEventModel(int eventModel)
|
||||
returns (NPError result);
|
||||
|
||||
rpc NPN_GetURL(nsCString url, nsCString target)
|
||||
intr NPN_GetURL(nsCString url, nsCString target)
|
||||
returns (NPError result);
|
||||
rpc NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file)
|
||||
intr NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file)
|
||||
returns (NPError result);
|
||||
|
||||
/**
|
||||
@ -180,7 +180,7 @@ parent:
|
||||
* @TODO This would be more readable as an overloaded method,
|
||||
* but IPDL doesn't allow that for constructors.
|
||||
*/
|
||||
rpc PStreamNotify(nsCString url, nsCString target, bool post,
|
||||
intr PStreamNotify(nsCString url, nsCString target, bool post,
|
||||
nsCString buffer, bool file)
|
||||
returns (NPError result);
|
||||
|
||||
@ -202,29 +202,29 @@ parent:
|
||||
gfxIntSize size,
|
||||
bool transparent);
|
||||
|
||||
rpc NPN_PushPopupsEnabledState(bool aState);
|
||||
intr NPN_PushPopupsEnabledState(bool aState);
|
||||
|
||||
rpc NPN_PopPopupsEnabledState();
|
||||
intr NPN_PopPopupsEnabledState();
|
||||
|
||||
rpc NPN_GetValueForURL(NPNURLVariable variable, nsCString url)
|
||||
intr NPN_GetValueForURL(NPNURLVariable variable, nsCString url)
|
||||
returns (nsCString value, NPError result);
|
||||
|
||||
rpc NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
|
||||
intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
|
||||
nsCString value)
|
||||
returns (NPError result);
|
||||
|
||||
rpc NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
|
||||
intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
|
||||
int32_t port, nsCString scheme,
|
||||
nsCString realm)
|
||||
returns (nsCString username, nsCString password, NPError result);
|
||||
|
||||
rpc NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
|
||||
intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
|
||||
NPCoordinateSpace destSpace)
|
||||
returns (double destX, double destY, bool result);
|
||||
|
||||
async RedrawPlugin();
|
||||
|
||||
rpc NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format)
|
||||
intr NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format)
|
||||
returns (NPRemoteAsyncSurface surfData, bool result);
|
||||
|
||||
// Send notification that a plugin tried to negotiate Carbon NPAPI so that
|
||||
@ -240,7 +240,7 @@ both:
|
||||
|
||||
child:
|
||||
/* NPP_NewStream */
|
||||
rpc PBrowserStream(nsCString url,
|
||||
intr PBrowserStream(nsCString url,
|
||||
uint32_t length,
|
||||
uint32_t lastmodified,
|
||||
nullable PStreamNotify notifyData,
|
||||
@ -252,16 +252,16 @@ child:
|
||||
|
||||
parent:
|
||||
/* NPN_NewStream */
|
||||
rpc PPluginStream(nsCString mimeType,
|
||||
intr PPluginStream(nsCString mimeType,
|
||||
nsCString target)
|
||||
returns (NPError result);
|
||||
|
||||
parent:
|
||||
rpc PluginFocusChange(bool gotFocus);
|
||||
intr PluginFocusChange(bool gotFocus);
|
||||
|
||||
child:
|
||||
rpc SetPluginFocus();
|
||||
rpc UpdateWindow();
|
||||
intr SetPluginFocus();
|
||||
intr UpdateWindow();
|
||||
|
||||
async PPluginBackgroundDestroyer();
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ using nsID;
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
rpc protocol PPluginModule
|
||||
intr protocol PPluginModule
|
||||
{
|
||||
manages PPluginInstance;
|
||||
manages PPluginIdentifier;
|
||||
@ -37,41 +37,41 @@ both:
|
||||
* from leaking out to plugin code and only allow the child's to be used.
|
||||
*
|
||||
* When calling into the plugin, the parent may create a "temporary"
|
||||
* identifier which is only valid for the lifetime of the current RPC frame.
|
||||
* identifier which is only valid for the lifetime of the current inerrupt frame.
|
||||
*/
|
||||
async PPluginIdentifier(nsCString aString,
|
||||
int32_t aInt,
|
||||
bool temporary);
|
||||
|
||||
// Window-specific message which instructs the RPC mechanism to enter
|
||||
// a nested event loop for the current RPC call.
|
||||
async ProcessNativeEventsInRPCCall();
|
||||
// Window-specific message which instructs the interrupt mechanism to enter
|
||||
// a nested event loop for the current interrupt call.
|
||||
async ProcessNativeEventsInInterruptCall();
|
||||
|
||||
child:
|
||||
// Forces the child process to update its plugin function table.
|
||||
rpc NP_GetEntryPoints()
|
||||
intr NP_GetEntryPoints()
|
||||
returns (NPError rv);
|
||||
|
||||
rpc NP_Initialize(uint32_t aFlags)
|
||||
intr NP_Initialize(uint32_t aFlags)
|
||||
returns (NPError rv);
|
||||
|
||||
rpc PPluginInstance(nsCString aMimeType,
|
||||
intr PPluginInstance(nsCString aMimeType,
|
||||
uint16_t aMode,
|
||||
nsCString[] aNames,
|
||||
nsCString[] aValues)
|
||||
returns (NPError rv);
|
||||
|
||||
rpc NP_Shutdown()
|
||||
intr NP_Shutdown()
|
||||
returns (NPError rv);
|
||||
|
||||
rpc OptionalFunctionsSupported()
|
||||
intr OptionalFunctionsSupported()
|
||||
returns (bool aURLRedirectNotify, bool aClearSiteData,
|
||||
bool aGetSitesWithData);
|
||||
|
||||
rpc NPP_ClearSiteData(nsCString site, uint64_t flags, uint64_t maxAge)
|
||||
intr NPP_ClearSiteData(nsCString site, uint64_t flags, uint64_t maxAge)
|
||||
returns (NPError rv);
|
||||
|
||||
rpc NPP_GetSitesWithData()
|
||||
intr NPP_GetSitesWithData()
|
||||
returns (nsCString[] sites);
|
||||
|
||||
// Windows specific message to set up an audio session in the plugin process
|
||||
@ -81,10 +81,10 @@ child:
|
||||
|
||||
async SetParentHangTimeout(uint32_t seconds);
|
||||
|
||||
rpc PCrashReporter()
|
||||
intr PCrashReporter()
|
||||
returns (NativeThreadId tid, uint32_t processType);
|
||||
|
||||
rpc GeckoGetProfile()
|
||||
intr GeckoGetProfile()
|
||||
returns (nsCString aProfile);
|
||||
|
||||
parent:
|
||||
@ -101,10 +101,10 @@ parent:
|
||||
*/
|
||||
async BackUpXResources(FileDescriptor aXSocketFd);
|
||||
|
||||
rpc NPN_UserAgent()
|
||||
intr NPN_UserAgent()
|
||||
returns (nsCString userAgent);
|
||||
|
||||
rpc NPN_GetValue_WithBoolReturn(NPNVariable aVariable)
|
||||
intr NPN_GetValue_WithBoolReturn(NPNVariable aVariable)
|
||||
returns (NPError aError,
|
||||
bool aBoolVal);
|
||||
|
||||
@ -112,7 +112,7 @@ parent:
|
||||
// Gtk-specific code upon detecting that the plugin process has
|
||||
// entered a nested event loop. If the browser doesn't process
|
||||
// native events, then "livelock" and some other glitches can occur.
|
||||
rpc ProcessSomeEvents();
|
||||
intr ProcessSomeEvents();
|
||||
|
||||
// OS X Specific calls to manage the plugin's window
|
||||
// when interposing system calls.
|
||||
|
@ -26,7 +26,7 @@ union Variant {
|
||||
nullable PPluginScriptableObject;
|
||||
};
|
||||
|
||||
rpc protocol PPluginScriptableObject
|
||||
intr protocol PPluginScriptableObject
|
||||
{
|
||||
manager PPluginInstance;
|
||||
|
||||
@ -34,42 +34,42 @@ both:
|
||||
async __delete__();
|
||||
|
||||
parent:
|
||||
rpc NPN_Evaluate(nsCString aScript)
|
||||
intr NPN_Evaluate(nsCString aScript)
|
||||
returns (Variant aResult,
|
||||
bool aSuccess);
|
||||
|
||||
child:
|
||||
rpc Invalidate();
|
||||
intr Invalidate();
|
||||
|
||||
both:
|
||||
// NPClass methods
|
||||
rpc HasMethod(PPluginIdentifier aId)
|
||||
intr HasMethod(PPluginIdentifier aId)
|
||||
returns (bool aHasMethod);
|
||||
|
||||
rpc Invoke(PPluginIdentifier aId,
|
||||
intr Invoke(PPluginIdentifier aId,
|
||||
Variant[] aArgs)
|
||||
returns (Variant aResult,
|
||||
bool aSuccess);
|
||||
|
||||
rpc InvokeDefault(Variant[] aArgs)
|
||||
intr InvokeDefault(Variant[] aArgs)
|
||||
returns (Variant aResult,
|
||||
bool aSuccess);
|
||||
|
||||
rpc HasProperty(PPluginIdentifier aId)
|
||||
intr HasProperty(PPluginIdentifier aId)
|
||||
returns (bool aHasProperty);
|
||||
|
||||
rpc SetProperty(PPluginIdentifier aId,
|
||||
intr SetProperty(PPluginIdentifier aId,
|
||||
Variant aValue)
|
||||
returns (bool aSuccess);
|
||||
|
||||
rpc RemoveProperty(PPluginIdentifier aId)
|
||||
intr RemoveProperty(PPluginIdentifier aId)
|
||||
returns (bool aSuccess);
|
||||
|
||||
rpc Enumerate()
|
||||
intr Enumerate()
|
||||
returns (PPluginIdentifier[] aProperties,
|
||||
bool aSuccess);
|
||||
|
||||
rpc Construct(Variant[] aArgs)
|
||||
intr Construct(Variant[] aArgs)
|
||||
returns (Variant aResult,
|
||||
bool aSuccess);
|
||||
|
||||
@ -90,12 +90,12 @@ both:
|
||||
* several checks at once and return all the results simultaneously.
|
||||
*/
|
||||
parent:
|
||||
rpc GetParentProperty(PPluginIdentifier aId)
|
||||
intr GetParentProperty(PPluginIdentifier aId)
|
||||
returns (Variant aResult,
|
||||
bool aSuccess);
|
||||
|
||||
child:
|
||||
rpc GetChildProperty(PPluginIdentifier aId)
|
||||
intr GetChildProperty(PPluginIdentifier aId)
|
||||
returns (bool aHasProperty,
|
||||
bool aHasMethod,
|
||||
Variant aResult,
|
||||
|
@ -18,12 +18,12 @@ namespace plugins {
|
||||
* PPluginStream represents an NPStream sent from the plugin to the browser.
|
||||
*/
|
||||
|
||||
rpc protocol PPluginStream
|
||||
intr protocol PPluginStream
|
||||
{
|
||||
manager PPluginInstance;
|
||||
|
||||
parent:
|
||||
rpc NPN_Write(Buffer data) returns (int32_t written);
|
||||
intr NPN_Write(Buffer data) returns (int32_t written);
|
||||
|
||||
both:
|
||||
/**
|
||||
@ -31,7 +31,7 @@ both:
|
||||
* @param artificial True when the stream is closed as a by-product of
|
||||
* some other call (such as a failure in NPN_Write).
|
||||
*/
|
||||
rpc __delete__(NPReason reason, bool artificial);
|
||||
intr __delete__(NPReason reason, bool artificial);
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
@ -13,7 +13,7 @@ using NPReason;
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
rpc protocol PStreamNotify
|
||||
intr protocol PStreamNotify
|
||||
{
|
||||
manager PPluginInstance;
|
||||
|
||||
|
@ -67,7 +67,7 @@ NPRemoteWindow::NPRemoteWindow() :
|
||||
clipRect.right = 0;
|
||||
}
|
||||
|
||||
ipc::RacyRPCPolicy
|
||||
ipc::RacyInterruptPolicy
|
||||
MediateRace(const MessageChannel::Message& parent,
|
||||
const MessageChannel::Message& child)
|
||||
{
|
||||
@ -78,10 +78,10 @@ MediateRace(const MessageChannel::Message& parent,
|
||||
case PPluginInstance::Msg_NPP_HandleEvent_IOSurface__ID:
|
||||
// our code relies on the frame list not changing during paints and
|
||||
// reflows
|
||||
return ipc::RRPParentWins;
|
||||
return ipc::RIPParentWins;
|
||||
|
||||
default:
|
||||
return ipc::RRPChildWins;
|
||||
return ipc::RIPChildWins;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ enum ScriptableObjectType
|
||||
Proxy
|
||||
};
|
||||
|
||||
mozilla::ipc::RacyRPCPolicy
|
||||
mozilla::ipc::RacyInterruptPolicy
|
||||
MediateRace(const mozilla::ipc::MessageChannel::Message& parent,
|
||||
const mozilla::ipc::MessageChannel::Message& child);
|
||||
|
||||
|
@ -583,7 +583,7 @@ PluginModuleChild::AnswerNP_Shutdown(NPError *rv)
|
||||
mozilla::widget::StopAudioSession();
|
||||
#endif
|
||||
|
||||
// the PluginModuleParent shuts down this process after this RPC
|
||||
// the PluginModuleParent shuts down this process after this interrupt
|
||||
// call pops off its stack
|
||||
|
||||
*rv = mShutdownFunc ? mShutdownFunc() : NPERR_NO_ERROR;
|
||||
@ -2350,7 +2350,7 @@ PluginModuleChild::NestedInputEventHook(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
uint32_t len = self->mIncallPumpingStack.Length();
|
||||
if (nCode >= 0 && len && !self->mIncallPumpingStack[len - 1]._spinning) {
|
||||
MessageLoop* loop = MessageLoop::current();
|
||||
self->SendProcessNativeEventsInRPCCall();
|
||||
self->SendProcessNativeEventsInInterruptCall();
|
||||
IncallFrame& f = self->mIncallPumpingStack[len - 1];
|
||||
f._spinning = true;
|
||||
f._savedNestableTasksAllowed = loop->NestableTasksAllowed();
|
||||
@ -2399,15 +2399,15 @@ PluginModuleChild::ResetEventHooks()
|
||||
#endif
|
||||
|
||||
bool
|
||||
PluginModuleChild::RecvProcessNativeEventsInRPCCall()
|
||||
PluginModuleChild::RecvProcessNativeEventsInInterruptCall()
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(OS_WIN)
|
||||
ProcessNativeEventsInRPCCall();
|
||||
ProcessNativeEventsInInterruptCall();
|
||||
return true;
|
||||
#else
|
||||
NS_RUNTIMEABORT(
|
||||
"PluginModuleChild::RecvProcessNativeEventsInRPCCall not implemented!");
|
||||
"PluginModuleChild::RecvProcessNativeEventsInInterruptCall not implemented!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ class PluginModuleChild : public PPluginModuleChild
|
||||
{
|
||||
typedef mozilla::dom::PCrashReporterChild PCrashReporterChild;
|
||||
protected:
|
||||
virtual mozilla::ipc::RacyRPCPolicy
|
||||
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
{
|
||||
return MediateRace(parent, child);
|
||||
}
|
||||
@ -158,7 +158,7 @@ protected:
|
||||
MOZ_NORETURN void QuickExit();
|
||||
|
||||
virtual bool
|
||||
RecvProcessNativeEventsInRPCCall() MOZ_OVERRIDE;
|
||||
RecvProcessNativeEventsInInterruptCall() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
AnswerGeckoGetProfile(nsCString* aProfile);
|
||||
@ -431,7 +431,7 @@ private:
|
||||
virtual void ExitedCall() MOZ_OVERRIDE;
|
||||
|
||||
// Entered/ExitedCall notifications keep track of whether the plugin has
|
||||
// entered a nested event loop within this RPC call.
|
||||
// entered a nested event loop within this interrupt call.
|
||||
struct IncallFrame
|
||||
{
|
||||
IncallFrame()
|
||||
|
@ -1241,7 +1241,7 @@ PluginModuleParent::NP_Shutdown(NPError* error)
|
||||
|
||||
bool ok = CallNP_Shutdown(error);
|
||||
|
||||
// if NP_Shutdown() is nested within another RPC call, this will
|
||||
// if NP_Shutdown() is nested within another interrupt call, this will
|
||||
// break things. but lord help us if we're doing that anyway; the
|
||||
// plugin dso will have been unloaded on the other side by the
|
||||
// CallNP_Shutdown() message
|
||||
@ -1466,28 +1466,28 @@ PluginModuleParent::AnswerProcessSomeEvents()
|
||||
#endif
|
||||
|
||||
bool
|
||||
PluginModuleParent::RecvProcessNativeEventsInRPCCall()
|
||||
PluginModuleParent::RecvProcessNativeEventsInInterruptCall()
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(OS_WIN)
|
||||
ProcessNativeEventsInRPCCall();
|
||||
ProcessNativeEventsInInterruptCall();
|
||||
return true;
|
||||
#else
|
||||
NS_NOTREACHED(
|
||||
"PluginModuleParent::RecvProcessNativeEventsInRPCCall not implemented!");
|
||||
"PluginModuleParent::RecvProcessNativeEventsInInterruptCall not implemented!");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleParent::ProcessRemoteNativeEventsInRPCCall()
|
||||
PluginModuleParent::ProcessRemoteNativeEventsInInterruptCall()
|
||||
{
|
||||
#if defined(OS_WIN)
|
||||
unused << SendProcessNativeEventsInRPCCall();
|
||||
unused << SendProcessNativeEventsInInterruptCall();
|
||||
return;
|
||||
#endif
|
||||
NS_NOTREACHED(
|
||||
"PluginModuleParent::ProcessRemoteNativeEventsInRPCCall not implemented!");
|
||||
"PluginModuleParent::ProcessRemoteNativeEventsInInterruptCall not implemented!");
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
PluginIdentifierParent*
|
||||
GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier);
|
||||
|
||||
void ProcessRemoteNativeEventsInRPCCall();
|
||||
void ProcessRemoteNativeEventsInInterruptCall();
|
||||
|
||||
void TerminateChildProcess(MessageLoop* aMsgLoop);
|
||||
|
||||
@ -134,8 +134,8 @@ public:
|
||||
#endif // XP_WIN
|
||||
|
||||
protected:
|
||||
virtual mozilla::ipc::RacyRPCPolicy
|
||||
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
{
|
||||
return MediateRace(parent, child);
|
||||
}
|
||||
@ -158,7 +158,7 @@ protected:
|
||||
virtual bool AnswerProcessSomeEvents() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
RecvProcessNativeEventsInRPCCall() MOZ_OVERRIDE;
|
||||
RecvProcessNativeEventsInInterruptCall() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
RecvPluginShowWindow(const uint32_t& aWindowId, const bool& aModal,
|
||||
|
@ -26,7 +26,7 @@ namespace layers {
|
||||
*/
|
||||
// This should really be 'sync', but we're using 'rpc' as a workaround
|
||||
// for Bug 716631.
|
||||
rpc protocol PCompositor
|
||||
intr protocol PCompositor
|
||||
{
|
||||
// A Compositor manages a single Layer Manager (PLayerTransaction)
|
||||
manages PLayerTransaction;
|
||||
|
@ -23,7 +23,7 @@ namespace layers {
|
||||
* frames directly to the compositor thread/process without relying on the main thread
|
||||
* which might be too busy dealing with content script.
|
||||
*/
|
||||
/*FIXME: sync*/ rpc protocol PImageBridge
|
||||
intr protocol PImageBridge
|
||||
{
|
||||
manages PCompositable;
|
||||
manages PGrallocBuffer;
|
||||
|
@ -38,8 +38,8 @@ Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority,
|
||||
#if defined(OS_POSIX)
|
||||
header()->num_fds = 0;
|
||||
#endif
|
||||
header()->rpc_remote_stack_depth_guess = static_cast<uint32_t>(-1);
|
||||
header()->rpc_local_stack_depth = static_cast<uint32_t>(-1);
|
||||
header()->interrupt_remote_stack_depth_guess = static_cast<uint32_t>(-1);
|
||||
header()->interrupt_local_stack_depth = static_cast<uint32_t>(-1);
|
||||
header()->seqno = 0;
|
||||
#if defined(OS_MACOSX)
|
||||
header()->cookie = 0;
|
||||
|
@ -87,8 +87,8 @@ class Message : public Pickle {
|
||||
}
|
||||
|
||||
// True if this is a synchronous message.
|
||||
bool is_rpc() const {
|
||||
return (header()->flags & RPC_BIT) != 0;
|
||||
bool is_interrupt() const {
|
||||
return (header()->flags & INTERRUPT_BIT) != 0;
|
||||
}
|
||||
|
||||
// True if this is an urgent message.
|
||||
@ -153,22 +153,22 @@ class Message : public Pickle {
|
||||
header()->routing = new_id;
|
||||
}
|
||||
|
||||
uint32_t rpc_remote_stack_depth_guess() const {
|
||||
return header()->rpc_remote_stack_depth_guess;
|
||||
uint32_t interrupt_remote_stack_depth_guess() const {
|
||||
return header()->interrupt_remote_stack_depth_guess;
|
||||
}
|
||||
|
||||
void set_rpc_remote_stack_depth_guess(uint32_t depth) {
|
||||
DCHECK(is_rpc());
|
||||
header()->rpc_remote_stack_depth_guess = depth;
|
||||
void set_interrupt_remote_stack_depth_guess(uint32_t depth) {
|
||||
DCHECK(is_interrupt());
|
||||
header()->interrupt_remote_stack_depth_guess = depth;
|
||||
}
|
||||
|
||||
uint32_t rpc_local_stack_depth() const {
|
||||
return header()->rpc_local_stack_depth;
|
||||
uint32_t interrupt_local_stack_depth() const {
|
||||
return header()->interrupt_local_stack_depth;
|
||||
}
|
||||
|
||||
void set_rpc_local_stack_depth(uint32_t depth) {
|
||||
DCHECK(is_rpc());
|
||||
header()->rpc_local_stack_depth = depth;
|
||||
void set_interrupt_local_stack_depth(uint32_t depth) {
|
||||
DCHECK(is_interrupt());
|
||||
header()->interrupt_local_stack_depth = depth;
|
||||
}
|
||||
|
||||
int32_t seqno() const {
|
||||
@ -271,8 +271,8 @@ class Message : public Pickle {
|
||||
header()->flags |= SYNC_BIT;
|
||||
}
|
||||
|
||||
void set_rpc() {
|
||||
header()->flags |= RPC_BIT;
|
||||
void set_interrupt() {
|
||||
header()->flags |= INTERRUPT_BIT;
|
||||
}
|
||||
|
||||
void set_urgent() {
|
||||
@ -292,7 +292,7 @@ class Message : public Pickle {
|
||||
UNBLOCK_BIT = 0x0020,
|
||||
PUMPING_MSGS_BIT= 0x0040,
|
||||
HAS_SENT_TIME_BIT = 0x0080,
|
||||
RPC_BIT = 0x0100,
|
||||
INTERRUPT_BIT = 0x0100,
|
||||
COMPRESS_BIT = 0x0200,
|
||||
URGENT_BIT = 0x0400
|
||||
};
|
||||
@ -308,9 +308,9 @@ class Message : public Pickle {
|
||||
# endif
|
||||
#endif
|
||||
// For RPC messages, a guess at what the *other* side's stack depth is.
|
||||
uint32_t rpc_remote_stack_depth_guess;
|
||||
uint32_t interrupt_remote_stack_depth_guess;
|
||||
// The actual local stack depth.
|
||||
uint32_t rpc_local_stack_depth;
|
||||
uint32_t interrupt_local_stack_depth;
|
||||
// Sequence number
|
||||
int32_t seqno;
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ MessageChannel::MessageChannel(MessageListener *aListener)
|
||||
mPendingUrgentReplies(0),
|
||||
mDispatchingSyncMessage(false),
|
||||
mRemoteStackDepthGuess(false),
|
||||
mSawRPCOutMsg(false)
|
||||
mSawInterruptOutMsg(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ipc::MessageChannel);
|
||||
|
||||
@ -270,7 +270,7 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
|
||||
if (MaybeInterceptSpecialIOMessage(aMsg))
|
||||
return;
|
||||
|
||||
// Regardless of the RPC stack, if we're awaiting a sync or urgent reply,
|
||||
// Regardless of the Interrupt stack, if we're awaiting a sync or urgent reply,
|
||||
// we know that it needs to be immediately handled to unblock us.
|
||||
if ((AwaitingSyncReply() && aMsg.is_sync()) ||
|
||||
(AwaitingUrgentReply() && aMsg.is_urgent()))
|
||||
@ -310,7 +310,7 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
|
||||
// posting a task to the main event loop, where it will be processed
|
||||
// once the synchronous reply has been received.
|
||||
//
|
||||
// (2) We are waiting on an RPC reply - main thread is blocked on the IPC monitor.
|
||||
// (2) We are waiting on an Interrupt reply - main thread is blocked on the IPC monitor.
|
||||
// - Always notify and wake up the main thread.
|
||||
//
|
||||
// (3) We are not waiting on a reply.
|
||||
@ -320,13 +320,13 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
|
||||
// blocked. This is okay, since we always check for pending events before
|
||||
// blocking again.
|
||||
//
|
||||
if (AwaitingRPCReply() || (AwaitingSyncReply() && aMsg.is_urgent())) {
|
||||
// Always wake up our RPC waiter, and wake up sync waiters for urgent
|
||||
if (AwaitingInterruptReply() || (AwaitingSyncReply() && aMsg.is_urgent())) {
|
||||
// Always wake up our Interrupt waiter, and wake up sync waiters for urgent
|
||||
// messages.
|
||||
NotifyWorkerThread();
|
||||
} else {
|
||||
// Worker thread is either not blocked on a reply, or this is an
|
||||
// incoming RPC that raced with outgoing sync, and needs to be
|
||||
// incoming Interrupt that raced with outgoing sync, and needs to be
|
||||
// deferred to a later event-loop iteration.
|
||||
if (!compress) {
|
||||
// If we compressed away the previous message, we'll re-use
|
||||
@ -357,7 +357,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
|
||||
|
||||
if (AwaitingSyncReply()) {
|
||||
// This is a temporary hack in place, for e10s CPOWs, until bug 901789
|
||||
// and the new followup RPC protocol land. Eventually this will become
|
||||
// and the new followup Interrupt protocol land. Eventually this will become
|
||||
// an assert again. See bug 900062 for details.
|
||||
NS_ERROR("Nested sync messages are not supported");
|
||||
return false;
|
||||
@ -390,7 +390,7 @@ MessageChannel::UrgentCall(Message* aMsg, Message* aReply)
|
||||
// At the moment, we don't allow urgent outcalls to nest, though this will
|
||||
// change soon.
|
||||
IPC_ASSERT(!AwaitingUrgentReply(), "urgent calls cannot nest");
|
||||
IPC_ASSERT(!AwaitingRPCReply(), "urgent calls cannot be issued within RPC calls");
|
||||
IPC_ASSERT(!AwaitingInterruptReply(), "urgent calls cannot be issued within Interrupt calls");
|
||||
IPC_ASSERT(!AwaitingSyncReply(), "urgent calls cannot be issued within sync sends");
|
||||
|
||||
AutoEnterPendingReply replies(mPendingUrgentReplies);
|
||||
@ -485,11 +485,11 @@ MessageChannel::Call(Message* aMsg, Message* aReply)
|
||||
{
|
||||
if (aMsg->is_urgent())
|
||||
return UrgentCall(aMsg, aReply);
|
||||
return RPCCall(aMsg, aReply);
|
||||
return InterruptCall(aMsg, aReply);
|
||||
}
|
||||
|
||||
bool
|
||||
MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
MessageChannel::InterruptCall(Message* aMsg, Message* aReply)
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
@ -511,18 +511,18 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
|
||||
// Sanity checks.
|
||||
IPC_ASSERT(!AwaitingSyncReply() && !AwaitingUrgentReply(),
|
||||
"cannot issue RPC call whiel blocked on sync or urgent");
|
||||
"cannot issue Interrupt call whiel blocked on sync or urgent");
|
||||
IPC_ASSERT(!DispatchingSyncMessage() || aMsg->priority() == IPC::Message::PRIORITY_HIGH,
|
||||
"violation of sync handler invariant");
|
||||
IPC_ASSERT(aMsg->is_rpc(), "can only Call() RPC messages here");
|
||||
IPC_ASSERT(aMsg->is_interrupt(), "can only Call() Interrupt messages here");
|
||||
|
||||
|
||||
nsAutoPtr<Message> msg(aMsg);
|
||||
|
||||
msg->set_seqno(NextSeqno());
|
||||
msg->set_rpc_remote_stack_depth_guess(mRemoteStackDepthGuess);
|
||||
msg->set_rpc_local_stack_depth(1 + RPCStackDepth());
|
||||
mRPCStack.push(*msg);
|
||||
msg->set_interrupt_remote_stack_depth_guess(mRemoteStackDepthGuess);
|
||||
msg->set_interrupt_local_stack_depth(1 + InterruptStackDepth());
|
||||
mInterruptStack.push(*msg);
|
||||
mLink->SendMessage(msg.forget());
|
||||
|
||||
while (true) {
|
||||
@ -532,7 +532,7 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
// trying another loop iteration will be futile because
|
||||
// channel state will have been cleared
|
||||
if (!Connected()) {
|
||||
ReportConnectionError("MessageChannel::RPCCall");
|
||||
ReportConnectionError("MessageChannel::InterruptCall");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -541,12 +541,12 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
MaybeUndeferIncall();
|
||||
|
||||
// Wait for an event to occur.
|
||||
while (!RPCEventOccurred()) {
|
||||
bool maybeTimedOut = !WaitForRPCNotify();
|
||||
while (!InterruptEventOccurred()) {
|
||||
bool maybeTimedOut = !WaitForInterruptNotify();
|
||||
|
||||
// We might have received a "subtly deferred" message in a nested
|
||||
// loop that it's now time to process.
|
||||
if (RPCEventOccurred() ||
|
||||
if (InterruptEventOccurred() ||
|
||||
(!maybeTimedOut && (!mDeferred.empty() || !mOutOfTurnReplies.empty())))
|
||||
{
|
||||
break;
|
||||
@ -562,7 +562,7 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
if (mPendingUrgentRequest) {
|
||||
recvd = *mPendingUrgentRequest;
|
||||
mPendingUrgentRequest = nullptr;
|
||||
} else if ((it = mOutOfTurnReplies.find(mRPCStack.top().seqno()))
|
||||
} else if ((it = mOutOfTurnReplies.find(mInterruptStack.top().seqno()))
|
||||
!= mOutOfTurnReplies.end())
|
||||
{
|
||||
recvd = it->second;
|
||||
@ -579,8 +579,8 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the message is not RPC, we can dispatch it as normal.
|
||||
if (!recvd.is_rpc()) {
|
||||
// If the message is not Interrupt, we can dispatch it as normal.
|
||||
if (!recvd.is_interrupt()) {
|
||||
// Other side should be blocked.
|
||||
IPC_ASSERT(!recvd.is_sync() || mPending.empty(), "other side should be blocked");
|
||||
|
||||
@ -596,15 +596,15 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the message is an RPC reply, either process it as a reply to our
|
||||
// If the message is an Interrupt reply, either process it as a reply to our
|
||||
// call, or add it to the list of out-of-turn replies we've received.
|
||||
if (recvd.is_reply()) {
|
||||
IPC_ASSERT(!mRPCStack.empty(), "invalid RPC stack");
|
||||
IPC_ASSERT(!mInterruptStack.empty(), "invalid Interrupt stack");
|
||||
|
||||
// If this is not a reply the call we've initiated, add it to our
|
||||
// out-of-turn replies and keep polling for events.
|
||||
{
|
||||
const Message &outcall = mRPCStack.top();
|
||||
const Message &outcall = mInterruptStack.top();
|
||||
|
||||
// Note, In the parent, sequence numbers increase from 0, and
|
||||
// in the child, they decrease from 0.
|
||||
@ -623,7 +623,7 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
|
||||
// We received a reply to our most recent outstanding call. Pop
|
||||
// this frame and return the reply.
|
||||
mRPCStack.pop();
|
||||
mInterruptStack.pop();
|
||||
|
||||
if (!recvd.is_reply_error()) {
|
||||
*aReply = recvd;
|
||||
@ -631,24 +631,24 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
|
||||
// If we have no more pending out calls waiting on replies, then
|
||||
// the reply queue should be empty.
|
||||
IPC_ASSERT(!mRPCStack.empty() || mOutOfTurnReplies.empty(),
|
||||
IPC_ASSERT(!mInterruptStack.empty() || mOutOfTurnReplies.empty(),
|
||||
"still have pending replies with no pending out-calls",
|
||||
true);
|
||||
|
||||
return !recvd.is_reply_error();
|
||||
}
|
||||
|
||||
// Dispatch an RPC in-call. Snapshot the current stack depth while we
|
||||
// Dispatch an Interrupt in-call. Snapshot the current stack depth while we
|
||||
// own the monitor.
|
||||
size_t stackDepth = RPCStackDepth();
|
||||
size_t stackDepth = InterruptStackDepth();
|
||||
{
|
||||
MonitorAutoUnlock unlock(*mMonitor);
|
||||
|
||||
CxxStackFrame frame(*this, IN_MESSAGE, &recvd);
|
||||
DispatchRPCMessage(recvd, stackDepth);
|
||||
DispatchInterruptMessage(recvd, stackDepth);
|
||||
}
|
||||
if (!Connected()) {
|
||||
ReportConnectionError("MessageChannel::DispatchRPCMessage");
|
||||
ReportConnectionError("MessageChannel::DispatchInterruptMessage");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -657,17 +657,17 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
|
||||
}
|
||||
|
||||
bool
|
||||
MessageChannel::RPCEventOccurred()
|
||||
MessageChannel::InterruptEventOccurred()
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
IPC_ASSERT(RPCStackDepth() > 0, "not in wait loop");
|
||||
IPC_ASSERT(InterruptStackDepth() > 0, "not in wait loop");
|
||||
|
||||
return (!Connected() ||
|
||||
!mPending.empty() ||
|
||||
mPendingUrgentRequest ||
|
||||
(!mOutOfTurnReplies.empty() &&
|
||||
mOutOfTurnReplies.find(mRPCStack.top().seqno()) !=
|
||||
mOutOfTurnReplies.find(mInterruptStack.top().seqno()) !=
|
||||
mOutOfTurnReplies.end()));
|
||||
}
|
||||
|
||||
@ -702,9 +702,9 @@ MessageChannel::OnMaybeDequeueOne()
|
||||
mPending.pop_front();
|
||||
} while (0);
|
||||
|
||||
if (IsOnCxxStack() && recvd.is_rpc() && recvd.is_reply()) {
|
||||
if (IsOnCxxStack() && recvd.is_interrupt() && recvd.is_reply()) {
|
||||
// We probably just received a reply in a nested loop for an
|
||||
// RPC call sent before entering that loop.
|
||||
// Interrupt call sent before entering that loop.
|
||||
mOutOfTurnReplies[recvd.seqno()] = recvd;
|
||||
return false;
|
||||
}
|
||||
@ -721,8 +721,8 @@ MessageChannel::DispatchMessage(const Message &aMsg)
|
||||
DispatchSyncMessage(aMsg);
|
||||
else if (aMsg.is_urgent())
|
||||
DispatchUrgentMessage(aMsg);
|
||||
else if (aMsg.is_rpc())
|
||||
DispatchRPCMessage(aMsg, 0);
|
||||
else if (aMsg.is_interrupt())
|
||||
DispatchInterruptMessage(aMsg, 0);
|
||||
else
|
||||
DispatchAsyncMessage(aMsg);
|
||||
}
|
||||
@ -778,7 +778,7 @@ void
|
||||
MessageChannel::DispatchAsyncMessage(const Message& aMsg)
|
||||
{
|
||||
AssertWorkerThread();
|
||||
MOZ_ASSERT(!aMsg.is_rpc() && !aMsg.is_sync() && !aMsg.is_urgent());
|
||||
MOZ_ASSERT(!aMsg.is_interrupt() && !aMsg.is_sync() && !aMsg.is_urgent());
|
||||
|
||||
if (aMsg.routing_id() == MSG_ROUTING_NONE) {
|
||||
NS_RUNTIMEABORT("unhandled special message!");
|
||||
@ -788,34 +788,34 @@ MessageChannel::DispatchAsyncMessage(const Message& aMsg)
|
||||
}
|
||||
|
||||
void
|
||||
MessageChannel::DispatchRPCMessage(const Message& aMsg, size_t stackDepth)
|
||||
MessageChannel::DispatchInterruptMessage(const Message& aMsg, size_t stackDepth)
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
|
||||
IPC_ASSERT(aMsg.is_rpc() && !aMsg.is_reply(), "wrong message type");
|
||||
IPC_ASSERT(aMsg.is_interrupt() && !aMsg.is_reply(), "wrong message type");
|
||||
|
||||
// Race detection: see the long comment near mRemoteStackDepthGuess in
|
||||
// RPCChannel.h. "Remote" stack depth means our side, and "local" means
|
||||
// MessageChannel.h. "Remote" stack depth means our side, and "local" means
|
||||
// the other side.
|
||||
if (aMsg.rpc_remote_stack_depth_guess() != RemoteViewOfStackDepth(stackDepth)) {
|
||||
// RPC in-calls have raced. The winner, if there is one, gets to defer
|
||||
if (aMsg.interrupt_remote_stack_depth_guess() != RemoteViewOfStackDepth(stackDepth)) {
|
||||
// Interrupt in-calls have raced. The winner, if there is one, gets to defer
|
||||
// processing of the other side's in-call.
|
||||
bool defer;
|
||||
const char* winner;
|
||||
switch (mListener->MediateRPCRace((mSide == ChildSide) ? aMsg : mRPCStack.top(),
|
||||
(mSide != ChildSide) ? mRPCStack.top() : aMsg))
|
||||
switch (mListener->MediateInterruptRace((mSide == ChildSide) ? aMsg : mInterruptStack.top(),
|
||||
(mSide != ChildSide) ? mInterruptStack.top() : aMsg))
|
||||
{
|
||||
case RRPChildWins:
|
||||
case RIPChildWins:
|
||||
winner = "child";
|
||||
defer = (mSide == ChildSide);
|
||||
break;
|
||||
case RRPParentWins:
|
||||
case RIPParentWins:
|
||||
winner = "parent";
|
||||
defer = (mSide != ChildSide);
|
||||
break;
|
||||
case RRPError:
|
||||
NS_RUNTIMEABORT("NYI: 'Error' RPC race policy");
|
||||
case RIPError:
|
||||
NS_RUNTIMEABORT("NYI: 'Error' Interrupt race policy");
|
||||
return;
|
||||
default:
|
||||
NS_RUNTIMEABORT("not reached");
|
||||
@ -852,10 +852,10 @@ MessageChannel::DispatchRPCMessage(const Message& aMsg, size_t stackDepth)
|
||||
Result rv = mListener->OnCallReceived(aMsg, reply);
|
||||
--mRemoteStackDepthGuess;
|
||||
|
||||
if (!MaybeHandleError(rv, "DispatchRPCMessage")) {
|
||||
if (!MaybeHandleError(rv, "DispatchInterruptMessage")) {
|
||||
delete reply;
|
||||
reply = new Message();
|
||||
reply->set_rpc();
|
||||
reply->set_interrupt();
|
||||
reply->set_reply();
|
||||
reply->set_reply_error();
|
||||
}
|
||||
@ -875,13 +875,13 @@ MessageChannel::MaybeUndeferIncall()
|
||||
if (mDeferred.empty())
|
||||
return;
|
||||
|
||||
size_t stackDepth = RPCStackDepth();
|
||||
size_t stackDepth = InterruptStackDepth();
|
||||
|
||||
// the other side can only *under*-estimate our actual stack depth
|
||||
IPC_ASSERT(mDeferred.top().rpc_remote_stack_depth_guess() <= stackDepth,
|
||||
IPC_ASSERT(mDeferred.top().interrupt_remote_stack_depth_guess() <= stackDepth,
|
||||
"fatal logic error");
|
||||
|
||||
if (mDeferred.top().rpc_remote_stack_depth_guess() < RemoteViewOfStackDepth(stackDepth))
|
||||
if (mDeferred.top().interrupt_remote_stack_depth_guess() < RemoteViewOfStackDepth(stackDepth))
|
||||
return;
|
||||
|
||||
// maybe time to process this message
|
||||
@ -896,7 +896,7 @@ MessageChannel::MaybeUndeferIncall()
|
||||
}
|
||||
|
||||
void
|
||||
MessageChannel::FlushPendingRPCQueue()
|
||||
MessageChannel::FlushPendingInterruptQueue()
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
@ -909,7 +909,7 @@ MessageChannel::FlushPendingRPCQueue()
|
||||
return;
|
||||
|
||||
const Message& last = mPending.back();
|
||||
if (!last.is_rpc() || last.is_reply())
|
||||
if (!last.is_interrupt() || last.is_reply())
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -921,11 +921,11 @@ void
|
||||
MessageChannel::ExitedCxxStack()
|
||||
{
|
||||
mListener->OnExitedCxxStack();
|
||||
if (mSawRPCOutMsg) {
|
||||
if (mSawInterruptOutMsg) {
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
// see long comment in OnMaybeDequeueOne()
|
||||
EnqueuePendingMessages();
|
||||
mSawRPCOutMsg = false;
|
||||
mSawInterruptOutMsg = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -990,7 +990,7 @@ MessageChannel::WaitForSyncNotify()
|
||||
}
|
||||
|
||||
bool
|
||||
MessageChannel::WaitForRPCNotify()
|
||||
MessageChannel::WaitForInterruptNotify()
|
||||
{
|
||||
return WaitForSyncNotify();
|
||||
}
|
||||
@ -1030,8 +1030,8 @@ MessageChannel::ShouldContinueFromTimeout()
|
||||
// tasks arriving from the child, posted to the worker thread's event
|
||||
// loop. This would complicate cleanup of the *Channel. But since
|
||||
// IPDL forbids this (and since it doesn't support children timing out
|
||||
// on parents), the parent can only block on RPC messages to the child,
|
||||
// and in that case arriving async messages are enqueued to the RPC
|
||||
// on parents), the parent can only block on interrupt messages to the child,
|
||||
// and in that case arriving async messages are enqueued to the interrupt
|
||||
// channel's special queue. They're then ignored because the channel
|
||||
// state changes to ChannelTimeout (i.e. !Connected).
|
||||
SynchronouslyClose();
|
||||
@ -1154,7 +1154,7 @@ MessageChannel::OnChannelErrorFromLink()
|
||||
AssertLinkThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (RPCStackDepth() > 0)
|
||||
if (InterruptStackDepth() > 0)
|
||||
NotifyWorkerThread();
|
||||
|
||||
if (AwaitingSyncReply())
|
||||
@ -1327,19 +1327,19 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
|
||||
const char* why,
|
||||
bool reply) const
|
||||
{
|
||||
printf_stderr("###!!! [RPCChannel][%s][%s:%d] "
|
||||
printf_stderr("###!!! [MessageChannel][%s][%s:%d] "
|
||||
"Assertion (%s) failed. %s %s\n",
|
||||
mSide == ChildSide ? "Child" : "Parent",
|
||||
file, line, cond,
|
||||
why,
|
||||
reply ? "(reply)" : "");
|
||||
// technically we need the mutex for this, but we're dying anyway
|
||||
DumpRPCStack(" ");
|
||||
printf_stderr(" remote RPC stack guess: %lu\n",
|
||||
DumpInterruptStack(" ");
|
||||
printf_stderr(" remote Interrupt stack guess: %lu\n",
|
||||
mRemoteStackDepthGuess);
|
||||
printf_stderr(" deferred stack size: %lu\n",
|
||||
mDeferred.size());
|
||||
printf_stderr(" out-of-turn RPC replies stack size: %lu\n",
|
||||
printf_stderr(" out-of-turn Interrupt replies stack size: %lu\n",
|
||||
mOutOfTurnReplies.size());
|
||||
printf_stderr(" Pending queue size: %lu, front to back:\n",
|
||||
mPending.size());
|
||||
@ -1347,7 +1347,7 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
|
||||
MessageQueue pending = mPending;
|
||||
while (!pending.empty()) {
|
||||
printf_stderr(" [ %s%s ]\n",
|
||||
pending.front().is_rpc() ? "rpc" :
|
||||
pending.front().is_interrupt() ? "intr" :
|
||||
(pending.front().is_sync() ? "sync" : "async"),
|
||||
pending.front().is_reply() ? "reply" : "");
|
||||
pending.pop_front();
|
||||
@ -1357,12 +1357,12 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
|
||||
}
|
||||
|
||||
void
|
||||
MessageChannel::DumpRPCStack(const char* const pfx) const
|
||||
MessageChannel::DumpInterruptStack(const char* const pfx) const
|
||||
{
|
||||
NS_WARN_IF_FALSE(MessageLoop::current() != mWorkerLoop,
|
||||
"The worker thread had better be paused in a debugger!");
|
||||
|
||||
printf_stderr("%sRPCChannel 'backtrace':\n", pfx);
|
||||
printf_stderr("%sMessageChannel 'backtrace':\n", pfx);
|
||||
|
||||
// print a python-style backtrace, first frame to last
|
||||
for (uint32_t i = 0; i < mCxxStackFrames.size(); ++i) {
|
||||
|
@ -88,7 +88,7 @@ class MessageChannel : HasResultCodes
|
||||
// Synchronously send |msg| (i.e., wait for |reply|)
|
||||
bool Send(Message* aMsg, Message* aReply);
|
||||
|
||||
// Make an RPC to the other side of the channel
|
||||
// Make an Interrupt call to the other side of the channel
|
||||
bool Call(Message* aMsg, Message* aReply);
|
||||
|
||||
void SetReplyTimeoutMs(int32_t aTimeoutMs);
|
||||
@ -97,7 +97,7 @@ class MessageChannel : HasResultCodes
|
||||
return !mCxxStackFrames.empty();
|
||||
}
|
||||
|
||||
void FlushPendingRPCQueue();
|
||||
void FlushPendingInterruptQueue();
|
||||
|
||||
// Unsound_IsClosed and Unsound_NumQueuedMessages are safe to call from any
|
||||
// thread, but they make no guarantees about whether you'll get an
|
||||
@ -122,10 +122,10 @@ class MessageChannel : HasResultCodes
|
||||
#ifdef OS_WIN
|
||||
struct MOZ_STACK_CLASS SyncStackFrame
|
||||
{
|
||||
SyncStackFrame(MessageChannel* channel, bool rpc);
|
||||
SyncStackFrame(MessageChannel* channel, bool interrupt);
|
||||
~SyncStackFrame();
|
||||
|
||||
bool mRPC;
|
||||
bool mInterrupt;
|
||||
bool mSpinNestedEvents;
|
||||
bool mListenerNotified;
|
||||
MessageChannel* mChannel;
|
||||
@ -154,7 +154,7 @@ class MessageChannel : HasResultCodes
|
||||
static SyncStackFrame* sStaticTopFrame;
|
||||
|
||||
public:
|
||||
void ProcessNativeEventsInRPCCall();
|
||||
void ProcessNativeEventsInInterruptCall();
|
||||
static void NotifyGeckoEventDispatch();
|
||||
|
||||
private:
|
||||
@ -189,10 +189,10 @@ class MessageChannel : HasResultCodes
|
||||
// up to process urgent calls from the parent.
|
||||
bool SendAndWait(Message* aMsg, Message* aReply);
|
||||
|
||||
bool RPCCall(Message* aMsg, Message* aReply);
|
||||
bool InterruptCall(Message* aMsg, Message* aReply);
|
||||
bool UrgentCall(Message* aMsg, Message* aReply);
|
||||
|
||||
bool RPCEventOccurred();
|
||||
bool InterruptEventOccurred();
|
||||
|
||||
void MaybeUndeferIncall();
|
||||
void EnqueuePendingMessages();
|
||||
@ -208,7 +208,7 @@ class MessageChannel : HasResultCodes
|
||||
void DispatchSyncMessage(const Message &aMsg);
|
||||
void DispatchUrgentMessage(const Message &aMsg);
|
||||
void DispatchAsyncMessage(const Message &aMsg);
|
||||
void DispatchRPCMessage(const Message &aMsg, size_t aStackDepth);
|
||||
void DispatchInterruptMessage(const Message &aMsg, size_t aStackDepth);
|
||||
|
||||
// Return true if the wait ended because a notification was received.
|
||||
//
|
||||
@ -221,7 +221,7 @@ class MessageChannel : HasResultCodes
|
||||
// So in sum: true is a meaningful return value; false isn't,
|
||||
// necessarily.
|
||||
bool WaitForSyncNotify();
|
||||
bool WaitForRPCNotify();
|
||||
bool WaitForInterruptNotify();
|
||||
|
||||
bool WaitResponse(bool aWaitTimedOut);
|
||||
|
||||
@ -229,7 +229,7 @@ class MessageChannel : HasResultCodes
|
||||
|
||||
// The "remote view of stack depth" can be different than the
|
||||
// actual stack depth when there are out-of-turn replies. When we
|
||||
// receive one, our actual RPC stack depth doesn't decrease, but
|
||||
// receive one, our actual Interrupt stack depth doesn't decrease, but
|
||||
// the other side (that sent the reply) thinks it has. So, the
|
||||
// "view" returned here is |stackDepth| minus the number of
|
||||
// out-of-turn replies.
|
||||
@ -247,8 +247,7 @@ class MessageChannel : HasResultCodes
|
||||
|
||||
// This helper class manages mCxxStackDepth on behalf of MessageChannel.
|
||||
// When the stack depth is incremented from zero to non-zero, it invokes
|
||||
// an RPCChannel callback, and similarly for when the depth goes from
|
||||
// non-zero to zero.
|
||||
// a callback, and similarly for when the depth goes from non-zero to zero.
|
||||
void EnteredCxxStack() {
|
||||
mListener->OnEnteredCxxStack();
|
||||
}
|
||||
@ -268,16 +267,16 @@ class MessageChannel : HasResultCodes
|
||||
}
|
||||
|
||||
enum Direction { IN_MESSAGE, OUT_MESSAGE };
|
||||
struct RPCFrame {
|
||||
RPCFrame(Direction direction, const Message* msg)
|
||||
struct InterruptFrame {
|
||||
InterruptFrame(Direction direction, const Message* msg)
|
||||
: mDirection(direction), mMsg(msg)
|
||||
{ }
|
||||
|
||||
bool IsRPCIncall() const {
|
||||
return mMsg->is_rpc() && IN_MESSAGE == mDirection;
|
||||
bool IsInterruptIncall() const {
|
||||
return mMsg->is_interrupt() && IN_MESSAGE == mDirection;
|
||||
}
|
||||
bool IsRPCOutcall() const {
|
||||
return mMsg->is_rpc() && OUT_MESSAGE == mDirection;
|
||||
bool IsInterruptOutcall() const {
|
||||
return mMsg->is_interrupt() && OUT_MESSAGE == mDirection;
|
||||
}
|
||||
|
||||
void Describe(int32_t* id, const char** dir, const char** sems,
|
||||
@ -285,7 +284,7 @@ class MessageChannel : HasResultCodes
|
||||
{
|
||||
*id = mMsg->routing_id();
|
||||
*dir = (IN_MESSAGE == mDirection) ? "in" : "out";
|
||||
*sems = mMsg->is_rpc() ? "rpc" : mMsg->is_sync() ? "sync" : "async";
|
||||
*sems = mMsg->is_interrupt() ? "intr" : mMsg->is_sync() ? "sync" : "async";
|
||||
*name = mMsg->name();
|
||||
}
|
||||
|
||||
@ -304,17 +303,17 @@ class MessageChannel : HasResultCodes
|
||||
if (mThat.mCxxStackFrames.empty())
|
||||
mThat.EnteredCxxStack();
|
||||
|
||||
mThat.mCxxStackFrames.push_back(RPCFrame(direction, msg));
|
||||
const RPCFrame& frame = mThat.mCxxStackFrames.back();
|
||||
mThat.mCxxStackFrames.push_back(InterruptFrame(direction, msg));
|
||||
const InterruptFrame& frame = mThat.mCxxStackFrames.back();
|
||||
|
||||
if (frame.IsRPCIncall())
|
||||
if (frame.IsInterruptIncall())
|
||||
mThat.EnteredCall();
|
||||
|
||||
mThat.mSawRPCOutMsg |= frame.IsRPCOutcall();
|
||||
mThat.mSawInterruptOutMsg |= frame.IsInterruptOutcall();
|
||||
}
|
||||
|
||||
~CxxStackFrame() {
|
||||
bool exitingCall = mThat.mCxxStackFrames.back().IsRPCIncall();
|
||||
bool exitingCall = mThat.mCxxStackFrames.back().IsInterruptIncall();
|
||||
mThat.mCxxStackFrames.pop_back();
|
||||
bool exitingStack = mThat.mCxxStackFrames.empty();
|
||||
|
||||
@ -345,13 +344,13 @@ class MessageChannel : HasResultCodes
|
||||
|
||||
// This method is only safe to call on the worker thread, or in a
|
||||
// debugger with all threads paused.
|
||||
void DumpRPCStack(const char* const pfx="") const;
|
||||
void DumpInterruptStack(const char* const pfx="") const;
|
||||
|
||||
private:
|
||||
// Called from both threads
|
||||
size_t RPCStackDepth() const {
|
||||
size_t InterruptStackDepth() const {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
return mRPCStack.size();
|
||||
return mInterruptStack.size();
|
||||
}
|
||||
|
||||
// Returns true if we're blocking waiting for a reply.
|
||||
@ -363,9 +362,9 @@ class MessageChannel : HasResultCodes
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
return mPendingUrgentReplies > 0;
|
||||
}
|
||||
bool AwaitingRPCReply() const {
|
||||
bool AwaitingInterruptReply() const {
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
return !mRPCStack.empty();
|
||||
return !mInterruptStack.empty();
|
||||
}
|
||||
|
||||
// Returns true if we're dispatching a sync message's callback.
|
||||
@ -517,8 +516,8 @@ class MessageChannel : HasResultCodes
|
||||
//
|
||||
// |A<| be an async in-message,
|
||||
// |S<| be a sync in-message,
|
||||
// |C<| be an RPC in-call,
|
||||
// |R<| be an RPC reply.
|
||||
// |C<| be an Interrupt in-call,
|
||||
// |R<| be an Interrupt reply.
|
||||
//
|
||||
// The queue can only match this configuration
|
||||
//
|
||||
@ -531,7 +530,7 @@ class MessageChannel : HasResultCodes
|
||||
// and thus can't send us any more messages until we process the sync
|
||||
// in-msg.
|
||||
//
|
||||
// The second case is |C<|, an RPC in-call; the other side must be blocked.
|
||||
// The second case is |C<|, an Interrupt in-call; the other side must be blocked.
|
||||
// (There's a subtlety here: this in-call might have raced with an
|
||||
// out-call, but we detect that with the mechanism below,
|
||||
// |mRemoteStackDepth|, and races don't matter to the queue.)
|
||||
@ -541,7 +540,7 @@ class MessageChannel : HasResultCodes
|
||||
// then other side "finished with us," and went back to its own business.
|
||||
// That business might have included sending any number of async message
|
||||
// |A<*| until sending a blocking message |(S< | C<)|. If we had more than
|
||||
// one RPC call on our stack, the other side *better* not have sent us
|
||||
// one Interrupt call on our stack, the other side *better* not have sent us
|
||||
// another blocking message, because it's blocked on a reply from us.
|
||||
//
|
||||
MessageQueue mPending;
|
||||
@ -551,12 +550,12 @@ class MessageChannel : HasResultCodes
|
||||
// Each stack refers to a different protocol and the stacks are mutually
|
||||
// exclusive: multiple outcalls of the same kind cannot be initiated while
|
||||
// another is active.
|
||||
std::stack<Message> mRPCStack;
|
||||
std::stack<Message> mInterruptStack;
|
||||
|
||||
// This is what we think the RPC stack depth is on the "other side" of this
|
||||
// RPC channel. We maintain this variable so that we can detect racy RPC
|
||||
// calls. With each RPC out-call sent, we send along what *we* think the
|
||||
// stack depth of the remote side is *before* it will receive the RPC call.
|
||||
// This is what we think the Interrupt stack depth is on the "other side" of this
|
||||
// Interrupt channel. We maintain this variable so that we can detect racy Interrupt
|
||||
// calls. With each Interrupt out-call sent, we send along what *we* think the
|
||||
// stack depth of the remote side is *before* it will receive the Interrupt call.
|
||||
//
|
||||
// After sending the out-call, our stack depth is "incremented" by pushing
|
||||
// that pending message onto mPending.
|
||||
@ -567,7 +566,7 @@ class MessageChannel : HasResultCodes
|
||||
//
|
||||
// I.e., my depth is actually the same as what the other side thought it
|
||||
// was when it sent in-call |c|. If this fails to hold, we have detected
|
||||
// racy RPC calls.
|
||||
// racy Interrupt calls.
|
||||
//
|
||||
// We then increment mRemoteStackDepth *just before* processing the
|
||||
// in-call, since we know the other side is waiting on it, and decrement
|
||||
@ -586,18 +585,18 @@ class MessageChannel : HasResultCodes
|
||||
// This member is only accessed on the worker thread, and so is not
|
||||
// protected by mMonitor. It is managed exclusively by the helper
|
||||
// |class CxxStackFrame|.
|
||||
std::vector<RPCFrame> mCxxStackFrames;
|
||||
std::vector<InterruptFrame> mCxxStackFrames;
|
||||
|
||||
// Did we process an RPC out-call during this stack? Only meaningful in
|
||||
// Did we process an Interrupt out-call during this stack? Only meaningful in
|
||||
// ExitedCxxStack(), from which this variable is reset.
|
||||
bool mSawRPCOutMsg;
|
||||
bool mSawInterruptOutMsg;
|
||||
|
||||
// Map of replies received "out of turn", because of RPC
|
||||
// Map of replies received "out of turn", because of Interrupt
|
||||
// in-calls racing with replies to outstanding in-calls. See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=521929.
|
||||
MessageMap mOutOfTurnReplies;
|
||||
|
||||
// Stack of RPC in-calls that were deferred because of race
|
||||
// Stack of Interrupt in-calls that were deferred because of race
|
||||
// conditions.
|
||||
std::stack<Message> mDeferred;
|
||||
|
||||
|
@ -48,11 +48,11 @@ enum ChannelState {
|
||||
ChannelError
|
||||
};
|
||||
|
||||
// What happens if RPC calls race?
|
||||
enum RacyRPCPolicy {
|
||||
RRPError,
|
||||
RRPChildWins,
|
||||
RRPParentWins
|
||||
// What happens if Interrupt calls race?
|
||||
enum RacyInterruptPolicy {
|
||||
RIPError,
|
||||
RIPChildWins,
|
||||
RIPParentWins
|
||||
};
|
||||
|
||||
class MessageListener
|
||||
@ -87,13 +87,13 @@ class MessageListener
|
||||
virtual void OnExitedCall() {
|
||||
NS_RUNTIMEABORT("default impl shouldn't be invoked");
|
||||
}
|
||||
virtual RacyRPCPolicy MediateRPCRace(const Message& parent,
|
||||
const Message& child)
|
||||
virtual RacyInterruptPolicy MediateInterruptRace(const Message& parent,
|
||||
const Message& child)
|
||||
{
|
||||
return RRPChildWins;
|
||||
return RIPChildWins;
|
||||
}
|
||||
|
||||
virtual void ProcessRemoteNativeEventsInRPCCall() {
|
||||
virtual void ProcessRemoteNativeEventsInInterruptCall() {
|
||||
}
|
||||
|
||||
// FIXME/bug 792652: this doesn't really belong here, but a
|
||||
|
@ -61,8 +61,8 @@ using namespace mozilla::ipc::windows;
|
||||
* in a special window procedure where we can either ignore the message or
|
||||
* process it in some fashion.
|
||||
*
|
||||
* Queued and "non-queued" messages will be processed during RPC calls if
|
||||
* modal UI related api calls block an RPC in-call in the child. To prevent
|
||||
* Queued and "non-queued" messages will be processed during Interrupt calls if
|
||||
* modal UI related api calls block an Interrupt in-call in the child. To prevent
|
||||
* windows from freezing, and to allow concurrent processing of critical
|
||||
* events (such as painting), we spin a native event dispatch loop while
|
||||
* these in-calls are blocked.
|
||||
@ -587,8 +587,8 @@ TimeoutHasExpired(const TimeoutData& aData)
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool rpc)
|
||||
: mRPC(rpc)
|
||||
MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool interrupt)
|
||||
: mInterrupt(interrupt)
|
||||
, mSpinNestedEvents(false)
|
||||
, mListenerNotified(false)
|
||||
, mChannel(channel)
|
||||
@ -608,9 +608,9 @@ MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool rpc
|
||||
MessageChannel::SyncStackFrame::~SyncStackFrame()
|
||||
{
|
||||
NS_ASSERTION(this == mChannel->mTopFrame,
|
||||
"Mismatched RPC stack frames");
|
||||
"Mismatched interrupt stack frames");
|
||||
NS_ASSERTION(this == sStaticTopFrame,
|
||||
"Mismatched static RPC stack frames");
|
||||
"Mismatched static Interrupt stack frames");
|
||||
|
||||
mChannel->mTopFrame = mPrev;
|
||||
sStaticTopFrame = mStaticPrev;
|
||||
@ -625,28 +625,28 @@ MessageChannel::SyncStackFrame::~SyncStackFrame()
|
||||
MessageChannel::SyncStackFrame* MessageChannel::sStaticTopFrame;
|
||||
|
||||
// nsAppShell's notification that gecko events are being processed.
|
||||
// If we are here and there is an RPC Incall active, we are spinning
|
||||
// If we are here and there is an Interrupt Incall active, we are spinning
|
||||
// a nested gecko event loop. In which case the remote process needs
|
||||
// to know about it.
|
||||
void /* static */
|
||||
MessageChannel::NotifyGeckoEventDispatch()
|
||||
{
|
||||
// sStaticTopFrame is only valid for RPC channels
|
||||
// sStaticTopFrame is only valid for Interrupt channels
|
||||
if (!sStaticTopFrame || sStaticTopFrame->mListenerNotified)
|
||||
return;
|
||||
|
||||
sStaticTopFrame->mListenerNotified = true;
|
||||
MessageChannel* channel = static_cast<MessageChannel*>(sStaticTopFrame->mChannel);
|
||||
channel->Listener()->ProcessRemoteNativeEventsInRPCCall();
|
||||
channel->Listener()->ProcessRemoteNativeEventsInInterruptCall();
|
||||
}
|
||||
|
||||
// invoked by the module that receives the spin event loop
|
||||
// message.
|
||||
void
|
||||
MessageChannel::ProcessNativeEventsInRPCCall()
|
||||
MessageChannel::ProcessNativeEventsInInterruptCall()
|
||||
{
|
||||
if (!mTopFrame) {
|
||||
NS_ERROR("Spin logic error: no RPC frame");
|
||||
NS_ERROR("Spin logic error: no Interrupt frame");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -655,9 +655,9 @@ MessageChannel::ProcessNativeEventsInRPCCall()
|
||||
|
||||
// Spin loop is called in place of WaitFor*Notify when modal ui is being shown
|
||||
// in a child. There are some intricacies in using it however. Spin loop is
|
||||
// enabled for a particular RPC frame by the client calling
|
||||
// MessageChannel::ProcessNativeEventsInRPCCall().
|
||||
// This call can be nested for multiple RPC frames in a single plugin or
|
||||
// enabled for a particular Interrupt frame by the client calling
|
||||
// MessageChannel::ProcessNativeEventsInInterrupt().
|
||||
// This call can be nested for multiple Interrupt frames in a single plugin or
|
||||
// multiple unrelated plugins.
|
||||
void
|
||||
MessageChannel::SpinInternalEventLoop()
|
||||
@ -722,7 +722,7 @@ MessageChannel::WaitForSyncNotify()
|
||||
// Initialize global objects used in deferred messaging.
|
||||
Init();
|
||||
|
||||
NS_ASSERTION(mTopFrame && !mTopFrame->mRPC,
|
||||
NS_ASSERTION(mTopFrame && !mTopFrame->mInterrupt,
|
||||
"Top frame is not a sync frame!");
|
||||
|
||||
MonitorAutoUnlock unlock(*mMonitor);
|
||||
@ -837,11 +837,11 @@ MessageChannel::WaitForSyncNotify()
|
||||
}
|
||||
|
||||
bool
|
||||
MessageChannel::WaitForRPCNotify()
|
||||
MessageChannel::WaitForInterruptNotify()
|
||||
{
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (!RPCStackDepth()) {
|
||||
if (!InterruptStackDepth()) {
|
||||
// There is currently no way to recover from this condition.
|
||||
NS_RUNTIMEABORT("StackDepth() is 0 in call to MessageChannel::WaitForNotify!");
|
||||
}
|
||||
@ -849,7 +849,7 @@ MessageChannel::WaitForRPCNotify()
|
||||
// Initialize global objects used in deferred messaging.
|
||||
Init();
|
||||
|
||||
NS_ASSERTION(mTopFrame && mTopFrame->mRPC,
|
||||
NS_ASSERTION(mTopFrame && mTopFrame->mInterrupt,
|
||||
"Top frame is not a sync frame!");
|
||||
|
||||
MonitorAutoUnlock unlock(*mMonitor);
|
||||
|
@ -197,8 +197,8 @@ class ASYNC:
|
||||
def __hash__(cls): return hash(cls.pretty)
|
||||
@classmethod
|
||||
def __str__(cls): return cls.pretty
|
||||
class RPC:
|
||||
pretty = 'rpc'
|
||||
class INTR:
|
||||
pretty = 'intr'
|
||||
@classmethod
|
||||
def __hash__(cls): return hash(cls.pretty)
|
||||
@classmethod
|
||||
@ -242,11 +242,11 @@ class OUT:
|
||||
_prettyTable = {
|
||||
IN : { 'async': 'AsyncRecv',
|
||||
'sync': 'SyncRecv',
|
||||
'rpc': 'RpcAnswer',
|
||||
'intr': 'IntrAnswer',
|
||||
'urgent': 'UrgentAnswer' },
|
||||
OUT : { 'async': 'AsyncSend',
|
||||
'sync': 'SyncSend',
|
||||
'rpc': 'RpcCall',
|
||||
'intr': 'IntrCall',
|
||||
'urgent': 'UrgentCall' }
|
||||
# inout doesn't make sense here
|
||||
}
|
||||
@ -332,7 +332,7 @@ class MessageDecl(Node):
|
||||
self.outParams += outParamsList
|
||||
|
||||
def hasReply(self):
|
||||
return self.sendSemantics is SYNC or self.sendSemantics is RPC
|
||||
return self.sendSemantics is SYNC or self.sendSemantics is INTR
|
||||
|
||||
class Transition(Node):
|
||||
def __init__(self, loc, trigger, msg, toStates):
|
||||
|
@ -5,7 +5,7 @@
|
||||
import os, sys
|
||||
|
||||
from ipdl.ast import Visitor
|
||||
from ipdl.ast import IN, OUT, INOUT, ASYNC, SYNC, RPC, URGENT
|
||||
from ipdl.ast import IN, OUT, INOUT, ASYNC, SYNC, INTR, URGENT
|
||||
|
||||
class CodePrinter:
|
||||
def __init__(self, outf=sys.stdout, indentCols=4):
|
||||
|
@ -277,13 +277,13 @@ def _putInNamespaces(cxxthing, namespaces):
|
||||
|
||||
def _sendPrefix(msgtype):
|
||||
"""Prefix of the name of the C++ method that sends |msgtype|."""
|
||||
if msgtype.isRpc() or msgtype.isUrgent():
|
||||
if msgtype.isInterrupt() or msgtype.isUrgent():
|
||||
return 'Call'
|
||||
return 'Send'
|
||||
|
||||
def _recvPrefix(msgtype):
|
||||
"""Prefix of the name of the C++ method that handles |msgtype|."""
|
||||
if msgtype.isRpc() or msgtype.isUrgent():
|
||||
if msgtype.isInterrupt() or msgtype.isUrgent():
|
||||
return 'Answer'
|
||||
return 'Recv'
|
||||
|
||||
@ -2884,7 +2884,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
ExprCall(ExprSelect(p.channelVar(), '.', 'Close'))))
|
||||
self.cls.addstmts([ closemeth, Whitespace.NL ])
|
||||
|
||||
if ptype.talksSync() or ptype.talksRpc():
|
||||
if ptype.talksSync() or ptype.talksInterrupt():
|
||||
# SetReplyTimeoutMs()
|
||||
timeoutvar = ExprVar('aTimeoutMs')
|
||||
settimeout = MethodDefn(MethodDecl(
|
||||
@ -2955,8 +2955,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
self.asyncSwitch = StmtSwitch(msgtype)
|
||||
if toplevel.talksSync():
|
||||
self.syncSwitch = StmtSwitch(msgtype)
|
||||
if toplevel.talksRpc():
|
||||
self.rpcSwitch = StmtSwitch(msgtype)
|
||||
if toplevel.talksInterrupt():
|
||||
self.interruptSwitch = StmtSwitch(msgtype)
|
||||
|
||||
# implement Send*() methods and add dispatcher cases to
|
||||
# message switch()es
|
||||
@ -2974,8 +2974,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
self.asyncSwitch.addcase(DefaultLabel(), default)
|
||||
if toplevel.talksSync():
|
||||
self.syncSwitch.addcase(DefaultLabel(), default)
|
||||
if toplevel.talksRpc():
|
||||
self.rpcSwitch.addcase(DefaultLabel(), default)
|
||||
if toplevel.talksInterrupt():
|
||||
self.interruptSwitch.addcase(DefaultLabel(), default)
|
||||
|
||||
# FIXME/bug 535053: only manager protocols and non-manager
|
||||
# protocols with union types need Lookup(). we'll give it to
|
||||
@ -3021,7 +3021,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
|
||||
method.addstmts([ routedecl, routeif, Whitespace.NL ])
|
||||
|
||||
# in the event of an RPC delete message, we want to loudly complain about
|
||||
# in the event of an Interrupt delete message, we want to loudly complain about
|
||||
# messages that are received that are not a reply to the original message
|
||||
if ptype.hasReentrantDelete:
|
||||
msgVar = ExprVar(params[0].name)
|
||||
@ -3031,7 +3031,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
ExprBinary(
|
||||
ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_reply')), '!=', ExprLiteral.TRUE),
|
||||
'||',
|
||||
ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_rpc')), '!=', ExprLiteral.TRUE))))
|
||||
ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_interrupt')), '!=', ExprLiteral.TRUE))))
|
||||
ifdying.addifstmts([_fatalError('incoming message racing with actor deletion'),
|
||||
StmtReturn(_Result.Processed)])
|
||||
method.addstmt(ifdying)
|
||||
@ -3051,8 +3051,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
hasReply=0, dispatches=dispatches),
|
||||
Whitespace.NL
|
||||
])
|
||||
if not toplevel.talksRpc():
|
||||
self.rpcSwitch = None
|
||||
if not toplevel.talksInterrupt():
|
||||
self.interruptSwitch = None
|
||||
if not toplevel.talksSync():
|
||||
self.syncSwitch = None
|
||||
self.cls.addstmts([
|
||||
@ -3061,7 +3061,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
Whitespace.NL
|
||||
])
|
||||
self.cls.addstmts([
|
||||
makeHandlerMethod('OnCallReceived', self.rpcSwitch,
|
||||
makeHandlerMethod('OnCallReceived', self.interruptSwitch,
|
||||
hasReply=1, dispatches=dispatches),
|
||||
Whitespace.NL
|
||||
])
|
||||
@ -3090,7 +3090,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
self.cls.addstmts([ gettypetag, Whitespace.NL ])
|
||||
|
||||
# OnReplyTimeout()
|
||||
if toplevel.talksSync() or toplevel.talksRpc():
|
||||
if toplevel.talksSync() or toplevel.talksInterrupt():
|
||||
ontimeout = MethodDefn(
|
||||
MethodDecl('OnReplyTimeout', ret=Type.BOOL))
|
||||
|
||||
@ -3129,10 +3129,10 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
onstack.addstmt(StmtReturn(ExprCall(
|
||||
ExprSelect(p.channelVar(), '.', p.onCxxStackVar().name))))
|
||||
|
||||
# void ProcessIncomingRacingRPCCall
|
||||
# void ProcessIncomingRacingInterruptCall
|
||||
processincoming = MethodDefn(
|
||||
MethodDecl('FlushPendingRPCQueue', ret=Type.VOID))
|
||||
processincoming.addstmt(StmtExpr(ExprCall(ExprSelect(_actorChannel(ExprVar.THIS), '.', 'FlushPendingRPCQueue'))))
|
||||
MethodDecl('FlushPendingInterruptQueue', ret=Type.VOID))
|
||||
processincoming.addstmt(StmtExpr(ExprCall(ExprSelect(_actorChannel(ExprVar.THIS), '.', 'FlushPendingInterruptQueue'))))
|
||||
|
||||
self.cls.addstmts([ onentered, onexited,
|
||||
onenteredcall, onexitedcall,
|
||||
@ -3178,16 +3178,16 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
# User-facing shmem methods
|
||||
self.cls.addstmts(self.makeShmemIface())
|
||||
|
||||
if (ptype.isToplevel() and ptype.talksRpc()):
|
||||
if (ptype.isToplevel() and ptype.talksInterrupt()):
|
||||
|
||||
processnative = MethodDefn(
|
||||
MethodDecl('ProcessNativeEventsInRPCCall', ret=Type.VOID))
|
||||
MethodDecl('ProcessNativeEventsInInterruptCall', ret=Type.VOID))
|
||||
|
||||
processnative.addstmts([
|
||||
CppDirective('ifdef', 'OS_WIN'),
|
||||
StmtExpr(ExprCall(
|
||||
ExprSelect(p.channelVar(), '.',
|
||||
'ProcessNativeEventsInRPCCall'))),
|
||||
'ProcessNativeEventsInInterruptCall'))),
|
||||
CppDirective('else'),
|
||||
_runtimeAbort('This method is Windows-only'),
|
||||
CppDirective('endif'),
|
||||
@ -4640,8 +4640,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
self.asyncSwitch.addcase(lbl, case)
|
||||
elif sems is ipdl.ast.SYNC:
|
||||
self.syncSwitch.addcase(lbl, case)
|
||||
elif sems is ipdl.ast.RPC or sems is ipdl.ast.URGENT:
|
||||
self.rpcSwitch.addcase(lbl, case)
|
||||
elif sems is ipdl.ast.INTR or sems is ipdl.ast.URGENT:
|
||||
self.interruptSwitch.addcase(lbl, case)
|
||||
else: assert 0
|
||||
|
||||
if self.sendsMessage(md):
|
||||
@ -5038,9 +5038,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
|
||||
elif md.decl.type.isUrgent():
|
||||
stmts.append(StmtExpr(ExprCall(
|
||||
ExprSelect(var, '->', 'set_urgent'))))
|
||||
elif md.decl.type.isRpc():
|
||||
elif md.decl.type.isInterrupt():
|
||||
stmts.append(StmtExpr(ExprCall(
|
||||
ExprSelect(var, '->', 'set_rpc'))))
|
||||
ExprSelect(var, '->', 'set_interrupt'))))
|
||||
|
||||
if reply:
|
||||
stmts.append(StmtExpr(ExprCall(
|
||||
|
@ -126,6 +126,7 @@ reserved = set((
|
||||
'delete', # reserve 'delete' to prevent its use
|
||||
'goto',
|
||||
'include',
|
||||
'intr',
|
||||
'manager',
|
||||
'manages',
|
||||
'namespace',
|
||||
@ -136,7 +137,6 @@ reserved = set((
|
||||
'protocol',
|
||||
'recv',
|
||||
'returns',
|
||||
'rpc',
|
||||
'send',
|
||||
'spawns',
|
||||
'start',
|
||||
@ -216,6 +216,7 @@ def p_TranslationUnit(p):
|
||||
tu.namespaces = tu.protocol.namespaces
|
||||
tu.name = tu.protocol.name
|
||||
else:
|
||||
print tu.filetype
|
||||
assert tu.filetype == 'header'
|
||||
# There's not really a canonical "thing" in headers. So
|
||||
# somewhat arbitrarily use the namespace of the last
|
||||
@ -605,12 +606,12 @@ def p_OptionalSendSemanticsQual(p):
|
||||
|
||||
def p_SendSemanticsQual(p):
|
||||
"""SendSemanticsQual : ASYNC
|
||||
| RPC
|
||||
| INTR
|
||||
| URGENT
|
||||
| SYNC"""
|
||||
s = p[1]
|
||||
if 'async' == s: p[0] = ASYNC
|
||||
elif 'rpc' == s: p[0] = RPC
|
||||
elif 'intr' == s: p[0] = INTR
|
||||
elif 'sync' == s: p[0] = SYNC
|
||||
elif 'urgent' == s: p[0] = URGENT
|
||||
else:
|
||||
|
@ -5,7 +5,9 @@
|
||||
|
||||
import os, sys
|
||||
|
||||
from ipdl.ast import CxxInclude, Decl, Loc, QualifiedId, State, StructDecl, TransitionStmt, TypeSpec, UnionDecl, UsingStmt, Visitor, ASYNC, SYNC, RPC, IN, OUT, INOUT, ANSWER, CALL, RECV, SEND, URGENT
|
||||
from ipdl.ast import CxxInclude, Decl, Loc, QualifiedId, State, StructDecl, TransitionStmt
|
||||
from ipdl.ast import TypeSpec, UnionDecl, UsingStmt, Visitor, ASYNC, SYNC, INTR
|
||||
from ipdl.ast import IN, OUT, INOUT, ANSWER, CALL, RECV, SEND, URGENT
|
||||
import ipdl.builtin as builtin
|
||||
|
||||
_DELETE_MSG = '__delete__'
|
||||
@ -204,18 +206,18 @@ class IPDLType(Type):
|
||||
|
||||
def isAsync(self): return self.sendSemantics is ASYNC
|
||||
def isSync(self): return self.sendSemantics is SYNC
|
||||
def isRpc(self): return self.sendSemantics is RPC
|
||||
def isInterrupt(self): return self.sendSemantics is INTR
|
||||
def isUrgent(self): return self.sendSemantics is URGENT
|
||||
|
||||
def talksAsync(self): return True
|
||||
def talksSync(self): return self.isSync() or self.isRpc()
|
||||
def talksRpc(self): return self.isRpc()
|
||||
def talksSync(self): return self.isSync() or self.isInterrupt()
|
||||
def talksInterrupt(self): return self.isInterrupt()
|
||||
|
||||
def hasReply(self): return self.isSync() or self.isRpc() or self.isUrgent()
|
||||
def hasReply(self): return self.isSync() or self.isInterrupt() or self.isUrgent()
|
||||
|
||||
def needsMoreJuiceThan(self, o):
|
||||
return (o.isAsync() and not self.isAsync()
|
||||
or o.isSync() and self.isRpc())
|
||||
or o.isSync() and self.isInterrupt())
|
||||
|
||||
class StateType(IPDLType):
|
||||
def __init__(self, protocol, name, start=False):
|
||||
@ -871,7 +873,7 @@ class GatherDecls(TcheckVisitor):
|
||||
"destructor declaration `%s(...)' required for managed protocol `%s'",
|
||||
_DELETE_MSG, p.name)
|
||||
|
||||
p.decl.type.hasReentrantDelete = p.decl.type.hasDelete and self.symtab.lookup(_DELETE_MSG).type.isRpc()
|
||||
p.decl.type.hasReentrantDelete = p.decl.type.hasDelete and self.symtab.lookup(_DELETE_MSG).type.isInterrupt()
|
||||
|
||||
for managed in p.managesStmts:
|
||||
mgdname = managed.name
|
||||
@ -1497,13 +1499,13 @@ class CheckTypes(TcheckVisitor):
|
||||
loc = t.loc
|
||||
impliedDirection, impliedSems = {
|
||||
SEND: [ OUT, _YNC ], RECV: [ IN, _YNC ],
|
||||
CALL: [ OUT, RPC ], ANSWER: [ IN, RPC ],
|
||||
CALL: [ OUT, INTR ], ANSWER: [ IN, INTR ],
|
||||
} [t.trigger]
|
||||
|
||||
if (OUT is impliedDirection and t.msg.type.isIn()
|
||||
or IN is impliedDirection and t.msg.type.isOut()
|
||||
or _YNC is impliedSems and t.msg.type.isRpc()
|
||||
or RPC is impliedSems and (not t.msg.type.isRpc())):
|
||||
or _YNC is impliedSems and t.msg.type.isInterrupt()
|
||||
or INTR is impliedSems and (not t.msg.type.isInterrupt())):
|
||||
mtype = t.msg.type
|
||||
|
||||
self.error(
|
||||
|
@ -18,12 +18,12 @@ IPDLTESTS = \
|
||||
TestMultiMgrs \
|
||||
TestNestedLoops \
|
||||
TestOpens \
|
||||
TestRPCErrorCleanup \
|
||||
TestRPCRaces \
|
||||
TestRPCShutdownRace \
|
||||
TestInterruptErrorCleanup \
|
||||
TestInterruptRaces \
|
||||
TestInterruptShutdownRace \
|
||||
TestRaceDeferral \
|
||||
TestRacyReentry \
|
||||
TestRacyRPCReplies \
|
||||
TestRacyInterruptReplies \
|
||||
TestRacyUndefer \
|
||||
TestSanity \
|
||||
TestSelfManageRoot \
|
||||
|
@ -6,7 +6,7 @@ namespace _ipdltest {
|
||||
// Test that a parent sending a reentrant __delete__ message
|
||||
// is not killed if a child's message races with the reply.
|
||||
|
||||
rpc protocol PTestBadActor {
|
||||
intr protocol PTestBadActor {
|
||||
manages PTestBadActorSub;
|
||||
|
||||
child:
|
||||
|
@ -3,11 +3,11 @@ include protocol PTestBadActor;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestBadActorSub {
|
||||
intr protocol PTestBadActorSub {
|
||||
manager PTestBadActor;
|
||||
|
||||
child:
|
||||
rpc __delete__();
|
||||
intr __delete__();
|
||||
|
||||
parent:
|
||||
Ping();
|
||||
|
@ -6,17 +6,17 @@ namespace _ipdltest {
|
||||
|
||||
// (Bridge protocols can have different semantics than the endpoints
|
||||
// they bridge)
|
||||
rpc protocol PTestBridgeMainSub {
|
||||
intr protocol PTestBridgeMainSub {
|
||||
bridges PTestBridgeMain, PTestBridgeSub;
|
||||
|
||||
child:
|
||||
Hi();
|
||||
rpc HiRpc();
|
||||
intr HiRpc();
|
||||
|
||||
parent:
|
||||
Hello();
|
||||
sync HelloSync();
|
||||
rpc HelloRpc();
|
||||
intr HelloRpc();
|
||||
__delete__();
|
||||
|
||||
state START: recv Hello goto HI;
|
||||
|
@ -7,9 +7,9 @@ namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
// NB: needs to be RPC so that the parent blocks on the child's crash.
|
||||
rpc protocol PTestCrashCleanup {
|
||||
intr protocol PTestCrashCleanup {
|
||||
child:
|
||||
rpc DIEDIEDIE();
|
||||
intr DIEDIEDIE();
|
||||
__delete__();
|
||||
|
||||
state ALIVE:
|
||||
|
@ -4,10 +4,10 @@ include protocol PTestDescSubsub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestDesc {
|
||||
intr protocol PTestDesc {
|
||||
manages PTestDescSub;
|
||||
child:
|
||||
rpc PTestDescSub(nullable PTestDescSubsub dummy);
|
||||
intr PTestDescSub(nullable PTestDescSubsub dummy);
|
||||
|
||||
Test(PTestDescSubsub a);
|
||||
|
||||
|
@ -4,14 +4,14 @@ include protocol PTestDescSubsub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestDescSub {
|
||||
intr protocol PTestDescSub {
|
||||
manager PTestDesc;
|
||||
manages PTestDescSubsub;
|
||||
|
||||
child:
|
||||
__delete__();
|
||||
|
||||
rpc PTestDescSubsub();
|
||||
intr PTestDescSubsub();
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -4,11 +4,11 @@ include protocol PTestDescSub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestDescSubsub {
|
||||
intr protocol PTestDescSubsub {
|
||||
manager PTestDescSub;
|
||||
|
||||
child:
|
||||
rpc __delete__();
|
||||
intr __delete__();
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ include protocol PTestFailedCtorSub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestFailedCtor {
|
||||
intr protocol PTestFailedCtor {
|
||||
manages PTestFailedCtorSub;
|
||||
child:
|
||||
rpc PTestFailedCtorSub();
|
||||
intr PTestFailedCtorSub();
|
||||
__delete__();
|
||||
|
||||
state CONSTRUCT:
|
||||
|
@ -4,7 +4,7 @@ include protocol PTestFailedCtorSubsub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestFailedCtorSub {
|
||||
intr protocol PTestFailedCtorSub {
|
||||
manager PTestFailedCtor;
|
||||
manages PTestFailedCtorSubsub;
|
||||
|
||||
|
@ -4,7 +4,7 @@ include protocol PTestFailedCtorSub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestFailedCtorSubsub {
|
||||
intr protocol PTestFailedCtorSubsub {
|
||||
manager PTestFailedCtorSub;
|
||||
|
||||
parent:
|
||||
|
@ -2,16 +2,16 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestHangs {
|
||||
intr protocol PTestHangs {
|
||||
both:
|
||||
rpc StackFrame();
|
||||
intr StackFrame();
|
||||
|
||||
parent:
|
||||
async Nonce();
|
||||
|
||||
child:
|
||||
async Start();
|
||||
rpc Hang();
|
||||
intr Hang();
|
||||
__delete__();
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestRPCErrorCleanup {
|
||||
intr protocol PTestInterruptErrorCleanup {
|
||||
child:
|
||||
rpc Error();
|
||||
rpc __delete__();
|
||||
intr Error();
|
||||
intr __delete__();
|
||||
};
|
||||
|
||||
} // namespace _ipdltest
|
@ -1,28 +1,28 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestRPCRaces {
|
||||
intr protocol PTestInterruptRaces {
|
||||
both:
|
||||
rpc Race() returns (bool hasReply);
|
||||
rpc StackFrame() returns ();
|
||||
rpc StackFrame3() returns ();
|
||||
intr Race() returns (bool hasReply);
|
||||
intr StackFrame() returns ();
|
||||
intr StackFrame3() returns ();
|
||||
|
||||
parent:
|
||||
sync StartRace();
|
||||
rpc Parent();
|
||||
intr Parent();
|
||||
sync GetAnsweredParent() returns (bool answeredParent);
|
||||
|
||||
child:
|
||||
Start();
|
||||
Wakeup();
|
||||
Wakeup3();
|
||||
rpc Child();
|
||||
intr Child();
|
||||
__delete__();
|
||||
|
||||
state START:
|
||||
send Start goto TEST1;
|
||||
|
||||
// First test: race while no other messages are on the RPC stack
|
||||
// First test: race while no other messages are on the Interrupt stack
|
||||
state TEST1:
|
||||
recv StartRace goto RACE1;
|
||||
state RACE1:
|
||||
@ -33,7 +33,7 @@ state DUMMY1_1:
|
||||
state DUMMY1_2:
|
||||
call Race goto TEST2;
|
||||
|
||||
// Second test: race while other messages are on the RPC stack
|
||||
// Second test: race while other messages are on the Interrupt stack
|
||||
state TEST2:
|
||||
call StackFrame goto MORESTACK;
|
||||
state MORESTACK:
|
@ -1,14 +1,14 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestRPCShutdownRace {
|
||||
intr protocol PTestInterruptShutdownRace {
|
||||
parent:
|
||||
sync StartDeath();
|
||||
async Orphan();
|
||||
|
||||
child:
|
||||
async Start();
|
||||
rpc Exit();
|
||||
intr Exit();
|
||||
async __delete__();
|
||||
|
||||
state START:
|
@ -3,17 +3,17 @@ namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
rpc protocol PTestLatency {
|
||||
intr protocol PTestLatency {
|
||||
|
||||
child:
|
||||
__delete__();
|
||||
Ping();
|
||||
Ping5();
|
||||
rpc Rpc();
|
||||
intr Rpc();
|
||||
Spam();
|
||||
rpc Synchro();
|
||||
intr Synchro();
|
||||
CompressedSpam(uint32_t seqno) compress;
|
||||
rpc Synchro2() returns (uint32_t lastSeqno,
|
||||
intr Synchro2() returns (uint32_t lastSeqno,
|
||||
uint32_t numMessagesDispatched);
|
||||
|
||||
parent:
|
||||
|
@ -3,11 +3,11 @@ namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
rpc protocol PTestNestedLoops {
|
||||
intr protocol PTestNestedLoops {
|
||||
|
||||
child:
|
||||
async Start();
|
||||
rpc R();
|
||||
intr R();
|
||||
__delete__();
|
||||
|
||||
parent:
|
||||
|
@ -3,15 +3,15 @@ namespace _ipdltest2 {
|
||||
|
||||
// (Opens protocols can have different semantics than the endpoints
|
||||
// that opened them)
|
||||
rpc protocol PTestOpensOpened {
|
||||
intr protocol PTestOpensOpened {
|
||||
child:
|
||||
Hi();
|
||||
rpc HiRpc();
|
||||
intr HiRpc();
|
||||
|
||||
parent:
|
||||
Hello();
|
||||
sync HelloSync();
|
||||
rpc HelloRpc();
|
||||
intr HelloRpc();
|
||||
__delete__();
|
||||
|
||||
state START: recv Hello goto HI;
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestRaceDeferral {
|
||||
intr protocol PTestRaceDeferral {
|
||||
parent:
|
||||
rpc Lose();
|
||||
intr Lose();
|
||||
|
||||
child:
|
||||
async StartRace();
|
||||
rpc Win();
|
||||
rpc Rpc();
|
||||
intr Win();
|
||||
intr Rpc();
|
||||
async __delete__();
|
||||
|
||||
// Test that messages deferred due to race resolution are
|
||||
|
@ -1,15 +1,15 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestRacyRPCReplies {
|
||||
intr protocol PTestRacyInterruptReplies {
|
||||
child:
|
||||
rpc R_() returns (int replyNum);
|
||||
intr R_() returns (int replyNum);
|
||||
async _A();
|
||||
async ChildTest();
|
||||
async __delete__();
|
||||
|
||||
parent:
|
||||
rpc _R() returns (int replyNum);
|
||||
intr _R() returns (int replyNum);
|
||||
async A_();
|
||||
|
||||
state PARENT_START:
|
@ -3,17 +3,17 @@ namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
rpc protocol PTestRacyReentry {
|
||||
intr protocol PTestRacyReentry {
|
||||
|
||||
parent:
|
||||
rpc E();
|
||||
intr E();
|
||||
__delete__();
|
||||
|
||||
child:
|
||||
async Start();
|
||||
|
||||
async N();
|
||||
rpc H();
|
||||
intr H();
|
||||
};
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
rpc protocol PTestRacyUndefer {
|
||||
intr protocol PTestRacyUndefer {
|
||||
|
||||
child:
|
||||
async Start();
|
||||
@ -11,14 +11,14 @@ child:
|
||||
async AwakenSpam();
|
||||
async AwakenRaceWinTwice();
|
||||
|
||||
rpc Race();
|
||||
intr Race();
|
||||
|
||||
async __delete__();
|
||||
|
||||
parent:
|
||||
|
||||
rpc Spam();
|
||||
rpc RaceWinTwice();
|
||||
intr Spam();
|
||||
intr RaceWinTwice();
|
||||
|
||||
async Done();
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ include protocol PTestShutdownSub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestShutdown {
|
||||
intr protocol PTestShutdown {
|
||||
manages PTestShutdownSub;
|
||||
|
||||
child:
|
||||
|
@ -4,12 +4,12 @@ include protocol PTestShutdownSubsub;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestShutdownSub {
|
||||
intr protocol PTestShutdownSub {
|
||||
manager PTestShutdown;
|
||||
manages PTestShutdownSubsub;
|
||||
|
||||
both:
|
||||
rpc StackFrame();
|
||||
intr StackFrame();
|
||||
|
||||
parent:
|
||||
PTestShutdownSubsub(bool expectParentDeleted);
|
||||
|
@ -3,7 +3,7 @@ namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
rpc protocol PTestStackHooks {
|
||||
intr protocol PTestStackHooks {
|
||||
child:
|
||||
async Start();
|
||||
|
||||
@ -12,10 +12,10 @@ child:
|
||||
parent:
|
||||
async Async();
|
||||
sync Sync();
|
||||
rpc Rpc();
|
||||
intr Rpc();
|
||||
|
||||
both:
|
||||
rpc StackFrame();
|
||||
intr StackFrame();
|
||||
|
||||
parent:
|
||||
__delete__();
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestSyncWakeup {
|
||||
intr protocol PTestSyncWakeup {
|
||||
both:
|
||||
rpc StackFrame();
|
||||
intr StackFrame();
|
||||
|
||||
child:
|
||||
async Start();
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
rpc protocol PTestUrgency
|
||||
intr protocol PTestUrgency
|
||||
{
|
||||
parent:
|
||||
sync Test1() returns (uint32_t result);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "TestRPCErrorCleanup.h"
|
||||
#include "TestInterruptErrorCleanup.h"
|
||||
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
@ -33,13 +33,13 @@ void DeleteSubprocess(Mutex* mutex, CondVar* cvar)
|
||||
|
||||
void DeleteTheWorld()
|
||||
{
|
||||
delete static_cast<TestRPCErrorCleanupParent*>(gParentActor);
|
||||
delete static_cast<TestInterruptErrorCleanupParent*>(gParentActor);
|
||||
gParentActor = nullptr;
|
||||
|
||||
// needs to be synchronous to avoid affecting event ordering on
|
||||
// the main thread
|
||||
Mutex mutex("TestRPCErrorCleanup.DeleteTheWorld.mutex");
|
||||
CondVar cvar(mutex, "TestRPCErrorCleanup.DeleteTheWorld.cvar");
|
||||
Mutex mutex("TestInterruptErrorCleanup.DeleteTheWorld.mutex");
|
||||
CondVar cvar(mutex, "TestInterruptErrorCleanup.DeleteTheWorld.cvar");
|
||||
|
||||
MutexAutoLock lock(mutex);
|
||||
|
||||
@ -61,26 +61,26 @@ void Done()
|
||||
|
||||
} // namespace <anon>
|
||||
|
||||
TestRPCErrorCleanupParent::TestRPCErrorCleanupParent()
|
||||
TestInterruptErrorCleanupParent::TestInterruptErrorCleanupParent()
|
||||
: mGotProcessingError(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TestRPCErrorCleanupParent);
|
||||
MOZ_COUNT_CTOR(TestInterruptErrorCleanupParent);
|
||||
}
|
||||
|
||||
TestRPCErrorCleanupParent::~TestRPCErrorCleanupParent()
|
||||
TestInterruptErrorCleanupParent::~TestInterruptErrorCleanupParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TestRPCErrorCleanupParent);
|
||||
MOZ_COUNT_DTOR(TestInterruptErrorCleanupParent);
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCErrorCleanupParent::Main()
|
||||
TestInterruptErrorCleanupParent::Main()
|
||||
{
|
||||
// This test models the following sequence of events
|
||||
//
|
||||
// (1) Parent: RPC out-call
|
||||
// (1) Parent: Interrupt out-call
|
||||
// (2) Child: crash
|
||||
// --[Parent-only hereafter]--
|
||||
// (3) RPC out-call return false
|
||||
// (3) Interrupt out-call return false
|
||||
// (4) Close()
|
||||
// --[event loop]--
|
||||
// (5) delete parentActor
|
||||
@ -122,7 +122,7 @@ TestRPCErrorCleanupParent::Main()
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCErrorCleanupParent::ProcessingError(Result what)
|
||||
TestInterruptErrorCleanupParent::ProcessingError(Result what)
|
||||
{
|
||||
if (what != MsgDropped)
|
||||
fail("unexpected processing error");
|
||||
@ -132,18 +132,18 @@ TestRPCErrorCleanupParent::ProcessingError(Result what)
|
||||
//-----------------------------------------------------------------------------
|
||||
// child
|
||||
|
||||
TestRPCErrorCleanupChild::TestRPCErrorCleanupChild()
|
||||
TestInterruptErrorCleanupChild::TestInterruptErrorCleanupChild()
|
||||
{
|
||||
MOZ_COUNT_CTOR(TestRPCErrorCleanupChild);
|
||||
MOZ_COUNT_CTOR(TestInterruptErrorCleanupChild);
|
||||
}
|
||||
|
||||
TestRPCErrorCleanupChild::~TestRPCErrorCleanupChild()
|
||||
TestInterruptErrorCleanupChild::~TestInterruptErrorCleanupChild()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TestRPCErrorCleanupChild);
|
||||
MOZ_COUNT_DTOR(TestInterruptErrorCleanupChild);
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCErrorCleanupChild::AnswerError()
|
||||
TestInterruptErrorCleanupChild::AnswerError()
|
||||
{
|
||||
_exit(0);
|
||||
NS_RUNTIMEABORT("unreached");
|
@ -1,21 +1,21 @@
|
||||
#ifndef mozilla__ipdltest_TestRPCErrorCleanup_h
|
||||
#define mozilla__ipdltest_TestRPCErrorCleanup_h 1
|
||||
#ifndef mozilla__ipdltest_TestInterruptErrorCleanup_h
|
||||
#define mozilla__ipdltest_TestInterruptErrorCleanup_h 1
|
||||
|
||||
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
||||
|
||||
#include "mozilla/_ipdltest/PTestRPCErrorCleanupParent.h"
|
||||
#include "mozilla/_ipdltest/PTestRPCErrorCleanupChild.h"
|
||||
#include "mozilla/_ipdltest/PTestInterruptErrorCleanupParent.h"
|
||||
#include "mozilla/_ipdltest/PTestInterruptErrorCleanupChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
class TestRPCErrorCleanupParent :
|
||||
public PTestRPCErrorCleanupParent
|
||||
class TestInterruptErrorCleanupParent :
|
||||
public PTestInterruptErrorCleanupParent
|
||||
{
|
||||
public:
|
||||
TestRPCErrorCleanupParent();
|
||||
virtual ~TestRPCErrorCleanupParent();
|
||||
TestInterruptErrorCleanupParent();
|
||||
virtual ~TestInterruptErrorCleanupParent();
|
||||
|
||||
static bool RunTestInProcesses() { return true; }
|
||||
// FIXME/bug 703323 Could work if modified
|
||||
@ -36,12 +36,12 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class TestRPCErrorCleanupChild :
|
||||
public PTestRPCErrorCleanupChild
|
||||
class TestInterruptErrorCleanupChild :
|
||||
public PTestInterruptErrorCleanupChild
|
||||
{
|
||||
public:
|
||||
TestRPCErrorCleanupChild();
|
||||
virtual ~TestRPCErrorCleanupChild();
|
||||
TestInterruptErrorCleanupChild();
|
||||
virtual ~TestInterruptErrorCleanupChild();
|
||||
|
||||
protected:
|
||||
virtual bool AnswerError() MOZ_OVERRIDE;
|
||||
@ -57,4 +57,4 @@ protected:
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
#endif // ifndef mozilla__ipdltest_TestRPCErrorCleanup_h
|
||||
#endif // ifndef mozilla__ipdltest_TestInterruptErrorCleanup_h
|
@ -1,48 +1,48 @@
|
||||
#include "TestRPCRaces.h"
|
||||
#include "TestInterruptRaces.h"
|
||||
|
||||
#include "IPDLUnitTests.h" // fail etc.
|
||||
|
||||
using mozilla::ipc::MessageChannel;
|
||||
|
||||
template<>
|
||||
struct RunnableMethodTraits<mozilla::_ipdltest::TestRPCRacesParent>
|
||||
struct RunnableMethodTraits<mozilla::_ipdltest::TestInterruptRacesParent>
|
||||
{
|
||||
static void RetainCallee(mozilla::_ipdltest::TestRPCRacesParent* obj) { }
|
||||
static void ReleaseCallee(mozilla::_ipdltest::TestRPCRacesParent* obj) { }
|
||||
static void RetainCallee(mozilla::_ipdltest::TestInterruptRacesParent* obj) { }
|
||||
static void ReleaseCallee(mozilla::_ipdltest::TestInterruptRacesParent* obj) { }
|
||||
};
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
ipc::RacyRPCPolicy
|
||||
ipc::RacyInterruptPolicy
|
||||
MediateRace(const MessageChannel::Message& parent,
|
||||
const MessageChannel::Message& child)
|
||||
{
|
||||
return (PTestRPCRaces::Msg_Child__ID == parent.type()) ?
|
||||
ipc::RRPParentWins : ipc::RRPChildWins;
|
||||
return (PTestInterruptRaces::Msg_Child__ID == parent.type()) ?
|
||||
ipc::RIPParentWins : ipc::RIPChildWins;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// parent
|
||||
void
|
||||
TestRPCRacesParent::Main()
|
||||
TestInterruptRacesParent::Main()
|
||||
{
|
||||
if (!SendStart())
|
||||
fail("sending Start()");
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesParent::RecvStartRace()
|
||||
TestInterruptRacesParent::RecvStartRace()
|
||||
{
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &TestRPCRacesParent::OnRaceTime));
|
||||
NewRunnableMethod(this, &TestInterruptRacesParent::OnRaceTime));
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCRacesParent::OnRaceTime()
|
||||
TestInterruptRacesParent::OnRaceTime()
|
||||
{
|
||||
if (!CallRace(&mChildHasReply))
|
||||
fail("problem calling Race()");
|
||||
@ -54,20 +54,20 @@ TestRPCRacesParent::OnRaceTime()
|
||||
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &TestRPCRacesParent::Test2));
|
||||
NewRunnableMethod(this, &TestInterruptRacesParent::Test2));
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesParent::AnswerRace(bool* hasReply)
|
||||
TestInterruptRacesParent::AnswerRace(bool* hasReply)
|
||||
{
|
||||
if (mHasReply)
|
||||
fail("apparently the parent won the RPC race!");
|
||||
fail("apparently the parent won the Interrupt race!");
|
||||
*hasReply = hasReply;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCRacesParent::Test2()
|
||||
TestInterruptRacesParent::Test2()
|
||||
{
|
||||
puts(" passed");
|
||||
puts("Test 2");
|
||||
@ -82,11 +82,11 @@ TestRPCRacesParent::Test2()
|
||||
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &TestRPCRacesParent::Test3));
|
||||
NewRunnableMethod(this, &TestInterruptRacesParent::Test3));
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesParent::AnswerStackFrame()
|
||||
TestInterruptRacesParent::AnswerStackFrame()
|
||||
{
|
||||
if (!SendWakeup())
|
||||
fail("can't wake up the child");
|
||||
@ -102,7 +102,7 @@ TestRPCRacesParent::AnswerStackFrame()
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCRacesParent::Test3()
|
||||
TestInterruptRacesParent::Test3()
|
||||
{
|
||||
puts("Test 3");
|
||||
|
||||
@ -115,7 +115,7 @@ TestRPCRacesParent::Test3()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesParent::AnswerStackFrame3()
|
||||
TestInterruptRacesParent::AnswerStackFrame3()
|
||||
{
|
||||
if (!SendWakeup3())
|
||||
fail("can't wake up the child");
|
||||
@ -127,14 +127,14 @@ TestRPCRacesParent::AnswerStackFrame3()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesParent::AnswerParent()
|
||||
TestInterruptRacesParent::AnswerParent()
|
||||
{
|
||||
mAnsweredParent = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesParent::RecvGetAnsweredParent(bool* answeredParent)
|
||||
TestInterruptRacesParent::RecvGetAnsweredParent(bool* answeredParent)
|
||||
{
|
||||
*answeredParent = mAnsweredParent;
|
||||
return true;
|
||||
@ -143,7 +143,7 @@ TestRPCRacesParent::RecvGetAnsweredParent(bool* answeredParent)
|
||||
//-----------------------------------------------------------------------------
|
||||
// child
|
||||
bool
|
||||
TestRPCRacesChild::RecvStart()
|
||||
TestInterruptRacesChild::RecvStart()
|
||||
{
|
||||
puts("Test 1");
|
||||
|
||||
@ -159,10 +159,10 @@ TestRPCRacesChild::RecvStart()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesChild::AnswerRace(bool* hasReply)
|
||||
TestInterruptRacesChild::AnswerRace(bool* hasReply)
|
||||
{
|
||||
if (!mHasReply)
|
||||
fail("apparently the child lost the RPC race!");
|
||||
fail("apparently the child lost the Interrupt race!");
|
||||
|
||||
*hasReply = mHasReply;
|
||||
|
||||
@ -170,7 +170,7 @@ TestRPCRacesChild::AnswerRace(bool* hasReply)
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesChild::AnswerStackFrame()
|
||||
TestInterruptRacesChild::AnswerStackFrame()
|
||||
{
|
||||
// reset for the second test
|
||||
mHasReply = false;
|
||||
@ -185,7 +185,7 @@ TestRPCRacesChild::AnswerStackFrame()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesChild::RecvWakeup()
|
||||
TestInterruptRacesChild::RecvWakeup()
|
||||
{
|
||||
bool dontcare;
|
||||
if (!CallRace(&dontcare))
|
||||
@ -196,7 +196,7 @@ TestRPCRacesChild::RecvWakeup()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesChild::AnswerStackFrame3()
|
||||
TestInterruptRacesChild::AnswerStackFrame3()
|
||||
{
|
||||
if (!CallStackFrame3())
|
||||
fail("can't set up stack frame");
|
||||
@ -204,7 +204,7 @@ TestRPCRacesChild::AnswerStackFrame3()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesChild::RecvWakeup3()
|
||||
TestInterruptRacesChild::RecvWakeup3()
|
||||
{
|
||||
if (!CallParent())
|
||||
fail("can't set up race condition");
|
||||
@ -212,7 +212,7 @@ TestRPCRacesChild::RecvWakeup3()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCRacesChild::AnswerChild()
|
||||
TestInterruptRacesChild::AnswerChild()
|
||||
{
|
||||
bool parentAnsweredParent;
|
||||
// the parent is supposed to win the race, which means its
|
@ -1,27 +1,27 @@
|
||||
#ifndef mozilla__ipdltest_TestRPCRaces_h
|
||||
#define mozilla__ipdltest_TestRPCRaces_h
|
||||
#ifndef mozilla__ipdltest_TestInterruptRaces_h
|
||||
#define mozilla__ipdltest_TestInterruptRaces_h
|
||||
|
||||
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
||||
|
||||
#include "mozilla/_ipdltest/PTestRPCRacesParent.h"
|
||||
#include "mozilla/_ipdltest/PTestRPCRacesChild.h"
|
||||
#include "mozilla/_ipdltest/PTestInterruptRacesParent.h"
|
||||
#include "mozilla/_ipdltest/PTestInterruptRacesChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
mozilla::ipc::RacyRPCPolicy
|
||||
mozilla::ipc::RacyInterruptPolicy
|
||||
MediateRace(const mozilla::ipc::MessageChannel::Message& parent,
|
||||
const mozilla::ipc::MessageChannel::Message& child);
|
||||
|
||||
class TestRPCRacesParent :
|
||||
public PTestRPCRacesParent
|
||||
class TestInterruptRacesParent :
|
||||
public PTestInterruptRacesParent
|
||||
{
|
||||
public:
|
||||
TestRPCRacesParent() : mHasReply(false),
|
||||
TestInterruptRacesParent() : mHasReply(false),
|
||||
mChildHasReply(false),
|
||||
mAnsweredParent(false)
|
||||
{ }
|
||||
virtual ~TestRPCRacesParent() { }
|
||||
virtual ~TestInterruptRacesParent() { }
|
||||
|
||||
static bool RunTestInProcesses() { return true; }
|
||||
static bool RunTestInThreads() { return true; }
|
||||
@ -47,8 +47,8 @@ protected:
|
||||
virtual bool
|
||||
RecvGetAnsweredParent(bool* answeredParent) MOZ_OVERRIDE;
|
||||
|
||||
virtual mozilla::ipc::RacyRPCPolicy
|
||||
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
{
|
||||
return MediateRace(parent, child);
|
||||
}
|
||||
@ -75,12 +75,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TestRPCRacesChild :
|
||||
public PTestRPCRacesChild
|
||||
class TestInterruptRacesChild :
|
||||
public PTestInterruptRacesChild
|
||||
{
|
||||
public:
|
||||
TestRPCRacesChild() : mHasReply(false) { }
|
||||
virtual ~TestRPCRacesChild() { }
|
||||
TestInterruptRacesChild() : mHasReply(false) { }
|
||||
virtual ~TestInterruptRacesChild() { }
|
||||
|
||||
protected:
|
||||
virtual bool
|
||||
@ -104,8 +104,8 @@ protected:
|
||||
virtual bool
|
||||
AnswerChild() MOZ_OVERRIDE;
|
||||
|
||||
virtual mozilla::ipc::RacyRPCPolicy
|
||||
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
|
||||
{
|
||||
return MediateRace(parent, child);
|
||||
}
|
||||
@ -126,4 +126,4 @@ private:
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
#endif // ifndef mozilla__ipdltest_TestRPCRaces_h
|
||||
#endif // ifndef mozilla__ipdltest_TestInterruptRaces_h
|
@ -1,13 +1,13 @@
|
||||
#include "TestRPCShutdownRace.h"
|
||||
#include "TestInterruptShutdownRace.h"
|
||||
|
||||
#include "IPDLUnitTests.h" // fail etc.
|
||||
#include "IPDLUnitTestSubprocess.h"
|
||||
|
||||
template<>
|
||||
struct RunnableMethodTraits<mozilla::_ipdltest::TestRPCShutdownRaceParent>
|
||||
struct RunnableMethodTraits<mozilla::_ipdltest::TestInterruptShutdownRaceParent>
|
||||
{
|
||||
static void RetainCallee(mozilla::_ipdltest::TestRPCShutdownRaceParent* obj) { }
|
||||
static void ReleaseCallee(mozilla::_ipdltest::TestRPCShutdownRaceParent* obj) { }
|
||||
static void RetainCallee(mozilla::_ipdltest::TestInterruptShutdownRaceParent* obj) { }
|
||||
static void ReleaseCallee(mozilla::_ipdltest::TestInterruptShutdownRaceParent* obj) { }
|
||||
};
|
||||
|
||||
|
||||
@ -36,37 +36,37 @@ void Done()
|
||||
|
||||
} // namespace <anon>
|
||||
|
||||
TestRPCShutdownRaceParent::TestRPCShutdownRaceParent()
|
||||
TestInterruptShutdownRaceParent::TestInterruptShutdownRaceParent()
|
||||
{
|
||||
MOZ_COUNT_CTOR(TestRPCShutdownRaceParent);
|
||||
MOZ_COUNT_CTOR(TestInterruptShutdownRaceParent);
|
||||
}
|
||||
|
||||
TestRPCShutdownRaceParent::~TestRPCShutdownRaceParent()
|
||||
TestInterruptShutdownRaceParent::~TestInterruptShutdownRaceParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TestRPCShutdownRaceParent);
|
||||
MOZ_COUNT_DTOR(TestInterruptShutdownRaceParent);
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCShutdownRaceParent::Main()
|
||||
TestInterruptShutdownRaceParent::Main()
|
||||
{
|
||||
if (!SendStart())
|
||||
fail("sending Start");
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCShutdownRaceParent::RecvStartDeath()
|
||||
TestInterruptShutdownRaceParent::RecvStartDeath()
|
||||
{
|
||||
// this will be ordered before the OnMaybeDequeueOne event of
|
||||
// Orphan in the queue
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this,
|
||||
&TestRPCShutdownRaceParent::StartShuttingDown));
|
||||
&TestInterruptShutdownRaceParent::StartShuttingDown));
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TestRPCShutdownRaceParent::StartShuttingDown()
|
||||
TestInterruptShutdownRaceParent::StartShuttingDown()
|
||||
{
|
||||
// NB: we sleep here to try and avoid receiving the Orphan message
|
||||
// while waiting for the CallExit() reply. if we fail at that, it
|
||||
@ -79,7 +79,7 @@ TestRPCShutdownRaceParent::StartShuttingDown()
|
||||
|
||||
Close();
|
||||
|
||||
delete static_cast<TestRPCShutdownRaceParent*>(gParentActor);
|
||||
delete static_cast<TestInterruptShutdownRaceParent*>(gParentActor);
|
||||
gParentActor = nullptr;
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
|
||||
@ -93,7 +93,7 @@ TestRPCShutdownRaceParent::StartShuttingDown()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCShutdownRaceParent::RecvOrphan()
|
||||
TestInterruptShutdownRaceParent::RecvOrphan()
|
||||
{
|
||||
// it would be nice to fail() here, but we'll process this message
|
||||
// while waiting for the reply CallExit(). The OnMaybeDequeueOne
|
||||
@ -105,18 +105,18 @@ TestRPCShutdownRaceParent::RecvOrphan()
|
||||
//-----------------------------------------------------------------------------
|
||||
// child
|
||||
|
||||
TestRPCShutdownRaceChild::TestRPCShutdownRaceChild()
|
||||
TestInterruptShutdownRaceChild::TestInterruptShutdownRaceChild()
|
||||
{
|
||||
MOZ_COUNT_CTOR(TestRPCShutdownRaceChild);
|
||||
MOZ_COUNT_CTOR(TestInterruptShutdownRaceChild);
|
||||
}
|
||||
|
||||
TestRPCShutdownRaceChild::~TestRPCShutdownRaceChild()
|
||||
TestInterruptShutdownRaceChild::~TestInterruptShutdownRaceChild()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TestRPCShutdownRaceChild);
|
||||
MOZ_COUNT_DTOR(TestInterruptShutdownRaceChild);
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCShutdownRaceChild::RecvStart()
|
||||
TestInterruptShutdownRaceChild::RecvStart()
|
||||
{
|
||||
if (!SendStartDeath())
|
||||
fail("sending StartDeath");
|
||||
@ -132,7 +132,7 @@ TestRPCShutdownRaceChild::RecvStart()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRPCShutdownRaceChild::AnswerExit()
|
||||
TestInterruptShutdownRaceChild::AnswerExit()
|
||||
{
|
||||
_exit(0);
|
||||
NS_RUNTIMEABORT("unreached");
|
@ -1,21 +1,21 @@
|
||||
#ifndef mozilla__ipdltest_TestRPCShutdownRace_h
|
||||
#define mozilla__ipdltest_TestRPCShutdownRace_h 1
|
||||
#ifndef mozilla__ipdltest_TestInterruptShutdownRace_h
|
||||
#define mozilla__ipdltest_TestInterruptShutdownRace_h 1
|
||||
|
||||
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
||||
|
||||
#include "mozilla/_ipdltest/PTestRPCShutdownRaceParent.h"
|
||||
#include "mozilla/_ipdltest/PTestRPCShutdownRaceChild.h"
|
||||
#include "mozilla/_ipdltest/PTestInterruptShutdownRaceParent.h"
|
||||
#include "mozilla/_ipdltest/PTestInterruptShutdownRaceChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
class TestRPCShutdownRaceParent :
|
||||
public PTestRPCShutdownRaceParent
|
||||
class TestInterruptShutdownRaceParent :
|
||||
public PTestInterruptShutdownRaceParent
|
||||
{
|
||||
public:
|
||||
TestRPCShutdownRaceParent();
|
||||
virtual ~TestRPCShutdownRaceParent();
|
||||
TestInterruptShutdownRaceParent();
|
||||
virtual ~TestInterruptShutdownRaceParent();
|
||||
|
||||
static bool RunTestInProcesses() { return true; }
|
||||
// FIXME/bug 703323 Could work if modified
|
||||
@ -38,12 +38,12 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class TestRPCShutdownRaceChild :
|
||||
public PTestRPCShutdownRaceChild
|
||||
class TestInterruptShutdownRaceChild :
|
||||
public PTestInterruptShutdownRaceChild
|
||||
{
|
||||
public:
|
||||
TestRPCShutdownRaceChild();
|
||||
virtual ~TestRPCShutdownRaceChild();
|
||||
TestInterruptShutdownRaceChild();
|
||||
virtual ~TestInterruptShutdownRaceChild();
|
||||
|
||||
protected:
|
||||
virtual bool RecvStart() MOZ_OVERRIDE;
|
||||
@ -61,4 +61,4 @@ protected:
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
#endif // ifndef mozilla__ipdltest_TestRPCShutdownRace_h
|
||||
#endif // ifndef mozilla__ipdltest_TestInterruptShutdownRace_h
|
@ -8,11 +8,11 @@ typedef mozilla::ipc::MessageChannel::Message Message;
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
static RacyRPCPolicy
|
||||
static RacyInterruptPolicy
|
||||
MediateRace(const Message& parent, const Message& child)
|
||||
{
|
||||
return (PTestRaceDeferral::Msg_Win__ID == parent.type()) ?
|
||||
RRPParentWins : RRPChildWins;
|
||||
RIPParentWins : RIPChildWins;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -66,8 +66,8 @@ TestRaceDeferralParent::AnswerLose()
|
||||
return true;
|
||||
}
|
||||
|
||||
RacyRPCPolicy
|
||||
TestRaceDeferralParent::MediateRPCRace(const Message& parent,
|
||||
RacyInterruptPolicy
|
||||
TestRaceDeferralParent::MediateInterruptRace(const Message& parent,
|
||||
const Message& child)
|
||||
{
|
||||
return MediateRace(parent, child);
|
||||
@ -106,8 +106,8 @@ TestRaceDeferralChild::AnswerRpc()
|
||||
return true;
|
||||
}
|
||||
|
||||
RacyRPCPolicy
|
||||
TestRaceDeferralChild::MediateRPCRace(const Message& parent,
|
||||
RacyInterruptPolicy
|
||||
TestRaceDeferralChild::MediateInterruptRace(const Message& parent,
|
||||
const Message& child)
|
||||
{
|
||||
return MediateRace(parent, child);
|
||||
|
@ -26,8 +26,8 @@ protected:
|
||||
|
||||
virtual bool AnswerLose() MOZ_OVERRIDE;
|
||||
|
||||
virtual mozilla::ipc::RacyRPCPolicy
|
||||
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE;
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
||||
{
|
||||
@ -55,8 +55,8 @@ protected:
|
||||
|
||||
virtual bool AnswerRpc() MOZ_OVERRIDE;
|
||||
|
||||
virtual mozilla::ipc::RacyRPCPolicy
|
||||
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE;
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "TestRacyRPCReplies.h"
|
||||
#include "TestRacyInterruptReplies.h"
|
||||
|
||||
#include "IPDLUnitTests.h" // fail etc.
|
||||
|
||||
@ -8,18 +8,18 @@ namespace _ipdltest {
|
||||
//-----------------------------------------------------------------------------
|
||||
// parent
|
||||
|
||||
TestRacyRPCRepliesParent::TestRacyRPCRepliesParent() : mReplyNum(0)
|
||||
TestRacyInterruptRepliesParent::TestRacyInterruptRepliesParent() : mReplyNum(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TestRacyRPCRepliesParent);
|
||||
MOZ_COUNT_CTOR(TestRacyInterruptRepliesParent);
|
||||
}
|
||||
|
||||
TestRacyRPCRepliesParent::~TestRacyRPCRepliesParent()
|
||||
TestRacyInterruptRepliesParent::~TestRacyInterruptRepliesParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TestRacyRPCRepliesParent);
|
||||
MOZ_COUNT_DTOR(TestRacyInterruptRepliesParent);
|
||||
}
|
||||
|
||||
void
|
||||
TestRacyRPCRepliesParent::Main()
|
||||
TestRacyInterruptRepliesParent::Main()
|
||||
{
|
||||
int replyNum = -1;
|
||||
if (!CallR_(&replyNum))
|
||||
@ -33,7 +33,7 @@ TestRacyRPCRepliesParent::Main()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRacyRPCRepliesParent::RecvA_()
|
||||
TestRacyInterruptRepliesParent::RecvA_()
|
||||
{
|
||||
int replyNum = -1;
|
||||
// this R() call races with the reply being generated by the other
|
||||
@ -51,7 +51,7 @@ TestRacyRPCRepliesParent::RecvA_()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRacyRPCRepliesParent::Answer_R(int* replyNum)
|
||||
TestRacyInterruptRepliesParent::Answer_R(int* replyNum)
|
||||
{
|
||||
*replyNum = ++mReplyNum;
|
||||
|
||||
@ -65,18 +65,18 @@ TestRacyRPCRepliesParent::Answer_R(int* replyNum)
|
||||
//-----------------------------------------------------------------------------
|
||||
// child
|
||||
|
||||
TestRacyRPCRepliesChild::TestRacyRPCRepliesChild() : mReplyNum(0)
|
||||
TestRacyInterruptRepliesChild::TestRacyInterruptRepliesChild() : mReplyNum(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TestRacyRPCRepliesChild);
|
||||
MOZ_COUNT_CTOR(TestRacyInterruptRepliesChild);
|
||||
}
|
||||
|
||||
TestRacyRPCRepliesChild::~TestRacyRPCRepliesChild()
|
||||
TestRacyInterruptRepliesChild::~TestRacyInterruptRepliesChild()
|
||||
{
|
||||
MOZ_COUNT_DTOR(TestRacyRPCRepliesChild);
|
||||
MOZ_COUNT_DTOR(TestRacyInterruptRepliesChild);
|
||||
}
|
||||
|
||||
bool
|
||||
TestRacyRPCRepliesChild::AnswerR_(int* replyNum)
|
||||
TestRacyInterruptRepliesChild::AnswerR_(int* replyNum)
|
||||
{
|
||||
*replyNum = ++mReplyNum;
|
||||
|
||||
@ -87,7 +87,7 @@ TestRacyRPCRepliesChild::AnswerR_(int* replyNum)
|
||||
}
|
||||
|
||||
bool
|
||||
TestRacyRPCRepliesChild::RecvChildTest()
|
||||
TestRacyInterruptRepliesChild::RecvChildTest()
|
||||
{
|
||||
int replyNum = -1;
|
||||
if (!Call_R(&replyNum))
|
||||
@ -102,7 +102,7 @@ TestRacyRPCRepliesChild::RecvChildTest()
|
||||
}
|
||||
|
||||
bool
|
||||
TestRacyRPCRepliesChild::Recv_A()
|
||||
TestRacyInterruptRepliesChild::Recv_A()
|
||||
{
|
||||
int replyNum = -1;
|
||||
|
@ -1,21 +1,21 @@
|
||||
#ifndef mozilla__ipdltest_TestRacyRPCReplies_h
|
||||
#define mozilla__ipdltest_TestRacyRPCReplies_h 1
|
||||
#ifndef mozilla__ipdltest_TestRacyInterruptReplies_h
|
||||
#define mozilla__ipdltest_TestRacyInterruptReplies_h 1
|
||||
|
||||
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
||||
|
||||
#include "mozilla/_ipdltest/PTestRacyRPCRepliesParent.h"
|
||||
#include "mozilla/_ipdltest/PTestRacyRPCRepliesChild.h"
|
||||
#include "mozilla/_ipdltest/PTestRacyInterruptRepliesParent.h"
|
||||
#include "mozilla/_ipdltest/PTestRacyInterruptRepliesChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
|
||||
class TestRacyRPCRepliesParent :
|
||||
public PTestRacyRPCRepliesParent
|
||||
class TestRacyInterruptRepliesParent :
|
||||
public PTestRacyInterruptRepliesParent
|
||||
{
|
||||
public:
|
||||
TestRacyRPCRepliesParent();
|
||||
virtual ~TestRacyRPCRepliesParent();
|
||||
TestRacyInterruptRepliesParent();
|
||||
virtual ~TestRacyInterruptRepliesParent();
|
||||
|
||||
static bool RunTestInProcesses() { return true; }
|
||||
static bool RunTestInThreads() { return true; }
|
||||
@ -40,12 +40,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class TestRacyRPCRepliesChild :
|
||||
public PTestRacyRPCRepliesChild
|
||||
class TestRacyInterruptRepliesChild :
|
||||
public PTestRacyInterruptRepliesChild
|
||||
{
|
||||
public:
|
||||
TestRacyRPCRepliesChild();
|
||||
virtual ~TestRacyRPCRepliesChild();
|
||||
TestRacyInterruptRepliesChild();
|
||||
virtual ~TestRacyInterruptRepliesChild();
|
||||
|
||||
protected:
|
||||
virtual bool AnswerR_(int* replyNum) MOZ_OVERRIDE;
|
||||
@ -70,4 +70,4 @@ private:
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
#endif // ifndef mozilla__ipdltest_TestRacyRPCReplies_h
|
||||
#endif // ifndef mozilla__ipdltest_TestRacyInterruptReplies_h
|
@ -48,6 +48,9 @@ IPDL_SOURCES += [
|
||||
'PTestIndirectProtocolParamFirst.ipdl',
|
||||
'PTestIndirectProtocolParamManage.ipdl',
|
||||
'PTestIndirectProtocolParamSecond.ipdl',
|
||||
'PTestInterruptErrorCleanup.ipdl',
|
||||
'PTestInterruptRaces.ipdl',
|
||||
'PTestInterruptShutdownRace.ipdl',
|
||||
'PTestJSON.ipdl',
|
||||
'PTestLatency.ipdl',
|
||||
'PTestManyChildAllocs.ipdl',
|
||||
@ -59,11 +62,8 @@ IPDL_SOURCES += [
|
||||
'PTestNestedLoops.ipdl',
|
||||
'PTestOpens.ipdl',
|
||||
'PTestOpensOpened.ipdl',
|
||||
'PTestRPCErrorCleanup.ipdl',
|
||||
'PTestRPCRaces.ipdl',
|
||||
'PTestRPCShutdownRace.ipdl',
|
||||
'PTestRaceDeferral.ipdl',
|
||||
'PTestRacyRPCReplies.ipdl',
|
||||
'PTestRacyInterruptReplies.ipdl',
|
||||
'PTestRacyReentry.ipdl',
|
||||
'PTestRacyUndefer.ipdl',
|
||||
'PTestSanity.ipdl',
|
||||
|
@ -1,6 +1,6 @@
|
||||
include protocol compressCtorManagee;
|
||||
|
||||
rpc protocol compressCtor {
|
||||
intr protocol compressCtor {
|
||||
manages compressCtorManagee;
|
||||
|
||||
parent:
|
||||
|
@ -1,6 +1,6 @@
|
||||
include protocol compressCtor;
|
||||
|
||||
rpc protocol compressCtorManagee {
|
||||
intr protocol compressCtorManagee {
|
||||
manager compressCtor;
|
||||
|
||||
child:
|
||||
|
6
ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl
Normal file
6
ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl
Normal file
@ -0,0 +1,6 @@
|
||||
intr protocol intrMessageCompress {
|
||||
parent:
|
||||
intr foo() compress;
|
||||
child:
|
||||
intr bar() compress;
|
||||
};
|
@ -1,6 +0,0 @@
|
||||
rpc protocol rpcMessageCompress {
|
||||
parent:
|
||||
rpc foo() compress;
|
||||
child:
|
||||
rpc bar() compress;
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
rpc protocol syncParentToChild {
|
||||
intr protocol syncParentToChild {
|
||||
|
||||
// can't declare sync parent-to-child messages
|
||||
child: sync Msg();
|
||||
|
7
ipc/ipdl/test/ipdl/error/tooWeakInterruptAsync.ipdl
Normal file
7
ipc/ipdl/test/ipdl/error/tooWeakInterruptAsync.ipdl
Normal file
@ -0,0 +1,7 @@
|
||||
protocol tooWeakRPCAsync {
|
||||
|
||||
// it's an error to declare an async protocol with an intr message
|
||||
|
||||
parent: intr Msg();
|
||||
|
||||
};
|
@ -1,7 +0,0 @@
|
||||
protocol tooWeakRPCAsync {
|
||||
|
||||
// it's an error to declare an async protocol with an rpc message
|
||||
|
||||
parent: rpc Msg();
|
||||
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
rpc protocol trans_WrongDirection4 {
|
||||
intr protocol trans_WrongDirection4 {
|
||||
|
||||
child:
|
||||
rpc Msg();
|
||||
intr Msg();
|
||||
__delete__();
|
||||
|
||||
state S1:
|
||||
|
@ -1,7 +1,7 @@
|
||||
rpc protocol trans_WrongDirection5 {
|
||||
intr protocol trans_WrongDirection5 {
|
||||
|
||||
parent:
|
||||
rpc Msg();
|
||||
intr Msg();
|
||||
__delete__()
|
||||
|
||||
state S1:
|
||||
|
@ -1,7 +1,7 @@
|
||||
rpc protocol trans_WrongName4 {
|
||||
intr protocol trans_WrongName4 {
|
||||
|
||||
child:
|
||||
rpc Msg();
|
||||
intr Msg();
|
||||
__delete__();
|
||||
|
||||
state S1:
|
||||
|
@ -1,7 +1,7 @@
|
||||
rpc protocol trans_WrongName5 {
|
||||
intr protocol trans_WrongName5 {
|
||||
|
||||
parent:
|
||||
rpc Msg();
|
||||
intr Msg();
|
||||
__delete__();
|
||||
|
||||
state S1:
|
||||
|
13
ipc/ipdl/test/ipdl/ok/intrProtocol.ipdl
Normal file
13
ipc/ipdl/test/ipdl/ok/intrProtocol.ipdl
Normal file
@ -0,0 +1,13 @@
|
||||
intr protocol intrProtocol {
|
||||
|
||||
// sanity check of Interrupt protocols
|
||||
child:
|
||||
AsyncMsg();
|
||||
|
||||
parent:
|
||||
sync SyncMsg(int i) returns (int r);
|
||||
|
||||
both:
|
||||
intr InterruptMsg(int x) returns (int y);
|
||||
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
include protocol content;
|
||||
include protocol jetpack;
|
||||
|
||||
rpc protocol jetpackContent {
|
||||
intr protocol jetpackContent {
|
||||
bridges jetpack, content;
|
||||
|
||||
child:
|
||||
|
@ -1,4 +1,4 @@
|
||||
rpc protocol messageCompress {
|
||||
intr protocol messageCompress {
|
||||
child:
|
||||
async foo() compress;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
rpc protocol plugin {
|
||||
intr protocol plugin {
|
||||
child:
|
||||
__delete__();
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
rpc protocol rpcProtocol {
|
||||
|
||||
// sanity check of RPC protocols
|
||||
child:
|
||||
AsyncMsg();
|
||||
|
||||
parent:
|
||||
sync SyncMsg(int i) returns (int r);
|
||||
|
||||
both:
|
||||
rpc RPCMsg(int x) returns (int y);
|
||||
|
||||
};
|
@ -3,11 +3,11 @@ union Foo {
|
||||
Shmem;
|
||||
};
|
||||
|
||||
rpc protocol shmem {
|
||||
intr protocol shmem {
|
||||
parent:
|
||||
Msg(Shmem s, Foo f);
|
||||
sync SyncMsg(Shmem s, Foo f)
|
||||
returns (Shmem t, Foo g);
|
||||
rpc RPCMsg(Shmem s, Foo f)
|
||||
intr InterruptMsg(Shmem s, Foo f)
|
||||
returns (Shmem t, Foo g);
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ include protocol PTestShellCommand;
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
rpc protocol PTestShell
|
||||
intr protocol PTestShell
|
||||
{
|
||||
manager PContent;
|
||||
|
||||
|
@ -14,7 +14,7 @@ using mozilla::void_t;
|
||||
namespace mozilla {
|
||||
namespace jsipc {
|
||||
|
||||
rpc protocol PJavaScript
|
||||
intr protocol PJavaScript
|
||||
{
|
||||
manager PContent;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user