зеркало из https://github.com/mozilla/gecko-dev.git
a697f87d36
The current IPC::Message constructor takes a large number of arguments, three of which--the nesting level, the priority, and the compression--are almost always constant by virtue of the vast majority of Message construction being done by auto-generated IPDL code. But then we take these constant values into the Message constructor, we check them for various values, and then based on those values, we perform a bunch of bitfield operations to store flags based on those values. This is wasted work. Furthermore, for replies to IPDL messages, we'll construct a Message object, and then call mutating setters on the Message object that will perform even more bitfield manipulations. Again, these operations are performing tasks at runtime that are the same every single time, and use information we already have at compile time. The impact of these extra operations is not large, maybe 15-30K of extra code, depending on platform. Nonetheless, we can easily make them go away, and make everything cleaner to boot. This patch adds a HeaderFlags class that encapsulates all the knowledge about the various kinds of flags Message needs to know about. We can construct HeaderFlags objects with strongly-typed enum arguments for the various kinds of flags, and the compiler can take care of folding all of those flags together into a constant when possible (and it is possible for all the IPDL-generated code that instantiates Messages). The upshot is that we do no unnecessary work in the Message constructor itself. We can also remove various mutating operations on Message, as those operations were only there to support post-constructor flag twiddling, which is no longer necessary. |
||
---|---|---|
.. | ||
BackgroundChild.h | ||
BackgroundChildImpl.cpp | ||
BackgroundChildImpl.h | ||
BackgroundImpl.cpp | ||
BackgroundParent.h | ||
BackgroundParentImpl.cpp | ||
BackgroundParentImpl.h | ||
BackgroundUtils.cpp | ||
BackgroundUtils.h | ||
BrowserProcessSubThread.cpp | ||
BrowserProcessSubThread.h | ||
CrashReporterClient.cpp | ||
CrashReporterClient.h | ||
CrashReporterHost.cpp | ||
CrashReporterHost.h | ||
CrashReporterMetadataShmem.cpp | ||
CrashReporterMetadataShmem.h | ||
CrossProcessMutex.h | ||
CrossProcessMutex_posix.cpp | ||
CrossProcessMutex_unimplemented.cpp | ||
CrossProcessMutex_windows.cpp | ||
CrossProcessSemaphore.h | ||
CrossProcessSemaphore_posix.cpp | ||
CrossProcessSemaphore_unimplemented.cpp | ||
CrossProcessSemaphore_windows.cpp | ||
Faulty.cpp | ||
Faulty.h | ||
FileDescriptor.cpp | ||
FileDescriptor.h | ||
FileDescriptorSetChild.cpp | ||
FileDescriptorSetChild.h | ||
FileDescriptorSetParent.cpp | ||
FileDescriptorSetParent.h | ||
FileDescriptorUtils.cpp | ||
FileDescriptorUtils.h | ||
GeckoChildProcessHost.cpp | ||
GeckoChildProcessHost.h | ||
IOThreadChild.h | ||
IPCMessageUtils.cpp | ||
IPCMessageUtils.h | ||
IPCStream.ipdlh | ||
IPCStreamAlloc.h | ||
IPCStreamChild.cpp | ||
IPCStreamDestination.cpp | ||
IPCStreamDestination.h | ||
IPCStreamParent.cpp | ||
IPCStreamSource.cpp | ||
IPCStreamSource.h | ||
IPCStreamUtils.cpp | ||
IPCStreamUtils.h | ||
InputStreamParams.ipdlh | ||
InputStreamUtils.cpp | ||
InputStreamUtils.h | ||
MessageChannel.cpp | ||
MessageChannel.h | ||
MessageLink.cpp | ||
MessageLink.h | ||
MessagePump.cpp | ||
MessagePump.h | ||
Neutering.h | ||
PBackground.ipdl | ||
PBackgroundSharedTypes.ipdlh | ||
PBackgroundTest.ipdl | ||
PChildToParentStream.ipdl | ||
PFileDescriptorSet.ipdl | ||
PParentToChildStream.ipdl | ||
ProcessChild.cpp | ||
ProcessChild.h | ||
ProcessUtils.h | ||
ProcessUtils_bsd.cpp | ||
ProcessUtils_linux.cpp | ||
ProcessUtils_mac.mm | ||
ProcessUtils_none.cpp | ||
ProtocolTypes.ipdlh | ||
ProtocolUtils.cpp | ||
ProtocolUtils.h | ||
ScopedXREEmbed.cpp | ||
ScopedXREEmbed.h | ||
SharedMemory.cpp | ||
SharedMemory.h | ||
SharedMemoryBasic.h | ||
SharedMemoryBasic_android.cpp | ||
SharedMemoryBasic_android.h | ||
SharedMemoryBasic_chromium.h | ||
SharedMemoryBasic_mach.h | ||
SharedMemoryBasic_mach.mm | ||
SharedMemory_posix.cpp | ||
SharedMemory_windows.cpp | ||
Shmem.cpp | ||
Shmem.h | ||
StringUtil.cpp | ||
TaskFactory.h | ||
Transport.h | ||
Transport_posix.cpp | ||
Transport_posix.h | ||
Transport_win.cpp | ||
Transport_win.h | ||
URIParams.ipdlh | ||
URIUtils.cpp | ||
URIUtils.h | ||
WindowsMessageLoop.cpp | ||
WindowsMessageLoop.h | ||
moz.build | ||
nsIIPCBackgroundChildCreateCallback.h | ||
nsIIPCSerializableInputStream.h | ||
nsIIPCSerializableURI.h |