Bug 1306708 - Rename prio to nested in IPDL (r=dvander)

This commit is contained in:
Bill McCloskey
2016-09-30 16:20:50 -07:00
parent 12ff97d0c4
commit 308f9f039b
28 changed files with 495 additions and 492 deletions

View File

@@ -43,7 +43,7 @@ struct RelationTargets
uint64_t[] Targets; uint64_t[] Targets;
}; };
prio(normal upto high) sync protocol PDocAccessible nested(upto inside_sync) sync protocol PDocAccessible
{ {
manager PBrowser; manager PBrowser;
@@ -74,20 +74,20 @@ child:
async __delete__(); async __delete__();
// Accessible // Accessible
prio(high) sync State(uint64_t aID) returns(uint64_t states); nested(inside_sync) sync State(uint64_t aID) returns(uint64_t states);
prio(high) sync NativeState(uint64_t aID) returns(uint64_t states); nested(inside_sync) sync NativeState(uint64_t aID) returns(uint64_t states);
prio(high) sync Name(uint64_t aID) returns(nsString name); nested(inside_sync) sync Name(uint64_t aID) returns(nsString name);
prio(high) sync Value(uint64_t aID) returns(nsString value); nested(inside_sync) sync Value(uint64_t aID) returns(nsString value);
prio(high) sync Help(uint64_t aID) returns(nsString help); nested(inside_sync) sync Help(uint64_t aID) returns(nsString help);
prio(high) sync Description(uint64_t aID) returns(nsString desc); nested(inside_sync) sync Description(uint64_t aID) returns(nsString desc);
prio(high) sync Attributes(uint64_t aID) returns(Attribute[] attributes); nested(inside_sync) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
prio(high) sync RelationByType(uint64_t aID, uint32_t aRelationType) nested(inside_sync) sync RelationByType(uint64_t aID, uint32_t aRelationType)
returns(uint64_t[] targets); returns(uint64_t[] targets);
prio(high) sync Relations(uint64_t aID) returns(RelationTargets[] relations); nested(inside_sync) sync Relations(uint64_t aID) returns(RelationTargets[] relations);
prio(high) sync IsSearchbox(uint64_t aID) returns(bool retval); nested(inside_sync) sync IsSearchbox(uint64_t aID) returns(bool retval);
prio(high) sync LandmarkRole(uint64_t aID) returns(nsString landmark); nested(inside_sync) sync LandmarkRole(uint64_t aID) returns(nsString landmark);
prio(high) sync ARIARoleAtom(uint64_t aID) returns(nsString role); nested(inside_sync) sync ARIARoleAtom(uint64_t aID) returns(nsString role);
prio(high) sync GetLevelInternal(uint64_t aID) returns(int32_t aLevel); nested(inside_sync) sync GetLevelInternal(uint64_t aID) returns(int32_t aLevel);
async ScrollTo(uint64_t aID, uint32_t aScrollType); async ScrollTo(uint64_t aID, uint32_t aScrollType);
async ScrollToPoint(uint64_t aID, uint32_t aScrollType, int32_t aX, async ScrollToPoint(uint64_t aID, uint32_t aScrollType, int32_t aX,
int32_t aY); int32_t aY);
@@ -95,43 +95,43 @@ child:
// AccessibleText // AccessibleText
// TextSubstring is getText in IDL. // TextSubstring is getText in IDL.
prio(high) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber); nested(inside_sync) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber);
prio(high) sync CaretOffset(uint64_t aID) returns(int32_t aOffset); nested(inside_sync) sync CaretOffset(uint64_t aID) returns(int32_t aOffset);
async SetCaretOffset(uint64_t aID, int32_t aOffset); async SetCaretOffset(uint64_t aID, int32_t aOffset);
prio(high) sync CharacterCount(uint64_t aID) returns(int32_t aCount); nested(inside_sync) sync CharacterCount(uint64_t aID) returns(int32_t aCount);
prio(high) sync SelectionCount(uint64_t aID) returns(int32_t aCount); nested(inside_sync) sync SelectionCount(uint64_t aID) returns(int32_t aCount);
prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t nested(inside_sync) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t
aEndOffset) returns(nsString aText, bool aValid); aEndOffset) returns(nsString aText, bool aValid);
prio(high) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType) nested(inside_sync) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset); returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync GetTextAtOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType) nested(inside_sync) sync GetTextAtOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset); returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync GetTextBeforeOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType) nested(inside_sync) sync GetTextBeforeOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset); returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync CharAt(uint64_t aID, int32_t aOffset) returns(uint16_t aChar); nested(inside_sync) sync CharAt(uint64_t aID, int32_t aOffset) returns(uint16_t aChar);
prio(high) sync TextAttributes(uint64_t aID, bool aIncludeDefAttrs, int32_t aOffset) nested(inside_sync) sync TextAttributes(uint64_t aID, bool aIncludeDefAttrs, int32_t aOffset)
returns(Attribute[] aAttributes, int32_t aStartOffset, int32_t aEndOffset); returns(Attribute[] aAttributes, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync DefaultTextAttributes(uint64_t aID) returns(Attribute[] aAttributes); nested(inside_sync) sync DefaultTextAttributes(uint64_t aID) returns(Attribute[] aAttributes);
prio(high) sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset, nested(inside_sync) sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
uint32_t aCoordType) uint32_t aCoordType)
returns(nsIntRect aRetVal); returns(nsIntRect aRetVal);
prio(high) sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType) nested(inside_sync) sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType)
returns(nsIntRect aRetVal); returns(nsIntRect aRetVal);
prio(high) sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType) nested(inside_sync) sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType)
returns(int32_t aRetVal); returns(int32_t aRetVal);
prio(high) sync SelectionBoundsAt(uint64_t aID, int32_t aSelectionNum) nested(inside_sync) sync SelectionBoundsAt(uint64_t aID, int32_t aSelectionNum)
returns(bool aSucceeded, nsString aData, int32_t aStartOffset, int32_t aEndOffset); returns(bool aSucceeded, nsString aData, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync SetSelectionBoundsAt(uint64_t aID, int32_t aSelectionNum, nested(inside_sync) sync SetSelectionBoundsAt(uint64_t aID, int32_t aSelectionNum,
int32_t aStartOffset, int32_t aEndOffset) int32_t aStartOffset, int32_t aEndOffset)
returns(bool aSucceeded); returns(bool aSucceeded);
prio(high) sync AddToSelection(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset) nested(inside_sync) sync AddToSelection(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset)
returns(bool aSucceeded); returns(bool aSucceeded);
prio(high) sync RemoveFromSelection(uint64_t aID, int32_t aSelectionNum) nested(inside_sync) sync RemoveFromSelection(uint64_t aID, int32_t aSelectionNum)
returns(bool aSucceeded); returns(bool aSucceeded);
async ScrollSubstringTo(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset, async ScrollSubstringTo(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
@@ -142,119 +142,119 @@ child:
uint32_t aCoordinateType, uint32_t aCoordinateType,
int32_t aX, int32_t aY); int32_t aX, int32_t aY);
prio(high) sync Text(uint64_t aID) returns(nsString aText); nested(inside_sync) sync Text(uint64_t aID) returns(nsString aText);
prio(high) sync ReplaceText(uint64_t aID, nsString aText); nested(inside_sync) sync ReplaceText(uint64_t aID, nsString aText);
prio(high) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition) nested(inside_sync) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition)
returns(bool aValid); returns(bool aValid);
prio(high) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos) nested(inside_sync) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
returns(bool aValid); returns(bool aValid);
prio(high) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos) nested(inside_sync) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
returns(bool aValid); returns(bool aValid);
prio(high) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos) nested(inside_sync) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
returns(bool aValid); returns(bool aValid);
prio(high) sync PasteText(uint64_t aID, int32_t aPosition) nested(inside_sync) sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid); returns(bool aValid);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal); nested(inside_sync) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal); nested(inside_sync) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);
prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); nested(inside_sync) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
prio(high) sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); nested(inside_sync) sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
prio(high) sync IsLinkValid(uint64_t aID) returns(bool aRetVal); nested(inside_sync) sync IsLinkValid(uint64_t aID) returns(bool aRetVal);
prio(high) sync AnchorCount(uint64_t aID) returns(uint32_t aRetVal, bool aOk); nested(inside_sync) sync AnchorCount(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
prio(high) sync AnchorURIAt(uint64_t aID, uint32_t aIndex) returns(nsCString aURI, bool aOk); nested(inside_sync) sync AnchorURIAt(uint64_t aID, uint32_t aIndex) returns(nsCString aURI, bool aOk);
prio(high) sync AnchorAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfAnchor, bool aOk); nested(inside_sync) sync AnchorAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfAnchor, bool aOk);
prio(high) sync LinkCount(uint64_t aID) returns(uint32_t aCount); nested(inside_sync) sync LinkCount(uint64_t aID) returns(uint32_t aCount);
prio(high) sync LinkAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfLink, bool aOk); nested(inside_sync) sync LinkAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfLink, bool aOk);
prio(high) sync LinkIndexOf(uint64_t aID, uint64_t aLinkID) returns(int32_t aIndex); nested(inside_sync) sync LinkIndexOf(uint64_t aID, uint64_t aLinkID) returns(int32_t aIndex);
prio(high) sync LinkIndexAtOffset(uint64_t aID, uint32_t aOffset) returns(int32_t aIndex); nested(inside_sync) sync LinkIndexAtOffset(uint64_t aID, uint32_t aOffset) returns(int32_t aIndex);
prio(high) sync TableOfACell(uint64_t aID) returns(uint64_t aTableID, bool aOk); nested(inside_sync) sync TableOfACell(uint64_t aID) returns(uint64_t aTableID, bool aOk);
prio(high) sync ColIdx(uint64_t aID) returns(uint32_t aIndex); nested(inside_sync) sync ColIdx(uint64_t aID) returns(uint32_t aIndex);
prio(high) sync RowIdx(uint64_t aID) returns(uint32_t aIndex); nested(inside_sync) sync RowIdx(uint64_t aID) returns(uint32_t aIndex);
prio(high) sync ColExtent(uint64_t aID) returns(uint32_t aExtent); nested(inside_sync) sync ColExtent(uint64_t aID) returns(uint32_t aExtent);
prio(high) sync RowExtent(uint64_t aID) returns(uint32_t aExtent); nested(inside_sync) sync RowExtent(uint64_t aID) returns(uint32_t aExtent);
prio(high) sync ColHeaderCells(uint64_t aID) returns(uint64_t[] aCells); nested(inside_sync) sync ColHeaderCells(uint64_t aID) returns(uint64_t[] aCells);
prio(high) sync RowHeaderCells(uint64_t aID) returns(uint64_t[] aCells); nested(inside_sync) sync RowHeaderCells(uint64_t aID) returns(uint64_t[] aCells);
prio(high) sync IsCellSelected(uint64_t aID) returns(bool aSelected); nested(inside_sync) sync IsCellSelected(uint64_t aID) returns(bool aSelected);
prio(high) sync TableCaption(uint64_t aID) returns(uint64_t aCaptionID, bool aOk); nested(inside_sync) sync TableCaption(uint64_t aID) returns(uint64_t aCaptionID, bool aOk);
prio(high) sync TableSummary(uint64_t aID) returns(nsString aSummary); nested(inside_sync) sync TableSummary(uint64_t aID) returns(nsString aSummary);
prio(high) sync TableColumnCount(uint64_t aID) returns(uint32_t aColCount); nested(inside_sync) sync TableColumnCount(uint64_t aID) returns(uint32_t aColCount);
prio(high) sync TableRowCount(uint64_t aID) returns(uint32_t aRowCount); nested(inside_sync) sync TableRowCount(uint64_t aID) returns(uint32_t aRowCount);
prio(high) sync TableCellAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint64_t aCellID, bool aOk); nested(inside_sync) sync TableCellAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint64_t aCellID, bool aOk);
prio(high) sync TableCellIndexAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(int32_t aIndex); nested(inside_sync) sync TableCellIndexAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(int32_t aIndex);
prio(high) sync TableColumnIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aCol); nested(inside_sync) sync TableColumnIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aCol);
prio(high) sync TableRowIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow); nested(inside_sync) sync TableRowIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow);
prio(high) sync TableRowAndColumnIndicesAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow, int32_t aCol); nested(inside_sync) sync TableRowAndColumnIndicesAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow, int32_t aCol);
prio(high) sync TableColumnExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent); nested(inside_sync) sync TableColumnExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent);
prio(high) sync TableRowExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent); nested(inside_sync) sync TableRowExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent);
prio(high) sync TableColumnDescription(uint64_t aID, uint32_t aCol) returns(nsString aDescription); nested(inside_sync) sync TableColumnDescription(uint64_t aID, uint32_t aCol) returns(nsString aDescription);
prio(high) sync TableRowDescription(uint64_t aID, uint32_t aRow) returns(nsString aDescription); nested(inside_sync) sync TableRowDescription(uint64_t aID, uint32_t aRow) returns(nsString aDescription);
prio(high) sync TableColumnSelected(uint64_t aID, uint32_t aCol) returns(bool aSelected); nested(inside_sync) sync TableColumnSelected(uint64_t aID, uint32_t aCol) returns(bool aSelected);
prio(high) sync TableRowSelected(uint64_t aID, uint32_t aRow) returns(bool aSelected); nested(inside_sync) sync TableRowSelected(uint64_t aID, uint32_t aRow) returns(bool aSelected);
prio(high) sync TableCellSelected(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(bool aSelected); nested(inside_sync) sync TableCellSelected(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(bool aSelected);
prio(high) sync TableSelectedCellCount(uint64_t aID) returns(uint32_t aSelectedCells); nested(inside_sync) sync TableSelectedCellCount(uint64_t aID) returns(uint32_t aSelectedCells);
prio(high) sync TableSelectedColumnCount(uint64_t aID) returns(uint32_t aSelectedColumns); nested(inside_sync) sync TableSelectedColumnCount(uint64_t aID) returns(uint32_t aSelectedColumns);
prio(high) sync TableSelectedRowCount(uint64_t aID) returns(uint32_t aSelectedRows); nested(inside_sync) sync TableSelectedRowCount(uint64_t aID) returns(uint32_t aSelectedRows);
prio(high) sync TableSelectedCells(uint64_t aID) returns(uint64_t[] aCellIDs); nested(inside_sync) sync TableSelectedCells(uint64_t aID) returns(uint64_t[] aCellIDs);
prio(high) sync TableSelectedCellIndices(uint64_t aID) returns(uint32_t[] aCellIndeces); nested(inside_sync) sync TableSelectedCellIndices(uint64_t aID) returns(uint32_t[] aCellIndeces);
prio(high) sync TableSelectedColumnIndices(uint64_t aID) returns(uint32_t[] aColumnIndeces); nested(inside_sync) sync TableSelectedColumnIndices(uint64_t aID) returns(uint32_t[] aColumnIndeces);
prio(high) sync TableSelectedRowIndices(uint64_t aID) returns(uint32_t[] aRowIndeces); nested(inside_sync) sync TableSelectedRowIndices(uint64_t aID) returns(uint32_t[] aRowIndeces);
prio(high) sync TableSelectColumn(uint64_t aID, uint32_t aCol); nested(inside_sync) sync TableSelectColumn(uint64_t aID, uint32_t aCol);
prio(high) sync TableSelectRow(uint64_t aID, uint32_t aRow); nested(inside_sync) sync TableSelectRow(uint64_t aID, uint32_t aRow);
prio(high) sync TableUnselectColumn(uint64_t aID, uint32_t aCol); nested(inside_sync) sync TableUnselectColumn(uint64_t aID, uint32_t aCol);
prio(high) sync TableUnselectRow(uint64_t aID, uint32_t aRow); nested(inside_sync) sync TableUnselectRow(uint64_t aID, uint32_t aRow);
prio(high) sync TableIsProbablyForLayout(uint64_t aID) returns(bool aForLayout); nested(inside_sync) sync TableIsProbablyForLayout(uint64_t aID) returns(bool aForLayout);
prio(high) sync AtkTableColumnHeader(uint64_t aID, int32_t aCol) nested(inside_sync) sync AtkTableColumnHeader(uint64_t aID, int32_t aCol)
returns(uint64_t aHeaderID, bool aOk); returns(uint64_t aHeaderID, bool aOk);
prio(high) sync AtkTableRowHeader(uint64_t aID, int32_t aRow) nested(inside_sync) sync AtkTableRowHeader(uint64_t aID, int32_t aRow)
returns(uint64_t aHeaderID, bool aOk); returns(uint64_t aHeaderID, bool aOk);
prio(high) sync SelectedItems(uint64_t aID) returns(uint64_t[] aSelectedItemIDs); nested(inside_sync) sync SelectedItems(uint64_t aID) returns(uint64_t[] aSelectedItemIDs);
prio(high) sync SelectedItemCount(uint64_t aID) returns(uint32_t aCount); nested(inside_sync) sync SelectedItemCount(uint64_t aID) returns(uint32_t aCount);
prio(high) sync GetSelectedItem(uint64_t aID, uint32_t aIndex) returns(uint64_t aSelected, bool aOk); nested(inside_sync) sync GetSelectedItem(uint64_t aID, uint32_t aIndex) returns(uint64_t aSelected, bool aOk);
prio(high) sync IsItemSelected(uint64_t aID, uint32_t aIndex) returns(bool aSelected); nested(inside_sync) sync IsItemSelected(uint64_t aID, uint32_t aIndex) returns(bool aSelected);
prio(high) sync AddItemToSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess); nested(inside_sync) sync AddItemToSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
prio(high) sync RemoveItemFromSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess); nested(inside_sync) sync RemoveItemFromSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
prio(high) sync SelectAll(uint64_t aID) returns(bool aSuccess); nested(inside_sync) sync SelectAll(uint64_t aID) returns(bool aSuccess);
prio(high) sync UnselectAll(uint64_t aID) returns(bool aSuccess); nested(inside_sync) sync UnselectAll(uint64_t aID) returns(bool aSuccess);
async TakeSelection(uint64_t aID); async TakeSelection(uint64_t aID);
async SetSelected(uint64_t aID, bool aSelected); async SetSelected(uint64_t aID, bool aSelected);
prio(high) sync DoAction(uint64_t aID, uint8_t aIndex) returns(bool aSuccess); nested(inside_sync) sync DoAction(uint64_t aID, uint8_t aIndex) returns(bool aSuccess);
prio(high) sync ActionCount(uint64_t aID) returns(uint8_t aCount); nested(inside_sync) sync ActionCount(uint64_t aID) returns(uint8_t aCount);
prio(high) sync ActionDescriptionAt(uint64_t aID, uint8_t aIndex) returns(nsString aDescription); nested(inside_sync) sync ActionDescriptionAt(uint64_t aID, uint8_t aIndex) returns(nsString aDescription);
prio(high) sync ActionNameAt(uint64_t aID, uint8_t aIndex) returns(nsString aName); nested(inside_sync) sync ActionNameAt(uint64_t aID, uint8_t aIndex) returns(nsString aName);
prio(high) sync AccessKey(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask); nested(inside_sync) sync AccessKey(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
prio(high) sync KeyboardShortcut(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask); nested(inside_sync) sync KeyboardShortcut(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
prio(high) sync AtkKeyBinding(uint64_t aID) returns(nsString aResult); nested(inside_sync) sync AtkKeyBinding(uint64_t aID) returns(nsString aResult);
prio(high) sync CurValue(uint64_t aID) returns(double aValue); nested(inside_sync) sync CurValue(uint64_t aID) returns(double aValue);
prio(high) sync SetCurValue(uint64_t aID, double aValue) returns(bool aRetVal); nested(inside_sync) sync SetCurValue(uint64_t aID, double aValue) returns(bool aRetVal);
prio(high) sync MinValue(uint64_t aID) returns(double aValue); nested(inside_sync) sync MinValue(uint64_t aID) returns(double aValue);
prio(high) sync MaxValue(uint64_t aID) returns(double aValue); nested(inside_sync) sync MaxValue(uint64_t aID) returns(double aValue);
prio(high) sync Step(uint64_t aID) returns(double aStep); nested(inside_sync) sync Step(uint64_t aID) returns(double aStep);
async TakeFocus(uint64_t aID); async TakeFocus(uint64_t aID);
prio(high) sync FocusedChild(uint64_t aID) nested(inside_sync) sync FocusedChild(uint64_t aID)
returns(uint64_t aChild, bool aOk); returns(uint64_t aChild, bool aOk);
prio(high) sync Language(uint64_t aID) returns(nsString aLocale); nested(inside_sync) sync Language(uint64_t aID) returns(nsString aLocale);
prio(high) sync DocType(uint64_t aID) returns(nsString aType); nested(inside_sync) sync DocType(uint64_t aID) returns(nsString aType);
prio(high) sync Title(uint64_t aID) returns(nsString aTitle); nested(inside_sync) sync Title(uint64_t aID) returns(nsString aTitle);
prio(high) sync URL(uint64_t aID) returns(nsString aURL); nested(inside_sync) sync URL(uint64_t aID) returns(nsString aURL);
prio(high) sync MimeType(uint64_t aID) returns(nsString aMime); nested(inside_sync) sync MimeType(uint64_t aID) returns(nsString aMime);
prio(high) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType); nested(inside_sync) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType);
prio(high) sync AccessibleAtPoint(uint64_t aID, int32_t aX, int32_t aY, bool aNeedsScreenCoords, uint32_t aWhich) nested(inside_sync) sync AccessibleAtPoint(uint64_t aID, int32_t aX, int32_t aY, bool aNeedsScreenCoords, uint32_t aWhich)
returns(uint64_t aResult, bool aOk); returns(uint64_t aResult, bool aOk);
prio(high) sync Extents(uint64_t aID, bool aNeedsScreenCoords) nested(inside_sync) sync Extents(uint64_t aID, bool aNeedsScreenCoords)
returns(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight); returns(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight);
prio(high) sync DOMNodeID(uint64_t aID) returns(nsString aDOMNodeID); nested(inside_sync) sync DOMNodeID(uint64_t aID) returns(nsString aDOMNodeID);
}; };
} }

