gecko-dev/ipc/glue/moz.build
Gabriele Svelto 2bc88d71e0 Bug 1614933 - Gather content processes' crash annotations at exception time instead of using IPC; r=froydnj
Crash annotations in content processes are currently sent over IPC via
shared memory buffers. To pave the way for the Rust rewrite of the exception
handler we are removing this code and gathering all the crash annotations
within the content processes themselves. This patch causes annotations to be
stored in the global table of each content process. They are then streamed
out to the parent process by the exception handler together with the
exception-time annotations.

This has a number of benefits:

* we have one less channel to exchange data between content processes and
  the parent process
* we save memory because we don't need to allocate the shared memory buffers
* annotations are faster because we don't stream them all out every time one
  changes
* we won't truncate annotations anymore if we run out of space in the shared
  segment.
* we don't need delayed annotations anymore, so we can get rid of the
  associated machinery

As I refactored the code I tried to adjust all the obsolete comments,
consolidate shared code and remove the redundant steps that were sometimes
present. In many places we had two entire crash annotation tables we merged to
change just a couple; that comes from the fact that historically we loaded
them from disk. Now it doesn't matter anymore and we can just go ahead and
change the ones we care about.

Differential Revision: https://phabricator.services.mozilla.com/D62586

--HG--
extra : moz-landing-system : lando
2020-04-08 06:55:40 +00:00

