Bug 1451363 - part 4 - consolidate generated code into IProtocol; r=mccr8

lower.py generates repetitious:

  SetManager(...);
  Register(...); // Or RegisterID.
  SetIPCChannel(...);

calls, which are moderately sized, given that the above call sequence
requires virtual calls in several places.  Instead of codegenning this
sequence, let's consolidate the sequence into IProtocol and change the
code generator to call into the consolidated function instead.
This commit is contained in:
Nathan Froyd
2018-04-23 14:13:37 -04:00
parent 21ff1b6664
commit e1afd1ee23
3 changed files with 38 additions and 9 deletions

View File

@@ -529,6 +529,30 @@ IProtocol::SetManager(IProtocol* aManager)
mManager = aManager;
}
void
IProtocol::SetManagerAndRegister(IProtocol* aManager)
{
// Set the manager prior to registering so registering properly inherits
// the manager's event target.
SetManager(aManager);
aManager->Register(this);
SetIPCChannel(aManager->GetIPCChannel());
}
void
IProtocol::SetManagerAndRegister(IProtocol* aManager, int32_t aId)
{
// Set the manager prior to registering so registering properly inherits
// the manager's event target.
SetManager(aManager);
aManager->RegisterID(this, aId);
SetIPCChannel(aManager->GetIPCChannel());
}
void
IProtocol::SetEventTargetForActor(IProtocol* aActor, nsIEventTarget* aEventTarget)
{