View File

@@ -111,7 +111,7 @@ union OptionalShmem
Shmem; Shmem;
}; };
prio(normal upto urgent) sync protocol PBrowser nested(upto inside_cpow) sync protocol PBrowser
{ {
manager PContent or PContentBridge; manager PContent or PContentBridge;
@@ -204,7 +204,7 @@ parent:
CpowEntry[] aCpows, Principal aPrincipal) CpowEntry[] aCpows, Principal aPrincipal)
returns (StructuredCloneData[] retval); returns (StructuredCloneData[] retval);
prio(high) sync RpcMessage(nsString aMessage, ClonedMessageData aData, nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
CpowEntry[] aCpows, Principal aPrincipal) CpowEntry[] aCpows, Principal aPrincipal)
returns (StructuredCloneData[] retval); returns (StructuredCloneData[] retval);
@@ -216,7 +216,7 @@ parent:
* notification Whole data of the notification * notification Whole data of the notification
* preference Native widget preference for IME updates * preference Native widget preference for IME updates
*/ */
prio(urgent) sync NotifyIMEFocus(ContentCache contentCache, nested(inside_cpow) sync NotifyIMEFocus(ContentCache contentCache,
IMENotification notification) IMENotification notification)
returns (nsIMEUpdatePreference preference); returns (nsIMEUpdatePreference preference);
@@ -228,7 +228,7 @@ parent:
* contentCache Cache of content * contentCache Cache of content
* notification Whole data of the notification * notification Whole data of the notification
*/ */
prio(urgent) async NotifyIMETextChange(ContentCache contentCache, nested(inside_cpow) async NotifyIMETextChange(ContentCache contentCache,
IMENotification notification); IMENotification notification);
/** /**
@@ -236,7 +236,7 @@ parent:
* *
* contentCache Cache of content * contentCache Cache of content
*/ */
prio(urgent) async NotifyIMECompositionUpdate(ContentCache contentCache, nested(inside_cpow) async NotifyIMECompositionUpdate(ContentCache contentCache,
IMENotification notification); IMENotification notification);
/** /**
@@ -246,7 +246,7 @@ parent:
* contentCache Cache of content * contentCache Cache of content
* notification Whole data of the notification * notification Whole data of the notification
*/ */
prio(urgent) async NotifyIMESelection(ContentCache contentCache, nested(inside_cpow) async NotifyIMESelection(ContentCache contentCache,
IMENotification notification); IMENotification notification);
/** /**
@@ -255,14 +255,14 @@ parent:
* *
* contentCache Cache of content * contentCache Cache of content
*/ */
prio(urgent) async UpdateContentCache(ContentCache contentCache); nested(inside_cpow) async UpdateContentCache(ContentCache contentCache);
/** /**
* Notifies IME of mouse button event on a character in focused editor. * Notifies IME of mouse button event on a character in focused editor.
* *
* Returns true if the mouse button event is consumd by IME. * Returns true if the mouse button event is consumd by IME.
*/ */
prio(urgent) sync NotifyIMEMouseButtonEvent(IMENotification notification) nested(inside_cpow) sync NotifyIMEMouseButtonEvent(IMENotification notification)
returns (bool consumedByIME); returns (bool consumedByIME);
/** /**
@@ -270,7 +270,7 @@ parent:
* *
* contentCache Cache of content * contentCache Cache of content
*/ */
prio(urgent) async NotifyIMEPositionChange(ContentCache contentCache, nested(inside_cpow) async NotifyIMEPositionChange(ContentCache contentCache,
IMENotification notification); IMENotification notification);
/** /**
@@ -285,7 +285,7 @@ parent:
* try to restore selected string which was * try to restore selected string which was
* replaced with the composition. * replaced with the composition.
*/ */
prio(urgent) sync RequestIMEToCommitComposition(bool cancel) nested(inside_cpow) sync RequestIMEToCommitComposition(bool cancel)
returns (bool isCommitted, nsString committedString); returns (bool isCommitted, nsString committedString);
/** /**
@@ -295,7 +295,7 @@ parent:
* *
* message The message value of the handled event. * message The message value of the handled event.
*/ */
prio(urgent) async OnEventNeedingAckHandled(EventMessage message); nested(inside_cpow) async OnEventNeedingAckHandled(EventMessage message);
/** /**
* Tells chrome to start plugin IME. If this results in a string getting * Tells chrome to start plugin IME. If this results in a string getting
@@ -306,7 +306,7 @@ parent:
* (should be just under the plugin) * (should be just under the plugin)
* aCommitted The string committed during IME -- otherwise empty * aCommitted The string committed during IME -- otherwise empty
*/ */
prio(urgent) sync StartPluginIME(WidgetKeyboardEvent aKeyboardEvent, nested(inside_cpow) sync StartPluginIME(WidgetKeyboardEvent aKeyboardEvent,
int32_t panelX, int32_t panelY) int32_t panelX, int32_t panelY)
returns (nsString aCommitted); returns (nsString aCommitted);
@@ -317,7 +317,7 @@ parent:
* *
* aFocused Whether or not a plugin is focused * aFocused Whether or not a plugin is focused
*/ */
prio(urgent) async SetPluginFocused(bool aFocused); nested(inside_cpow) async SetPluginFocused(bool aFocused);
/** /**
* Set IME candidate window by windowless plugin if plugin has focus. * Set IME candidate window by windowless plugin if plugin has focus.
@@ -332,7 +332,7 @@ parent:
* NativeEventData depending on the caller. Please check * NativeEventData depending on the caller. Please check
* PluginInstanceChild. * PluginInstanceChild.
*/ */
prio(urgent) async OnWindowedPluginKeyEvent(NativeEventData aKeyEventData); nested(inside_cpow) async OnWindowedPluginKeyEvent(NativeEventData aKeyEventData);
/** /**
* When plugin event isn't consumed, call this * When plugin event isn't consumed, call this
@@ -353,10 +353,10 @@ parent:
nsCString[] enabledCommands, nsCString[] enabledCommands,
nsCString[] disabledCommands); nsCString[] disabledCommands);
prio(urgent) sync GetInputContext() returns (int32_t IMEEnabled, nested(inside_cpow) sync GetInputContext() returns (int32_t IMEEnabled,
int32_t IMEOpen); int32_t IMEOpen);
prio(urgent) async SetInputContext(int32_t IMEEnabled, nested(inside_cpow) async SetInputContext(int32_t IMEEnabled,
int32_t IMEOpen, int32_t IMEOpen,
nsString type, nsString type,
nsString inputmode, nsString inputmode,
@@ -579,9 +579,9 @@ parent:
*/ */
async SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY, int32_t aCx, int32_t aCy); async SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY, int32_t aCx, int32_t aCy);
prio(high) sync DispatchWheelEvent(WidgetWheelEvent event); nested(inside_sync) sync DispatchWheelEvent(WidgetWheelEvent event);
prio(high) sync DispatchMouseEvent(WidgetMouseEvent event); nested(inside_sync) sync DispatchMouseEvent(WidgetMouseEvent event);
prio(high) sync DispatchKeyboardEvent(WidgetKeyboardEvent event); nested(inside_sync) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);
async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action, async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
OptionalShmem visualData, OptionalShmem visualData,