267 lines
6.3 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include('/media/webrtc/webrtc.mozbuild')
EXPORTS += [
'nsIIPCSerializableInputStream.h',
]
EXPORTS.mozilla.ipc += [
'BackgroundChild.h',
'BackgroundParent.h',
'BackgroundUtils.h',
'BrowserProcessSubThread.h',
'ByteBuf.h',
'ByteBufUtils.h',
'CrashReporterClient.h',
'CrashReporterHelper.h',
'CrashReporterHost.h',
'CrossProcessMutex.h',
'CrossProcessSemaphore.h',
'EnvironmentMap.h',
'FileDescriptor.h',
'FileDescriptorSetChild.h',
'FileDescriptorSetParent.h',
'FileDescriptorUtils.h',
'GeckoChildProcessHost.h',
'IdleSchedulerChild.h',
'IdleSchedulerParent.h',
'InProcessChild.h',
'InProcessParent.h',
'InputStreamUtils.h',
'IOThreadChild.h',
'IPCStreamAlloc.h',
'IPCStreamDestination.h',
'IPCStreamSource.h',
'IPCStreamUtils.h',
'IPDLParamTraits.h',
'LibrarySandboxPreload.h',
'MessageChannel.h',
'MessageLink.h',
'Neutering.h',
'ProcessChild.h',
'ProtocolUtils.h',
'ScopedXREEmbed.h',
'SharedMemory.h',
'SharedMemoryBasic.h',
'Shmem.h',
'TaintingIPCUtils.h',
'TaskFactory.h',
'Transport.h',
'TransportSecurityInfoUtils.h',
'URIUtils.h',
'WindowsMessageLoop.h',
]
if CONFIG['OS_ARCH'] == 'WINNT':
EXPORTS.mozilla.ipc += [
'Transport_win.h',
]
SOURCES += [
'SharedMemory_windows.cpp',
'Transport_win.cpp',
'WindowsMessageLoop.cpp',
]
else:
EXPORTS.mozilla.ipc += [
'Transport_posix.h',
]
UNIFIED_SOURCES += [
'SharedMemory_posix.cpp',
'Transport_posix.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'CrossProcessMutex_windows.cpp',
]
elif not CONFIG['OS_ARCH'] in ('NetBSD', 'OpenBSD'):
UNIFIED_SOURCES += [
'CrossProcessMutex_posix.cpp',
]
else:
UNIFIED_SOURCES += [
'CrossProcessMutex_unimplemented.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'CrossProcessSemaphore_windows.cpp',
]
elif CONFIG['OS_ARCH'] != 'Darwin':
UNIFIED_SOURCES += [
'CrossProcessSemaphore_posix.cpp',
]
else:
UNIFIED_SOURCES += [
'CrossProcessSemaphore_unimplemented.cpp',
]
# Android has its own,
# almost-but-not-quite-compatible-with-POSIX-or-/dev/shm shared memory
# impl.
if CONFIG['OS_TARGET'] == 'Android':
EXPORTS.mozilla.ipc += ['SharedMemoryBasic_android.h']
UNIFIED_SOURCES += [
'SharedMemoryBasic_android.cpp',
]
elif CONFIG['OS_ARCH'] == 'Darwin':
EXPORTS.mozilla.ipc += ['SharedMemoryBasic_mach.h']
SOURCES += [
'SharedMemoryBasic_mach.mm',
]
else:
EXPORTS.mozilla.ipc += ['SharedMemoryBasic_chromium.h']
if CONFIG['OS_ARCH'] == 'Linux':
UNIFIED_SOURCES += [
'ProcessUtils_linux.cpp',
]
elif CONFIG['OS_ARCH'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
UNIFIED_SOURCES += [
'ProcessUtils_bsd.cpp'
]
elif CONFIG['OS_ARCH'] == 'Darwin':
UNIFIED_SOURCES += [
'ProcessUtils_mac.mm'
]
else:
UNIFIED_SOURCES += [
'ProcessUtils_none.cpp',
]
if CONFIG['OS_ARCH'] != 'WINNT':
EXPORTS.mozilla.ipc += [
'FileDescriptorShuffle.h',
]
UNIFIED_SOURCES += [
'FileDescriptorShuffle.cpp',
]
EXPORTS.ipc += [
'IPCMessageUtils.h',
]
UNIFIED_SOURCES += [
'BackgroundImpl.cpp',
'BackgroundUtils.cpp',
'BrowserProcessSubThread.cpp',
'CrashReporterClient.cpp',
'CrashReporterHost.cpp',
'FileDescriptor.cpp',
'FileDescriptorUtils.cpp',
'IdleSchedulerChild.cpp',
'IdleSchedulerParent.cpp',
'InProcessImpl.cpp',
'InputStreamUtils.cpp',
'IPCMessageUtils.cpp',
'IPCStreamChild.cpp',
'IPCStreamDestination.cpp',
'IPCStreamParent.cpp',
'IPCStreamSource.cpp',
'IPCStreamUtils.cpp',
'LibrarySandboxPreload.cpp',
'MessageChannel.cpp',
'MessageLink.cpp',
'MessagePump.cpp',
'ProcessChild.cpp',
'ProcessUtils_common.cpp',
'ProtocolUtils.cpp',
'ScopedXREEmbed.cpp',
'SharedMemory.cpp',
'Shmem.cpp',
'StringUtil.cpp',
'TransportSecurityInfoUtils.cpp',
'URIUtils.cpp',
]
SOURCES += [
'BackgroundChildImpl.cpp',
'BackgroundParentImpl.cpp',
'FileDescriptorSetChild.cpp',
'FileDescriptorSetParent.cpp',
]
if CONFIG['OS_ARCH'] == 'Darwin':
# GeckoChildProcessHost.cpp cannot be built unified due to OSX header
# clashes with TextRange.
SOURCES += [
'GeckoChildProcessHost.cpp',
]
else:
UNIFIED_SOURCES += [
'GeckoChildProcessHost.cpp',
]
LOCAL_INCLUDES += [
'/caps',
'/dom/broadcastchannel',
'/dom/indexedDB',
'/dom/storage',
'/media/webrtc/trunk',
'/media/webrtc/trunk/webrtc',
'/netwerk/base',
'/xpcom/build',
]
IPDL_SOURCES = [
'InputStreamParams.ipdlh',
'IPCStream.ipdlh',
'PBackground.ipdl',
'PBackgroundSharedTypes.ipdlh',
'PBackgroundTest.ipdl',
'PChildToParentStream.ipdl',
'PFileDescriptorSet.ipdl',
'PIdleScheduler.ipdl',
'PInProcess.ipdl',
'PParentToChildStream.ipdl',
'ProtocolTypes.ipdlh',
'URIParams.ipdlh',
]
if CONFIG['MOZ_ENABLE_FORKSERVER']:
EXPORTS.mozilla.ipc += [
'ForkServer.h',
'ForkServiceChild.h',
'MiniTransceiver.h',
]
UNIFIED_SOURCES += [
'ForkServer.cpp',
'ForkServiceChild.cpp',
'MiniTransceiver.cpp',
]
XPCOM_MANIFESTS += [
'components.conf',
]
LOCAL_INCLUDES += [
'/dom/ipc',
'/toolkit/crashreporter',
'/toolkit/xre',
'/xpcom/base',
'/xpcom/threads',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_BUNDLE'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
LOCAL_INCLUDES += [
'/security/sandbox/chromium',
'/security/sandbox/chromium-shim',
'/security/sandbox/win/src/sandboxbroker',
]
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-shadow']
# Add libFuzzer configuration directives
include('/tools/fuzzing/libfuzzer-config.mozbuild')