browser/app/moz.build
author Nicholas Nethercote <nnethercote@mozilla.com>
Wed, 12 Jul 2017 15:13:37 +1000
changeset 419917 129793760f2d718ed61ba17d9aacd57c7ec6785b
parent 404308 fbab448119b7fd3c0cfb1cb543f24d3b8c0871de
child 428875 f3455c101b7a672cce40ecd64f332d5e6e2d9447
permissions -rw-r--r--
Bug 1380227 - Avoid many UTF16toUTF8 and UTF8toUTF16 conversions in nsStringBundle. r=emk. Most of the names passed to nsIStringBundle::{Get,Format}StringFromUTF8Name have one of the two following forms: - a 16-bit C string literal, which is then converted to an 8-bit string in order for the lookup to occur; - an 8-bit C string literal converted to a 16-bit string, which is then converted back to an 8-bit string in order for the lookup to occur. This patch introduces and uses alternative methods that can take an 8-bit C string literal, which requires changing some signatures in other methods and functions. It replaces all C++ uses of the old methods. The patch also changes the existing {Get,Format}StringFromName() methods so they take an AUTF8String argument for the name instead of a wstring, because that's nicer for JS code. Even though there is a method for C++ code and a different one for JS code, |binaryname| is used so that the existing method names can be used for the common case in both languages. The change reduces the number of NS_ConvertUTF8toUTF16 and NS_ConvertUTF16toUTF8 conversions while running Speedometer v2 from ~270,000 to ~160,000. (Most of these conversions involved the string "deprecatedReferrerDirective" in nsCSPParser.cpp.)

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

DIRS += ['profile/extensions']

GeckoProgram(CONFIG['MOZ_APP_NAME'])

JS_PREFERENCE_PP_FILES += [
    'profile/firefox.js',
]

SOURCES += [
    'nsBrowserApp.cpp',
]

FINAL_TARGET_FILES += ['blocklist.xml']
FINAL_TARGET_FILES.defaults += ['permissions']

DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION']

LOCAL_INCLUDES += [
    '!/build',
    '/toolkit/xre',
    '/xpcom/base',
    '/xpcom/build',
]

if CONFIG['LIBFUZZER']:
    USE_LIBS += [ 'fuzzer' ]
    LOCAL_INCLUDES += [
        '/tools/fuzzing/libfuzzer',
    ]

if CONFIG['_MSC_VER']:
    # Always enter a Windows program through wmain, whether or not we're
    # a console application.
    WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']

if CONFIG['OS_ARCH'] == 'WINNT':
    RCINCLUDE = 'splash.rc'
    DEFINES['MOZ_PHOENIX'] = True

for cdm in CONFIG['MOZ_EME_MODULES']:
    DEFINES['MOZ_%s_EME' % cdm.upper()] = True

if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
    # For sandbox includes and the include dependencies those have
    LOCAL_INCLUDES += [
        '/security/sandbox/chromium',
        '/security/sandbox/chromium-shim',
    ]

    USE_LIBS += [
        'sandbox_s',
    ]

    DELAYLOAD_DLLS += [
        'winmm.dll',
        'user32.dll',
    ]

# Control the default heap size.
# This is the heap returned by GetProcessHeap().
# As we use the CRT heap, the default size is too large and wastes VM.
#
# The default heap size is 1MB on Win32.
# The heap will grow if need be.
#
# Set it to 256k.  See bug 127069.
if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
    LDFLAGS += ['/HEAP:0x40000']

DISABLE_STL_WRAPPING = True

if CONFIG['MOZ_LINKER']:
    OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']

if CONFIG['HAVE_CLOCK_MONOTONIC']:
    OS_LIBS += CONFIG['REALTIME_LIBS']

if CONFIG['MOZ_GPSD']:
    DEFINES['MOZ_GPSD'] = True

if CONFIG['MOZ_LINUX_32_SSE2_STARTUP_ERROR']:
    DEFINES['MOZ_LINUX_32_SSE2_STARTUP_ERROR'] = True

for icon in ('firefox', 'document', 'newwindow', 'newtab', 'pbmode'):
    DEFINES[icon.upper() + '_ICO'] = '"%s/%s/%s.ico"' % (
        TOPSRCDIR, CONFIG['MOZ_BRANDING_DIRECTORY'], icon)