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:
David Anderson 2013-09-30 17:27:45 -07:00
parent 73ed891def
commit 437f6053a9
88 changed files with 578 additions and 576 deletions

View File

@ -17,7 +17,7 @@ struct RemoteVoice {
bool localService; bool localService;
}; };
rpc protocol PSpeechSynthesis intr protocol PSpeechSynthesis
{ {
manager PContent; manager PContent;
manages PSpeechSynthesisRequest; manages PSpeechSynthesisRequest;

View File

@ -9,7 +9,7 @@ include protocol PSpeechSynthesis;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
rpc protocol PSpeechSynthesisRequest intr protocol PSpeechSynthesisRequest
{ {
manager PSpeechSynthesis; manager PSpeechSynthesis;

View File

@ -58,7 +58,7 @@ using mozilla::CSSToScreenScale;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
rpc protocol PBrowser intr protocol PBrowser
{ {
manager PContent; manager PContent;
@ -81,7 +81,7 @@ parent:
Event(RemoteDOMEvent aEvent); Event(RemoteDOMEvent aEvent);
rpc CreateWindow() returns (PBrowser window); intr CreateWindow() returns (PBrowser window);
sync SyncMessage(nsString aMessage, ClonedMessageData aData, CpowEntry[] aCpows) sync SyncMessage(nsString aMessage, ClonedMessageData aData, CpowEntry[] aCpows)
returns (nsString[] retval); returns (nsString[] retval);

View File

@ -181,7 +181,7 @@ struct PrefSetting {
MaybePrefValue userValue; MaybePrefValue userValue;
}; };
rpc protocol PContent intr protocol PContent
{ {
parent opens PCompositor; parent opens PCompositor;
parent opens PImageBridge; parent opens PImageBridge;

View File

@ -18,7 +18,7 @@ struct Mapping {
size_t file_offset; size_t file_offset;
}; };
protocol PCrashReporter { intr protocol PCrashReporter {
manager PContent or PPluginModule; manager PContent or PPluginModule;
parent: parent:
AnnotateCrashReport(nsCString key, nsCString data); AnnotateCrashReport(nsCString key, nsCString data);

View File

@ -66,7 +66,7 @@ COMMessageFilter::MessagePending(HTASK htaskCallee,
DWORD dwTickCount, DWORD dwTickCount,
DWORD dwPendingType) DWORD dwPendingType)
{ {
mPlugin->FlushPendingRPCQueue(); mPlugin->FlushPendingInterruptQueue();
if (mPreviousFilter) if (mPreviousFilter)
return mPreviousFilter->MessagePending(htaskCallee, dwTickCount, return mPreviousFilter->MessagePending(htaskCallee, dwTickCount,
dwPendingType); dwPendingType);

View File

@ -20,7 +20,7 @@ namespace plugins {
* NPBrowserStream represents a NPStream sent from the browser to the plugin. * NPBrowserStream represents a NPStream sent from the browser to the plugin.
*/ */
rpc protocol PBrowserStream intr protocol PBrowserStream
{ {
manager PPluginInstance; manager PPluginInstance;
@ -37,7 +37,7 @@ child:
async __delete__(); async __delete__();
parent: parent:
rpc NPN_RequestRead(IPCByteRanges ranges) intr NPN_RequestRead(IPCByteRanges ranges)
returns (NPError result); returns (NPError result);
async NPN_DestroyStream(NPReason reason); async NPN_DestroyStream(NPReason reason);
async StreamDestroyed(); async StreamDestroyed();

View File

@ -76,7 +76,7 @@ struct NPRemoteAsyncSurface
uintptr_t hostPtr; uintptr_t hostPtr;
}; };
rpc protocol PPluginInstance intr protocol PPluginInstance
{ {
manager PPluginModule; manager PPluginModule;
@ -88,34 +88,34 @@ rpc protocol PPluginInstance
manages PPluginSurface; manages PPluginSurface;
child: 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); returns (bool value, NPError result);
// this message is not used on non-X platforms // this message is not used on non-X platforms
rpc NPP_GetValue_NPPVpluginNeedsXEmbed() intr NPP_GetValue_NPPVpluginNeedsXEmbed()
returns (bool value, NPError result); returns (bool value, NPError result);
rpc NPP_GetValue_NPPVpluginScriptableNPObject() intr NPP_GetValue_NPPVpluginScriptableNPObject()
returns (nullable PPluginScriptableObject value, NPError result); returns (nullable PPluginScriptableObject value, NPError result);
rpc NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result); intr NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
rpc NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId() intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
returns (nsCString plug_id, NPError result); returns (nsCString plug_id, NPError result);
rpc NPP_HandleEvent(NPRemoteEvent event) intr NPP_HandleEvent(NPRemoteEvent event)
returns (int16_t handled); returns (int16_t handled);
// special cases where we need to a shared memory buffer // 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); returns (int16_t handled, Shmem rtnbuffer);
// special cases where we need an iosurface // 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); returns (int16_t handled);
// special cases of HandleEvent to make mediating races simpler // special cases of HandleEvent to make mediating races simpler
rpc Paint(NPRemoteEvent event) intr Paint(NPRemoteEvent event)
returns (int16_t handled); returns (int16_t handled);
// this is only used on windows to forward WM_WINDOWPOSCHANGE // this is only used on windows to forward WM_WINDOWPOSCHANGE
async WindowPosChanged(NPRemoteEvent event); async WindowPosChanged(NPRemoteEvent event);
@ -142,37 +142,37 @@ child:
async NPP_DidComposite(); async NPP_DidComposite();
rpc NPP_Destroy() intr NPP_Destroy()
returns (NPError rv); returns (NPError rv);
parent: parent:
rpc NPN_GetValue_NPNVWindowNPObject() intr NPN_GetValue_NPNVWindowNPObject()
returns (nullable PPluginScriptableObject value, NPError result); returns (nullable PPluginScriptableObject value, NPError result);
rpc NPN_GetValue_NPNVPluginElementNPObject() intr NPN_GetValue_NPNVPluginElementNPObject()
returns (nullable PPluginScriptableObject value, NPError result); returns (nullable PPluginScriptableObject value, NPError result);
rpc NPN_GetValue_NPNVprivateModeBool() intr NPN_GetValue_NPNVprivateModeBool()
returns (bool value, NPError result); returns (bool value, NPError result);
rpc NPN_GetValue_NPNVnetscapeWindow() intr NPN_GetValue_NPNVnetscapeWindow()
returns (NativeWindowHandle value, NPError result); returns (NativeWindowHandle value, NPError result);
rpc NPN_GetValue_NPNVdocumentOrigin() intr NPN_GetValue_NPNVdocumentOrigin()
returns (nsCString value, NPError result); returns (nsCString value, NPError result);
rpc NPN_GetValue_DrawingModelSupport(NPNVariable model) intr NPN_GetValue_DrawingModelSupport(NPNVariable model)
returns (bool value); returns (bool value);
rpc NPN_SetValue_NPPVpluginWindow(bool windowed) intr NPN_SetValue_NPPVpluginWindow(bool windowed)
returns (NPError result); returns (NPError result);
rpc NPN_SetValue_NPPVpluginTransparent(bool transparent) intr NPN_SetValue_NPPVpluginTransparent(bool transparent)
returns (NPError result); returns (NPError result);
rpc NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor) intr NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor)
returns (NPError result); returns (NPError result);
rpc NPN_SetValue_NPPVpluginDrawingModel(int drawingModel) intr NPN_SetValue_NPPVpluginDrawingModel(int drawingModel)
returns (OptionalShmem remoteImageData, CrossProcessMutexHandle mutex, NPError result); returns (OptionalShmem remoteImageData, CrossProcessMutexHandle mutex, NPError result);
rpc NPN_SetValue_NPPVpluginEventModel(int eventModel) intr NPN_SetValue_NPPVpluginEventModel(int eventModel)
returns (NPError result); returns (NPError result);
rpc NPN_GetURL(nsCString url, nsCString target) intr NPN_GetURL(nsCString url, nsCString target)
returns (NPError result); 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); returns (NPError result);
/** /**
@ -180,7 +180,7 @@ parent:
* @TODO This would be more readable as an overloaded method, * @TODO This would be more readable as an overloaded method,
* but IPDL doesn't allow that for constructors. * 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) nsCString buffer, bool file)
returns (NPError result); returns (NPError result);
@ -202,29 +202,29 @@ parent:
gfxIntSize size, gfxIntSize size,
bool transparent); 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); returns (nsCString value, NPError result);
rpc NPN_SetValueForURL(NPNURLVariable variable, nsCString url, intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
nsCString value) nsCString value)
returns (NPError result); returns (NPError result);
rpc NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host, intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
int32_t port, nsCString scheme, int32_t port, nsCString scheme,
nsCString realm) nsCString realm)
returns (nsCString username, nsCString password, NPError result); 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) NPCoordinateSpace destSpace)
returns (double destX, double destY, bool result); returns (double destX, double destY, bool result);
async RedrawPlugin(); async RedrawPlugin();
rpc NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format) intr NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format)
returns (NPRemoteAsyncSurface surfData, bool result); returns (NPRemoteAsyncSurface surfData, bool result);
// Send notification that a plugin tried to negotiate Carbon NPAPI so that // Send notification that a plugin tried to negotiate Carbon NPAPI so that
@ -240,7 +240,7 @@ both:
child: child:
/* NPP_NewStream */ /* NPP_NewStream */
rpc PBrowserStream(nsCString url, intr PBrowserStream(nsCString url,
uint32_t length, uint32_t length,
uint32_t lastmodified, uint32_t lastmodified,
nullable PStreamNotify notifyData, nullable PStreamNotify notifyData,
@ -252,16 +252,16 @@ child:
parent: parent:
/* NPN_NewStream */ /* NPN_NewStream */
rpc PPluginStream(nsCString mimeType, intr PPluginStream(nsCString mimeType,
nsCString target) nsCString target)
returns (NPError result); returns (NPError result);
parent: parent:
rpc PluginFocusChange(bool gotFocus); intr PluginFocusChange(bool gotFocus);
child: child:
rpc SetPluginFocus(); intr SetPluginFocus();
rpc UpdateWindow(); intr UpdateWindow();
async PPluginBackgroundDestroyer(); async PPluginBackgroundDestroyer();
}; };

View File

@ -21,7 +21,7 @@ using nsID;
namespace mozilla { namespace mozilla {
namespace plugins { namespace plugins {
rpc protocol PPluginModule intr protocol PPluginModule
{ {
manages PPluginInstance; manages PPluginInstance;
manages PPluginIdentifier; manages PPluginIdentifier;
@ -37,41 +37,41 @@ both:
* from leaking out to plugin code and only allow the child's to be used. * 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" * 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, async PPluginIdentifier(nsCString aString,
int32_t aInt, int32_t aInt,
bool temporary); bool temporary);
// Window-specific message which instructs the RPC mechanism to enter // Window-specific message which instructs the interrupt mechanism to enter
// a nested event loop for the current RPC call. // a nested event loop for the current interrupt call.
async ProcessNativeEventsInRPCCall(); async ProcessNativeEventsInInterruptCall();
child: child:
// Forces the child process to update its plugin function table. // Forces the child process to update its plugin function table.
rpc NP_GetEntryPoints() intr NP_GetEntryPoints()
returns (NPError rv); returns (NPError rv);
rpc NP_Initialize(uint32_t aFlags) intr NP_Initialize(uint32_t aFlags)
returns (NPError rv); returns (NPError rv);
rpc PPluginInstance(nsCString aMimeType, intr PPluginInstance(nsCString aMimeType,
uint16_t aMode, uint16_t aMode,
nsCString[] aNames, nsCString[] aNames,
nsCString[] aValues) nsCString[] aValues)
returns (NPError rv); returns (NPError rv);
rpc NP_Shutdown() intr NP_Shutdown()
returns (NPError rv); returns (NPError rv);
rpc OptionalFunctionsSupported() intr OptionalFunctionsSupported()
returns (bool aURLRedirectNotify, bool aClearSiteData, returns (bool aURLRedirectNotify, bool aClearSiteData,
bool aGetSitesWithData); 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); returns (NPError rv);
rpc NPP_GetSitesWithData() intr NPP_GetSitesWithData()
returns (nsCString[] sites); returns (nsCString[] sites);
// Windows specific message to set up an audio session in the plugin process // Windows specific message to set up an audio session in the plugin process
@ -81,10 +81,10 @@ child:
async SetParentHangTimeout(uint32_t seconds); async SetParentHangTimeout(uint32_t seconds);
rpc PCrashReporter() intr PCrashReporter()
returns (NativeThreadId tid, uint32_t processType); returns (NativeThreadId tid, uint32_t processType);
rpc GeckoGetProfile() intr GeckoGetProfile()
returns (nsCString aProfile); returns (nsCString aProfile);
parent: parent:
@ -101,10 +101,10 @@ parent:
*/ */
async BackUpXResources(FileDescriptor aXSocketFd); async BackUpXResources(FileDescriptor aXSocketFd);
rpc NPN_UserAgent() intr NPN_UserAgent()
returns (nsCString userAgent); returns (nsCString userAgent);
rpc NPN_GetValue_WithBoolReturn(NPNVariable aVariable) intr NPN_GetValue_WithBoolReturn(NPNVariable aVariable)
returns (NPError aError, returns (NPError aError,
bool aBoolVal); bool aBoolVal);
@ -112,7 +112,7 @@ parent:
// Gtk-specific code upon detecting that the plugin process has // Gtk-specific code upon detecting that the plugin process has
// entered a nested event loop. If the browser doesn't process // entered a nested event loop. If the browser doesn't process
// native events, then "livelock" and some other glitches can occur. // native events, then "livelock" and some other glitches can occur.
rpc ProcessSomeEvents(); intr ProcessSomeEvents();
// OS X Specific calls to manage the plugin's window // OS X Specific calls to manage the plugin's window
// when interposing system calls. // when interposing system calls.

View File

@ -26,7 +26,7 @@ union Variant {
nullable PPluginScriptableObject; nullable PPluginScriptableObject;
}; };
rpc protocol PPluginScriptableObject intr protocol PPluginScriptableObject
{ {
manager PPluginInstance; manager PPluginInstance;
@ -34,42 +34,42 @@ both:
async __delete__(); async __delete__();
parent: parent:
rpc NPN_Evaluate(nsCString aScript) intr NPN_Evaluate(nsCString aScript)
returns (Variant aResult, returns (Variant aResult,
bool aSuccess); bool aSuccess);
child: child:
rpc Invalidate(); intr Invalidate();
both: both:
// NPClass methods // NPClass methods
rpc HasMethod(PPluginIdentifier aId) intr HasMethod(PPluginIdentifier aId)
returns (bool aHasMethod); returns (bool aHasMethod);
rpc Invoke(PPluginIdentifier aId, intr Invoke(PPluginIdentifier aId,
Variant[] aArgs) Variant[] aArgs)
returns (Variant aResult, returns (Variant aResult,
bool aSuccess); bool aSuccess);
rpc InvokeDefault(Variant[] aArgs) intr InvokeDefault(Variant[] aArgs)
returns (Variant aResult, returns (Variant aResult,
bool aSuccess); bool aSuccess);
rpc HasProperty(PPluginIdentifier aId) intr HasProperty(PPluginIdentifier aId)
returns (bool aHasProperty); returns (bool aHasProperty);
rpc SetProperty(PPluginIdentifier aId, intr SetProperty(PPluginIdentifier aId,
Variant aValue) Variant aValue)
returns (bool aSuccess); returns (bool aSuccess);
rpc RemoveProperty(PPluginIdentifier aId) intr RemoveProperty(PPluginIdentifier aId)
returns (bool aSuccess); returns (bool aSuccess);
rpc Enumerate() intr Enumerate()
returns (PPluginIdentifier[] aProperties, returns (PPluginIdentifier[] aProperties,
bool aSuccess); bool aSuccess);
rpc Construct(Variant[] aArgs) intr Construct(Variant[] aArgs)
returns (Variant aResult, returns (Variant aResult,
bool aSuccess); bool aSuccess);
@ -90,12 +90,12 @@ both:
* several checks at once and return all the results simultaneously. * several checks at once and return all the results simultaneously.
*/ */
parent: parent:
rpc GetParentProperty(PPluginIdentifier aId) intr GetParentProperty(PPluginIdentifier aId)
returns (Variant aResult, returns (Variant aResult,
bool aSuccess); bool aSuccess);
child: child:
rpc GetChildProperty(PPluginIdentifier aId) intr GetChildProperty(PPluginIdentifier aId)
returns (bool aHasProperty, returns (bool aHasProperty,
bool aHasMethod, bool aHasMethod,
Variant aResult, Variant aResult,

View File

@ -18,12 +18,12 @@ namespace plugins {
* PPluginStream represents an NPStream sent from the plugin to the browser. * PPluginStream represents an NPStream sent from the plugin to the browser.
*/ */
rpc protocol PPluginStream intr protocol PPluginStream
{ {
manager PPluginInstance; manager PPluginInstance;
parent: parent:
rpc NPN_Write(Buffer data) returns (int32_t written); intr NPN_Write(Buffer data) returns (int32_t written);
both: both:
/** /**
@ -31,7 +31,7 @@ both:
* @param artificial True when the stream is closed as a by-product of * @param artificial True when the stream is closed as a by-product of
* some other call (such as a failure in NPN_Write). * some other call (such as a failure in NPN_Write).
*/ */
rpc __delete__(NPReason reason, bool artificial); intr __delete__(NPReason reason, bool artificial);
}; };
} // namespace plugins } // namespace plugins

View File

@ -13,7 +13,7 @@ using NPReason;
namespace mozilla { namespace mozilla {
namespace plugins { namespace plugins {
rpc protocol PStreamNotify intr protocol PStreamNotify
{ {
manager PPluginInstance; manager PPluginInstance;

View File

@ -67,7 +67,7 @@ NPRemoteWindow::NPRemoteWindow() :
clipRect.right = 0; clipRect.right = 0;
} }
ipc::RacyRPCPolicy ipc::RacyInterruptPolicy
MediateRace(const MessageChannel::Message& parent, MediateRace(const MessageChannel::Message& parent,
const MessageChannel::Message& child) const MessageChannel::Message& child)
{ {
@ -78,10 +78,10 @@ MediateRace(const MessageChannel::Message& parent,
case PPluginInstance::Msg_NPP_HandleEvent_IOSurface__ID: case PPluginInstance::Msg_NPP_HandleEvent_IOSurface__ID:
// our code relies on the frame list not changing during paints and // our code relies on the frame list not changing during paints and
// reflows // reflows
return ipc::RRPParentWins; return ipc::RIPParentWins;
default: default:
return ipc::RRPChildWins; return ipc::RIPChildWins;
} }
} }

View File

@ -43,7 +43,7 @@ enum ScriptableObjectType
Proxy Proxy
}; };
mozilla::ipc::RacyRPCPolicy mozilla::ipc::RacyInterruptPolicy
MediateRace(const mozilla::ipc::MessageChannel::Message& parent, MediateRace(const mozilla::ipc::MessageChannel::Message& parent,
const mozilla::ipc::MessageChannel::Message& child); const mozilla::ipc::MessageChannel::Message& child);

View File

@ -583,7 +583,7 @@ PluginModuleChild::AnswerNP_Shutdown(NPError *rv)
mozilla::widget::StopAudioSession(); mozilla::widget::StopAudioSession();
#endif #endif
// the PluginModuleParent shuts down this process after this RPC // the PluginModuleParent shuts down this process after this interrupt
// call pops off its stack // call pops off its stack
*rv = mShutdownFunc ? mShutdownFunc() : NPERR_NO_ERROR; *rv = mShutdownFunc ? mShutdownFunc() : NPERR_NO_ERROR;
@ -2350,7 +2350,7 @@ PluginModuleChild::NestedInputEventHook(int nCode, WPARAM wParam, LPARAM lParam)
uint32_t len = self->mIncallPumpingStack.Length(); uint32_t len = self->mIncallPumpingStack.Length();
if (nCode >= 0 && len && !self->mIncallPumpingStack[len - 1]._spinning) { if (nCode >= 0 && len && !self->mIncallPumpingStack[len - 1]._spinning) {
MessageLoop* loop = MessageLoop::current(); MessageLoop* loop = MessageLoop::current();
self->SendProcessNativeEventsInRPCCall(); self->SendProcessNativeEventsInInterruptCall();
IncallFrame& f = self->mIncallPumpingStack[len - 1]; IncallFrame& f = self->mIncallPumpingStack[len - 1];
f._spinning = true; f._spinning = true;
f._savedNestableTasksAllowed = loop->NestableTasksAllowed(); f._savedNestableTasksAllowed = loop->NestableTasksAllowed();
@ -2399,15 +2399,15 @@ PluginModuleChild::ResetEventHooks()
#endif #endif
bool bool
PluginModuleChild::RecvProcessNativeEventsInRPCCall() PluginModuleChild::RecvProcessNativeEventsInInterruptCall()
{ {
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
#if defined(OS_WIN) #if defined(OS_WIN)
ProcessNativeEventsInRPCCall(); ProcessNativeEventsInInterruptCall();
return true; return true;
#else #else
NS_RUNTIMEABORT( NS_RUNTIMEABORT(
"PluginModuleChild::RecvProcessNativeEventsInRPCCall not implemented!"); "PluginModuleChild::RecvProcessNativeEventsInInterruptCall not implemented!");
return false; return false;
#endif #endif
} }

View File

@ -74,8 +74,8 @@ class PluginModuleChild : public PPluginModuleChild
{ {
typedef mozilla::dom::PCrashReporterChild PCrashReporterChild; typedef mozilla::dom::PCrashReporterChild PCrashReporterChild;
protected: protected:
virtual mozilla::ipc::RacyRPCPolicy virtual mozilla::ipc::RacyInterruptPolicy
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
{ {
return MediateRace(parent, child); return MediateRace(parent, child);
} }
@ -158,7 +158,7 @@ protected:
MOZ_NORETURN void QuickExit(); MOZ_NORETURN void QuickExit();
virtual bool virtual bool
RecvProcessNativeEventsInRPCCall() MOZ_OVERRIDE; RecvProcessNativeEventsInInterruptCall() MOZ_OVERRIDE;
virtual bool virtual bool
AnswerGeckoGetProfile(nsCString* aProfile); AnswerGeckoGetProfile(nsCString* aProfile);
@ -431,7 +431,7 @@ private:
virtual void ExitedCall() MOZ_OVERRIDE; virtual void ExitedCall() MOZ_OVERRIDE;
// Entered/ExitedCall notifications keep track of whether the plugin has // 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 struct IncallFrame
{ {
IncallFrame() IncallFrame()

View File

@ -1241,7 +1241,7 @@ PluginModuleParent::NP_Shutdown(NPError* error)
bool ok = CallNP_Shutdown(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 // 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 // plugin dso will have been unloaded on the other side by the
// CallNP_Shutdown() message // CallNP_Shutdown() message
@ -1466,28 +1466,28 @@ PluginModuleParent::AnswerProcessSomeEvents()
#endif #endif
bool bool
PluginModuleParent::RecvProcessNativeEventsInRPCCall() PluginModuleParent::RecvProcessNativeEventsInInterruptCall()
{ {
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
#if defined(OS_WIN) #if defined(OS_WIN)
ProcessNativeEventsInRPCCall(); ProcessNativeEventsInInterruptCall();
return true; return true;
#else #else
NS_NOTREACHED( NS_NOTREACHED(
"PluginModuleParent::RecvProcessNativeEventsInRPCCall not implemented!"); "PluginModuleParent::RecvProcessNativeEventsInInterruptCall not implemented!");
return false; return false;
#endif #endif
} }
void void
PluginModuleParent::ProcessRemoteNativeEventsInRPCCall() PluginModuleParent::ProcessRemoteNativeEventsInInterruptCall()
{ {
#if defined(OS_WIN) #if defined(OS_WIN)
unused << SendProcessNativeEventsInRPCCall(); unused << SendProcessNativeEventsInInterruptCall();
return; return;
#endif #endif
NS_NOTREACHED( NS_NOTREACHED(
"PluginModuleParent::ProcessRemoteNativeEventsInRPCCall not implemented!"); "PluginModuleParent::ProcessRemoteNativeEventsInInterruptCall not implemented!");
} }
bool bool

View File

@ -124,7 +124,7 @@ public:
PluginIdentifierParent* PluginIdentifierParent*
GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier); GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier);
void ProcessRemoteNativeEventsInRPCCall(); void ProcessRemoteNativeEventsInInterruptCall();
void TerminateChildProcess(MessageLoop* aMsgLoop); void TerminateChildProcess(MessageLoop* aMsgLoop);
@ -134,8 +134,8 @@ public:
#endif // XP_WIN #endif // XP_WIN
protected: protected:
virtual mozilla::ipc::RacyRPCPolicy virtual mozilla::ipc::RacyInterruptPolicy
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
{ {
return MediateRace(parent, child); return MediateRace(parent, child);
} }
@ -158,7 +158,7 @@ protected:
virtual bool AnswerProcessSomeEvents() MOZ_OVERRIDE; virtual bool AnswerProcessSomeEvents() MOZ_OVERRIDE;
virtual bool virtual bool
RecvProcessNativeEventsInRPCCall() MOZ_OVERRIDE; RecvProcessNativeEventsInInterruptCall() MOZ_OVERRIDE;
virtual bool virtual bool
RecvPluginShowWindow(const uint32_t& aWindowId, const bool& aModal, RecvPluginShowWindow(const uint32_t& aWindowId, const bool& aModal,

View File

@ -26,7 +26,7 @@ namespace layers {
*/ */
// This should really be 'sync', but we're using 'rpc' as a workaround // This should really be 'sync', but we're using 'rpc' as a workaround
// for Bug 716631. // for Bug 716631.
rpc protocol PCompositor intr protocol PCompositor
{ {
// A Compositor manages a single Layer Manager (PLayerTransaction) // A Compositor manages a single Layer Manager (PLayerTransaction)
manages PLayerTransaction; manages PLayerTransaction;

View File

@ -23,7 +23,7 @@ namespace layers {
* frames directly to the compositor thread/process without relying on the main thread * frames directly to the compositor thread/process without relying on the main thread
* which might be too busy dealing with content script. * which might be too busy dealing with content script.
*/ */
/*FIXME: sync*/ rpc protocol PImageBridge intr protocol PImageBridge
{ {
manages PCompositable; manages PCompositable;
manages PGrallocBuffer; manages PGrallocBuffer;

View File

@ -38,8 +38,8 @@ Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority,
#if defined(OS_POSIX) #if defined(OS_POSIX)
header()->num_fds = 0; header()->num_fds = 0;
#endif #endif
header()->rpc_remote_stack_depth_guess = static_cast<uint32_t>(-1); header()->interrupt_remote_stack_depth_guess = static_cast<uint32_t>(-1);
header()->rpc_local_stack_depth = static_cast<uint32_t>(-1); header()->interrupt_local_stack_depth = static_cast<uint32_t>(-1);
header()->seqno = 0; header()->seqno = 0;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
header()->cookie = 0; header()->cookie = 0;

View File

@ -87,8 +87,8 @@ class Message : public Pickle {
} }
// True if this is a synchronous message. // True if this is a synchronous message.
bool is_rpc() const { bool is_interrupt() const {
return (header()->flags & RPC_BIT) != 0; return (header()->flags & INTERRUPT_BIT) != 0;
} }
// True if this is an urgent message. // True if this is an urgent message.
@ -153,22 +153,22 @@ class Message : public Pickle {
header()->routing = new_id; header()->routing = new_id;
} }
uint32_t rpc_remote_stack_depth_guess() const { uint32_t interrupt_remote_stack_depth_guess() const {
return header()->rpc_remote_stack_depth_guess; return header()->interrupt_remote_stack_depth_guess;
} }
void set_rpc_remote_stack_depth_guess(uint32_t depth) { void set_interrupt_remote_stack_depth_guess(uint32_t depth) {
DCHECK(is_rpc()); DCHECK(is_interrupt());
header()->rpc_remote_stack_depth_guess = depth; header()->interrupt_remote_stack_depth_guess = depth;
} }
uint32_t rpc_local_stack_depth() const { uint32_t interrupt_local_stack_depth() const {
return header()->rpc_local_stack_depth; return header()->interrupt_local_stack_depth;
} }
void set_rpc_local_stack_depth(uint32_t depth) { void set_interrupt_local_stack_depth(uint32_t depth) {
DCHECK(is_rpc()); DCHECK(is_interrupt());
header()->rpc_local_stack_depth = depth; header()->interrupt_local_stack_depth = depth;
} }
int32_t seqno() const { int32_t seqno() const {
@ -271,8 +271,8 @@ class Message : public Pickle {
header()->flags |= SYNC_BIT; header()->flags |= SYNC_BIT;
} }
void set_rpc() { void set_interrupt() {
header()->flags |= RPC_BIT; header()->flags |= INTERRUPT_BIT;
} }
void set_urgent() { void set_urgent() {
@ -292,7 +292,7 @@ class Message : public Pickle {
UNBLOCK_BIT = 0x0020, UNBLOCK_BIT = 0x0020,
PUMPING_MSGS_BIT= 0x0040, PUMPING_MSGS_BIT= 0x0040,
HAS_SENT_TIME_BIT = 0x0080, HAS_SENT_TIME_BIT = 0x0080,
RPC_BIT = 0x0100, INTERRUPT_BIT = 0x0100,
COMPRESS_BIT = 0x0200, COMPRESS_BIT = 0x0200,
URGENT_BIT = 0x0400 URGENT_BIT = 0x0400
}; };
@ -308,9 +308,9 @@ class Message : public Pickle {
# endif # endif
#endif #endif
// For RPC messages, a guess at what the *other* side's stack depth is. // 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. // The actual local stack depth.
uint32_t rpc_local_stack_depth; uint32_t interrupt_local_stack_depth;
// Sequence number // Sequence number
int32_t seqno; int32_t seqno;
}; };

View File

@ -53,7 +53,7 @@ MessageChannel::MessageChannel(MessageListener *aListener)
mPendingUrgentReplies(0), mPendingUrgentReplies(0),
mDispatchingSyncMessage(false), mDispatchingSyncMessage(false),
mRemoteStackDepthGuess(false), mRemoteStackDepthGuess(false),
mSawRPCOutMsg(false) mSawInterruptOutMsg(false)
{ {
MOZ_COUNT_CTOR(ipc::MessageChannel); MOZ_COUNT_CTOR(ipc::MessageChannel);
@ -270,7 +270,7 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
if (MaybeInterceptSpecialIOMessage(aMsg)) if (MaybeInterceptSpecialIOMessage(aMsg))
return; 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. // we know that it needs to be immediately handled to unblock us.
if ((AwaitingSyncReply() && aMsg.is_sync()) || if ((AwaitingSyncReply() && aMsg.is_sync()) ||
(AwaitingUrgentReply() && aMsg.is_urgent())) (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 // posting a task to the main event loop, where it will be processed
// once the synchronous reply has been received. // 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. // - Always notify and wake up the main thread.
// //
// (3) We are not waiting on a reply. // (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 // blocked. This is okay, since we always check for pending events before
// blocking again. // blocking again.
// //
if (AwaitingRPCReply() || (AwaitingSyncReply() && aMsg.is_urgent())) { if (AwaitingInterruptReply() || (AwaitingSyncReply() && aMsg.is_urgent())) {
// Always wake up our RPC waiter, and wake up sync waiters for urgent // Always wake up our Interrupt waiter, and wake up sync waiters for urgent
// messages. // messages.
NotifyWorkerThread(); NotifyWorkerThread();
} else { } else {
// Worker thread is either not blocked on a reply, or this is an // 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. // deferred to a later event-loop iteration.
if (!compress) { if (!compress) {
// If we compressed away the previous message, we'll re-use // If we compressed away the previous message, we'll re-use
@ -357,7 +357,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
if (AwaitingSyncReply()) { if (AwaitingSyncReply()) {
// This is a temporary hack in place, for e10s CPOWs, until bug 901789 // 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. // an assert again. See bug 900062 for details.
NS_ERROR("Nested sync messages are not supported"); NS_ERROR("Nested sync messages are not supported");
return false; 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 // At the moment, we don't allow urgent outcalls to nest, though this will
// change soon. // change soon.
IPC_ASSERT(!AwaitingUrgentReply(), "urgent calls cannot nest"); 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"); IPC_ASSERT(!AwaitingSyncReply(), "urgent calls cannot be issued within sync sends");
AutoEnterPendingReply replies(mPendingUrgentReplies); AutoEnterPendingReply replies(mPendingUrgentReplies);
@ -485,11 +485,11 @@ MessageChannel::Call(Message* aMsg, Message* aReply)
{ {
if (aMsg->is_urgent()) if (aMsg->is_urgent())
return UrgentCall(aMsg, aReply); return UrgentCall(aMsg, aReply);
return RPCCall(aMsg, aReply); return InterruptCall(aMsg, aReply);
} }
bool bool
MessageChannel::RPCCall(Message* aMsg, Message* aReply) MessageChannel::InterruptCall(Message* aMsg, Message* aReply)
{ {
AssertWorkerThread(); AssertWorkerThread();
mMonitor->AssertNotCurrentThreadOwns(); mMonitor->AssertNotCurrentThreadOwns();
@ -511,18 +511,18 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
// Sanity checks. // Sanity checks.
IPC_ASSERT(!AwaitingSyncReply() && !AwaitingUrgentReply(), 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, IPC_ASSERT(!DispatchingSyncMessage() || aMsg->priority() == IPC::Message::PRIORITY_HIGH,
"violation of sync handler invariant"); "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); nsAutoPtr<Message> msg(aMsg);
msg->set_seqno(NextSeqno()); msg->set_seqno(NextSeqno());
msg->set_rpc_remote_stack_depth_guess(mRemoteStackDepthGuess); msg->set_interrupt_remote_stack_depth_guess(mRemoteStackDepthGuess);
msg->set_rpc_local_stack_depth(1 + RPCStackDepth()); msg->set_interrupt_local_stack_depth(1 + InterruptStackDepth());
mRPCStack.push(*msg); mInterruptStack.push(*msg);
mLink->SendMessage(msg.forget()); mLink->SendMessage(msg.forget());
while (true) { while (true) {
@ -532,7 +532,7 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
// trying another loop iteration will be futile because // trying another loop iteration will be futile because
// channel state will have been cleared // channel state will have been cleared
if (!Connected()) { if (!Connected()) {
ReportConnectionError("MessageChannel::RPCCall"); ReportConnectionError("MessageChannel::InterruptCall");
return false; return false;
} }
@ -541,12 +541,12 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
MaybeUndeferIncall(); MaybeUndeferIncall();
// Wait for an event to occur. // Wait for an event to occur.
while (!RPCEventOccurred()) { while (!InterruptEventOccurred()) {
bool maybeTimedOut = !WaitForRPCNotify(); bool maybeTimedOut = !WaitForInterruptNotify();
// We might have received a "subtly deferred" message in a nested // We might have received a "subtly deferred" message in a nested
// loop that it's now time to process. // loop that it's now time to process.
if (RPCEventOccurred() || if (InterruptEventOccurred() ||
(!maybeTimedOut && (!mDeferred.empty() || !mOutOfTurnReplies.empty()))) (!maybeTimedOut && (!mDeferred.empty() || !mOutOfTurnReplies.empty())))
{ {
break; break;
@ -562,7 +562,7 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
if (mPendingUrgentRequest) { if (mPendingUrgentRequest) {
recvd = *mPendingUrgentRequest; recvd = *mPendingUrgentRequest;
mPendingUrgentRequest = nullptr; mPendingUrgentRequest = nullptr;
} else if ((it = mOutOfTurnReplies.find(mRPCStack.top().seqno())) } else if ((it = mOutOfTurnReplies.find(mInterruptStack.top().seqno()))
!= mOutOfTurnReplies.end()) != mOutOfTurnReplies.end())
{ {
recvd = it->second; recvd = it->second;
@ -579,8 +579,8 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
continue; continue;
} }
// If the message is not RPC, we can dispatch it as normal. // If the message is not Interrupt, we can dispatch it as normal.
if (!recvd.is_rpc()) { if (!recvd.is_interrupt()) {
// Other side should be blocked. // Other side should be blocked.
IPC_ASSERT(!recvd.is_sync() || mPending.empty(), "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; 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. // call, or add it to the list of out-of-turn replies we've received.
if (recvd.is_reply()) { 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 // If this is not a reply the call we've initiated, add it to our
// out-of-turn replies and keep polling for events. // 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 // Note, In the parent, sequence numbers increase from 0, and
// in the child, they decrease from 0. // 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 // We received a reply to our most recent outstanding call. Pop
// this frame and return the reply. // this frame and return the reply.
mRPCStack.pop(); mInterruptStack.pop();
if (!recvd.is_reply_error()) { if (!recvd.is_reply_error()) {
*aReply = recvd; *aReply = recvd;
@ -631,24 +631,24 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
// If we have no more pending out calls waiting on replies, then // If we have no more pending out calls waiting on replies, then
// the reply queue should be empty. // 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", "still have pending replies with no pending out-calls",
true); true);
return !recvd.is_reply_error(); 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. // own the monitor.
size_t stackDepth = RPCStackDepth(); size_t stackDepth = InterruptStackDepth();
{ {
MonitorAutoUnlock unlock(*mMonitor); MonitorAutoUnlock unlock(*mMonitor);
CxxStackFrame frame(*this, IN_MESSAGE, &recvd); CxxStackFrame frame(*this, IN_MESSAGE, &recvd);
DispatchRPCMessage(recvd, stackDepth); DispatchInterruptMessage(recvd, stackDepth);
} }
if (!Connected()) { if (!Connected()) {
ReportConnectionError("MessageChannel::DispatchRPCMessage"); ReportConnectionError("MessageChannel::DispatchInterruptMessage");
return false; return false;
} }
} }
@ -657,17 +657,17 @@ MessageChannel::RPCCall(Message* aMsg, Message* aReply)
} }
bool bool
MessageChannel::RPCEventOccurred() MessageChannel::InterruptEventOccurred()
{ {
AssertWorkerThread(); AssertWorkerThread();
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
IPC_ASSERT(RPCStackDepth() > 0, "not in wait loop"); IPC_ASSERT(InterruptStackDepth() > 0, "not in wait loop");
return (!Connected() || return (!Connected() ||
!mPending.empty() || !mPending.empty() ||
mPendingUrgentRequest || mPendingUrgentRequest ||
(!mOutOfTurnReplies.empty() && (!mOutOfTurnReplies.empty() &&
mOutOfTurnReplies.find(mRPCStack.top().seqno()) != mOutOfTurnReplies.find(mInterruptStack.top().seqno()) !=
mOutOfTurnReplies.end())); mOutOfTurnReplies.end()));
} }
@ -702,9 +702,9 @@ MessageChannel::OnMaybeDequeueOne()
mPending.pop_front(); mPending.pop_front();
} while (0); } 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 // 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; mOutOfTurnReplies[recvd.seqno()] = recvd;
return false; return false;
} }
@ -721,8 +721,8 @@ MessageChannel::DispatchMessage(const Message &aMsg)
DispatchSyncMessage(aMsg); DispatchSyncMessage(aMsg);
else if (aMsg.is_urgent()) else if (aMsg.is_urgent())
DispatchUrgentMessage(aMsg); DispatchUrgentMessage(aMsg);
else if (aMsg.is_rpc()) else if (aMsg.is_interrupt())
DispatchRPCMessage(aMsg, 0); DispatchInterruptMessage(aMsg, 0);
else else
DispatchAsyncMessage(aMsg); DispatchAsyncMessage(aMsg);
} }
@ -778,7 +778,7 @@ void
MessageChannel::DispatchAsyncMessage(const Message& aMsg) MessageChannel::DispatchAsyncMessage(const Message& aMsg)
{ {
AssertWorkerThread(); 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) { if (aMsg.routing_id() == MSG_ROUTING_NONE) {
NS_RUNTIMEABORT("unhandled special message!"); NS_RUNTIMEABORT("unhandled special message!");
@ -788,34 +788,34 @@ MessageChannel::DispatchAsyncMessage(const Message& aMsg)
} }
void void
MessageChannel::DispatchRPCMessage(const Message& aMsg, size_t stackDepth) MessageChannel::DispatchInterruptMessage(const Message& aMsg, size_t stackDepth)
{ {
AssertWorkerThread(); AssertWorkerThread();
mMonitor->AssertNotCurrentThreadOwns(); 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 // 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. // the other side.
if (aMsg.rpc_remote_stack_depth_guess() != RemoteViewOfStackDepth(stackDepth)) { if (aMsg.interrupt_remote_stack_depth_guess() != RemoteViewOfStackDepth(stackDepth)) {
// RPC in-calls have raced. The winner, if there is one, gets to defer // Interrupt in-calls have raced. The winner, if there is one, gets to defer
// processing of the other side's in-call. // processing of the other side's in-call.
bool defer; bool defer;
const char* winner; const char* winner;
switch (mListener->MediateRPCRace((mSide == ChildSide) ? aMsg : mRPCStack.top(), switch (mListener->MediateInterruptRace((mSide == ChildSide) ? aMsg : mInterruptStack.top(),
(mSide != ChildSide) ? mRPCStack.top() : aMsg)) (mSide != ChildSide) ? mInterruptStack.top() : aMsg))
{ {
case RRPChildWins: case RIPChildWins:
winner = "child"; winner = "child";
defer = (mSide == ChildSide); defer = (mSide == ChildSide);
break; break;
case RRPParentWins: case RIPParentWins:
winner = "parent"; winner = "parent";
defer = (mSide != ChildSide); defer = (mSide != ChildSide);
break; break;
case RRPError: case RIPError:
NS_RUNTIMEABORT("NYI: 'Error' RPC race policy"); NS_RUNTIMEABORT("NYI: 'Error' Interrupt race policy");
return; return;
default: default:
NS_RUNTIMEABORT("not reached"); NS_RUNTIMEABORT("not reached");
@ -852,10 +852,10 @@ MessageChannel::DispatchRPCMessage(const Message& aMsg, size_t stackDepth)
Result rv = mListener->OnCallReceived(aMsg, reply); Result rv = mListener->OnCallReceived(aMsg, reply);
--mRemoteStackDepthGuess; --mRemoteStackDepthGuess;
if (!MaybeHandleError(rv, "DispatchRPCMessage")) { if (!MaybeHandleError(rv, "DispatchInterruptMessage")) {
delete reply; delete reply;
reply = new Message(); reply = new Message();
reply->set_rpc(); reply->set_interrupt();
reply->set_reply(); reply->set_reply();
reply->set_reply_error(); reply->set_reply_error();
} }
@ -875,13 +875,13 @@ MessageChannel::MaybeUndeferIncall()
if (mDeferred.empty()) if (mDeferred.empty())
return; return;
size_t stackDepth = RPCStackDepth(); size_t stackDepth = InterruptStackDepth();
// the other side can only *under*-estimate our actual stack depth // 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"); "fatal logic error");
if (mDeferred.top().rpc_remote_stack_depth_guess() < RemoteViewOfStackDepth(stackDepth)) if (mDeferred.top().interrupt_remote_stack_depth_guess() < RemoteViewOfStackDepth(stackDepth))
return; return;
// maybe time to process this message // maybe time to process this message
@ -896,7 +896,7 @@ MessageChannel::MaybeUndeferIncall()
} }
void void
MessageChannel::FlushPendingRPCQueue() MessageChannel::FlushPendingInterruptQueue()
{ {
AssertWorkerThread(); AssertWorkerThread();
mMonitor->AssertNotCurrentThreadOwns(); mMonitor->AssertNotCurrentThreadOwns();
@ -909,7 +909,7 @@ MessageChannel::FlushPendingRPCQueue()
return; return;
const Message& last = mPending.back(); const Message& last = mPending.back();
if (!last.is_rpc() || last.is_reply()) if (!last.is_interrupt() || last.is_reply())
return; return;
} }
} }
@ -921,11 +921,11 @@ void
MessageChannel::ExitedCxxStack() MessageChannel::ExitedCxxStack()
{ {
mListener->OnExitedCxxStack(); mListener->OnExitedCxxStack();
if (mSawRPCOutMsg) { if (mSawInterruptOutMsg) {
MonitorAutoLock lock(*mMonitor); MonitorAutoLock lock(*mMonitor);
// see long comment in OnMaybeDequeueOne() // see long comment in OnMaybeDequeueOne()
EnqueuePendingMessages(); EnqueuePendingMessages();
mSawRPCOutMsg = false; mSawInterruptOutMsg = false;
} }
} }
@ -990,7 +990,7 @@ MessageChannel::WaitForSyncNotify()
} }
bool bool
MessageChannel::WaitForRPCNotify() MessageChannel::WaitForInterruptNotify()
{ {
return WaitForSyncNotify(); return WaitForSyncNotify();
} }
@ -1030,8 +1030,8 @@ MessageChannel::ShouldContinueFromTimeout()
// tasks arriving from the child, posted to the worker thread's event // tasks arriving from the child, posted to the worker thread's event
// loop. This would complicate cleanup of the *Channel. But since // loop. This would complicate cleanup of the *Channel. But since
// IPDL forbids this (and since it doesn't support children timing out // 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, // on parents), the parent can only block on interrupt messages to the child,
// and in that case arriving async messages are enqueued to the RPC // and in that case arriving async messages are enqueued to the interrupt
// channel's special queue. They're then ignored because the channel // channel's special queue. They're then ignored because the channel
// state changes to ChannelTimeout (i.e. !Connected). // state changes to ChannelTimeout (i.e. !Connected).
SynchronouslyClose(); SynchronouslyClose();
@ -1154,7 +1154,7 @@ MessageChannel::OnChannelErrorFromLink()
AssertLinkThread(); AssertLinkThread();
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
if (RPCStackDepth() > 0) if (InterruptStackDepth() > 0)
NotifyWorkerThread(); NotifyWorkerThread();
if (AwaitingSyncReply()) if (AwaitingSyncReply())
@ -1327,19 +1327,19 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
const char* why, const char* why,
bool reply) const bool reply) const
{ {
printf_stderr("###!!! [RPCChannel][%s][%s:%d] " printf_stderr("###!!! [MessageChannel][%s][%s:%d] "
"Assertion (%s) failed. %s %s\n", "Assertion (%s) failed. %s %s\n",
mSide == ChildSide ? "Child" : "Parent", mSide == ChildSide ? "Child" : "Parent",
file, line, cond, file, line, cond,
why, why,
reply ? "(reply)" : ""); reply ? "(reply)" : "");
// technically we need the mutex for this, but we're dying anyway // technically we need the mutex for this, but we're dying anyway
DumpRPCStack(" "); DumpInterruptStack(" ");
printf_stderr(" remote RPC stack guess: %lu\n", printf_stderr(" remote Interrupt stack guess: %lu\n",
mRemoteStackDepthGuess); mRemoteStackDepthGuess);
printf_stderr(" deferred stack size: %lu\n", printf_stderr(" deferred stack size: %lu\n",
mDeferred.size()); 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()); mOutOfTurnReplies.size());
printf_stderr(" Pending queue size: %lu, front to back:\n", printf_stderr(" Pending queue size: %lu, front to back:\n",
mPending.size()); mPending.size());
@ -1347,7 +1347,7 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
MessageQueue pending = mPending; MessageQueue pending = mPending;
while (!pending.empty()) { while (!pending.empty()) {
printf_stderr(" [ %s%s ]\n", printf_stderr(" [ %s%s ]\n",
pending.front().is_rpc() ? "rpc" : pending.front().is_interrupt() ? "intr" :
(pending.front().is_sync() ? "sync" : "async"), (pending.front().is_sync() ? "sync" : "async"),
pending.front().is_reply() ? "reply" : ""); pending.front().is_reply() ? "reply" : "");
pending.pop_front(); pending.pop_front();
@ -1357,12 +1357,12 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
} }
void void
MessageChannel::DumpRPCStack(const char* const pfx) const MessageChannel::DumpInterruptStack(const char* const pfx) const
{ {
NS_WARN_IF_FALSE(MessageLoop::current() != mWorkerLoop, NS_WARN_IF_FALSE(MessageLoop::current() != mWorkerLoop,
"The worker thread had better be paused in a debugger!"); "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 // print a python-style backtrace, first frame to last
for (uint32_t i = 0; i < mCxxStackFrames.size(); ++i) { for (uint32_t i = 0; i < mCxxStackFrames.size(); ++i) {

View File

@ -88,7 +88,7 @@ class MessageChannel : HasResultCodes
// Synchronously send |msg| (i.e., wait for |reply|) // Synchronously send |msg| (i.e., wait for |reply|)
bool Send(Message* aMsg, Message* aReply); 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); bool Call(Message* aMsg, Message* aReply);
void SetReplyTimeoutMs(int32_t aTimeoutMs); void SetReplyTimeoutMs(int32_t aTimeoutMs);
@ -97,7 +97,7 @@ class MessageChannel : HasResultCodes
return !mCxxStackFrames.empty(); return !mCxxStackFrames.empty();
} }
void FlushPendingRPCQueue(); void FlushPendingInterruptQueue();
// Unsound_IsClosed and Unsound_NumQueuedMessages are safe to call from any // Unsound_IsClosed and Unsound_NumQueuedMessages are safe to call from any
// thread, but they make no guarantees about whether you'll get an // thread, but they make no guarantees about whether you'll get an
@ -122,10 +122,10 @@ class MessageChannel : HasResultCodes
#ifdef OS_WIN #ifdef OS_WIN
struct MOZ_STACK_CLASS SyncStackFrame struct MOZ_STACK_CLASS SyncStackFrame
{ {
SyncStackFrame(MessageChannel* channel, bool rpc); SyncStackFrame(MessageChannel* channel, bool interrupt);
~SyncStackFrame(); ~SyncStackFrame();
bool mRPC; bool mInterrupt;
bool mSpinNestedEvents; bool mSpinNestedEvents;
bool mListenerNotified; bool mListenerNotified;
MessageChannel* mChannel; MessageChannel* mChannel;
@ -154,7 +154,7 @@ class MessageChannel : HasResultCodes
static SyncStackFrame* sStaticTopFrame; static SyncStackFrame* sStaticTopFrame;
public: public:
void ProcessNativeEventsInRPCCall(); void ProcessNativeEventsInInterruptCall();
static void NotifyGeckoEventDispatch(); static void NotifyGeckoEventDispatch();
private: private:
@ -189,10 +189,10 @@ class MessageChannel : HasResultCodes
// up to process urgent calls from the parent. // up to process urgent calls from the parent.
bool SendAndWait(Message* aMsg, Message* aReply); 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 UrgentCall(Message* aMsg, Message* aReply);
bool RPCEventOccurred(); bool InterruptEventOccurred();
void MaybeUndeferIncall(); void MaybeUndeferIncall();
void EnqueuePendingMessages(); void EnqueuePendingMessages();
@ -208,7 +208,7 @@ class MessageChannel : HasResultCodes
void DispatchSyncMessage(const Message &aMsg); void DispatchSyncMessage(const Message &aMsg);
void DispatchUrgentMessage(const Message &aMsg); void DispatchUrgentMessage(const Message &aMsg);
void DispatchAsyncMessage(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. // 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, // So in sum: true is a meaningful return value; false isn't,
// necessarily. // necessarily.
bool WaitForSyncNotify(); bool WaitForSyncNotify();
bool WaitForRPCNotify(); bool WaitForInterruptNotify();
bool WaitResponse(bool aWaitTimedOut); bool WaitResponse(bool aWaitTimedOut);
@ -229,7 +229,7 @@ class MessageChannel : HasResultCodes
// The "remote view of stack depth" can be different than the // The "remote view of stack depth" can be different than the
// actual stack depth when there are out-of-turn replies. When we // 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 // the other side (that sent the reply) thinks it has. So, the
// "view" returned here is |stackDepth| minus the number of // "view" returned here is |stackDepth| minus the number of
// out-of-turn replies. // out-of-turn replies.
@ -247,8 +247,7 @@ class MessageChannel : HasResultCodes
// This helper class manages mCxxStackDepth on behalf of MessageChannel. // This helper class manages mCxxStackDepth on behalf of MessageChannel.
// When the stack depth is incremented from zero to non-zero, it invokes // When the stack depth is incremented from zero to non-zero, it invokes
// an RPCChannel callback, and similarly for when the depth goes from // a callback, and similarly for when the depth goes from non-zero to zero.
// non-zero to zero.
void EnteredCxxStack() { void EnteredCxxStack() {
mListener->OnEnteredCxxStack(); mListener->OnEnteredCxxStack();
} }
@ -268,16 +267,16 @@ class MessageChannel : HasResultCodes
} }
enum Direction { IN_MESSAGE, OUT_MESSAGE }; enum Direction { IN_MESSAGE, OUT_MESSAGE };
struct RPCFrame { struct InterruptFrame {
RPCFrame(Direction direction, const Message* msg) InterruptFrame(Direction direction, const Message* msg)
: mDirection(direction), mMsg(msg) : mDirection(direction), mMsg(msg)
{ } { }
bool IsRPCIncall() const { bool IsInterruptIncall() const {
return mMsg->is_rpc() && IN_MESSAGE == mDirection; return mMsg->is_interrupt() && IN_MESSAGE == mDirection;
} }
bool IsRPCOutcall() const { bool IsInterruptOutcall() const {
return mMsg->is_rpc() && OUT_MESSAGE == mDirection; return mMsg->is_interrupt() && OUT_MESSAGE == mDirection;
} }
void Describe(int32_t* id, const char** dir, const char** sems, void Describe(int32_t* id, const char** dir, const char** sems,
@ -285,7 +284,7 @@ class MessageChannel : HasResultCodes
{ {
*id = mMsg->routing_id(); *id = mMsg->routing_id();
*dir = (IN_MESSAGE == mDirection) ? "in" : "out"; *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(); *name = mMsg->name();
} }
@ -304,17 +303,17 @@ class MessageChannel : HasResultCodes
if (mThat.mCxxStackFrames.empty()) if (mThat.mCxxStackFrames.empty())
mThat.EnteredCxxStack(); mThat.EnteredCxxStack();
mThat.mCxxStackFrames.push_back(RPCFrame(direction, msg)); mThat.mCxxStackFrames.push_back(InterruptFrame(direction, msg));
const RPCFrame& frame = mThat.mCxxStackFrames.back(); const InterruptFrame& frame = mThat.mCxxStackFrames.back();
if (frame.IsRPCIncall()) if (frame.IsInterruptIncall())
mThat.EnteredCall(); mThat.EnteredCall();
mThat.mSawRPCOutMsg |= frame.IsRPCOutcall(); mThat.mSawInterruptOutMsg |= frame.IsInterruptOutcall();
} }
~CxxStackFrame() { ~CxxStackFrame() {
bool exitingCall = mThat.mCxxStackFrames.back().IsRPCIncall(); bool exitingCall = mThat.mCxxStackFrames.back().IsInterruptIncall();
mThat.mCxxStackFrames.pop_back(); mThat.mCxxStackFrames.pop_back();
bool exitingStack = mThat.mCxxStackFrames.empty(); 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 // This method is only safe to call on the worker thread, or in a
// debugger with all threads paused. // debugger with all threads paused.
void DumpRPCStack(const char* const pfx="") const; void DumpInterruptStack(const char* const pfx="") const;
private: private:
// Called from both threads // Called from both threads
size_t RPCStackDepth() const { size_t InterruptStackDepth() const {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
return mRPCStack.size(); return mInterruptStack.size();
} }
// Returns true if we're blocking waiting for a reply. // Returns true if we're blocking waiting for a reply.
@ -363,9 +362,9 @@ class MessageChannel : HasResultCodes
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
return mPendingUrgentReplies > 0; return mPendingUrgentReplies > 0;
} }
bool AwaitingRPCReply() const { bool AwaitingInterruptReply() const {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
return !mRPCStack.empty(); return !mInterruptStack.empty();
} }
// Returns true if we're dispatching a sync message's callback. // Returns true if we're dispatching a sync message's callback.
@ -517,8 +516,8 @@ class MessageChannel : HasResultCodes
// //
// |A<| be an async in-message, // |A<| be an async in-message,
// |S<| be a sync in-message, // |S<| be a sync in-message,
// |C<| be an RPC in-call, // |C<| be an Interrupt in-call,
// |R<| be an RPC reply. // |R<| be an Interrupt reply.
// //
// The queue can only match this configuration // 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 // and thus can't send us any more messages until we process the sync
// in-msg. // 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 // (There's a subtlety here: this in-call might have raced with an
// out-call, but we detect that with the mechanism below, // out-call, but we detect that with the mechanism below,
// |mRemoteStackDepth|, and races don't matter to the queue.) // |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. // then other side "finished with us," and went back to its own business.
// That business might have included sending any number of async message // That business might have included sending any number of async message
// |A<*| until sending a blocking message |(S< | C<)|. If we had more than // |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. // another blocking message, because it's blocked on a reply from us.
// //
MessageQueue mPending; MessageQueue mPending;
@ -551,12 +550,12 @@ class MessageChannel : HasResultCodes
// Each stack refers to a different protocol and the stacks are mutually // Each stack refers to a different protocol and the stacks are mutually
// exclusive: multiple outcalls of the same kind cannot be initiated while // exclusive: multiple outcalls of the same kind cannot be initiated while
// another is active. // 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 // This is what we think the Interrupt stack depth is on the "other side" of this
// RPC channel. We maintain this variable so that we can detect racy RPC // Interrupt channel. We maintain this variable so that we can detect racy Interrupt
// calls. With each RPC out-call sent, we send along what *we* think the // 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 RPC call. // 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 // After sending the out-call, our stack depth is "incremented" by pushing
// that pending message onto mPending. // 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 // 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 // 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 // We then increment mRemoteStackDepth *just before* processing the
// in-call, since we know the other side is waiting on it, and decrement // 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 // This member is only accessed on the worker thread, and so is not
// protected by mMonitor. It is managed exclusively by the helper // protected by mMonitor. It is managed exclusively by the helper
// |class CxxStackFrame|. // |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. // 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 // in-calls racing with replies to outstanding in-calls. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=521929. // https://bugzilla.mozilla.org/show_bug.cgi?id=521929.
MessageMap mOutOfTurnReplies; 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. // conditions.
std::stack<Message> mDeferred; std::stack<Message> mDeferred;

View File

@ -48,11 +48,11 @@ enum ChannelState {
ChannelError ChannelError
}; };
// What happens if RPC calls race? // What happens if Interrupt calls race?
enum RacyRPCPolicy { enum RacyInterruptPolicy {
RRPError, RIPError,
RRPChildWins, RIPChildWins,
RRPParentWins RIPParentWins
}; };
class MessageListener class MessageListener
@ -87,13 +87,13 @@ class MessageListener
virtual void OnExitedCall() { virtual void OnExitedCall() {
NS_RUNTIMEABORT("default impl shouldn't be invoked"); NS_RUNTIMEABORT("default impl shouldn't be invoked");
} }
virtual RacyRPCPolicy MediateRPCRace(const Message& parent, virtual RacyInterruptPolicy MediateInterruptRace(const Message& parent,
const Message& child) const Message& child)
{ {
return RRPChildWins; return RIPChildWins;
} }
virtual void ProcessRemoteNativeEventsInRPCCall() { virtual void ProcessRemoteNativeEventsInInterruptCall() {
} }
// FIXME/bug 792652: this doesn't really belong here, but a // FIXME/bug 792652: this doesn't really belong here, but a

View File

@ -61,8 +61,8 @@ using namespace mozilla::ipc::windows;
* in a special window procedure where we can either ignore the message or * in a special window procedure where we can either ignore the message or
* process it in some fashion. * process it in some fashion.
* *
* Queued and "non-queued" messages will be processed during RPC calls if * Queued and "non-queued" messages will be processed during Interrupt calls if
* modal UI related api calls block an RPC in-call in the child. To prevent * 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 * windows from freezing, and to allow concurrent processing of critical
* events (such as painting), we spin a native event dispatch loop while * events (such as painting), we spin a native event dispatch loop while
* these in-calls are blocked. * these in-calls are blocked.
@ -587,8 +587,8 @@ TimeoutHasExpired(const TimeoutData& aData)
} // anonymous namespace } // anonymous namespace
MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool rpc) MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool interrupt)
: mRPC(rpc) : mInterrupt(interrupt)
, mSpinNestedEvents(false) , mSpinNestedEvents(false)
, mListenerNotified(false) , mListenerNotified(false)
, mChannel(channel) , mChannel(channel)
@ -608,9 +608,9 @@ MessageChannel::SyncStackFrame::SyncStackFrame(MessageChannel* channel, bool rpc
MessageChannel::SyncStackFrame::~SyncStackFrame() MessageChannel::SyncStackFrame::~SyncStackFrame()
{ {
NS_ASSERTION(this == mChannel->mTopFrame, NS_ASSERTION(this == mChannel->mTopFrame,
"Mismatched RPC stack frames"); "Mismatched interrupt stack frames");
NS_ASSERTION(this == sStaticTopFrame, NS_ASSERTION(this == sStaticTopFrame,
"Mismatched static RPC stack frames"); "Mismatched static Interrupt stack frames");
mChannel->mTopFrame = mPrev; mChannel->mTopFrame = mPrev;
sStaticTopFrame = mStaticPrev; sStaticTopFrame = mStaticPrev;
@ -625,28 +625,28 @@ MessageChannel::SyncStackFrame::~SyncStackFrame()
MessageChannel::SyncStackFrame* MessageChannel::sStaticTopFrame; MessageChannel::SyncStackFrame* MessageChannel::sStaticTopFrame;
// nsAppShell's notification that gecko events are being processed. // 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 // a nested gecko event loop. In which case the remote process needs
// to know about it. // to know about it.
void /* static */ void /* static */
MessageChannel::NotifyGeckoEventDispatch() MessageChannel::NotifyGeckoEventDispatch()
{ {
// sStaticTopFrame is only valid for RPC channels // sStaticTopFrame is only valid for Interrupt channels
if (!sStaticTopFrame || sStaticTopFrame->mListenerNotified) if (!sStaticTopFrame || sStaticTopFrame->mListenerNotified)
return; return;
sStaticTopFrame->mListenerNotified = true; sStaticTopFrame->mListenerNotified = true;
MessageChannel* channel = static_cast<MessageChannel*>(sStaticTopFrame->mChannel); MessageChannel* channel = static_cast<MessageChannel*>(sStaticTopFrame->mChannel);
channel->Listener()->ProcessRemoteNativeEventsInRPCCall(); channel->Listener()->ProcessRemoteNativeEventsInInterruptCall();
} }
// invoked by the module that receives the spin event loop // invoked by the module that receives the spin event loop
// message. // message.
void void
MessageChannel::ProcessNativeEventsInRPCCall() MessageChannel::ProcessNativeEventsInInterruptCall()
{ {
if (!mTopFrame) { if (!mTopFrame) {
NS_ERROR("Spin logic error: no RPC frame"); NS_ERROR("Spin logic error: no Interrupt frame");
return; return;
} }
@ -655,9 +655,9 @@ MessageChannel::ProcessNativeEventsInRPCCall()
// Spin loop is called in place of WaitFor*Notify when modal ui is being shown // 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 // in a child. There are some intricacies in using it however. Spin loop is
// enabled for a particular RPC frame by the client calling // enabled for a particular Interrupt frame by the client calling
// MessageChannel::ProcessNativeEventsInRPCCall(). // MessageChannel::ProcessNativeEventsInInterrupt().
// This call can be nested for multiple RPC frames in a single plugin or // This call can be nested for multiple Interrupt frames in a single plugin or
// multiple unrelated plugins. // multiple unrelated plugins.
void void
MessageChannel::SpinInternalEventLoop() MessageChannel::SpinInternalEventLoop()
@ -722,7 +722,7 @@ MessageChannel::WaitForSyncNotify()
// Initialize global objects used in deferred messaging. // Initialize global objects used in deferred messaging.
Init(); Init();
NS_ASSERTION(mTopFrame && !mTopFrame->mRPC, NS_ASSERTION(mTopFrame && !mTopFrame->mInterrupt,
"Top frame is not a sync frame!"); "Top frame is not a sync frame!");
MonitorAutoUnlock unlock(*mMonitor); MonitorAutoUnlock unlock(*mMonitor);
@ -837,11 +837,11 @@ MessageChannel::WaitForSyncNotify()
} }
bool bool
MessageChannel::WaitForRPCNotify() MessageChannel::WaitForInterruptNotify()
{ {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
if (!RPCStackDepth()) { if (!InterruptStackDepth()) {
// There is currently no way to recover from this condition. // There is currently no way to recover from this condition.
NS_RUNTIMEABORT("StackDepth() is 0 in call to MessageChannel::WaitForNotify!"); NS_RUNTIMEABORT("StackDepth() is 0 in call to MessageChannel::WaitForNotify!");
} }
@ -849,7 +849,7 @@ MessageChannel::WaitForRPCNotify()
// Initialize global objects used in deferred messaging. // Initialize global objects used in deferred messaging.
Init(); Init();
NS_ASSERTION(mTopFrame && mTopFrame->mRPC, NS_ASSERTION(mTopFrame && mTopFrame->mInterrupt,
"Top frame is not a sync frame!"); "Top frame is not a sync frame!");
MonitorAutoUnlock unlock(*mMonitor); MonitorAutoUnlock unlock(*mMonitor);

View File

@ -197,8 +197,8 @@ class ASYNC:
def __hash__(cls): return hash(cls.pretty) def __hash__(cls): return hash(cls.pretty)
@classmethod @classmethod
def __str__(cls): return cls.pretty def __str__(cls): return cls.pretty
class RPC: class INTR:
pretty = 'rpc' pretty = 'intr'
@classmethod @classmethod
def __hash__(cls): return hash(cls.pretty) def __hash__(cls): return hash(cls.pretty)
@classmethod @classmethod
@ -242,11 +242,11 @@ class OUT:
_prettyTable = { _prettyTable = {
IN : { 'async': 'AsyncRecv', IN : { 'async': 'AsyncRecv',
'sync': 'SyncRecv', 'sync': 'SyncRecv',
'rpc': 'RpcAnswer', 'intr': 'IntrAnswer',
'urgent': 'UrgentAnswer' }, 'urgent': 'UrgentAnswer' },
OUT : { 'async': 'AsyncSend', OUT : { 'async': 'AsyncSend',
'sync': 'SyncSend', 'sync': 'SyncSend',
'rpc': 'RpcCall', 'intr': 'IntrCall',
'urgent': 'UrgentCall' } 'urgent': 'UrgentCall' }
# inout doesn't make sense here # inout doesn't make sense here
} }
@ -332,7 +332,7 @@ class MessageDecl(Node):
self.outParams += outParamsList self.outParams += outParamsList
def hasReply(self): 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): class Transition(Node):
def __init__(self, loc, trigger, msg, toStates): def __init__(self, loc, trigger, msg, toStates):

View File

@ -5,7 +5,7 @@
import os, sys import os, sys
from ipdl.ast import Visitor 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: class CodePrinter:
def __init__(self, outf=sys.stdout, indentCols=4): def __init__(self, outf=sys.stdout, indentCols=4):

View File

@ -277,13 +277,13 @@ def _putInNamespaces(cxxthing, namespaces):
def _sendPrefix(msgtype): def _sendPrefix(msgtype):
"""Prefix of the name of the C++ method that sends |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 'Call'
return 'Send' return 'Send'
def _recvPrefix(msgtype): def _recvPrefix(msgtype):
"""Prefix of the name of the C++ method that handles |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 'Answer'
return 'Recv' return 'Recv'
@ -2884,7 +2884,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ExprCall(ExprSelect(p.channelVar(), '.', 'Close')))) ExprCall(ExprSelect(p.channelVar(), '.', 'Close'))))
self.cls.addstmts([ closemeth, Whitespace.NL ]) self.cls.addstmts([ closemeth, Whitespace.NL ])
if ptype.talksSync() or ptype.talksRpc(): if ptype.talksSync() or ptype.talksInterrupt():
# SetReplyTimeoutMs() # SetReplyTimeoutMs()
timeoutvar = ExprVar('aTimeoutMs') timeoutvar = ExprVar('aTimeoutMs')
settimeout = MethodDefn(MethodDecl( settimeout = MethodDefn(MethodDecl(
@ -2955,8 +2955,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
self.asyncSwitch = StmtSwitch(msgtype) self.asyncSwitch = StmtSwitch(msgtype)
if toplevel.talksSync(): if toplevel.talksSync():
self.syncSwitch = StmtSwitch(msgtype) self.syncSwitch = StmtSwitch(msgtype)
if toplevel.talksRpc(): if toplevel.talksInterrupt():
self.rpcSwitch = StmtSwitch(msgtype) self.interruptSwitch = StmtSwitch(msgtype)
# implement Send*() methods and add dispatcher cases to # implement Send*() methods and add dispatcher cases to
# message switch()es # message switch()es
@ -2974,8 +2974,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
self.asyncSwitch.addcase(DefaultLabel(), default) self.asyncSwitch.addcase(DefaultLabel(), default)
if toplevel.talksSync(): if toplevel.talksSync():
self.syncSwitch.addcase(DefaultLabel(), default) self.syncSwitch.addcase(DefaultLabel(), default)
if toplevel.talksRpc(): if toplevel.talksInterrupt():
self.rpcSwitch.addcase(DefaultLabel(), default) self.interruptSwitch.addcase(DefaultLabel(), default)
# FIXME/bug 535053: only manager protocols and non-manager # FIXME/bug 535053: only manager protocols and non-manager
# protocols with union types need Lookup(). we'll give it to # 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 ]) 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 # messages that are received that are not a reply to the original message
if ptype.hasReentrantDelete: if ptype.hasReentrantDelete:
msgVar = ExprVar(params[0].name) msgVar = ExprVar(params[0].name)
@ -3031,7 +3031,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ExprBinary( ExprBinary(
ExprBinary(ExprCall(ExprSelect(msgVar, '.', 'is_reply')), '!=', ExprLiteral.TRUE), 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'), ifdying.addifstmts([_fatalError('incoming message racing with actor deletion'),
StmtReturn(_Result.Processed)]) StmtReturn(_Result.Processed)])
method.addstmt(ifdying) method.addstmt(ifdying)
@ -3051,8 +3051,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
hasReply=0, dispatches=dispatches), hasReply=0, dispatches=dispatches),
Whitespace.NL Whitespace.NL
]) ])
if not toplevel.talksRpc(): if not toplevel.talksInterrupt():
self.rpcSwitch = None self.interruptSwitch = None
if not toplevel.talksSync(): if not toplevel.talksSync():
self.syncSwitch = None self.syncSwitch = None
self.cls.addstmts([ self.cls.addstmts([
@ -3061,7 +3061,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
Whitespace.NL Whitespace.NL
]) ])
self.cls.addstmts([ self.cls.addstmts([
makeHandlerMethod('OnCallReceived', self.rpcSwitch, makeHandlerMethod('OnCallReceived', self.interruptSwitch,
hasReply=1, dispatches=dispatches), hasReply=1, dispatches=dispatches),
Whitespace.NL Whitespace.NL
]) ])
@ -3090,7 +3090,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
self.cls.addstmts([ gettypetag, Whitespace.NL ]) self.cls.addstmts([ gettypetag, Whitespace.NL ])
# OnReplyTimeout() # OnReplyTimeout()
if toplevel.talksSync() or toplevel.talksRpc(): if toplevel.talksSync() or toplevel.talksInterrupt():
ontimeout = MethodDefn( ontimeout = MethodDefn(
MethodDecl('OnReplyTimeout', ret=Type.BOOL)) MethodDecl('OnReplyTimeout', ret=Type.BOOL))
@ -3129,10 +3129,10 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
onstack.addstmt(StmtReturn(ExprCall( onstack.addstmt(StmtReturn(ExprCall(
ExprSelect(p.channelVar(), '.', p.onCxxStackVar().name)))) ExprSelect(p.channelVar(), '.', p.onCxxStackVar().name))))
# void ProcessIncomingRacingRPCCall # void ProcessIncomingRacingInterruptCall
processincoming = MethodDefn( processincoming = MethodDefn(
MethodDecl('FlushPendingRPCQueue', ret=Type.VOID)) MethodDecl('FlushPendingInterruptQueue', ret=Type.VOID))
processincoming.addstmt(StmtExpr(ExprCall(ExprSelect(_actorChannel(ExprVar.THIS), '.', 'FlushPendingRPCQueue')))) processincoming.addstmt(StmtExpr(ExprCall(ExprSelect(_actorChannel(ExprVar.THIS), '.', 'FlushPendingInterruptQueue'))))
self.cls.addstmts([ onentered, onexited, self.cls.addstmts([ onentered, onexited,
onenteredcall, onexitedcall, onenteredcall, onexitedcall,
@ -3178,16 +3178,16 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
# User-facing shmem methods # User-facing shmem methods
self.cls.addstmts(self.makeShmemIface()) self.cls.addstmts(self.makeShmemIface())
if (ptype.isToplevel() and ptype.talksRpc()): if (ptype.isToplevel() and ptype.talksInterrupt()):
processnative = MethodDefn( processnative = MethodDefn(
MethodDecl('ProcessNativeEventsInRPCCall', ret=Type.VOID)) MethodDecl('ProcessNativeEventsInInterruptCall', ret=Type.VOID))
processnative.addstmts([ processnative.addstmts([
CppDirective('ifdef', 'OS_WIN'), CppDirective('ifdef', 'OS_WIN'),
StmtExpr(ExprCall( StmtExpr(ExprCall(
ExprSelect(p.channelVar(), '.', ExprSelect(p.channelVar(), '.',
'ProcessNativeEventsInRPCCall'))), 'ProcessNativeEventsInInterruptCall'))),
CppDirective('else'), CppDirective('else'),
_runtimeAbort('This method is Windows-only'), _runtimeAbort('This method is Windows-only'),
CppDirective('endif'), CppDirective('endif'),
@ -4640,8 +4640,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
self.asyncSwitch.addcase(lbl, case) self.asyncSwitch.addcase(lbl, case)
elif sems is ipdl.ast.SYNC: elif sems is ipdl.ast.SYNC:
self.syncSwitch.addcase(lbl, case) self.syncSwitch.addcase(lbl, case)
elif sems is ipdl.ast.RPC or sems is ipdl.ast.URGENT: elif sems is ipdl.ast.INTR or sems is ipdl.ast.URGENT:
self.rpcSwitch.addcase(lbl, case) self.interruptSwitch.addcase(lbl, case)
else: assert 0 else: assert 0
if self.sendsMessage(md): if self.sendsMessage(md):
@ -5038,9 +5038,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
elif md.decl.type.isUrgent(): elif md.decl.type.isUrgent():
stmts.append(StmtExpr(ExprCall( stmts.append(StmtExpr(ExprCall(
ExprSelect(var, '->', 'set_urgent')))) ExprSelect(var, '->', 'set_urgent'))))
elif md.decl.type.isRpc(): elif md.decl.type.isInterrupt():
stmts.append(StmtExpr(ExprCall( stmts.append(StmtExpr(ExprCall(
ExprSelect(var, '->', 'set_rpc')))) ExprSelect(var, '->', 'set_interrupt'))))
if reply: if reply:
stmts.append(StmtExpr(ExprCall( stmts.append(StmtExpr(ExprCall(

View File

@ -126,6 +126,7 @@ reserved = set((
'delete', # reserve 'delete' to prevent its use 'delete', # reserve 'delete' to prevent its use
'goto', 'goto',
'include', 'include',
'intr',
'manager', 'manager',
'manages', 'manages',
'namespace', 'namespace',
@ -136,7 +137,6 @@ reserved = set((
'protocol', 'protocol',
'recv', 'recv',
'returns', 'returns',
'rpc',
'send', 'send',
'spawns', 'spawns',
'start', 'start',
@ -216,6 +216,7 @@ def p_TranslationUnit(p):
tu.namespaces = tu.protocol.namespaces tu.namespaces = tu.protocol.namespaces
tu.name = tu.protocol.name tu.name = tu.protocol.name
else: else:
print tu.filetype
assert tu.filetype == 'header' assert tu.filetype == 'header'
# There's not really a canonical "thing" in headers. So # There's not really a canonical "thing" in headers. So
# somewhat arbitrarily use the namespace of the last # somewhat arbitrarily use the namespace of the last
@ -605,12 +606,12 @@ def p_OptionalSendSemanticsQual(p):
def p_SendSemanticsQual(p): def p_SendSemanticsQual(p):
"""SendSemanticsQual : ASYNC """SendSemanticsQual : ASYNC
| RPC | INTR
| URGENT | URGENT
| SYNC""" | SYNC"""
s = p[1] s = p[1]
if 'async' == s: p[0] = ASYNC 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 'sync' == s: p[0] = SYNC
elif 'urgent' == s: p[0] = URGENT elif 'urgent' == s: p[0] = URGENT
else: else:

View File

@ -5,7 +5,9 @@
import os, sys 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 import ipdl.builtin as builtin
_DELETE_MSG = '__delete__' _DELETE_MSG = '__delete__'
@ -204,18 +206,18 @@ class IPDLType(Type):
def isAsync(self): return self.sendSemantics is ASYNC def isAsync(self): return self.sendSemantics is ASYNC
def isSync(self): return self.sendSemantics is SYNC 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 isUrgent(self): return self.sendSemantics is URGENT
def talksAsync(self): return True def talksAsync(self): return True
def talksSync(self): return self.isSync() or self.isRpc() def talksSync(self): return self.isSync() or self.isInterrupt()
def talksRpc(self): return self.isRpc() 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): def needsMoreJuiceThan(self, o):
return (o.isAsync() and not self.isAsync() return (o.isAsync() and not self.isAsync()
or o.isSync() and self.isRpc()) or o.isSync() and self.isInterrupt())
class StateType(IPDLType): class StateType(IPDLType):
def __init__(self, protocol, name, start=False): def __init__(self, protocol, name, start=False):
@ -871,7 +873,7 @@ class GatherDecls(TcheckVisitor):
"destructor declaration `%s(...)' required for managed protocol `%s'", "destructor declaration `%s(...)' required for managed protocol `%s'",
_DELETE_MSG, p.name) _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: for managed in p.managesStmts:
mgdname = managed.name mgdname = managed.name
@ -1497,13 +1499,13 @@ class CheckTypes(TcheckVisitor):
loc = t.loc loc = t.loc
impliedDirection, impliedSems = { impliedDirection, impliedSems = {
SEND: [ OUT, _YNC ], RECV: [ IN, _YNC ], SEND: [ OUT, _YNC ], RECV: [ IN, _YNC ],
CALL: [ OUT, RPC ], ANSWER: [ IN, RPC ], CALL: [ OUT, INTR ], ANSWER: [ IN, INTR ],
} [t.trigger] } [t.trigger]
if (OUT is impliedDirection and t.msg.type.isIn() if (OUT is impliedDirection and t.msg.type.isIn()
or IN is impliedDirection and t.msg.type.isOut() or IN is impliedDirection and t.msg.type.isOut()
or _YNC is impliedSems and t.msg.type.isRpc() or _YNC is impliedSems and t.msg.type.isInterrupt()
or RPC is impliedSems and (not t.msg.type.isRpc())): or INTR is impliedSems and (not t.msg.type.isInterrupt())):
mtype = t.msg.type mtype = t.msg.type
self.error( self.error(

View File

@ -18,12 +18,12 @@ IPDLTESTS = \
TestMultiMgrs \ TestMultiMgrs \
TestNestedLoops \ TestNestedLoops \
TestOpens \ TestOpens \
TestRPCErrorCleanup \ TestInterruptErrorCleanup \
TestRPCRaces \ TestInterruptRaces \
TestRPCShutdownRace \ TestInterruptShutdownRace \
TestRaceDeferral \ TestRaceDeferral \
TestRacyReentry \ TestRacyReentry \
TestRacyRPCReplies \ TestRacyInterruptReplies \
TestRacyUndefer \ TestRacyUndefer \
TestSanity \ TestSanity \
TestSelfManageRoot \ TestSelfManageRoot \

View File

@ -6,7 +6,7 @@ namespace _ipdltest {
// Test that a parent sending a reentrant __delete__ message // Test that a parent sending a reentrant __delete__ message
// is not killed if a child's message races with the reply. // is not killed if a child's message races with the reply.
rpc protocol PTestBadActor { intr protocol PTestBadActor {
manages PTestBadActorSub; manages PTestBadActorSub;
child: child:

View File

@ -3,11 +3,11 @@ include protocol PTestBadActor;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestBadActorSub { intr protocol PTestBadActorSub {
manager PTestBadActor; manager PTestBadActor;
child: child:
rpc __delete__(); intr __delete__();
parent: parent:
Ping(); Ping();

View File

@ -6,17 +6,17 @@ namespace _ipdltest {
// (Bridge protocols can have different semantics than the endpoints // (Bridge protocols can have different semantics than the endpoints
// they bridge) // they bridge)
rpc protocol PTestBridgeMainSub { intr protocol PTestBridgeMainSub {
bridges PTestBridgeMain, PTestBridgeSub; bridges PTestBridgeMain, PTestBridgeSub;
child: child:
Hi(); Hi();
rpc HiRpc(); intr HiRpc();
parent: parent:
Hello(); Hello();
sync HelloSync(); sync HelloSync();
rpc HelloRpc(); intr HelloRpc();
__delete__(); __delete__();
state START: recv Hello goto HI; state START: recv Hello goto HI;

View File

@ -7,9 +7,9 @@ namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
// NB: needs to be RPC so that the parent blocks on the child's crash. // NB: needs to be RPC so that the parent blocks on the child's crash.
rpc protocol PTestCrashCleanup { intr protocol PTestCrashCleanup {
child: child:
rpc DIEDIEDIE(); intr DIEDIEDIE();
__delete__(); __delete__();
state ALIVE: state ALIVE:

View File

@ -4,10 +4,10 @@ include protocol PTestDescSubsub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestDesc { intr protocol PTestDesc {
manages PTestDescSub; manages PTestDescSub;
child: child:
rpc PTestDescSub(nullable PTestDescSubsub dummy); intr PTestDescSub(nullable PTestDescSubsub dummy);
Test(PTestDescSubsub a); Test(PTestDescSubsub a);

View File

@ -4,14 +4,14 @@ include protocol PTestDescSubsub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestDescSub { intr protocol PTestDescSub {
manager PTestDesc; manager PTestDesc;
manages PTestDescSubsub; manages PTestDescSubsub;
child: child:
__delete__(); __delete__();
rpc PTestDescSubsub(); intr PTestDescSubsub();
}; };
} }

View File

@ -4,11 +4,11 @@ include protocol PTestDescSub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestDescSubsub { intr protocol PTestDescSubsub {
manager PTestDescSub; manager PTestDescSub;
child: child:
rpc __delete__(); intr __delete__();
}; };
} }

View File

@ -3,10 +3,10 @@ include protocol PTestFailedCtorSub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestFailedCtor { intr protocol PTestFailedCtor {
manages PTestFailedCtorSub; manages PTestFailedCtorSub;
child: child:
rpc PTestFailedCtorSub(); intr PTestFailedCtorSub();
__delete__(); __delete__();
state CONSTRUCT: state CONSTRUCT:

View File

@ -4,7 +4,7 @@ include protocol PTestFailedCtorSubsub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestFailedCtorSub { intr protocol PTestFailedCtorSub {
manager PTestFailedCtor; manager PTestFailedCtor;
manages PTestFailedCtorSubsub; manages PTestFailedCtorSubsub;

View File

@ -4,7 +4,7 @@ include protocol PTestFailedCtorSub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestFailedCtorSubsub { intr protocol PTestFailedCtorSubsub {
manager PTestFailedCtorSub; manager PTestFailedCtorSub;
parent: parent:

View File

@ -2,16 +2,16 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestHangs { intr protocol PTestHangs {
both: both:
rpc StackFrame(); intr StackFrame();
parent: parent:
async Nonce(); async Nonce();
child: child:
async Start(); async Start();
rpc Hang(); intr Hang();
__delete__(); __delete__();

View File

@ -1,10 +1,10 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRPCErrorCleanup { intr protocol PTestInterruptErrorCleanup {
child: child:
rpc Error(); intr Error();
rpc __delete__(); intr __delete__();
}; };
} // namespace _ipdltest } // namespace _ipdltest

View File

@ -1,28 +1,28 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRPCRaces { intr protocol PTestInterruptRaces {
both: both:
rpc Race() returns (bool hasReply); intr Race() returns (bool hasReply);
rpc StackFrame() returns (); intr StackFrame() returns ();
rpc StackFrame3() returns (); intr StackFrame3() returns ();
parent: parent:
sync StartRace(); sync StartRace();
rpc Parent(); intr Parent();
sync GetAnsweredParent() returns (bool answeredParent); sync GetAnsweredParent() returns (bool answeredParent);
child: child:
Start(); Start();
Wakeup(); Wakeup();
Wakeup3(); Wakeup3();
rpc Child(); intr Child();
__delete__(); __delete__();
state START: state START:
send Start goto TEST1; 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: state TEST1:
recv StartRace goto RACE1; recv StartRace goto RACE1;
state RACE1: state RACE1:
@ -33,7 +33,7 @@ state DUMMY1_1:
state DUMMY1_2: state DUMMY1_2:
call Race goto TEST2; 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: state TEST2:
call StackFrame goto MORESTACK; call StackFrame goto MORESTACK;
state MORESTACK: state MORESTACK:

View File

@ -1,14 +1,14 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRPCShutdownRace { intr protocol PTestInterruptShutdownRace {
parent: parent:
sync StartDeath(); sync StartDeath();
async Orphan(); async Orphan();
child: child:
async Start(); async Start();
rpc Exit(); intr Exit();
async __delete__(); async __delete__();
state START: state START:

View File

@ -3,17 +3,17 @@ namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestLatency { intr protocol PTestLatency {
child: child:
__delete__(); __delete__();
Ping(); Ping();
Ping5(); Ping5();
rpc Rpc(); intr Rpc();
Spam(); Spam();
rpc Synchro(); intr Synchro();
CompressedSpam(uint32_t seqno) compress; CompressedSpam(uint32_t seqno) compress;
rpc Synchro2() returns (uint32_t lastSeqno, intr Synchro2() returns (uint32_t lastSeqno,
uint32_t numMessagesDispatched); uint32_t numMessagesDispatched);
parent: parent:

View File

@ -3,11 +3,11 @@ namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestNestedLoops { intr protocol PTestNestedLoops {
child: child:
async Start(); async Start();
rpc R(); intr R();
__delete__(); __delete__();
parent: parent:

View File

@ -3,15 +3,15 @@ namespace _ipdltest2 {
// (Opens protocols can have different semantics than the endpoints // (Opens protocols can have different semantics than the endpoints
// that opened them) // that opened them)
rpc protocol PTestOpensOpened { intr protocol PTestOpensOpened {
child: child:
Hi(); Hi();
rpc HiRpc(); intr HiRpc();
parent: parent:
Hello(); Hello();
sync HelloSync(); sync HelloSync();
rpc HelloRpc(); intr HelloRpc();
__delete__(); __delete__();
state START: recv Hello goto HI; state START: recv Hello goto HI;

View File

@ -1,14 +1,14 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRaceDeferral { intr protocol PTestRaceDeferral {
parent: parent:
rpc Lose(); intr Lose();
child: child:
async StartRace(); async StartRace();
rpc Win(); intr Win();
rpc Rpc(); intr Rpc();
async __delete__(); async __delete__();
// Test that messages deferred due to race resolution are // Test that messages deferred due to race resolution are

View File

@ -1,15 +1,15 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRacyRPCReplies { intr protocol PTestRacyInterruptReplies {
child: child:
rpc R_() returns (int replyNum); intr R_() returns (int replyNum);
async _A(); async _A();
async ChildTest(); async ChildTest();
async __delete__(); async __delete__();
parent: parent:
rpc _R() returns (int replyNum); intr _R() returns (int replyNum);
async A_(); async A_();
state PARENT_START: state PARENT_START:

View File

@ -3,17 +3,17 @@ namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRacyReentry { intr protocol PTestRacyReentry {
parent: parent:
rpc E(); intr E();
__delete__(); __delete__();
child: child:
async Start(); async Start();
async N(); async N();
rpc H(); intr H();
}; };

View File

@ -3,7 +3,7 @@ namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestRacyUndefer { intr protocol PTestRacyUndefer {
child: child:
async Start(); async Start();
@ -11,14 +11,14 @@ child:
async AwakenSpam(); async AwakenSpam();
async AwakenRaceWinTwice(); async AwakenRaceWinTwice();
rpc Race(); intr Race();
async __delete__(); async __delete__();
parent: parent:
rpc Spam(); intr Spam();
rpc RaceWinTwice(); intr RaceWinTwice();
async Done(); async Done();
}; };

View File

@ -3,7 +3,7 @@ include protocol PTestShutdownSub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestShutdown { intr protocol PTestShutdown {
manages PTestShutdownSub; manages PTestShutdownSub;
child: child:

View File

@ -4,12 +4,12 @@ include protocol PTestShutdownSubsub;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestShutdownSub { intr protocol PTestShutdownSub {
manager PTestShutdown; manager PTestShutdown;
manages PTestShutdownSubsub; manages PTestShutdownSubsub;
both: both:
rpc StackFrame(); intr StackFrame();
parent: parent:
PTestShutdownSubsub(bool expectParentDeleted); PTestShutdownSubsub(bool expectParentDeleted);

View File

@ -3,7 +3,7 @@ namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestStackHooks { intr protocol PTestStackHooks {
child: child:
async Start(); async Start();
@ -12,10 +12,10 @@ child:
parent: parent:
async Async(); async Async();
sync Sync(); sync Sync();
rpc Rpc(); intr Rpc();
both: both:
rpc StackFrame(); intr StackFrame();
parent: parent:
__delete__(); __delete__();

View File

@ -1,9 +1,9 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestSyncWakeup { intr protocol PTestSyncWakeup {
both: both:
rpc StackFrame(); intr StackFrame();
child: child:
async Start(); async Start();

View File

@ -1,7 +1,7 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
rpc protocol PTestUrgency intr protocol PTestUrgency
{ {
parent: parent:
sync Test1() returns (uint32_t result); sync Test1() returns (uint32_t result);

View File

@ -1,4 +1,4 @@
#include "TestRPCErrorCleanup.h" #include "TestInterruptErrorCleanup.h"
#include "mozilla/CondVar.h" #include "mozilla/CondVar.h"
#include "mozilla/Mutex.h" #include "mozilla/Mutex.h"
@ -33,13 +33,13 @@ void DeleteSubprocess(Mutex* mutex, CondVar* cvar)
void DeleteTheWorld() void DeleteTheWorld()
{ {
delete static_cast<TestRPCErrorCleanupParent*>(gParentActor); delete static_cast<TestInterruptErrorCleanupParent*>(gParentActor);
gParentActor = nullptr; gParentActor = nullptr;
// needs to be synchronous to avoid affecting event ordering on // needs to be synchronous to avoid affecting event ordering on
// the main thread // the main thread
Mutex mutex("TestRPCErrorCleanup.DeleteTheWorld.mutex"); Mutex mutex("TestInterruptErrorCleanup.DeleteTheWorld.mutex");
CondVar cvar(mutex, "TestRPCErrorCleanup.DeleteTheWorld.cvar"); CondVar cvar(mutex, "TestInterruptErrorCleanup.DeleteTheWorld.cvar");
MutexAutoLock lock(mutex); MutexAutoLock lock(mutex);
@ -61,26 +61,26 @@ void Done()
} // namespace <anon> } // namespace <anon>
TestRPCErrorCleanupParent::TestRPCErrorCleanupParent() TestInterruptErrorCleanupParent::TestInterruptErrorCleanupParent()
: mGotProcessingError(false) : mGotProcessingError(false)
{ {
MOZ_COUNT_CTOR(TestRPCErrorCleanupParent); MOZ_COUNT_CTOR(TestInterruptErrorCleanupParent);
} }
TestRPCErrorCleanupParent::~TestRPCErrorCleanupParent() TestInterruptErrorCleanupParent::~TestInterruptErrorCleanupParent()
{ {
MOZ_COUNT_DTOR(TestRPCErrorCleanupParent); MOZ_COUNT_DTOR(TestInterruptErrorCleanupParent);
} }
void void
TestRPCErrorCleanupParent::Main() TestInterruptErrorCleanupParent::Main()
{ {
// This test models the following sequence of events // This test models the following sequence of events
// //
// (1) Parent: RPC out-call // (1) Parent: Interrupt out-call
// (2) Child: crash // (2) Child: crash
// --[Parent-only hereafter]-- // --[Parent-only hereafter]--
// (3) RPC out-call return false // (3) Interrupt out-call return false
// (4) Close() // (4) Close()
// --[event loop]-- // --[event loop]--
// (5) delete parentActor // (5) delete parentActor
@ -122,7 +122,7 @@ TestRPCErrorCleanupParent::Main()
} }
void void
TestRPCErrorCleanupParent::ProcessingError(Result what) TestInterruptErrorCleanupParent::ProcessingError(Result what)
{ {
if (what != MsgDropped) if (what != MsgDropped)
fail("unexpected processing error"); fail("unexpected processing error");
@ -132,18 +132,18 @@ TestRPCErrorCleanupParent::ProcessingError(Result what)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// child // 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 bool
TestRPCErrorCleanupChild::AnswerError() TestInterruptErrorCleanupChild::AnswerError()
{ {
_exit(0); _exit(0);
NS_RUNTIMEABORT("unreached"); NS_RUNTIMEABORT("unreached");

View File

@ -1,21 +1,21 @@
#ifndef mozilla__ipdltest_TestRPCErrorCleanup_h #ifndef mozilla__ipdltest_TestInterruptErrorCleanup_h
#define mozilla__ipdltest_TestRPCErrorCleanup_h 1 #define mozilla__ipdltest_TestInterruptErrorCleanup_h 1
#include "mozilla/_ipdltest/IPDLUnitTests.h" #include "mozilla/_ipdltest/IPDLUnitTests.h"
#include "mozilla/_ipdltest/PTestRPCErrorCleanupParent.h" #include "mozilla/_ipdltest/PTestInterruptErrorCleanupParent.h"
#include "mozilla/_ipdltest/PTestRPCErrorCleanupChild.h" #include "mozilla/_ipdltest/PTestInterruptErrorCleanupChild.h"
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
class TestRPCErrorCleanupParent : class TestInterruptErrorCleanupParent :
public PTestRPCErrorCleanupParent public PTestInterruptErrorCleanupParent
{ {
public: public:
TestRPCErrorCleanupParent(); TestInterruptErrorCleanupParent();
virtual ~TestRPCErrorCleanupParent(); virtual ~TestInterruptErrorCleanupParent();
static bool RunTestInProcesses() { return true; } static bool RunTestInProcesses() { return true; }
// FIXME/bug 703323 Could work if modified // FIXME/bug 703323 Could work if modified
@ -36,12 +36,12 @@ protected:
}; };
class TestRPCErrorCleanupChild : class TestInterruptErrorCleanupChild :
public PTestRPCErrorCleanupChild public PTestInterruptErrorCleanupChild
{ {
public: public:
TestRPCErrorCleanupChild(); TestInterruptErrorCleanupChild();
virtual ~TestRPCErrorCleanupChild(); virtual ~TestInterruptErrorCleanupChild();
protected: protected:
virtual bool AnswerError() MOZ_OVERRIDE; virtual bool AnswerError() MOZ_OVERRIDE;
@ -57,4 +57,4 @@ protected:
} // namespace mozilla } // namespace mozilla
#endif // ifndef mozilla__ipdltest_TestRPCErrorCleanup_h #endif // ifndef mozilla__ipdltest_TestInterruptErrorCleanup_h

View File

@ -1,48 +1,48 @@
#include "TestRPCRaces.h" #include "TestInterruptRaces.h"
#include "IPDLUnitTests.h" // fail etc. #include "IPDLUnitTests.h" // fail etc.
using mozilla::ipc::MessageChannel; using mozilla::ipc::MessageChannel;
template<> template<>
struct RunnableMethodTraits<mozilla::_ipdltest::TestRPCRacesParent> struct RunnableMethodTraits<mozilla::_ipdltest::TestInterruptRacesParent>
{ {
static void RetainCallee(mozilla::_ipdltest::TestRPCRacesParent* obj) { } static void RetainCallee(mozilla::_ipdltest::TestInterruptRacesParent* obj) { }
static void ReleaseCallee(mozilla::_ipdltest::TestRPCRacesParent* obj) { } static void ReleaseCallee(mozilla::_ipdltest::TestInterruptRacesParent* obj) { }
}; };
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
ipc::RacyRPCPolicy ipc::RacyInterruptPolicy
MediateRace(const MessageChannel::Message& parent, MediateRace(const MessageChannel::Message& parent,
const MessageChannel::Message& child) const MessageChannel::Message& child)
{ {
return (PTestRPCRaces::Msg_Child__ID == parent.type()) ? return (PTestInterruptRaces::Msg_Child__ID == parent.type()) ?
ipc::RRPParentWins : ipc::RRPChildWins; ipc::RIPParentWins : ipc::RIPChildWins;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// parent // parent
void void
TestRPCRacesParent::Main() TestInterruptRacesParent::Main()
{ {
if (!SendStart()) if (!SendStart())
fail("sending Start()"); fail("sending Start()");
} }
bool bool
TestRPCRacesParent::RecvStartRace() TestInterruptRacesParent::RecvStartRace()
{ {
MessageLoop::current()->PostTask( MessageLoop::current()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &TestRPCRacesParent::OnRaceTime)); NewRunnableMethod(this, &TestInterruptRacesParent::OnRaceTime));
return true; return true;
} }
void void
TestRPCRacesParent::OnRaceTime() TestInterruptRacesParent::OnRaceTime()
{ {
if (!CallRace(&mChildHasReply)) if (!CallRace(&mChildHasReply))
fail("problem calling Race()"); fail("problem calling Race()");
@ -54,20 +54,20 @@ TestRPCRacesParent::OnRaceTime()
MessageLoop::current()->PostTask( MessageLoop::current()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &TestRPCRacesParent::Test2)); NewRunnableMethod(this, &TestInterruptRacesParent::Test2));
} }
bool bool
TestRPCRacesParent::AnswerRace(bool* hasReply) TestInterruptRacesParent::AnswerRace(bool* hasReply)
{ {
if (mHasReply) if (mHasReply)
fail("apparently the parent won the RPC race!"); fail("apparently the parent won the Interrupt race!");
*hasReply = hasReply; *hasReply = hasReply;
return true; return true;
} }
void void
TestRPCRacesParent::Test2() TestInterruptRacesParent::Test2()
{ {
puts(" passed"); puts(" passed");
puts("Test 2"); puts("Test 2");
@ -82,11 +82,11 @@ TestRPCRacesParent::Test2()
MessageLoop::current()->PostTask( MessageLoop::current()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, &TestRPCRacesParent::Test3)); NewRunnableMethod(this, &TestInterruptRacesParent::Test3));
} }
bool bool
TestRPCRacesParent::AnswerStackFrame() TestInterruptRacesParent::AnswerStackFrame()
{ {
if (!SendWakeup()) if (!SendWakeup())
fail("can't wake up the child"); fail("can't wake up the child");
@ -102,7 +102,7 @@ TestRPCRacesParent::AnswerStackFrame()
} }
void void
TestRPCRacesParent::Test3() TestInterruptRacesParent::Test3()
{ {
puts("Test 3"); puts("Test 3");
@ -115,7 +115,7 @@ TestRPCRacesParent::Test3()
} }
bool bool
TestRPCRacesParent::AnswerStackFrame3() TestInterruptRacesParent::AnswerStackFrame3()
{ {
if (!SendWakeup3()) if (!SendWakeup3())
fail("can't wake up the child"); fail("can't wake up the child");
@ -127,14 +127,14 @@ TestRPCRacesParent::AnswerStackFrame3()
} }
bool bool
TestRPCRacesParent::AnswerParent() TestInterruptRacesParent::AnswerParent()
{ {
mAnsweredParent = true; mAnsweredParent = true;
return true; return true;
} }
bool bool
TestRPCRacesParent::RecvGetAnsweredParent(bool* answeredParent) TestInterruptRacesParent::RecvGetAnsweredParent(bool* answeredParent)
{ {
*answeredParent = mAnsweredParent; *answeredParent = mAnsweredParent;
return true; return true;
@ -143,7 +143,7 @@ TestRPCRacesParent::RecvGetAnsweredParent(bool* answeredParent)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// child // child
bool bool
TestRPCRacesChild::RecvStart() TestInterruptRacesChild::RecvStart()
{ {
puts("Test 1"); puts("Test 1");
@ -159,10 +159,10 @@ TestRPCRacesChild::RecvStart()
} }
bool bool
TestRPCRacesChild::AnswerRace(bool* hasReply) TestInterruptRacesChild::AnswerRace(bool* hasReply)
{ {
if (!mHasReply) if (!mHasReply)
fail("apparently the child lost the RPC race!"); fail("apparently the child lost the Interrupt race!");
*hasReply = mHasReply; *hasReply = mHasReply;
@ -170,7 +170,7 @@ TestRPCRacesChild::AnswerRace(bool* hasReply)
} }
bool bool
TestRPCRacesChild::AnswerStackFrame() TestInterruptRacesChild::AnswerStackFrame()
{ {
// reset for the second test // reset for the second test
mHasReply = false; mHasReply = false;
@ -185,7 +185,7 @@ TestRPCRacesChild::AnswerStackFrame()
} }
bool bool
TestRPCRacesChild::RecvWakeup() TestInterruptRacesChild::RecvWakeup()
{ {
bool dontcare; bool dontcare;
if (!CallRace(&dontcare)) if (!CallRace(&dontcare))
@ -196,7 +196,7 @@ TestRPCRacesChild::RecvWakeup()
} }
bool bool
TestRPCRacesChild::AnswerStackFrame3() TestInterruptRacesChild::AnswerStackFrame3()
{ {
if (!CallStackFrame3()) if (!CallStackFrame3())
fail("can't set up stack frame"); fail("can't set up stack frame");
@ -204,7 +204,7 @@ TestRPCRacesChild::AnswerStackFrame3()
} }
bool bool
TestRPCRacesChild::RecvWakeup3() TestInterruptRacesChild::RecvWakeup3()
{ {
if (!CallParent()) if (!CallParent())
fail("can't set up race condition"); fail("can't set up race condition");
@ -212,7 +212,7 @@ TestRPCRacesChild::RecvWakeup3()
} }
bool bool
TestRPCRacesChild::AnswerChild() TestInterruptRacesChild::AnswerChild()
{ {
bool parentAnsweredParent; bool parentAnsweredParent;
// the parent is supposed to win the race, which means its // the parent is supposed to win the race, which means its

View File

@ -1,27 +1,27 @@
#ifndef mozilla__ipdltest_TestRPCRaces_h #ifndef mozilla__ipdltest_TestInterruptRaces_h
#define mozilla__ipdltest_TestRPCRaces_h #define mozilla__ipdltest_TestInterruptRaces_h
#include "mozilla/_ipdltest/IPDLUnitTests.h" #include "mozilla/_ipdltest/IPDLUnitTests.h"
#include "mozilla/_ipdltest/PTestRPCRacesParent.h" #include "mozilla/_ipdltest/PTestInterruptRacesParent.h"
#include "mozilla/_ipdltest/PTestRPCRacesChild.h" #include "mozilla/_ipdltest/PTestInterruptRacesChild.h"
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
mozilla::ipc::RacyRPCPolicy mozilla::ipc::RacyInterruptPolicy
MediateRace(const mozilla::ipc::MessageChannel::Message& parent, MediateRace(const mozilla::ipc::MessageChannel::Message& parent,
const mozilla::ipc::MessageChannel::Message& child); const mozilla::ipc::MessageChannel::Message& child);
class TestRPCRacesParent : class TestInterruptRacesParent :
public PTestRPCRacesParent public PTestInterruptRacesParent
{ {
public: public:
TestRPCRacesParent() : mHasReply(false), TestInterruptRacesParent() : mHasReply(false),
mChildHasReply(false), mChildHasReply(false),
mAnsweredParent(false) mAnsweredParent(false)
{ } { }
virtual ~TestRPCRacesParent() { } virtual ~TestInterruptRacesParent() { }
static bool RunTestInProcesses() { return true; } static bool RunTestInProcesses() { return true; }
static bool RunTestInThreads() { return true; } static bool RunTestInThreads() { return true; }
@ -47,8 +47,8 @@ protected:
virtual bool virtual bool
RecvGetAnsweredParent(bool* answeredParent) MOZ_OVERRIDE; RecvGetAnsweredParent(bool* answeredParent) MOZ_OVERRIDE;
virtual mozilla::ipc::RacyRPCPolicy virtual mozilla::ipc::RacyInterruptPolicy
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
{ {
return MediateRace(parent, child); return MediateRace(parent, child);
} }
@ -75,12 +75,12 @@ private:
}; };
class TestRPCRacesChild : class TestInterruptRacesChild :
public PTestRPCRacesChild public PTestInterruptRacesChild
{ {
public: public:
TestRPCRacesChild() : mHasReply(false) { } TestInterruptRacesChild() : mHasReply(false) { }
virtual ~TestRPCRacesChild() { } virtual ~TestInterruptRacesChild() { }
protected: protected:
virtual bool virtual bool
@ -104,8 +104,8 @@ protected:
virtual bool virtual bool
AnswerChild() MOZ_OVERRIDE; AnswerChild() MOZ_OVERRIDE;
virtual mozilla::ipc::RacyRPCPolicy virtual mozilla::ipc::RacyInterruptPolicy
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE
{ {
return MediateRace(parent, child); return MediateRace(parent, child);
} }
@ -126,4 +126,4 @@ private:
} // namespace mozilla } // namespace mozilla
#endif // ifndef mozilla__ipdltest_TestRPCRaces_h #endif // ifndef mozilla__ipdltest_TestInterruptRaces_h

View File

@ -1,13 +1,13 @@
#include "TestRPCShutdownRace.h" #include "TestInterruptShutdownRace.h"
#include "IPDLUnitTests.h" // fail etc. #include "IPDLUnitTests.h" // fail etc.
#include "IPDLUnitTestSubprocess.h" #include "IPDLUnitTestSubprocess.h"
template<> template<>
struct RunnableMethodTraits<mozilla::_ipdltest::TestRPCShutdownRaceParent> struct RunnableMethodTraits<mozilla::_ipdltest::TestInterruptShutdownRaceParent>
{ {
static void RetainCallee(mozilla::_ipdltest::TestRPCShutdownRaceParent* obj) { } static void RetainCallee(mozilla::_ipdltest::TestInterruptShutdownRaceParent* obj) { }
static void ReleaseCallee(mozilla::_ipdltest::TestRPCShutdownRaceParent* obj) { } static void ReleaseCallee(mozilla::_ipdltest::TestInterruptShutdownRaceParent* obj) { }
}; };
@ -36,37 +36,37 @@ void Done()
} // namespace <anon> } // 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 void
TestRPCShutdownRaceParent::Main() TestInterruptShutdownRaceParent::Main()
{ {
if (!SendStart()) if (!SendStart())
fail("sending Start"); fail("sending Start");
} }
bool bool
TestRPCShutdownRaceParent::RecvStartDeath() TestInterruptShutdownRaceParent::RecvStartDeath()
{ {
// this will be ordered before the OnMaybeDequeueOne event of // this will be ordered before the OnMaybeDequeueOne event of
// Orphan in the queue // Orphan in the queue
MessageLoop::current()->PostTask( MessageLoop::current()->PostTask(
FROM_HERE, FROM_HERE,
NewRunnableMethod(this, NewRunnableMethod(this,
&TestRPCShutdownRaceParent::StartShuttingDown)); &TestInterruptShutdownRaceParent::StartShuttingDown));
return true; return true;
} }
void void
TestRPCShutdownRaceParent::StartShuttingDown() TestInterruptShutdownRaceParent::StartShuttingDown()
{ {
// NB: we sleep here to try and avoid receiving the Orphan message // NB: we sleep here to try and avoid receiving the Orphan message
// while waiting for the CallExit() reply. if we fail at that, it // while waiting for the CallExit() reply. if we fail at that, it
@ -79,7 +79,7 @@ TestRPCShutdownRaceParent::StartShuttingDown()
Close(); Close();
delete static_cast<TestRPCShutdownRaceParent*>(gParentActor); delete static_cast<TestInterruptShutdownRaceParent*>(gParentActor);
gParentActor = nullptr; gParentActor = nullptr;
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
@ -93,7 +93,7 @@ TestRPCShutdownRaceParent::StartShuttingDown()
} }
bool bool
TestRPCShutdownRaceParent::RecvOrphan() TestInterruptShutdownRaceParent::RecvOrphan()
{ {
// it would be nice to fail() here, but we'll process this message // it would be nice to fail() here, but we'll process this message
// while waiting for the reply CallExit(). The OnMaybeDequeueOne // while waiting for the reply CallExit(). The OnMaybeDequeueOne
@ -105,18 +105,18 @@ TestRPCShutdownRaceParent::RecvOrphan()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// child // 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 bool
TestRPCShutdownRaceChild::RecvStart() TestInterruptShutdownRaceChild::RecvStart()
{ {
if (!SendStartDeath()) if (!SendStartDeath())
fail("sending StartDeath"); fail("sending StartDeath");
@ -132,7 +132,7 @@ TestRPCShutdownRaceChild::RecvStart()
} }
bool bool
TestRPCShutdownRaceChild::AnswerExit() TestInterruptShutdownRaceChild::AnswerExit()
{ {
_exit(0); _exit(0);
NS_RUNTIMEABORT("unreached"); NS_RUNTIMEABORT("unreached");

View File

@ -1,21 +1,21 @@
#ifndef mozilla__ipdltest_TestRPCShutdownRace_h #ifndef mozilla__ipdltest_TestInterruptShutdownRace_h
#define mozilla__ipdltest_TestRPCShutdownRace_h 1 #define mozilla__ipdltest_TestInterruptShutdownRace_h 1
#include "mozilla/_ipdltest/IPDLUnitTests.h" #include "mozilla/_ipdltest/IPDLUnitTests.h"
#include "mozilla/_ipdltest/PTestRPCShutdownRaceParent.h" #include "mozilla/_ipdltest/PTestInterruptShutdownRaceParent.h"
#include "mozilla/_ipdltest/PTestRPCShutdownRaceChild.h" #include "mozilla/_ipdltest/PTestInterruptShutdownRaceChild.h"
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
class TestRPCShutdownRaceParent : class TestInterruptShutdownRaceParent :
public PTestRPCShutdownRaceParent public PTestInterruptShutdownRaceParent
{ {
public: public:
TestRPCShutdownRaceParent(); TestInterruptShutdownRaceParent();
virtual ~TestRPCShutdownRaceParent(); virtual ~TestInterruptShutdownRaceParent();
static bool RunTestInProcesses() { return true; } static bool RunTestInProcesses() { return true; }
// FIXME/bug 703323 Could work if modified // FIXME/bug 703323 Could work if modified
@ -38,12 +38,12 @@ protected:
}; };
class TestRPCShutdownRaceChild : class TestInterruptShutdownRaceChild :
public PTestRPCShutdownRaceChild public PTestInterruptShutdownRaceChild
{ {
public: public:
TestRPCShutdownRaceChild(); TestInterruptShutdownRaceChild();
virtual ~TestRPCShutdownRaceChild(); virtual ~TestInterruptShutdownRaceChild();
protected: protected:
virtual bool RecvStart() MOZ_OVERRIDE; virtual bool RecvStart() MOZ_OVERRIDE;
@ -61,4 +61,4 @@ protected:
} // namespace mozilla } // namespace mozilla
#endif // ifndef mozilla__ipdltest_TestRPCShutdownRace_h #endif // ifndef mozilla__ipdltest_TestInterruptShutdownRace_h

View File

@ -8,11 +8,11 @@ typedef mozilla::ipc::MessageChannel::Message Message;
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
static RacyRPCPolicy static RacyInterruptPolicy
MediateRace(const Message& parent, const Message& child) MediateRace(const Message& parent, const Message& child)
{ {
return (PTestRaceDeferral::Msg_Win__ID == parent.type()) ? return (PTestRaceDeferral::Msg_Win__ID == parent.type()) ?
RRPParentWins : RRPChildWins; RIPParentWins : RIPChildWins;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -66,8 +66,8 @@ TestRaceDeferralParent::AnswerLose()
return true; return true;
} }
RacyRPCPolicy RacyInterruptPolicy
TestRaceDeferralParent::MediateRPCRace(const Message& parent, TestRaceDeferralParent::MediateInterruptRace(const Message& parent,
const Message& child) const Message& child)
{ {
return MediateRace(parent, child); return MediateRace(parent, child);
@ -106,8 +106,8 @@ TestRaceDeferralChild::AnswerRpc()
return true; return true;
} }
RacyRPCPolicy RacyInterruptPolicy
TestRaceDeferralChild::MediateRPCRace(const Message& parent, TestRaceDeferralChild::MediateInterruptRace(const Message& parent,
const Message& child) const Message& child)
{ {
return MediateRace(parent, child); return MediateRace(parent, child);

View File

@ -26,8 +26,8 @@ protected:
virtual bool AnswerLose() MOZ_OVERRIDE; virtual bool AnswerLose() MOZ_OVERRIDE;
virtual mozilla::ipc::RacyRPCPolicy virtual mozilla::ipc::RacyInterruptPolicy
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE; MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
{ {
@ -55,8 +55,8 @@ protected:
virtual bool AnswerRpc() MOZ_OVERRIDE; virtual bool AnswerRpc() MOZ_OVERRIDE;
virtual mozilla::ipc::RacyRPCPolicy virtual mozilla::ipc::RacyInterruptPolicy
MediateRPCRace(const Message& parent, const Message& child) MOZ_OVERRIDE; MediateInterruptRace(const Message& parent, const Message& child) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
{ {

View File

@ -1,4 +1,4 @@
#include "TestRacyRPCReplies.h" #include "TestRacyInterruptReplies.h"
#include "IPDLUnitTests.h" // fail etc. #include "IPDLUnitTests.h" // fail etc.
@ -8,18 +8,18 @@ namespace _ipdltest {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// parent // 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 void
TestRacyRPCRepliesParent::Main() TestRacyInterruptRepliesParent::Main()
{ {
int replyNum = -1; int replyNum = -1;
if (!CallR_(&replyNum)) if (!CallR_(&replyNum))
@ -33,7 +33,7 @@ TestRacyRPCRepliesParent::Main()
} }
bool bool
TestRacyRPCRepliesParent::RecvA_() TestRacyInterruptRepliesParent::RecvA_()
{ {
int replyNum = -1; int replyNum = -1;
// this R() call races with the reply being generated by the other // this R() call races with the reply being generated by the other
@ -51,7 +51,7 @@ TestRacyRPCRepliesParent::RecvA_()
} }
bool bool
TestRacyRPCRepliesParent::Answer_R(int* replyNum) TestRacyInterruptRepliesParent::Answer_R(int* replyNum)
{ {
*replyNum = ++mReplyNum; *replyNum = ++mReplyNum;
@ -65,18 +65,18 @@ TestRacyRPCRepliesParent::Answer_R(int* replyNum)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// child // 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 bool
TestRacyRPCRepliesChild::AnswerR_(int* replyNum) TestRacyInterruptRepliesChild::AnswerR_(int* replyNum)
{ {
*replyNum = ++mReplyNum; *replyNum = ++mReplyNum;
@ -87,7 +87,7 @@ TestRacyRPCRepliesChild::AnswerR_(int* replyNum)
} }
bool bool
TestRacyRPCRepliesChild::RecvChildTest() TestRacyInterruptRepliesChild::RecvChildTest()
{ {
int replyNum = -1; int replyNum = -1;
if (!Call_R(&replyNum)) if (!Call_R(&replyNum))
@ -102,7 +102,7 @@ TestRacyRPCRepliesChild::RecvChildTest()
} }
bool bool
TestRacyRPCRepliesChild::Recv_A() TestRacyInterruptRepliesChild::Recv_A()
{ {
int replyNum = -1; int replyNum = -1;

View File

@ -1,21 +1,21 @@
#ifndef mozilla__ipdltest_TestRacyRPCReplies_h #ifndef mozilla__ipdltest_TestRacyInterruptReplies_h
#define mozilla__ipdltest_TestRacyRPCReplies_h 1 #define mozilla__ipdltest_TestRacyInterruptReplies_h 1
#include "mozilla/_ipdltest/IPDLUnitTests.h" #include "mozilla/_ipdltest/IPDLUnitTests.h"
#include "mozilla/_ipdltest/PTestRacyRPCRepliesParent.h" #include "mozilla/_ipdltest/PTestRacyInterruptRepliesParent.h"
#include "mozilla/_ipdltest/PTestRacyRPCRepliesChild.h" #include "mozilla/_ipdltest/PTestRacyInterruptRepliesChild.h"
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
class TestRacyRPCRepliesParent : class TestRacyInterruptRepliesParent :
public PTestRacyRPCRepliesParent public PTestRacyInterruptRepliesParent
{ {
public: public:
TestRacyRPCRepliesParent(); TestRacyInterruptRepliesParent();
virtual ~TestRacyRPCRepliesParent(); virtual ~TestRacyInterruptRepliesParent();
static bool RunTestInProcesses() { return true; } static bool RunTestInProcesses() { return true; }
static bool RunTestInThreads() { return true; } static bool RunTestInThreads() { return true; }
@ -40,12 +40,12 @@ private:
}; };
class TestRacyRPCRepliesChild : class TestRacyInterruptRepliesChild :
public PTestRacyRPCRepliesChild public PTestRacyInterruptRepliesChild
{ {
public: public:
TestRacyRPCRepliesChild(); TestRacyInterruptRepliesChild();
virtual ~TestRacyRPCRepliesChild(); virtual ~TestRacyInterruptRepliesChild();
protected: protected:
virtual bool AnswerR_(int* replyNum) MOZ_OVERRIDE; virtual bool AnswerR_(int* replyNum) MOZ_OVERRIDE;
@ -70,4 +70,4 @@ private:
} // namespace mozilla } // namespace mozilla
#endif // ifndef mozilla__ipdltest_TestRacyRPCReplies_h #endif // ifndef mozilla__ipdltest_TestRacyInterruptReplies_h

View File

@ -48,6 +48,9 @@ IPDL_SOURCES += [
'PTestIndirectProtocolParamFirst.ipdl', 'PTestIndirectProtocolParamFirst.ipdl',
'PTestIndirectProtocolParamManage.ipdl', 'PTestIndirectProtocolParamManage.ipdl',
'PTestIndirectProtocolParamSecond.ipdl', 'PTestIndirectProtocolParamSecond.ipdl',
'PTestInterruptErrorCleanup.ipdl',
'PTestInterruptRaces.ipdl',
'PTestInterruptShutdownRace.ipdl',
'PTestJSON.ipdl', 'PTestJSON.ipdl',
'PTestLatency.ipdl', 'PTestLatency.ipdl',
'PTestManyChildAllocs.ipdl', 'PTestManyChildAllocs.ipdl',
@ -59,11 +62,8 @@ IPDL_SOURCES += [
'PTestNestedLoops.ipdl', 'PTestNestedLoops.ipdl',
'PTestOpens.ipdl', 'PTestOpens.ipdl',
'PTestOpensOpened.ipdl', 'PTestOpensOpened.ipdl',
'PTestRPCErrorCleanup.ipdl',
'PTestRPCRaces.ipdl',
'PTestRPCShutdownRace.ipdl',
'PTestRaceDeferral.ipdl', 'PTestRaceDeferral.ipdl',
'PTestRacyRPCReplies.ipdl', 'PTestRacyInterruptReplies.ipdl',
'PTestRacyReentry.ipdl', 'PTestRacyReentry.ipdl',
'PTestRacyUndefer.ipdl', 'PTestRacyUndefer.ipdl',
'PTestSanity.ipdl', 'PTestSanity.ipdl',

View File

@ -1,6 +1,6 @@
include protocol compressCtorManagee; include protocol compressCtorManagee;
rpc protocol compressCtor { intr protocol compressCtor {
manages compressCtorManagee; manages compressCtorManagee;
parent: parent:

View File

@ -1,6 +1,6 @@
include protocol compressCtor; include protocol compressCtor;
rpc protocol compressCtorManagee { intr protocol compressCtorManagee {
manager compressCtor; manager compressCtor;
child: child:

View File

@ -0,0 +1,6 @@
intr protocol intrMessageCompress {
parent:
intr foo() compress;
child:
intr bar() compress;
};

View File

@ -1,6 +0,0 @@
rpc protocol rpcMessageCompress {
parent:
rpc foo() compress;
child:
rpc bar() compress;
};

View File

@ -1,4 +1,4 @@
rpc protocol syncParentToChild { intr protocol syncParentToChild {
// can't declare sync parent-to-child messages // can't declare sync parent-to-child messages
child: sync Msg(); child: sync Msg();

View File

@ -0,0 +1,7 @@
protocol tooWeakRPCAsync {
// it's an error to declare an async protocol with an intr message
parent: intr Msg();
};

View File

@ -1,7 +0,0 @@
protocol tooWeakRPCAsync {
// it's an error to declare an async protocol with an rpc message
parent: rpc Msg();
};

View File

@ -1,7 +1,7 @@
rpc protocol trans_WrongDirection4 { intr protocol trans_WrongDirection4 {
child: child:
rpc Msg(); intr Msg();
__delete__(); __delete__();
state S1: state S1:

View File

@ -1,7 +1,7 @@
rpc protocol trans_WrongDirection5 { intr protocol trans_WrongDirection5 {
parent: parent:
rpc Msg(); intr Msg();
__delete__() __delete__()
state S1: state S1:

View File

@ -1,7 +1,7 @@
rpc protocol trans_WrongName4 { intr protocol trans_WrongName4 {
child: child:
rpc Msg(); intr Msg();
__delete__(); __delete__();
state S1: state S1:

View File

@ -1,7 +1,7 @@
rpc protocol trans_WrongName5 { intr protocol trans_WrongName5 {
parent: parent:
rpc Msg(); intr Msg();
__delete__(); __delete__();
state S1: state S1:

View 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);
};

View File

@ -1,7 +1,7 @@
include protocol content; include protocol content;
include protocol jetpack; include protocol jetpack;
rpc protocol jetpackContent { intr protocol jetpackContent {
bridges jetpack, content; bridges jetpack, content;
child: child:

View File

@ -1,4 +1,4 @@
rpc protocol messageCompress { intr protocol messageCompress {
child: child:
async foo() compress; async foo() compress;
}; };

View File

@ -1,4 +1,4 @@
rpc protocol plugin { intr protocol plugin {
child: child:
__delete__(); __delete__();

View File

@ -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);
};

View File

@ -3,11 +3,11 @@ union Foo {
Shmem; Shmem;
}; };
rpc protocol shmem { intr protocol shmem {
parent: parent:
Msg(Shmem s, Foo f); Msg(Shmem s, Foo f);
sync SyncMsg(Shmem s, Foo f) sync SyncMsg(Shmem s, Foo f)
returns (Shmem t, Foo g); returns (Shmem t, Foo g);
rpc RPCMsg(Shmem s, Foo f) intr InterruptMsg(Shmem s, Foo f)
returns (Shmem t, Foo g); returns (Shmem t, Foo g);
}; };

View File

@ -9,7 +9,7 @@ include protocol PTestShellCommand;
namespace mozilla { namespace mozilla {
namespace ipc { namespace ipc {
rpc protocol PTestShell intr protocol PTestShell
{ {
manager PContent; manager PContent;

View File

@ -14,7 +14,7 @@ using mozilla::void_t;
namespace mozilla { namespace mozilla {
namespace jsipc { namespace jsipc {
rpc protocol PJavaScript intr protocol PJavaScript
{ {
manager PContent; manager PContent;