View File

@@ -377,7 +377,7 @@ struct BlobURLRegistrationData
Principal principal; Principal principal;
}; };
prio(normal upto urgent) sync protocol PContent nested(upto inside_cpow) sync protocol PContent
{ {
parent spawns PPluginModule; parent spawns PPluginModule;
@@ -843,7 +843,7 @@ parent:
sync GetLookAndFeelCache() sync GetLookAndFeelCache()
returns (LookAndFeelInt[] lookAndFeelIntCache); returns (LookAndFeelInt[] lookAndFeelIntCache);
prio(urgent) async PHal(); nested(inside_cpow) async PHal();
async PHeapSnapshotTempFileHelper(); async PHeapSnapshotTempFileHelper();
@@ -857,7 +857,7 @@ parent:
async PSendStream(); async PSendStream();
prio(high) sync PScreenManager() nested(inside_sync) sync PScreenManager()
returns (uint32_t numberOfScreens, returns (uint32_t numberOfScreens,
float systemDefaultScale, float systemDefaultScale,
bool success); bool success);
@@ -868,7 +868,7 @@ parent:
async PSpeechSynthesis(); async PSpeechSynthesis();
prio(urgent) async PStorage(); nested(inside_cpow) async PStorage();
async PTelephony(); async PTelephony();
@@ -908,7 +908,7 @@ parent:
CpowEntry[] aCpows, Principal aPrincipal) CpowEntry[] aCpows, Principal aPrincipal)
returns (StructuredCloneData[] retval); returns (StructuredCloneData[] retval);
prio(high) sync RpcMessage(nsString aMessage, ClonedMessageData aData, nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
CpowEntry[] aCpows, Principal aPrincipal) CpowEntry[] aCpows, Principal aPrincipal)
returns (StructuredCloneData[] retval); returns (StructuredCloneData[] retval);
@@ -1057,7 +1057,7 @@ parent:
* before one is submitted. This is urgent because an extension might use * before one is submitted. This is urgent because an extension might use
* a CPOW to synchronously submit a keygen element. * a CPOW to synchronously submit a keygen element.
*/ */
prio(urgent) sync KeygenProcessValue(nsString oldValue, nested(inside_cpow) sync KeygenProcessValue(nsString oldValue,
nsString challenge, nsString challenge,
nsString keytype, nsString keytype,
nsString keyparams) nsString keyparams)

View File

