build/moz.build
author Andrew McCreight <continuation@gmail.com>
Mon, 22 Apr 2019 16:34:51 +0000
changeset 470376 3073770e06f157040f4c64951b7e8425e1ad7bbe
parent 467502 3305707514a18ff272af09a9e426819b9b47dc6a
child 472061 10fbbb071d9c36433d5810640b005487d3c3d062
permissions -rw-r--r--
Bug 1535403 - Take indirection into account for the CC optimizations for the outer window wrapper. r=peterv Most wrapper cached C++ objects are held alive by their wrapper. The cycle collector takes advantage of this in many classes and ignores the C++ object if the wrapper is marked black. However, this is not true for the outer window's wrapper. Instead, the outer window's wrapper keeps the inner window alive. The inner window usually keeps its outer window alive, but not after it has been unlinked. For reasons I do not yet understand, the outer window's wrapper can be kept alive after the inner window it is a proxy for is unlinked. This patch fixes the cycle collector optimization for the outer window by only applying it if the outer window still has a weak reference to the inner window, which it will until the inner no longer holds the outer alive. This in turn fixes, or at least helps fix, window leaks seen intermittently when the lifetime of outer windows and docshells are tied together. The code comment is based on a review comment by peterv. Differential Revision: https://phabricator.services.mozilla.com/D27981

# -*- 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/.

with Files('**'):
    BUG_COMPONENT = ('Firefox Build System', 'General')

# This cannot be named "build" because of bug 922191.
SPHINX_TREES['buildsystem'] = 'docs'

with Files('docs/**'):
    SCHEDULES.exclusive = ['docs']

if CONFIG['OS_ARCH'] == 'WINNT':
    DIRS += ['win32']
else:
    DIRS += ['unix']

CRAMTEST_MANIFESTS += [
    'tests/cram/cram.ini',
]

DEFINES['ACCEPTED_MAR_CHANNEL_IDS'] = CONFIG['ACCEPTED_MAR_CHANNEL_IDS']

if CONFIG['MOZ_BUILD_APP'] == 'browser':
    PYTHON_UNITTEST_MANIFESTS += [
        'compare-mozconfig/python.ini',
    ]

if CONFIG['ENABLE_TESTS'] or CONFIG['MOZ_DMD']:
    FINAL_TARGET_FILES += ['/tools/rb/fix_stack_using_bpsyms.py']
    if CONFIG['OS_ARCH'] == 'Darwin':
        FINAL_TARGET_FILES += ['/tools/rb/fix_macosx_stack.py']
    if CONFIG['OS_ARCH'] == 'Linux':
        FINAL_TARGET_FILES += ['/tools/rb/fix_linux_stack.py']

if CONFIG['MOZ_DMD']:
    FINAL_TARGET_FILES += ['/memory/replace/dmd/dmd.py']

# Put a useful .gdbinit in the bin directory, to be picked up automatically
# by GDB when we debug executables there.
FINAL_TARGET_FILES += ['/.gdbinit']
FINAL_TARGET_PP_FILES += ['.gdbinit_python.in']
OBJDIR_FILES += ['!/dist/bin/.gdbinit_python']

# Install the clang-cl runtime library for ASAN next to the binaries we produce.
if CONFIG['MOZ_ASAN'] and CONFIG['CC_TYPE'] == 'clang-cl':
    FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]
    FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH'].replace(".dll", ".pdb")]

if CONFIG['LLVM_SYMBOLIZER']:
    FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']]

if CONFIG['MOZ_APP_BASENAME']:
    appini_defines = {
        'TOPOBJDIR': TOPOBJDIR,
    }

    for var in ('GRE_MILESTONE', 'MOZ_APP_VERSION', 'MOZ_APP_BASENAME',
                'MOZ_APP_VENDOR', 'MOZ_APP_ID', 'MAR_CHANNEL_ID',
                'MOZ_APP_REMOTINGNAME'):
        appini_defines[var] = CONFIG[var]

    if CONFIG['MOZ_APP_DISPLAYNAME'] != CONFIG['MOZ_APP_BASENAME']:
        appini_defines['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME']

    if CONFIG['MOZ_BUILD_APP'] == 'browser':
        appini_defines['MOZ_BUILD_APP_IS_BROWSER'] = True

    if CONFIG['MOZ_APP_PROFILE']:
        appini_defines['MOZ_APP_PROFILE'] = CONFIG['MOZ_APP_PROFILE']

    for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR'):
        if CONFIG[var]:
            appini_defines[var] = True

    GENERATED_FILES += ['application.ini']

    appini = GENERATED_FILES['application.ini']
    appini.script = '../python/mozbuild/mozbuild/action/preprocessor.py:generate'
    appini.inputs = ['application.ini.in']
    appini.flags = ['-D%s=%s' % (k, '1' if v is True else v)
                    for k, v in appini_defines.iteritems()]
    FINAL_TARGET_FILES += ['!application.ini']
    if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']:
        FINAL_TARGET_PP_FILES += ['update-settings.ini']

    GENERATED_FILES += ['application.ini.h']
    appini = GENERATED_FILES['application.ini.h']
    appini.script = 'appini_header.py'
    appini.inputs = ['!application.ini']

if CONFIG['ENABLE_TESTS']:
    GENERATED_FILES += ['automation.py']
    auto = GENERATED_FILES['automation.py']
    auto.script = 'gen_automation.py'
    auto.inputs = ['automation.py.in']

    TEST_HARNESS_FILES.reftest += [
        '!automation.py',
    ]

    TEST_HARNESS_FILES.testing.mochitest += [
        '!automation.py',
    ]

# NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
OBJDIR_FILES += ['/.gdbinit']

# Put a .lldbinit in the bin directory and the objdir, to be picked up
# automatically by LLDB when we debug executables using either of those two
# directories as the current working directory.  The .lldbinit file will
# load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are.
DEFINES['topsrcdir'] = TOPSRCDIR
DEFINES['topobjdir'] = TOPOBJDIR
FINAL_TARGET_PP_FILES += ['.lldbinit.in']
OBJDIR_FILES += ['!/dist/bin/.lldbinit']

# Put the .ycm_extra_conf.py file at the root of the objdir. It is used by
# the vim plugin YouCompleteMe.
OBJDIR_FILES += ['/.ycm_extra_conf.py']

if CONFIG['MOZ_VALGRIND']:
    OBJDIR_FILES._valgrind += [
        'valgrind/cross-architecture.sup',
        'valgrind/i386-pc-linux-gnu.sup',
        'valgrind/x86_64-pc-linux-gnu.sup',
    ]