Skip to content

Commit

Permalink
Bug 1600605, add support for mediumhigh priority ipdl messages, r=jld
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D57013

--HG--
extra : moz-landing-system : lando
  • Loading branch information
Olli Pettay authored and Olli Pettay committed Dec 13, 2019
1 parent cb59553 commit 667df30
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions ipc/chromium/src/chrome/common/ipc_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Message : public Pickle {
NORMAL_PRIORITY = 0,
INPUT_PRIORITY = 1,
HIGH_PRIORITY = 2,
MEDIUMHIGH_PRIORITY = 3,
};

enum MessageCompression {
Expand Down
3 changes: 3 additions & 0 deletions ipc/glue/MessageChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,9 @@ MessageChannel::MessageTask::GetPriority(uint32_t* aPriority) {
case Message::HIGH_PRIORITY:
*aPriority = PRIORITY_HIGH;
break;
case Message::MEDIUMHIGH_PRIORITY:
*aPriority = PRIORITY_MEDIUMHIGH;
break;
default:
MOZ_ASSERT(false);
break;
Expand Down
2 changes: 1 addition & 1 deletion ipc/ipdl/ipdl/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
NORMAL_PRIORITY = 1
INPUT_PRIORITY = 2
HIGH_PRIORITY = 3

MEDIUMHIGH_PRIORITY = 4

class Visitor:
def defaultVisit(self, node):
Expand Down
4 changes: 3 additions & 1 deletion ipc/ipdl/ipdl/lower.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,8 +1799,10 @@ def _generateMessageConstructor(md, segmentSize, protocol, forReply=False):
prioEnum = 'NORMAL_PRIORITY'
elif prio == ipdl.ast.INPUT_PRIORITY:
prioEnum = 'INPUT_PRIORITY'
else:
elif prio == ipdl.ast.HIGH_PRIORITY:
prioEnum = 'HIGH_PRIORITY'
else:
prioEnum = 'MEDIUMHIGH_PRIORITY'

if md.decl.type.isSync():
syncEnum = 'SYNC'
Expand Down
5 changes: 3 additions & 2 deletions ipc/ipdl/ipdl/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,10 @@ def p_Priority(p):
"""Priority : ID"""
kinds = {'normal': 1,
'input': 2,
'high': 3}
'high': 3,
'mediumhigh': 4}
if p[1] not in kinds:
_error(locFromTok(p, 1), "Expected normal or high for prio()")
_error(locFromTok(p, 1), "Expected normal, input, high or mediumhigh for prio()")

p[0] = {'prio': kinds[p[1]]}

Expand Down
2 changes: 2 additions & 0 deletions ipc/ipdl/sync-messages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ description =
description =
[PTestPriority::PMsg4]
description =
[PTestPriority::PMsg6]
description =
[PTestRPC::Test1_Start]
description =
[PTestRPC::Test1_InnerEvent]
Expand Down
3 changes: 3 additions & 0 deletions ipc/ipdl/test/cxx/PTestPriority.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ parent:
prio(input) sync PMsg2();
prio(high) async PMsg3();
prio(high) sync PMsg4();
prio(mediumhigh) async PMsg5();
prio(mediumhigh) sync PMsg6();

child:
prio(input) async CMsg1();
prio(high) async CMsg2();
prio(mediumhigh) async CMsg3();
};

} // namespace _ipdltest
Expand Down
1 change: 1 addition & 0 deletions ipc/ipdl/test/ipdl/ok/Prio.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ child:
prio(normal) async NormalPrio();
prio(high) async HighPrio();
prio(input) async InputPrio();
prio(mediumhigh) async MediumHighPrio();
};

0 comments on commit 667df30

Please sign in to comment.