@@ -32,7 +32,7 @@ namespace dom {
* allocate the PContentBridgeChild. This protocol allows these processes to * allocate the PContentBridgeChild. This protocol allows these processes to
* share PBrowsers and send messages to each other. * share PBrowsers and send messages to each other.
*/ */
prio(normal upto urgent) sync protocol PContentBridge nested(upto inside_cpow) sync protocol PContentBridge
{ {
bridges PContent, PContent; bridges PContent, PContent;

View File

@@ -25,32 +25,32 @@ struct ScreenDetails {
double contentsScaleFactor; double contentsScaleFactor;
}; };
prio(normal upto high) sync protocol PScreenManager nested(upto inside_sync) sync protocol PScreenManager
{ {
manager PContent; manager PContent;
parent: parent:
prio(high) sync Refresh() nested(inside_sync) sync Refresh()
returns (uint32_t numberOfScreens, returns (uint32_t numberOfScreens,
float systemDefaultScale, float systemDefaultScale,
bool success); bool success);
prio(high) sync ScreenRefresh(uint32_t aId) nested(inside_sync) sync ScreenRefresh(uint32_t aId)
returns (ScreenDetails screen, returns (ScreenDetails screen,
bool success); bool success);
prio(high) sync GetPrimaryScreen() nested(inside_sync) sync GetPrimaryScreen()
returns (ScreenDetails screen, returns (ScreenDetails screen,
bool success); bool success);
prio(high) sync ScreenForRect(int32_t aLeft, nested(inside_sync) sync ScreenForRect(int32_t aLeft,
int32_t aTop, int32_t aTop,
int32_t aWidth, int32_t aWidth,
int32_t aHeight) int32_t aHeight)
returns (ScreenDetails screen, returns (ScreenDetails screen,
bool success); bool success);
prio(high) sync ScreenForBrowser(TabId aTabId) nested(inside_sync) sync ScreenForBrowser(TabId aTabId)
returns (ScreenDetails screen, returns (ScreenDetails screen,
bool success); bool success);

View File

@@ -12,14 +12,14 @@ namespace dom {
/* This protocol bridges async access to the database thread running on the parent process /* This protocol bridges async access to the database thread running on the parent process
* and caches running on the child process. * and caches running on the child process.
*/ */
prio(normal upto urgent) sync protocol PStorage nested(upto inside_cpow) sync protocol PStorage
{ {
manager PContent; manager PContent;
parent: parent:
async __delete__(); async __delete__();
prio(urgent) sync Preload(nsCString originSuffix, nsCString originNoSuffix, uint32_t alreadyLoadedCount) nested(inside_cpow) sync Preload(nsCString originSuffix, nsCString originNoSuffix, uint32_t alreadyLoadedCount)
returns (nsString[] keys, nsString[] values, nsresult rv); returns (nsString[] keys, nsString[] values, nsresult rv);
async AsyncPreload(nsCString originSuffix, nsCString originNoSuffix, bool priority); async AsyncPreload(nsCString originSuffix, nsCString originNoSuffix, bool priority);

View File

@@ -96,7 +96,7 @@ struct SystemTimezoneChangeInformation {
namespace hal_sandbox { namespace hal_sandbox {
prio(normal upto urgent) sync protocol PHal { nested(upto inside_cpow) sync protocol PHal {
manager PContent; manager PContent;
child: child:
@@ -156,7 +156,7 @@ parent:
async EnableScreenConfigurationNotifications(); async EnableScreenConfigurationNotifications();
async DisableScreenConfigurationNotifications(); async DisableScreenConfigurationNotifications();
prio(urgent) sync GetCurrentScreenConfiguration() nested(inside_cpow) sync GetCurrentScreenConfiguration()
returns (ScreenConfiguration aScreenConfiguration); returns (ScreenConfiguration aScreenConfiguration);
sync LockScreenOrientation(ScreenOrientationInternal aOrientation) sync LockScreenOrientation(ScreenOrientationInternal aOrientation)
returns (bool allowed); returns (bool allowed);

View File

@@ -263,8 +263,7 @@ void Channel::ChannelImpl::ResetFileDescriptor(int fd) {
bool Channel::ChannelImpl::EnqueueHelloMessage() { bool Channel::ChannelImpl::EnqueueHelloMessage() {
mozilla::UniquePtr<Message> msg(new Message(MSG_ROUTING_NONE, mozilla::UniquePtr<Message> msg(new Message(MSG_ROUTING_NONE,
HELLO_MESSAGE_TYPE, HELLO_MESSAGE_TYPE));
IPC::Message::PRIORITY_NORMAL));
if (!msg->WriteInt(base::GetCurrentProcId())) { if (!msg->WriteInt(base::GetCurrentProcId())) {
Close(); Close();
return false; return false;

View File

@@ -228,8 +228,7 @@ bool Channel::ChannelImpl::CreatePipe(const std::wstring& channel_id,
bool Channel::ChannelImpl::EnqueueHelloMessage() { bool Channel::ChannelImpl::EnqueueHelloMessage() {
mozilla::UniquePtr<Message> m = mozilla::MakeUnique<Message>(MSG_ROUTING_NONE, mozilla::UniquePtr<Message> m = mozilla::MakeUnique<Message>(MSG_ROUTING_NONE,
HELLO_MESSAGE_TYPE, HELLO_MESSAGE_TYPE);
IPC::Message::PRIORITY_NORMAL);
// If we're waiting for our shared secret from the other end's hello message // If we're waiting for our shared secret from the other end's hello message
// then don't give the game away by sending it in ours. // then don't give the game away by sending it in ours.

View File

@@ -45,13 +45,15 @@ Message::Message()
InitLoggingVariables(); InitLoggingVariables();
} }
Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority, Message::Message(int32_t routing_id, msgid_t type, NestedLevel nestedLevel, PriorityValue priority,
MessageCompression compression, const char* const aName) MessageCompression compression, const char* const aName)
: Pickle(sizeof(Header)) { : Pickle(sizeof(Header)) {
MOZ_COUNT_CTOR(IPC::Message); MOZ_COUNT_CTOR(IPC::Message);
header()->routing = routing_id; header()->routing = routing_id;
header()->type = type; header()->type = type;
header()->flags = priority; header()->flags = nestedLevel;
if (priority == HIGH_PRIORITY)
header()->flags |= PRIORITY_BIT;
if (compression == COMPRESSION_ENABLED) if (compression == COMPRESSION_ENABLED)
header()->flags |= COMPRESS_BIT; header()->flags |= COMPRESS_BIT;
else if (compression == COMPRESSION_ALL) else if (compression == COMPRESSION_ALL)

View File

@@ -38,10 +38,15 @@ class Message : public Pickle {
public: public:
typedef uint32_t msgid_t; typedef uint32_t msgid_t;
enum NestedLevel {
NOT_NESTED = 1,
NESTED_INSIDE_SYNC = 2,
NESTED_INSIDE_CPOW = 3
};
enum PriorityValue { enum PriorityValue {
PRIORITY_NORMAL = 1, NORMAL_PRIORITY,
PRIORITY_HIGH = 2, HIGH_PRIORITY,
PRIORITY_URGENT = 3
}; };
enum MessageCompression { enum MessageCompression {
@@ -56,7 +61,10 @@ class Message : public Pickle {
// Initialize a message with a user-defined type, priority value, and // Initialize a message with a user-defined type, priority value, and
// destination WebView ID. // destination WebView ID.
Message(int32_t routing_id, msgid_t type, PriorityValue priority, Message(int32_t routing_id,
msgid_t type,
NestedLevel nestedLevel = NOT_NESTED,
PriorityValue priority = NORMAL_PRIORITY,
MessageCompression compression = COMPRESSION_NONE, MessageCompression compression = COMPRESSION_NONE,
const char* const name="???"); const char* const name="???");
@@ -67,13 +75,27 @@ class Message : public Pickle {
Message& operator=(const Message& other) = delete; Message& operator=(const Message& other) = delete;
Message& operator=(Message&& other); Message& operator=(Message&& other);
PriorityValue priority() const { NestedLevel nested_level() const {
return static_cast<PriorityValue>(header()->flags & PRIORITY_MASK); return static_cast<NestedLevel>(header()->flags & NESTED_MASK);
} }
void set_priority(int prio) { void set_nested_level(NestedLevel nestedLevel) {
DCHECK((prio & ~PRIORITY_MASK) == 0); DCHECK((nestedLevel & ~NESTED_MASK) == 0);
header()->flags = (header()->flags & ~PRIORITY_MASK) | prio; header()->flags = (header()->flags & ~NESTED_MASK) | nestedLevel;
}
PriorityValue priority() const {
if (header()->flags & PRIORITY_BIT) {
return HIGH_PRIORITY;
}
return NORMAL_PRIORITY;
}
void set_priority(PriorityValue prio) {
header()->flags &= ~PRIORITY_BIT;
if (prio == HIGH_PRIORITY) {
header()->flags |= PRIORITY_BIT;
}
} }
// True if this is a synchronous message. // True if this is a synchronous message.
@@ -114,27 +136,6 @@ class Message : public Pickle {
return (header()->flags & REPLY_ERROR_BIT) != 0; return (header()->flags & REPLY_ERROR_BIT) != 0;
} }
// Normally when a receiver gets a message and they're blocked on a
// synchronous message Send, they buffer a message. Setting this flag causes
// the receiver to be unblocked and the message to be dispatched immediately.
void set_unblock(bool unblock) {
if (unblock) {
header()->flags |= UNBLOCK_BIT;
} else {
header()->flags &= ~UNBLOCK_BIT;
}
}
bool should_unblock() const {
return (header()->flags & UNBLOCK_BIT) != 0;
}
// Tells the receiver that the caller is pumping messages while waiting
// for the result.
bool is_caller_pumping_messages() const {
return (header()->flags & PUMPING_MSGS_BIT) != 0;
}
msgid_t type() const { msgid_t type() const {
return header()->type; return header()->type;
} }
@@ -269,16 +270,14 @@ class Message : public Pickle {
// flags // flags
enum { enum {
PRIORITY_MASK = 0x0003, NESTED_MASK = 0x0003,
SYNC_BIT = 0x0004, PRIORITY_BIT = 0x0004,
REPLY_BIT = 0x0008, SYNC_BIT = 0x0008,
REPLY_ERROR_BIT = 0x0010, REPLY_BIT = 0x0010,
UNBLOCK_BIT = 0x0020, REPLY_ERROR_BIT = 0x0020,
PUMPING_MSGS_BIT= 0x0040, INTERRUPT_BIT = 0x0040,
HAS_SENT_TIME_BIT = 0x0080, COMPRESS_BIT = 0x0080,
INTERRUPT_BIT = 0x0100, COMPRESSALL_BIT = 0x0100,
COMPRESS_BIT = 0x0200,
COMPRESSALL_BIT = 0x0400,
}; };
struct Header : Pickle::Header { struct Header : Pickle::Header {

View File

@@ -39,36 +39,41 @@ static mozilla::LazyLogModule sLogModule("ipc");
* IPC design: * IPC design:
* *
* There are three kinds of messages: async, sync, and intr. Sync and intr * There are three kinds of messages: async, sync, and intr. Sync and intr
* messages are blocking. Only intr and high-priority sync messages can nest. * messages are blocking.
* *
* Terminology: To dispatch a message Foo is to run the RecvFoo code for * Terminology: To dispatch a message Foo is to run the RecvFoo code for
* it. This is also called "handling" the message. * it. This is also called "handling" the message.
* *
* Sync and async messages have priorities while intr messages always have * Sync and async messages can sometimes "nest" inside other sync messages
* normal priority. The three possible priorities are normal, high, and urgent. * (i.e., while waiting for the sync reply, we can dispatch the inner
* The intended uses of these priorities are: * message). Intr messages cannot nest. The three possible nesting levels are
* NORMAL - most messages. * NOT_NESTED, NESTED_INSIDE_SYNC, and NESTED_INSIDE_CPOW. The intended uses
* HIGH - CPOW-related messages, which can go in either direction. * are:
* URGENT - messages where we don't want to dispatch * NOT_NESTED - most messages.
* NESTED_INSIDE_SYNC - CPOW-related messages, which are always sync
* and can go in either direction.
* NESTED_INSIDE_CPOW - messages where we don't want to dispatch
* incoming CPOWs while waiting for the response. * incoming CPOWs while waiting for the response.
* Async messages cannot have HIGH priority. * These nesting levels are ordered: NOT_NESTED, NESTED_INSIDE_SYNC,
* NESTED_INSIDE_CPOW. Async messages cannot be NESTED_INSIDE_SYNC but they can
* be NESTED_INSIDE_CPOW.
* *
* To avoid jank, the parent process is not allowed to send sync messages of * To avoid jank, the parent process is not allowed to send NOT_NESTED sync messages.
* normal priority. When a process is waiting for a response to a sync message * When a process is waiting for a response to a sync message
* M0, it will dispatch an incoming message M if: * M0, it will dispatch an incoming message M if:
* 1. M has a higher priority than M0, or * 1. M has a higher nesting level than M0, or
* 2. if M has the same priority as M0 and we're in the child, or * 2. if M has the same nesting level as M0 and we're in the child, or
* 3. if M has the same priority as M0 and it was sent by the other side * 3. if M has the same nesting level as M0 and it was sent by the other side
* while dispatching M0 (nesting). * while dispatching M0.
* The idea is that higher priority messages should take precendence, and we * The idea is that messages with higher nesting should take precendence. The
* also want to allow nesting. The purpose of rule 2 is to handle a race where * purpose of rule 2 is to handle a race where both processes send to each other
* both processes send to each other simultaneously. In this case, we resolve * simultaneously. In this case, we resolve the race in favor of the parent (so
* the race in favor of the parent (so the child dispatches first). * the child dispatches first).
* *
* Messages satisfy the following properties: * Messages satisfy the following properties:
* A. When waiting for a response to a sync message, we won't dispatch any * A. When waiting for a response to a sync message, we won't dispatch any
* messages of lower priority. * messages of nesting level.
* B. Messages of the same priority will be dispatched roughly in the * B. Messages of the same nesting level will be dispatched roughly in the
* order they were sent. The exception is when the parent and child send * order they were sent. The exception is when the parent and child send
* sync messages to each other simulataneously. In this case, the parent's * sync messages to each other simulataneously. In this case, the parent's
* message is dispatched first. While it is dispatched, the child may send * message is dispatched first. While it is dispatched, the child may send
@@ -78,13 +83,13 @@ static mozilla::LazyLogModule sLogModule("ipc");
* after the parent's message is finished being dispatched. * after the parent's message is finished being dispatched.
* *
* When waiting for a sync message reply, we dispatch an async message only if * When waiting for a sync message reply, we dispatch an async message only if
* it has URGENT priority. Normally URGENT async messages are sent only from the * it is NESTED_INSIDE_CPOW. Normally NESTED_INSIDE_CPOW async
* child. However, the parent can send URGENT async messages when it is creating * messages are sent only from the child. However, the parent can send
* a bridged protocol. * NESTED_INSIDE_CPOW async messages when it is creating a bridged protocol.
* *
* Intr messages are blocking but not prioritized. While waiting for an intr * Intr messages are blocking and can nest, but they don't participate in the
* response, all incoming messages are dispatched until a response is * nesting levels. While waiting for an intr response, all incoming messages are
* received. Intr messages also can be nested. When two intr messages race with * dispatched until a response is received. When two intr messages race with
* each other, a similar scheme is used to ensure that one side wins. The * each other, a similar scheme is used to ensure that one side wins. The
* winning side is chosen based on the message type. * winning side is chosen based on the message type.
* *
@@ -287,11 +292,11 @@ public:
explicit AutoEnterTransaction(MessageChannel *aChan, explicit AutoEnterTransaction(MessageChannel *aChan,
int32_t aMsgSeqno, int32_t aMsgSeqno,
int32_t aTransactionID, int32_t aTransactionID,
int aPriority) int aNestedLevel)
: mChan(aChan), : mChan(aChan),
mActive(true), mActive(true),
mOutgoing(true), mOutgoing(true),
mPriority(aPriority), mNestedLevel(aNestedLevel),
mSeqno(aMsgSeqno), mSeqno(aMsgSeqno),
mTransaction(aTransactionID), mTransaction(aTransactionID),
mNext(mChan->mTransactionStack) mNext(mChan->mTransactionStack)
@@ -304,7 +309,7 @@ public:
: mChan(aChan), : mChan(aChan),
mActive(true), mActive(true),
mOutgoing(false), mOutgoing(false),
mPriority(aMessage.priority()), mNestedLevel(aMessage.nested_level()),
mSeqno(aMessage.seqno()), mSeqno(aMessage.seqno()),
mTransaction(aMessage.transaction_id()), mTransaction(aMessage.transaction_id()),
mNext(mChan->mTransactionStack) mNext(mChan->mTransactionStack)
@@ -329,11 +334,11 @@ public:
void Cancel() { void Cancel() {
AutoEnterTransaction *cur = mChan->mTransactionStack; AutoEnterTransaction *cur = mChan->mTransactionStack;
MOZ_RELEASE_ASSERT(cur == this); MOZ_RELEASE_ASSERT(cur == this);
while (cur && cur->mPriority != IPC::Message::PRIORITY_NORMAL) { while (cur && cur->mNestedLevel != IPC::Message::NOT_NESTED) {
// Note that, in the following situation, we will cancel multiple // Note that, in the following situation, we will cancel multiple
// transactions: // transactions:
// 1. Parent sends high prio message P1 to child. // 1. Parent sends NESTED_INSIDE_SYNC message P1 to child.
// 2. Child sends high prio message C1 to child. // 2. Child sends NESTED_INSIDE_SYNC message C1 to child.
// 3. Child dispatches P1, parent blocks. // 3. Child dispatches P1, parent blocks.
// 4. Child cancels. // 4. Child cancels.
// In this case, both P1 and C1 are cancelled. The parent will // In this case, both P1 and C1 are cancelled. The parent will
@@ -356,12 +361,12 @@ public:
return mNext ? mNext->AwaitingSyncReply() : false; return mNext ? mNext->AwaitingSyncReply() : false;
} }
int AwaitingSyncReplyPriority() const { int AwaitingSyncReplyNestedLevel() const {
MOZ_RELEASE_ASSERT(mActive); MOZ_RELEASE_ASSERT(mActive);
if (mOutgoing) { if (mOutgoing) {
return mPriority; return mNestedLevel;
} }
return mNext ? mNext->AwaitingSyncReplyPriority() : 0; return mNext ? mNext->AwaitingSyncReplyNestedLevel() : 0;
} }
bool DispatchingSyncMessage() const { bool DispatchingSyncMessage() const {
@@ -372,17 +377,17 @@ public:
return mNext ? mNext->DispatchingSyncMessage() : false; return mNext ? mNext->DispatchingSyncMessage() : false;
} }
int DispatchingSyncMessagePriority() const { int DispatchingSyncMessageNestedLevel() const {
MOZ_RELEASE_ASSERT(mActive); MOZ_RELEASE_ASSERT(mActive);
if (!mOutgoing) { if (!mOutgoing) {
return mPriority; return mNestedLevel;
} }
return mNext ? mNext->DispatchingSyncMessagePriority() : 0; return mNext ? mNext->DispatchingSyncMessageNestedLevel() : 0;
} }
int Priority() const { int NestedLevel() const {
MOZ_RELEASE_ASSERT(mActive); MOZ_RELEASE_ASSERT(mActive);
return mPriority; return mNestedLevel;
} }
int32_t SequenceNumber() const { int32_t SequenceNumber() const {
@@ -456,7 +461,7 @@ private:
bool mOutgoing; bool mOutgoing;
// Properties of the message being sent/received. // Properties of the message being sent/received.
int mPriority; int mNestedLevel;
int32_t mSeqno; int32_t mSeqno;
int32_t mTransaction; int32_t mTransaction;
@@ -480,10 +485,10 @@ MessageChannel::MessageChannel(MessageListener *aListener)
mNextSeqno(0), mNextSeqno(0),
mLastSendError(SyncSendError::SendSuccess), mLastSendError(SyncSendError::SendSuccess),
mDispatchingAsyncMessage(false), mDispatchingAsyncMessage(false),
mDispatchingAsyncMessagePriority(0), mDispatchingAsyncMessageNestedLevel(0),
mTransactionStack(nullptr), mTransactionStack(nullptr),
mTimedOutMessageSeqno(0), mTimedOutMessageSeqno(0),
mTimedOutMessagePriority(0), mTimedOutMessageNestedLevel(0),
#if defined(MOZ_CRASHREPORTER) && defined(OS_WIN) #if defined(MOZ_CRASHREPORTER) && defined(OS_WIN)
mPending(AnnotateAllocator<Message>(*this)), mPending(AnnotateAllocator<Message>(*this)),
#endif #endif
@@ -543,16 +548,16 @@ MessageChannel::~MessageChannel()
// "current transaction" can be hard to define when messages race with each // "current transaction" can be hard to define when messages race with each
// other and one gets canceled and the other doesn't, we require that this // other and one gets canceled and the other doesn't, we require that this
// function is only called when the current transaction is known to be for a // function is only called when the current transaction is known to be for a
// high priority message. In that case, we know for sure what the caller is // NESTED_INSIDE_SYNC message. In that case, we know for sure what the caller is
// looking for. // looking for.
int32_t int32_t
MessageChannel::CurrentHighPriorityTransaction() const MessageChannel::CurrentNestedInsideSyncTransaction() const
{ {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
if (!mTransactionStack) { if (!mTransactionStack) {
return 0; return 0;
} }
MOZ_RELEASE_ASSERT(mTransactionStack->Priority() == IPC::Message::PRIORITY_HIGH); MOZ_RELEASE_ASSERT(mTransactionStack->NestedLevel() == IPC::Message::NESTED_INSIDE_SYNC);
return mTransactionStack->TransactionID(); return mTransactionStack->TransactionID();
} }
@@ -564,10 +569,10 @@ MessageChannel::AwaitingSyncReply() const
} }
int int
MessageChannel::AwaitingSyncReplyPriority() const MessageChannel::AwaitingSyncReplyNestedLevel() const
{ {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
return mTransactionStack ? mTransactionStack->AwaitingSyncReplyPriority() : 0; return mTransactionStack ? mTransactionStack->AwaitingSyncReplyNestedLevel() : 0;
} }
bool bool
@@ -578,10 +583,10 @@ MessageChannel::DispatchingSyncMessage() const
} }
int int
MessageChannel::DispatchingSyncMessagePriority() const MessageChannel::DispatchingSyncMessageNestedLevel() const
{ {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
return mTransactionStack ? mTransactionStack->DispatchingSyncMessagePriority() : 0; return mTransactionStack ? mTransactionStack->DispatchingSyncMessageNestedLevel() : 0;
} }
static void static void
@@ -797,7 +802,7 @@ class CancelMessage : public IPC::Message
{ {
public: public:
explicit CancelMessage(int transaction) : explicit CancelMessage(int transaction) :
IPC::Message(MSG_ROUTING_NONE, CANCEL_MESSAGE_TYPE, PRIORITY_NORMAL) IPC::Message(MSG_ROUTING_NONE, CANCEL_MESSAGE_TYPE)
{ {
set_transaction_id(transaction); set_transaction_id(transaction);
} }
@@ -838,32 +843,32 @@ MessageChannel::MaybeInterceptSpecialIOMessage(const Message& aMsg)
bool bool
MessageChannel::ShouldDeferMessage(const Message& aMsg) MessageChannel::ShouldDeferMessage(const Message& aMsg)
{ {
// Never defer messages that have the highest priority, even async // Never defer messages that have the highest nested level, even async
// ones. This is safe because only the child can send these messages, so // ones. This is safe because only the child can send these messages, so
// they can never nest. // they can never nest.
if (aMsg.priority() == IPC::Message::PRIORITY_URGENT) if (aMsg.nested_level() == IPC::Message::NESTED_INSIDE_CPOW)
return false; return false;
// Unless they're urgent, we always defer async messages. // Unless they're NESTED_INSIDE_CPOW, we always defer async messages.
// Note that we never send an async high priority message. // Note that we never send an async NESTED_INSIDE_SYNC message.
if (!aMsg.is_sync()) { if (!aMsg.is_sync()) {
MOZ_RELEASE_ASSERT(aMsg.priority() == IPC::Message::PRIORITY_NORMAL); MOZ_RELEASE_ASSERT(aMsg.nested_level() == IPC::Message::NOT_NESTED);
return true; return true;
} }
int msgPrio = aMsg.priority(); int msgNestedLevel = aMsg.nested_level();
int waitingPrio = AwaitingSyncReplyPriority(); int waitingNestedLevel = AwaitingSyncReplyNestedLevel();
// Always defer if the priority of the incoming message is less than the // Always defer if the nested level of the incoming message is less than the
// priority of the message we're awaiting. // nested level of the message we're awaiting.
if (msgPrio < waitingPrio) if (msgNestedLevel < waitingNestedLevel)
return true; return true;
// Never defer if the message has strictly greater priority. // Never defer if the message has strictly greater nested level.
if (msgPrio > waitingPrio) if (msgNestedLevel > waitingNestedLevel)
return false; return false;
// When both sides send sync messages of the same priority, we resolve the // When both sides send sync messages of the same nested level, we resolve the
// race by dispatching in the child and deferring the incoming message in // race by dispatching in the child and deferring the incoming message in
// the parent. However, the parent still needs to dispatch nested sync // the parent. However, the parent still needs to dispatch nested sync
// messages. // messages.
@@ -872,7 +877,7 @@ MessageChannel::ShouldDeferMessage(const Message& aMsg)
// child's message comes in, we can pretend the child hasn't quite // child's message comes in, we can pretend the child hasn't quite
// finished sending it yet. Since the message is sync, we know that the // finished sending it yet. Since the message is sync, we know that the
// child hasn't moved on yet. // child hasn't moved on yet.
return mSide == ParentSide && aMsg.transaction_id() != CurrentHighPriorityTransaction(); return mSide == ParentSide && aMsg.transaction_id() != CurrentNestedInsideSyncTransaction();
} }
// Predicate that is true for messages that should be consolidated if 'compress' is set. // Predicate that is true for messages that should be consolidated if 'compress' is set.
@@ -917,9 +922,9 @@ MessageChannel::OnMessageReceivedFromLink(Message&& aMsg)
return; return;
} }
// Prioritized messages cannot be compressed. // Nested messages cannot be compressed.
MOZ_RELEASE_ASSERT(aMsg.compress_type() == IPC::Message::COMPRESSION_NONE || MOZ_RELEASE_ASSERT(aMsg.compress_type() == IPC::Message::COMPRESSION_NONE ||
aMsg.priority() == IPC::Message::PRIORITY_NORMAL); aMsg.nested_level() == IPC::Message::NOT_NESTED);
bool compress = false; bool compress = false;
if (aMsg.compress_type() == IPC::Message::COMPRESSION_ENABLED) { if (aMsg.compress_type() == IPC::Message::COMPRESSION_ENABLED) {
@@ -969,7 +974,7 @@ MessageChannel::OnMessageReceivedFromLink(Message&& aMsg)
// //
// (1) We are waiting on a sync reply - main thread is blocked on the // (1) We are waiting on a sync reply - main thread is blocked on the
// IPC monitor. // IPC monitor.
// - If the message is high priority, we wake up the main thread to // - If the message is NESTED_INSIDE_SYNC, we wake up the main thread to
// deliver the message depending on ShouldDeferMessage. Otherwise, we // deliver the message depending on ShouldDeferMessage. Otherwise, we
// leave it in the mPending queue, posting a task to the main event // leave it in the mPending queue, posting a task to the main event
// loop, where it will be processed once the synchronous reply has been // loop, where it will be processed once the synchronous reply has been
@@ -1021,13 +1026,13 @@ MessageChannel::ProcessPendingRequests(AutoEnterTransaction& aTransaction)
IPC_LOG("ProcessPendingRequests for seqno=%d, xid=%d", IPC_LOG("ProcessPendingRequests for seqno=%d, xid=%d",
aTransaction.SequenceNumber(), aTransaction.TransactionID()); aTransaction.SequenceNumber(), aTransaction.TransactionID());
// Loop until there aren't any more priority messages to process. // Loop until there aren't any more nested messages to process.
for (;;) { for (;;) {
// If we canceled during ProcessPendingRequest, then we need to leave // If we canceled during ProcessPendingRequest, then we need to leave
// immediately because the results of ShouldDeferMessage will be // immediately because the results of ShouldDeferMessage will be
// operating with weird state (as if no Send is in progress). That could // operating with weird state (as if no Send is in progress). That could
// cause even normal priority sync messages to be processed (but not // cause even NOT_NESTED sync messages to be processed (but not
// normal priority async messages), which would break message ordering. // NOT_NESTED async messages), which would break message ordering.
if (aTransaction.IsCanceled()) { if (aTransaction.IsCanceled()) {
return; return;
} }
@@ -1042,7 +1047,7 @@ MessageChannel::ProcessPendingRequests(AutoEnterTransaction& aTransaction)
bool defer = ShouldDeferMessage(msg); bool defer = ShouldDeferMessage(msg);
// Only log the interesting messages. // Only log the interesting messages.
if (msg.is_sync() || msg.priority() == IPC::Message::PRIORITY_URGENT) { if (msg.is_sync() || msg.nested_level() == IPC::Message::NESTED_INSIDE_CPOW) {
IPC_LOG("ShouldDeferMessage(seqno=%d) = %d", msg.seqno(), defer); IPC_LOG("ShouldDeferMessage(seqno=%d) = %d", msg.seqno(), defer);
} }
@@ -1101,48 +1106,48 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
return false; return false;
} }
if (DispatchingSyncMessagePriority() == IPC::Message::PRIORITY_NORMAL && if (DispatchingSyncMessageNestedLevel() == IPC::Message::NOT_NESTED &&
msg->priority() > IPC::Message::PRIORITY_NORMAL) msg->nested_level() > IPC::Message::NOT_NESTED)
{ {
// Don't allow sending CPOWs while we're dispatching a sync message. // Don't allow sending CPOWs while we're dispatching a sync message.
// If you want to do that, use sendRpcMessage instead. // If you want to do that, use sendRpcMessage instead.
IPC_LOG("Prio forbids send"); IPC_LOG("Nested level forbids send");
mLastSendError = SyncSendError::SendingCPOWWhileDispatchingSync; mLastSendError = SyncSendError::SendingCPOWWhileDispatchingSync;
return false; return false;
} }
if (DispatchingSyncMessagePriority() == IPC::Message::PRIORITY_URGENT || if (DispatchingSyncMessageNestedLevel() == IPC::Message::NESTED_INSIDE_CPOW ||
DispatchingAsyncMessagePriority() == IPC::Message::PRIORITY_URGENT) DispatchingAsyncMessageNestedLevel() == IPC::Message::NESTED_INSIDE_CPOW)
{ {
// Generally only the parent dispatches urgent messages. And the only // Generally only the parent dispatches urgent messages. And the only
// sync messages it can send are high-priority. Mainly we want to ensure // sync messages it can send are NESTED_INSIDE_SYNC. Mainly we want to ensure
// here that we don't return false for non-CPOW messages. // here that we don't return false for non-CPOW messages.
MOZ_RELEASE_ASSERT(msg->priority() == IPC::Message::PRIORITY_HIGH); MOZ_RELEASE_ASSERT(msg->nested_level() == IPC::Message::NESTED_INSIDE_SYNC);
IPC_LOG("Sending while dispatching urgent message"); IPC_LOG("Sending while dispatching urgent message");
mLastSendError = SyncSendError::SendingCPOWWhileDispatchingUrgent; mLastSendError = SyncSendError::SendingCPOWWhileDispatchingUrgent;
return false; return false;
} }
if (msg->priority() < DispatchingSyncMessagePriority() || if (msg->nested_level() < DispatchingSyncMessageNestedLevel() ||
msg->priority() < AwaitingSyncReplyPriority()) msg->nested_level() < AwaitingSyncReplyNestedLevel())
{ {
MOZ_RELEASE_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage()); MOZ_RELEASE_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage());
IPC_LOG("Cancel from Send"); IPC_LOG("Cancel from Send");
CancelMessage *cancel = new CancelMessage(CurrentHighPriorityTransaction()); CancelMessage *cancel = new CancelMessage(CurrentNestedInsideSyncTransaction());
CancelTransaction(CurrentHighPriorityTransaction()); CancelTransaction(CurrentNestedInsideSyncTransaction());
mLink->SendMessage(cancel); mLink->SendMessage(cancel);
} }
IPC_ASSERT(msg->is_sync(), "can only Send() sync messages here"); IPC_ASSERT(msg->is_sync(), "can only Send() sync messages here");
IPC_ASSERT(msg->priority() >= DispatchingSyncMessagePriority(), IPC_ASSERT(msg->nested_level() >= DispatchingSyncMessageNestedLevel(),
"can't send sync message of a lesser priority than what's being dispatched"); "can't send sync message of a lesser nested level than what's being dispatched");
IPC_ASSERT(AwaitingSyncReplyPriority() <= msg->priority(), IPC_ASSERT(AwaitingSyncReplyNestedLevel() <= msg->nested_level(),
"nested sync message sends must be of increasing priority"); "nested sync message sends must be of increasing nested level");
IPC_ASSERT(DispatchingSyncMessagePriority() != IPC::Message::PRIORITY_URGENT, IPC_ASSERT(DispatchingSyncMessageNestedLevel() != IPC::Message::NESTED_INSIDE_CPOW,
"not allowed to send messages while dispatching urgent messages"); "not allowed to send messages while dispatching urgent messages");
IPC_ASSERT(DispatchingAsyncMessagePriority() != IPC::Message::PRIORITY_URGENT, IPC_ASSERT(DispatchingAsyncMessageNestedLevel() != IPC::Message::NESTED_INSIDE_CPOW,
"not allowed to send messages while dispatching urgent messages"); "not allowed to send messages while dispatching urgent messages");
if (!Connected()) { if (!Connected()) {
@@ -1154,21 +1159,21 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
msg->set_seqno(NextSeqno()); msg->set_seqno(NextSeqno());
int32_t seqno = msg->seqno(); int32_t seqno = msg->seqno();
int prio = msg->priority(); int nestedLevel = msg->nested_level();
msgid_t replyType = msg->type() + 1; msgid_t replyType = msg->type() + 1;
AutoEnterTransaction *stackTop = mTransactionStack; AutoEnterTransaction *stackTop = mTransactionStack;
// If the most recent message on the stack is high priority, then our // If the most recent message on the stack is NESTED_INSIDE_SYNC, then our
// message should nest inside that and we use the same transaction // message should nest inside that and we use the same transaction
// ID. Otherwise we need a new transaction ID (so we use the seqno of the // ID. Otherwise we need a new transaction ID (so we use the seqno of the
// message we're sending). // message we're sending).
bool nest = stackTop && stackTop->Priority() == IPC::Message::PRIORITY_HIGH; bool nest = stackTop && stackTop->NestedLevel() == IPC::Message::NESTED_INSIDE_SYNC;
int32_t transaction = nest ? stackTop->TransactionID() : seqno; int32_t transaction = nest ? stackTop->TransactionID() : seqno;
msg->set_transaction_id(transaction); msg->set_transaction_id(transaction);
bool handleWindowsMessages = mListener->HandleWindowsMessages(*aMsg); bool handleWindowsMessages = mListener->HandleWindowsMessages(*aMsg);
AutoEnterTransaction transact(this, seqno, transaction, prio); AutoEnterTransaction transact(this, seqno, transaction, nestedLevel);
IPC_LOG("Send seqno=%d, xid=%d", seqno, transaction); IPC_LOG("Send seqno=%d, xid=%d", seqno, transaction);
@@ -1227,7 +1232,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
IPC_LOG("Timing out Send: xid=%d", transaction); IPC_LOG("Timing out Send: xid=%d", transaction);
mTimedOutMessageSeqno = seqno; mTimedOutMessageSeqno = seqno;
mTimedOutMessagePriority = prio; mTimedOutMessageNestedLevel = nestedLevel;
mLastSendError = SyncSendError::TimedOut; mLastSendError = SyncSendError::TimedOut;
return false; return false;
} }
@@ -1515,10 +1520,10 @@ MessageChannel::DequeueOne(Message *recvd)
// If we've timed out a message and we're awaiting the reply to the timed // If we've timed out a message and we're awaiting the reply to the timed
// out message, we have to be careful what messages we process. Here's what // out message, we have to be careful what messages we process. Here's what
// can go wrong: // can go wrong:
// 1. child sends a normal priority sync message S // 1. child sends a NOT_NESTED sync message S
// 2. parent sends a high priority sync message H at the same time // 2. parent sends a NESTED_INSIDE_SYNC sync message H at the same time
// 3. parent times out H // 3. parent times out H
// 4. child starts processing H and sends a high priority message H' nested // 4. child starts processing H and sends a NESTED_INSIDE_SYNC message H' nested
// within the same transaction // within the same transaction
// 5. parent dispatches S and sends reply // 5. parent dispatches S and sends reply
// 6. child asserts because it instead expected a reply to H'. // 6. child asserts because it instead expected a reply to H'.
@@ -1526,13 +1531,13 @@ MessageChannel::DequeueOne(Message *recvd)
// To solve this, we refuse to process S in the parent until we get a reply // To solve this, we refuse to process S in the parent until we get a reply
// to H. More generally, let the timed out message be M. We don't process a // to H. More generally, let the timed out message be M. We don't process a
// message unless the child would need the response to that message in order // message unless the child would need the response to that message in order
// to process M. Those messages are the ones that have a higher priority // to process M. Those messages are the ones that have a higher nested level
// than M or that are part of the same transaction as M. // than M or that are part of the same transaction as M.
if (mTimedOutMessageSeqno) { if (mTimedOutMessageSeqno) {
for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); it++) { for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); it++) {
Message &msg = *it; Message &msg = *it;
if (msg.priority() > mTimedOutMessagePriority || if (msg.nested_level() > mTimedOutMessageNestedLevel ||
(msg.priority() == mTimedOutMessagePriority (msg.nested_level() == mTimedOutMessageNestedLevel
&& msg.transaction_id() == mTimedOutMessageSeqno)) && msg.transaction_id() == mTimedOutMessageSeqno))
{ {
*recvd = Move(msg); *recvd = Move(msg);
@@ -1626,9 +1631,9 @@ MessageChannel::DispatchSyncMessage(const Message& aMsg, Message*& aReply)
{ {
AssertWorkerThread(); AssertWorkerThread();
int prio = aMsg.priority(); int nestedLevel = aMsg.nested_level();
MOZ_RELEASE_ASSERT(prio == IPC::Message::PRIORITY_NORMAL || NS_IsMainThread()); MOZ_RELEASE_ASSERT(nestedLevel == IPC::Message::NOT_NESTED || NS_IsMainThread());
MessageChannel* dummy; MessageChannel* dummy;
MessageChannel*& blockingVar = mSide == ChildSide && NS_IsMainThread() ? gParentProcessBlocker : dummy; MessageChannel*& blockingVar = mSide == ChildSide && NS_IsMainThread() ? gParentProcessBlocker : dummy;
@@ -1642,7 +1647,7 @@ MessageChannel::DispatchSyncMessage(const Message& aMsg, Message*& aReply)
if (!MaybeHandleError(rv, aMsg, "DispatchSyncMessage")) { if (!MaybeHandleError(rv, aMsg, "DispatchSyncMessage")) {
aReply = new Message(); aReply = new Message();
aReply->set_sync(); aReply->set_sync();
aReply->set_priority(aMsg.priority()); aReply->set_nested_level(aMsg.nested_level());
aReply->set_reply(); aReply->set_reply();
aReply->set_reply_error(); aReply->set_reply_error();
} }
@@ -1662,9 +1667,9 @@ MessageChannel::DispatchAsyncMessage(const Message& aMsg)
Result rv; Result rv;
{ {
int prio = aMsg.priority(); int nestedLevel = aMsg.nested_level();
AutoSetValue<bool> async(mDispatchingAsyncMessage, true); AutoSetValue<bool> async(mDispatchingAsyncMessage, true);
AutoSetValue<int> prioSet(mDispatchingAsyncMessagePriority, prio); AutoSetValue<int> nestedLevelSet(mDispatchingAsyncMessageNestedLevel, nestedLevel);
rv = mListener->OnMessageReceived(aMsg); rv = mListener->OnMessageReceived(aMsg);
} }
MaybeHandleError(rv, aMsg, "DispatchAsyncMessage"); MaybeHandleError(rv, aMsg, "DispatchAsyncMessage");
@@ -1775,7 +1780,7 @@ MessageChannel::MaybeUndeferIncall()
IPC_ASSERT(0 < mRemoteStackDepthGuess, "fatal logic error"); IPC_ASSERT(0 < mRemoteStackDepthGuess, "fatal logic error");
--mRemoteStackDepthGuess; --mRemoteStackDepthGuess;
MOZ_RELEASE_ASSERT(call.priority() == IPC::Message::PRIORITY_NORMAL); MOZ_RELEASE_ASSERT(call.nested_level() == IPC::Message::NOT_NESTED);
mPending.push_back(Move(call)); mPending.push_back(Move(call));
} }
@@ -2149,7 +2154,7 @@ class GoodbyeMessage : public IPC::Message
{ {
public: public:
GoodbyeMessage() : GoodbyeMessage() :
IPC::Message(MSG_ROUTING_NONE, GOODBYE_MESSAGE_TYPE, PRIORITY_NORMAL) IPC::Message(MSG_ROUTING_NONE, GOODBYE_MESSAGE_TYPE)
{ {
} }
static bool Read(const Message* msg) { static bool Read(const Message* msg) {
@@ -2338,7 +2343,7 @@ MessageChannel::EndTimeout()
IPC_LOG("Ending timeout of seqno=%d", mTimedOutMessageSeqno); IPC_LOG("Ending timeout of seqno=%d", mTimedOutMessageSeqno);
mTimedOutMessageSeqno = 0; mTimedOutMessageSeqno = 0;
mTimedOutMessagePriority = 0; mTimedOutMessageNestedLevel = 0;
for (size_t i = 0; i < mPending.size(); i++) { for (size_t i = 0; i < mPending.size(); i++) {
// There may be messages in the queue that we expected to process from // There may be messages in the queue that we expected to process from
@@ -2375,7 +2380,7 @@ MessageChannel::CancelTransaction(int transaction)
EndTimeout(); EndTimeout();
// Normally mCurrentTransaction == 0 here. But it can be non-zero if: // Normally mCurrentTransaction == 0 here. But it can be non-zero if:
// 1. Parent sends hi prio message H. // 1. Parent sends NESTED_INSIDE_SYNC message H.
// 2. Parent times out H. // 2. Parent times out H.
// 3. Child dispatches H and sends nested message H' (same transaction). // 3. Child dispatches H and sends nested message H' (same transaction).
// 4. Parent dispatches H' and cancels. // 4. Parent dispatches H' and cancels.
@@ -2395,8 +2400,8 @@ MessageChannel::CancelTransaction(int transaction)
// If there was a race between the parent and the child, then we may // If there was a race between the parent and the child, then we may
// have a queued sync message. We want to drop this message from the // have a queued sync message. We want to drop this message from the
// queue since if will get cancelled along with the transaction being // queue since if will get cancelled along with the transaction being
// cancelled. This happens if the message in the queue is high priority. // cancelled. This happens if the message in the queue is NESTED_INSIDE_SYNC.
if (msg.is_sync() && msg.priority() != IPC::Message::PRIORITY_NORMAL) { if (msg.is_sync() && msg.nested_level() != IPC::Message::NOT_NESTED) {
MOZ_RELEASE_ASSERT(!foundSync); MOZ_RELEASE_ASSERT(!foundSync);
MOZ_RELEASE_ASSERT(msg.transaction_id() != transaction); MOZ_RELEASE_ASSERT(msg.transaction_id() != transaction);
IPC_LOG("Removing msg from queue seqno=%d xid=%d", msg.seqno(), msg.transaction_id()); IPC_LOG("Removing msg from queue seqno=%d xid=%d", msg.seqno(), msg.transaction_id());
@@ -2420,17 +2425,17 @@ void
MessageChannel::CancelCurrentTransaction() MessageChannel::CancelCurrentTransaction()
{ {
MonitorAutoLock lock(*mMonitor); MonitorAutoLock lock(*mMonitor);
if (DispatchingSyncMessagePriority() >= IPC::Message::PRIORITY_HIGH) { if (DispatchingSyncMessageNestedLevel() >= IPC::Message::NESTED_INSIDE_SYNC) {
if (DispatchingSyncMessagePriority() == IPC::Message::PRIORITY_URGENT || if (DispatchingSyncMessageNestedLevel() == IPC::Message::NESTED_INSIDE_CPOW ||
DispatchingAsyncMessagePriority() == IPC::Message::PRIORITY_URGENT) DispatchingAsyncMessageNestedLevel() == IPC::Message::NESTED_INSIDE_CPOW)
{ {
mListener->IntentionalCrash(); mListener->IntentionalCrash();
} }
IPC_LOG("Cancel requested: current xid=%d", CurrentHighPriorityTransaction()); IPC_LOG("Cancel requested: current xid=%d", CurrentNestedInsideSyncTransaction());
MOZ_RELEASE_ASSERT(DispatchingSyncMessage()); MOZ_RELEASE_ASSERT(DispatchingSyncMessage());
CancelMessage *cancel = new CancelMessage(CurrentHighPriorityTransaction()); CancelMessage *cancel = new CancelMessage(CurrentNestedInsideSyncTransaction());
CancelTransaction(CurrentHighPriorityTransaction()); CancelTransaction(CurrentNestedInsideSyncTransaction());
mLink->SendMessage(cancel); mLink->SendMessage(cancel);
} }
} }

View File

@@ -408,9 +408,9 @@ class MessageChannel : HasResultCodes
return mDispatchingAsyncMessage; return mDispatchingAsyncMessage;
} }
int DispatchingAsyncMessagePriority() const { int DispatchingAsyncMessageNestedLevel() const {
AssertWorkerThread(); AssertWorkerThread();
return mDispatchingAsyncMessagePriority; return mDispatchingAsyncMessageNestedLevel;
} }
bool Connected() const; bool Connected() const;
@@ -626,7 +626,7 @@ class MessageChannel : HasResultCodes
}; };
bool mDispatchingAsyncMessage; bool mDispatchingAsyncMessage;
int mDispatchingAsyncMessagePriority; int mDispatchingAsyncMessageNestedLevel;
// When we send an urgent request from the parent process, we could race // When we send an urgent request from the parent process, we could race
// with an RPC message that was issued by the child beforehand. In this // with an RPC message that was issued by the child beforehand. In this
@@ -649,13 +649,13 @@ class MessageChannel : HasResultCodes
friend class AutoEnterTransaction; friend class AutoEnterTransaction;
AutoEnterTransaction *mTransactionStack; AutoEnterTransaction *mTransactionStack;
int32_t CurrentHighPriorityTransaction() const; int32_t CurrentNestedInsideSyncTransaction() const;
bool AwaitingSyncReply() const; bool AwaitingSyncReply() const;
int AwaitingSyncReplyPriority() const; int AwaitingSyncReplyNestedLevel() const;
bool DispatchingSyncMessage() const; bool DispatchingSyncMessage() const;
int DispatchingSyncMessagePriority() const; int DispatchingSyncMessageNestedLevel() const;
// If a sync message times out, we store its sequence number here. Any // If a sync message times out, we store its sequence number here. Any
// future sync messages will fail immediately. Once the reply for original // future sync messages will fail immediately. Once the reply for original
@@ -671,7 +671,7 @@ class MessageChannel : HasResultCodes
// hitting a lot of corner cases with message nesting that we don't really // hitting a lot of corner cases with message nesting that we don't really
// care about. // care about.
int32_t mTimedOutMessageSeqno; int32_t mTimedOutMessageSeqno;
int mTimedOutMessagePriority; int mTimedOutMessageNestedLevel;
// Queue of all incoming messages, except for replies to sync and urgent // Queue of all incoming messages, except for replies to sync and urgent
// messages, which are delivered directly to mRecvd, and any pending urgent // messages, which are delivered directly to mRecvd, and any pending urgent

View File

@@ -83,10 +83,10 @@ public:
ChannelOpened(TransportDescriptor aDescriptor, ChannelOpened(TransportDescriptor aDescriptor,
ProcessId aOtherProcess, ProcessId aOtherProcess,
ProtocolId aProtocol, ProtocolId aProtocol,
PriorityValue aPriority = PRIORITY_NORMAL) NestedLevel aNestedLevel = NOT_NESTED)
: IPC::Message(MSG_ROUTING_CONTROL, // these only go to top-level actors : IPC::Message(MSG_ROUTING_CONTROL, // these only go to top-level actors
CHANNEL_OPENED_MESSAGE_TYPE, CHANNEL_OPENED_MESSAGE_TYPE,
aPriority) aNestedLevel)
{ {
IPC::WriteParam(this, aDescriptor); IPC::WriteParam(this, aDescriptor);
IPC::WriteParam(this, aOtherProcess); IPC::WriteParam(this, aOtherProcess);
@@ -128,7 +128,7 @@ Bridge(const PrivateIPDLInterface&,
if (!aParentChannel->Send(new ChannelOpened(parentSide, if (!aParentChannel->Send(new ChannelOpened(parentSide,
aChildPid, aChildPid,
aProtocol, aProtocol,
IPC::Message::PRIORITY_URGENT))) { IPC::Message::NESTED_INSIDE_CPOW))) {
CloseDescriptor(parentSide); CloseDescriptor(parentSide);
CloseDescriptor(childSide); CloseDescriptor(childSide);
return NS_ERROR_BRIDGE_OPEN_PARENT; return NS_ERROR_BRIDGE_OPEN_PARENT;
@@ -137,7 +137,7 @@ Bridge(const PrivateIPDLInterface&,
if (!aChildChannel->Send(new ChannelOpened(childSide, if (!aChildChannel->Send(new ChannelOpened(childSide,
aParentPid, aParentPid,
aChildProtocol, aChildProtocol,
IPC::Message::PRIORITY_URGENT))) { IPC::Message::NESTED_INSIDE_CPOW))) {
CloseDescriptor(parentSide); CloseDescriptor(parentSide);
CloseDescriptor(childSide); CloseDescriptor(childSide);
return NS_ERROR_BRIDGE_OPEN_CHILD; return NS_ERROR_BRIDGE_OPEN_CHILD;

View File

@@ -25,7 +25,7 @@ public:
id_t aIPDLId, id_t aIPDLId,
size_t aSize, size_t aSize,
SharedMemory::SharedMemoryType aType) : SharedMemory::SharedMemoryType aType) :
IPC::Message(routingId, SHMEM_CREATED_MESSAGE_TYPE, PRIORITY_URGENT) IPC::Message(routingId, SHMEM_CREATED_MESSAGE_TYPE, NESTED_INSIDE_CPOW)
{ {
IPC::WriteParam(this, aIPDLId); IPC::WriteParam(this, aIPDLId);
IPC::WriteParam(this, aSize); IPC::WriteParam(this, aSize);
@@ -60,7 +60,7 @@ private:
public: public:
ShmemDestroyed(int32_t routingId, ShmemDestroyed(int32_t routingId,
id_t aIPDLId) : id_t aIPDLId) :
IPC::Message(routingId, SHMEM_DESTROYED_MESSAGE_TYPE, PRIORITY_NORMAL) IPC::Message(routingId, SHMEM_DESTROYED_MESSAGE_TYPE)
{ {
IPC::WriteParam(this, aIPDLId); IPC::WriteParam(this, aIPDLId);
} }

View File

@@ -4,9 +4,9 @@
import sys import sys
NORMAL_PRIORITY = 1 NOT_NESTED = 1
HIGH_PRIORITY = 2 INSIDE_SYNC_NESTED = 2
URGENT_PRIORITY = 3 INSIDE_CPOW_NESTED = 3
class Visitor: class Visitor:
def defaultVisit(self, node): def defaultVisit(self, node):
@@ -236,7 +236,7 @@ class Protocol(NamespacedNode):
def __init__(self, loc): def __init__(self, loc):
NamespacedNode.__init__(self, loc) NamespacedNode.__init__(self, loc)
self.sendSemantics = ASYNC self.sendSemantics = ASYNC
self.priority = NORMAL_PRIORITY self.nested = NOT_NESTED
self.spawnsStmts = [ ] self.spawnsStmts = [ ]
self.bridgesStmts = [ ] self.bridgesStmts = [ ]
self.opensStmts = [ ] self.opensStmts = [ ]
@@ -296,7 +296,7 @@ class MessageDecl(Node):
Node.__init__(self, loc) Node.__init__(self, loc)
self.name = None self.name = None
self.sendSemantics = ASYNC self.sendSemantics = ASYNC
self.priority = NORMAL_PRIORITY self.nested = NOT_NESTED
self.direction = None self.direction = None
self.inParams = [ ] self.inParams = [ ]
self.outParams = [ ] self.outParams = [ ]

View File

@@ -1685,7 +1685,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
mfDecl, mfDefn = _splitFuncDeclDefn( mfDecl, mfDefn = _splitFuncDeclDefn(
_generateMessageConstructor(md.msgCtorFunc(), md.msgId(), _generateMessageConstructor(md.msgCtorFunc(), md.msgId(),
md.decl.type.priority, md.decl.type.nested,
md.prettyMsgName(p.name+'::'), md.prettyMsgName(p.name+'::'),
md.decl.type.compress)) md.decl.type.compress))
decls.append(mfDecl) decls.append(mfDecl)
@@ -1695,7 +1695,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
rfDecl, rfDefn = _splitFuncDeclDefn( rfDecl, rfDefn = _splitFuncDeclDefn(
_generateMessageConstructor( _generateMessageConstructor(
md.replyCtorFunc(), md.replyId(), md.replyCtorFunc(), md.replyId(),
md.decl.type.priority, md.decl.type.nested,
md.prettyReplyName(p.name+'::'), md.prettyReplyName(p.name+'::'),
md.decl.type.compress)) md.decl.type.compress))
decls.append(rfDecl) decls.append(rfDecl)
@@ -1926,7 +1926,7 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
##-------------------------------------------------- ##--------------------------------------------------
def _generateMessageConstructor(clsname, msgid, priority, prettyName, compress): def _generateMessageConstructor(clsname, msgid, nested, prettyName, compress):
routingId = ExprVar('routingId') routingId = ExprVar('routingId')
func = FunctionDefn(FunctionDecl( func = FunctionDefn(FunctionDecl(
@@ -1941,19 +1941,21 @@ def _generateMessageConstructor(clsname, msgid, priority, prettyName, compress):
compression = ExprVar('IPC::Message::COMPRESSION_ALL') compression = ExprVar('IPC::Message::COMPRESSION_ALL')
else: else:
compression = ExprVar('IPC::Message::COMPRESSION_NONE') compression = ExprVar('IPC::Message::COMPRESSION_NONE')
if priority == ipdl.ast.NORMAL_PRIORITY:
priorityEnum = 'IPC::Message::PRIORITY_NORMAL' if nested == ipdl.ast.NOT_NESTED:
elif priority == ipdl.ast.HIGH_PRIORITY: nestedEnum = 'IPC::Message::NOT_NESTED'
priorityEnum = 'IPC::Message::PRIORITY_HIGH' elif nested == ipdl.ast.INSIDE_SYNC_NESTED:
nestedEnum = 'IPC::Message::NESTED_INSIDE_SYNC'
else: else:
assert priority == ipdl.ast.URGENT_PRIORITY assert nested == ipdl.ast.INSIDE_CPOW_NESTED
priorityEnum = 'IPC::Message::PRIORITY_URGENT' nestedEnum = 'IPC::Message::NESTED_INSIDE_CPOW'
func.addstmt( func.addstmt(
StmtReturn(ExprNew(Type('IPC::Message'), StmtReturn(ExprNew(Type('IPC::Message'),
args=[ routingId, args=[ routingId,
ExprVar(msgid), ExprVar(msgid),
ExprVar(priorityEnum), ExprVar(nestedEnum),
ExprVar('IPC::Message::NORMAL_PRIORITY'),
compression, compression,
ExprLiteral.String(prettyName) ]))) ExprLiteral.String(prettyName) ])))

View File

@@ -128,18 +128,16 @@ reserved = set((
'delete', # reserve 'delete' to prevent its use 'delete', # reserve 'delete' to prevent its use
'from', 'from',
'goto', 'goto',
'high',
'include', 'include',
'intr', 'intr',
'manager', 'manager',
'manages', 'manages',
'namespace', 'namespace',
'normal', 'nested',
'nullable', 'nullable',
'opens', 'opens',
'or', 'or',
'parent', 'parent',
'prio',
'protocol', 'protocol',
'recv', 'recv',
'returns', 'returns',
@@ -151,7 +149,6 @@ reserved = set((
'sync', 'sync',
'union', 'union',
'upto', 'upto',
'urgent',
'using', 'using',
'verify')) 'verify'))
tokens = [ tokens = [
@@ -359,7 +356,7 @@ def p_ProtocolDefn(p):
protocol = p[5] protocol = p[5]
protocol.loc = locFromTok(p, 2) protocol.loc = locFromTok(p, 2)
protocol.name = p[3] protocol.name = p[3]
protocol.priorityRange = p[1][0] protocol.nestedRange = p[1][0]
protocol.sendSemantics = p[1][1] protocol.sendSemantics = p[1][1]
p[0] = protocol p[0] = protocol
@@ -502,7 +499,7 @@ def p_MessageDirectionLabel(p):
def p_MessageDecl(p): def p_MessageDecl(p):
"""MessageDecl : SendSemanticsQual MessageBody""" """MessageDecl : SendSemanticsQual MessageBody"""
msg = p[2] msg = p[2]
msg.priority = p[1][0] msg.nested = p[1][0]
msg.sendSemantics = p[1][1] msg.sendSemantics = p[1][1]
if Parser.current.direction is None: if Parser.current.direction is None:
@@ -641,61 +638,61 @@ def p_State(p):
##-------------------- ##--------------------
## Minor stuff ## Minor stuff
def p_Priority(p): def p_Nested(p):
"""Priority : NORMAL """Nested : ID"""
| HIGH kinds = {'not': 1,
| URGENT""" 'inside_sync': 2,
prios = {'normal': 1, 'inside_cpow': 3}
'high': 2, if p[1] not in kinds:
'urgent': 3} _error(locFromTok(p, 1), "Expected not, inside_sync, or inside_cpow for nested()")
p[0] = prios[p[1]]
p[0] = kinds[p[1]]
def p_SendSemanticsQual(p): def p_SendSemanticsQual(p):
"""SendSemanticsQual : ASYNC """SendSemanticsQual : ASYNC
| SYNC | SYNC
| PRIO '(' Priority ')' ASYNC | NESTED '(' Nested ')' ASYNC
| PRIO '(' Priority ')' SYNC | NESTED '(' Nested ')' SYNC
| INTR""" | INTR"""
if p[1] == 'prio': if p[1] == 'nested':
mtype = p[5] mtype = p[5]
prio = p[3] nested = p[3]
else: else:
mtype = p[1] mtype = p[1]
prio = NORMAL_PRIORITY nested = NOT_NESTED
if mtype == 'async': mtype = ASYNC if mtype == 'async': mtype = ASYNC
elif mtype == 'sync': mtype = SYNC elif mtype == 'sync': mtype = SYNC
elif mtype == 'intr': mtype = INTR elif mtype == 'intr': mtype = INTR
else: assert 0 else: assert 0
p[0] = [ prio, mtype ] p[0] = [ nested, mtype ]
def p_OptionalProtocolSendSemanticsQual(p): def p_OptionalProtocolSendSemanticsQual(p):
"""OptionalProtocolSendSemanticsQual : ProtocolSendSemanticsQual """OptionalProtocolSendSemanticsQual : ProtocolSendSemanticsQual
| """ | """
if 2 == len(p): p[0] = p[1] if 2 == len(p): p[0] = p[1]
else: p[0] = [ (NORMAL_PRIORITY, NORMAL_PRIORITY), ASYNC ] else: p[0] = [ (NOT_NESTED, NOT_NESTED), ASYNC ]
def p_ProtocolSendSemanticsQual(p): def p_ProtocolSendSemanticsQual(p):
"""ProtocolSendSemanticsQual : ASYNC """ProtocolSendSemanticsQual : ASYNC
| SYNC | SYNC
| PRIO '(' Priority UPTO Priority ')' ASYNC | NESTED '(' UPTO Nested ')' ASYNC
| PRIO '(' Priority UPTO Priority ')' SYNC | NESTED '(' UPTO Nested ')' SYNC
| PRIO '(' Priority UPTO Priority ')' INTR
| INTR""" | INTR"""
if p[1] == 'prio': if p[1] == 'nested':
mtype = p[7] mtype = p[6]
prio = (p[3], p[5]) nested = (NOT_NESTED, p[4])
else: else:
mtype = p[1] mtype = p[1]
prio = (NORMAL_PRIORITY, NORMAL_PRIORITY) nested = (NOT_NESTED, NOT_NESTED)
if mtype == 'async': mtype = ASYNC if mtype == 'async': mtype = ASYNC
elif mtype == 'sync': mtype = SYNC elif mtype == 'sync': mtype = SYNC
elif mtype == 'intr': mtype = INTR elif mtype == 'intr': mtype = INTR
else: assert 0 else: assert 0
p[0] = [ prio, mtype ] p[0] = [ nested, mtype ]
def p_ParamList(p): def p_ParamList(p):
"""ParamList : ParamList ',' Param """ParamList : ParamList ',' Param

View File

@@ -9,7 +9,7 @@ from ipdl.ast import CxxInclude, Decl, Loc, QualifiedId, State, StructDecl, Tran
from ipdl.ast import TypeSpec, UnionDecl, UsingStmt, Visitor from ipdl.ast import TypeSpec, UnionDecl, UsingStmt, Visitor
from ipdl.ast import ASYNC, SYNC, INTR from ipdl.ast import ASYNC, SYNC, INTR
from ipdl.ast import IN, OUT, INOUT, ANSWER, CALL, RECV, SEND from ipdl.ast import IN, OUT, INOUT, ANSWER, CALL, RECV, SEND
from ipdl.ast import NORMAL_PRIORITY, HIGH_PRIORITY, URGENT_PRIORITY from ipdl.ast import NOT_NESTED, INSIDE_SYNC_NESTED, INSIDE_CPOW_NESTED
import ipdl.builtin as builtin import ipdl.builtin as builtin
_DELETE_MSG = '__delete__' _DELETE_MSG = '__delete__'
@@ -217,14 +217,14 @@ class IPDLType(Type):
@classmethod @classmethod
def convertsTo(cls, lesser, greater): def convertsTo(cls, lesser, greater):
if (lesser.priorityRange[0] < greater.priorityRange[0] or if (lesser.nestedRange[0] < greater.nestedRange[0] or
lesser.priorityRange[1] > greater.priorityRange[1]): lesser.nestedRange[1] > greater.nestedRange[1]):
return False return False
# Protocols that use intr semantics are not allowed to use # Protocols that use intr semantics are not allowed to use
# message priorities. # message nesting.
if (greater.isInterrupt() and if (greater.isInterrupt() and
lesser.priorityRange != (NORMAL_PRIORITY, NORMAL_PRIORITY)): lesser.nestedRange != (NOT_NESTED, NOT_NESTED)):
return False return False
if lesser.isAsync(): if lesser.isAsync():
@@ -251,14 +251,14 @@ class StateType(IPDLType):
return self.name() return self.name()
class MessageType(IPDLType): class MessageType(IPDLType):
def __init__(self, priority, sendSemantics, direction, def __init__(self, nested, sendSemantics, direction,
ctor=False, dtor=False, cdtype=None, compress=False, ctor=False, dtor=False, cdtype=None, compress=False,
verify=False): verify=False):
assert not (ctor and dtor) assert not (ctor and dtor)
assert not (ctor or dtor) or type is not None assert not (ctor or dtor) or type is not None
self.priority = priority self.nested = nested
self.priorityRange = (priority, priority) self.nestedRange = (nested, nested)
self.sendSemantics = sendSemantics self.sendSemantics = sendSemantics
self.direction = direction self.direction = direction
self.params = [ ] self.params = [ ]
@@ -295,9 +295,9 @@ class Bridge:
return hash(self.parent) + hash(self.child) return hash(self.parent) + hash(self.child)
class ProtocolType(IPDLType): class ProtocolType(IPDLType):
def __init__(self, qname, priorityRange, sendSemantics, stateless=False): def __init__(self, qname, nestedRange, sendSemantics, stateless=False):
self.qname = qname self.qname = qname
self.priorityRange = priorityRange self.nestedRange = nestedRange
self.sendSemantics = sendSemantics self.sendSemantics = sendSemantics
self.spawns = set() # ProtocolType self.spawns = set() # ProtocolType
self.opens = set() # ProtocolType self.opens = set() # ProtocolType
@@ -715,7 +715,7 @@ class GatherDecls(TcheckVisitor):
fullname = str(qname) fullname = str(qname)
p.decl = self.declare( p.decl = self.declare(
loc=p.loc, loc=p.loc,
type=ProtocolType(qname, p.priorityRange, p.sendSemantics, type=ProtocolType(qname, p.nestedRange, p.sendSemantics,
stateless=(0 == len(p.transitionStmts))), stateless=(0 == len(p.transitionStmts))),
shortname=p.name, shortname=p.name,
fullname=fullname) fullname=fullname)
@@ -1125,7 +1125,7 @@ class GatherDecls(TcheckVisitor):
# enter message scope # enter message scope
self.symtab.enterScope(md) self.symtab.enterScope(md)
msgtype = MessageType(md.priority, md.sendSemantics, md.direction, msgtype = MessageType(md.nested, md.sendSemantics, md.direction,
ctor=isctor, dtor=isdtor, cdtype=cdtype, ctor=isctor, dtor=isdtor, cdtype=cdtype,
compress=md.compress, verify=md.verify) compress=md.compress, verify=md.verify)
@@ -1499,22 +1499,22 @@ class CheckTypes(TcheckVisitor):
loc = md.decl.loc loc = md.decl.loc
if mtype.priority == HIGH_PRIORITY and not mtype.isSync(): if mtype.nested == INSIDE_SYNC_NESTED and not mtype.isSync():
self.error( self.error(
loc, loc,
"high priority messages must be sync (here, message `%s' in protocol `%s')", "inside_sync nested messages must be sync (here, message `%s' in protocol `%s')",
mname, pname) mname, pname)
if mtype.priority == URGENT_PRIORITY and (mtype.isOut() or mtype.isInout()): if mtype.nested == INSIDE_CPOW_NESTED and (mtype.isOut() or mtype.isInout()):
self.error( self.error(
loc, loc,
"urgent parent-to-child messages are verboten (here, message `%s' in protocol `%s')", "inside_cpow nested parent-to-child messages are verboten (here, message `%s' in protocol `%s')",
mname, pname) mname, pname)
# We allow high priority sync messages to be sent from the # We allow inside_sync messages that are themselves sync to be sent from the
# parent. Normal and urgent sync messages can only come from # parent. Normal and inside_cpow nested messages that are sync can only come from
# the child. # the child.
if mtype.isSync() and mtype.priority == NORMAL_PRIORITY and (mtype.isOut() or mtype.isInout()): if mtype.isSync() and mtype.nested == NOT_NESTED and (mtype.isOut() or mtype.isInout()):
self.error( self.error(
loc, loc,
"sync parent-to-child messages are verboten (here, message `%s' in protocol `%s')", "sync parent-to-child messages are verboten (here, message `%s' in protocol `%s')",

View File

@@ -1,35 +1,35 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
prio(normal upto high) sync protocol PTestCancel nested(upto inside_sync) sync protocol PTestCancel
{ {
// Test1 // Test1
child: child:
prio(high) sync Test1_1(); nested(inside_sync) sync Test1_1();
parent: parent:
async Done1(); async Done1();
// Test2 // Test2
child: child:
async Start2(); async Start2();
prio(high) sync Test2_2(); nested(inside_sync) sync Test2_2();
parent: parent:
sync Test2_1(); sync Test2_1();
// Test3 // Test3
child: child:
prio(high) sync Test3_1(); nested(inside_sync) sync Test3_1();
parent: parent:
async Start3(); async Start3();
prio(high) sync Test3_2(); nested(inside_sync) sync Test3_2();
parent: parent:
async Done(); async Done();
child: child:
prio(high) sync CheckChild() returns (uint32_t reply); nested(inside_sync) sync CheckChild() returns (uint32_t reply);
parent: parent:
prio(high) sync CheckParent() returns (uint32_t reply); nested(inside_sync) sync CheckParent() returns (uint32_t reply);
}; };
} // namespace _ipdltest } // namespace _ipdltest

View File

@@ -1,20 +1,20 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
prio(normal upto urgent) sync protocol PTestDemon nested(upto inside_cpow) sync protocol PTestDemon
{ {
child: child:
async Start(); async Start();
both: both:
async AsyncMessage(int n); async AsyncMessage(int n);
prio(high) sync HiPrioSyncMessage(); nested(inside_sync) sync HiPrioSyncMessage();
parent: parent:
sync SyncMessage(int n); sync SyncMessage(int n);
prio(urgent) async UrgentAsyncMessage(int n); nested(inside_cpow) async UrgentAsyncMessage(int n);
prio(urgent) sync UrgentSyncMessage(int n); nested(inside_cpow) sync UrgentSyncMessage(int n);
}; };
} // namespace _ipdltest } // namespace _ipdltest

View File

@@ -1,17 +1,17 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
prio(normal upto urgent) sync protocol PTestHighestPrio nested(upto inside_cpow) sync protocol PTestHighestPrio
{ {
parent: parent:
prio(urgent) async Msg1(); nested(inside_cpow) async Msg1();
prio(high) sync Msg2(); nested(inside_sync) sync Msg2();
prio(urgent) async Msg3(); nested(inside_cpow) async Msg3();
prio(urgent) sync Msg4(); nested(inside_cpow) sync Msg4();
child: child:
async Start(); async Start();
prio(high) sync StartInner(); nested(inside_sync) sync StartInner();
}; };
} }

View File

@@ -1,20 +1,20 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
prio(normal upto high) sync protocol PTestRPC nested(upto inside_sync) sync protocol PTestRPC
{ {
parent: parent:
prio(high) sync Test1_Start() returns (uint32_t result); nested(inside_sync) sync Test1_Start() returns (uint32_t result);
prio(high) sync Test1_InnerEvent() returns (uint32_t result); nested(inside_sync) sync Test1_InnerEvent() returns (uint32_t result);
async Test2_Start(); async Test2_Start();
prio(high) sync Test2_OutOfOrder(); nested(inside_sync) sync Test2_OutOfOrder();
child: child:
async Start(); async Start();
prio(high) sync Test1_InnerQuery() returns (uint32_t result); nested(inside_sync) sync Test1_InnerQuery() returns (uint32_t result);
prio(high) sync Test1_NoReenter() returns (uint32_t result); nested(inside_sync) sync Test1_NoReenter() returns (uint32_t result);
prio(high) sync Test2_FirstUrgent(); nested(inside_sync) sync Test2_FirstUrgent();
prio(high) sync Test2_SecondUrgent(); nested(inside_sync) sync Test2_SecondUrgent();
}; };
} // namespace _ipdltest } // namespace _ipdltest

View File

@@ -1,18 +1,18 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
prio(normal upto high) sync protocol PTestUrgency nested(upto inside_cpow) sync protocol PTestUrgency
{ {
parent: parent:
prio(high) sync Test1() returns (uint32_t result); nested(inside_sync) sync Test1() returns (uint32_t result);
async Test2(); async Test2();
sync Test3() returns (uint32_t result); sync Test3() returns (uint32_t result);
sync FinalTest_Begin(); sync FinalTest_Begin();
child: child:
async Start(); async Start();
prio(high) sync Reply1() returns (uint32_t result); nested(inside_sync) sync Reply1() returns (uint32_t result);
prio(high) sync Reply2() returns (uint32_t result); nested(inside_sync) sync Reply2() returns (uint32_t result);
}; };
} // namespace _ipdltest } // namespace _ipdltest

View File

@@ -1,27 +1,27 @@
namespace mozilla { namespace mozilla {
namespace _ipdltest { namespace _ipdltest {
prio(normal upto urgent) sync protocol PTestUrgentHangs nested(upto inside_cpow) sync protocol PTestUrgentHangs
{ {
parent: parent:
prio(high) sync Test1_2(); nested(inside_sync) sync Test1_2();
prio(high) sync TestInner(); nested(inside_sync) sync TestInner();
prio(urgent) sync TestInnerUrgent(); nested(inside_cpow) sync TestInnerUrgent();
child: child:
prio(high) sync Test1_1(); nested(inside_sync) sync Test1_1();
prio(high) sync Test1_3(); nested(inside_sync) sync Test1_3();
prio(high) sync Test2(); nested(inside_sync) sync Test2();
prio(high) sync Test3(); nested(inside_sync) sync Test3();
async Test4(); async Test4();
prio(high) sync Test4_1(); nested(inside_sync) sync Test4_1();
async Test5(); async Test5();
prio(high) sync Test5_1(); nested(inside_sync) sync Test5_1();
}; };
} // namespace _ipdltest } // namespace _ipdltest

View File

@@ -15,7 +15,7 @@ using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
namespace mozilla { namespace mozilla {
namespace jsipc { namespace jsipc {
prio(normal upto high) sync protocol PJavaScript nested(upto inside_sync) sync protocol PJavaScript
{ {
manager PContent or PContentBridge; manager PContent or PContentBridge;
@@ -24,30 +24,30 @@ both:
async DropObject(uint64_t objId); async DropObject(uint64_t objId);
// These roughly map to the ProxyHandler hooks that CPOWs need. // These roughly map to the ProxyHandler hooks that CPOWs need.
prio(high) sync PreventExtensions(uint64_t objId) returns (ReturnStatus rs); nested(inside_sync) sync PreventExtensions(uint64_t objId) returns (ReturnStatus rs);
prio(high) sync GetPropertyDescriptor(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, PPropertyDescriptor result); nested(inside_sync) sync GetPropertyDescriptor(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, PPropertyDescriptor result);
prio(high) sync GetOwnPropertyDescriptor(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, PPropertyDescriptor result); nested(inside_sync) sync GetOwnPropertyDescriptor(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, PPropertyDescriptor result);
prio(high) sync DefineProperty(uint64_t objId, JSIDVariant id, PPropertyDescriptor descriptor) returns (ReturnStatus rs); nested(inside_sync) sync DefineProperty(uint64_t objId, JSIDVariant id, PPropertyDescriptor descriptor) returns (ReturnStatus rs);
prio(high) sync Delete(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs); nested(inside_sync) sync Delete(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs);
prio(high) sync Has(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, bool has); nested(inside_sync) sync Has(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, bool has);
prio(high) sync HasOwn(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, bool has); nested(inside_sync) sync HasOwn(uint64_t objId, JSIDVariant id) returns (ReturnStatus rs, bool has);
prio(high) sync Get(uint64_t objId, JSVariant receiver, JSIDVariant id) returns (ReturnStatus rs, JSVariant result); nested(inside_sync) sync Get(uint64_t objId, JSVariant receiver, JSIDVariant id) returns (ReturnStatus rs, JSVariant result);
prio(high) sync Set(uint64_t objId, JSIDVariant id, JSVariant value, JSVariant receiver) returns (ReturnStatus rs); nested(inside_sync) sync Set(uint64_t objId, JSIDVariant id, JSVariant value, JSVariant receiver) returns (ReturnStatus rs);
prio(high) sync IsExtensible(uint64_t objId) returns (ReturnStatus rs, bool result); nested(inside_sync) sync IsExtensible(uint64_t objId) returns (ReturnStatus rs, bool result);
prio(high) sync CallOrConstruct(uint64_t objId, JSParam[] argv, bool construct) returns (ReturnStatus rs, JSVariant result, JSParam[] outparams); nested(inside_sync) sync CallOrConstruct(uint64_t objId, JSParam[] argv, bool construct) returns (ReturnStatus rs, JSVariant result, JSParam[] outparams);
prio(high) sync HasInstance(uint64_t objId, JSVariant v) returns (ReturnStatus rs, bool has); nested(inside_sync) sync HasInstance(uint64_t objId, JSVariant v) returns (ReturnStatus rs, bool has);
prio(high) sync GetBuiltinClass(uint64_t objId) returns (ReturnStatus rs, uint32_t classValue); nested(inside_sync) sync GetBuiltinClass(uint64_t objId) returns (ReturnStatus rs, uint32_t classValue);
prio(high) sync IsArray(uint64_t objId) returns (ReturnStatus rs, uint32_t ans); nested(inside_sync) sync IsArray(uint64_t objId) returns (ReturnStatus rs, uint32_t ans);
prio(high) sync ClassName(uint64_t objId) returns (nsCString name); nested(inside_sync) sync ClassName(uint64_t objId) returns (nsCString name);
prio(high) sync GetPrototype(uint64_t objId) returns (ReturnStatus rs, ObjectOrNullVariant result); nested(inside_sync) sync GetPrototype(uint64_t objId) returns (ReturnStatus rs, ObjectOrNullVariant result);
prio(high) sync GetPrototypeIfOrdinary(uint64_t objId) returns (ReturnStatus rs, bool isOrdinary, ObjectOrNullVariant result); nested(inside_sync) sync GetPrototypeIfOrdinary(uint64_t objId) returns (ReturnStatus rs, bool isOrdinary, ObjectOrNullVariant result);
prio(high) sync RegExpToShared(uint64_t objId) returns (ReturnStatus rs, nsString source, uint32_t flags); nested(inside_sync) sync RegExpToShared(uint64_t objId) returns (ReturnStatus rs, nsString source, uint32_t flags);
prio(high) sync GetPropertyKeys(uint64_t objId, uint32_t flags) returns (ReturnStatus rs, JSIDVariant[] ids); nested(inside_sync) sync GetPropertyKeys(uint64_t objId, uint32_t flags) returns (ReturnStatus rs, JSIDVariant[] ids);
prio(high) sync InstanceOf(uint64_t objId, JSIID iid) returns (ReturnStatus rs, bool instanceof); nested(inside_sync) sync InstanceOf(uint64_t objId, JSIID iid) returns (ReturnStatus rs, bool instanceof);
prio(high) sync DOMInstanceOf(uint64_t objId, int prototypeID, int depth) returns (ReturnStatus rs, bool instanceof); nested(inside_sync) sync DOMInstanceOf(uint64_t objId, int prototypeID, int depth) returns (ReturnStatus rs, bool instanceof);
parent: parent:
async __delete__(); async __delete__();

View File

@@ -26,7 +26,7 @@ namespace net {
* @see nsICookiePermission * @see nsICookiePermission
*/ */
prio(normal upto urgent) sync protocol PCookieService nested(upto inside_cpow) sync protocol PCookieService
{ {
manager PNecko; manager PNecko;
@@ -59,7 +59,7 @@ parent:
* *
* @return the resulting cookie string. * @return the resulting cookie string.
*/ */
prio(urgent) sync GetCookieString(URIParams host, nested(inside_cpow) sync GetCookieString(URIParams host,
bool isForeign, bool isForeign,
bool fromHttp, bool fromHttp,
NeckoOriginAttributes attrs) NeckoOriginAttributes attrs)
@@ -94,7 +94,7 @@ parent:
* @see nsICookieService.setCookieStringFromHttp * @see nsICookieService.setCookieStringFromHttp
* @see mozIThirdPartyUtil.isThirdPartyChannel * @see mozIThirdPartyUtil.isThirdPartyChannel
*/ */
prio(urgent) async SetCookieString(URIParams host, nested(inside_cpow) async SetCookieString(URIParams host,
bool isForeign, bool isForeign,
nsCString cookieString, nsCString cookieString,
nsCString serverTime, nsCString serverTime,

View File

@@ -40,7 +40,7 @@ namespace mozilla {
namespace net { namespace net {
//------------------------------------------------------------------- //-------------------------------------------------------------------
prio(normal upto urgent) sync protocol PNecko nested(upto inside_cpow) sync protocol PNecko
{ {
manager PContent; manager PContent;
manages PHttpChannel; manages PHttpChannel;
@@ -64,7 +64,7 @@ prio(normal upto urgent) sync protocol PNecko
parent: parent:
async __delete__(); async __delete__();
prio(urgent) async PCookieService(); nested(inside_cpow) async PCookieService();
async PHttpChannel(PBrowserOrId browser, async PHttpChannel(PBrowserOrId browser,
SerializedLoadContext loadContext, SerializedLoadContext loadContext,
HttpChannelCreationArgs args); HttpChannelCreationArgs args);