提交 211f2d4a 编写于 作者: A Adam Barth

Revert base roll and its fallout.

Updating base turns out to be more complicated than I thought.

This reverts commit daa822aa.
This reverts commit c38428c7.
This reverts commit 4b73a8a0.
上级 daa822aa
......@@ -20,7 +20,7 @@
vars = {
'chromium_git': 'https://chromium.googlesource.com',
'mojo_sdk_revision': 'fbe912aa65e0346382bc1e2874eb88fa3aad3358',
'base_revision': 'ff0b4b505e01de0098fd6ed13cf6661fa58be851',
'base_revision': '672b04e54b937ec899429a6bd5409c5a6300d151',
'skia_revision': '8cc209111876b7c78b5ec577c9221d8ed5e21024',
# Note: When updating the Dart revision, ensure that all entries that are
......@@ -30,7 +30,7 @@ vars = {
'dart_observatory_packages_revision': 'cf90eb9077177d3d6b3fd5e8289477c2385c026a',
'dart_root_certificates_revision': 'aed07942ce98507d2be28cbd29e879525410c7fc',
'buildtools_revision': '222bd42ce39d1bd8f08fe089b066f49c469e1cdf',
'buildtools_revision': '565d04e8741429fb1b4f26d102f2c6c3b849edeb',
}
# Only these hosts are allowed for dependencies in this DEPS file.
......@@ -42,19 +42,19 @@ allowed_hosts = [
deps = {
'src/base':
'https://github.com/domokit/base.git' + '@' + Var('base_revision'),
Var('chromium_git') + '/external/github.com/domokit/base' + '@' + Var('base_revision'),
'src/buildtools':
Var('chromium_git') + '/chromium/buildtools.git' + '@' + Var('buildtools_revision'),
'src/testing/gtest':
Var('chromium_git') + '/external/googletest.git' + '@' + '9855a87157778d39b95eccfb201a9dc90f6d61c6',
Var('chromium_git') + '/external/googletest.git' + '@' + '23574bf2333f834ff665f894c97bef8a5b33a0a9',
'src/testing/gmock':
Var('chromium_git') + '/external/googlemock.git' + '@' + '0421b6f358139f02e102c9c332ce19a33faf75be',
Var('chromium_git') + '/external/googlemock.git' + '@' + '29763965ab52f24565299976b936d1265cb6a271',
'src/third_party/icu':
Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '94e4b770ce2f6065d4261d29c32683a6099b9d93',
Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'c3f79166089e5360c09e3053fce50e6e296c3204',
'src/dart':
Var('chromium_git') + '/external/github.com/dart-lang/sdk.git' + '@' + Var('dart_revision'),
......@@ -80,7 +80,7 @@ deps = {
Var('chromium_git') + '/skia.git' + '@' + Var('skia_revision'),
'src/third_party/yasm/source/patched-yasm':
Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git' + '@' + '7da28c6c7c6a1387217352ce02b31754deb54d2a',
Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git' + '@' + '4671120cd8558ce62ee8672ebf3eb6f5216f909b',
'src/third_party/libjpeg_turbo':
Var('chromium_git') + '/chromium/deps/libjpeg_turbo.git' + '@' + 'f4631b6ee8b1dbb05e51ae335a7886f9ac598ab6',
......
......@@ -20,6 +20,10 @@ config("gtest_config") {
# Gtest headers need to be able to find themselves.
include_dirs = [ "include" ]
if (is_win) {
cflags = [ "/wd4800" ] # Unused variable warning.
}
if (is_posix) {
defines += [
# gtest isn't able to figure out when RTTI is disabled for gcc
......@@ -107,6 +111,16 @@ static_library("gtest") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
config("gtest_warnings") {
if (is_win && is_clang) {
# The Mutex constructor initializer list in gtest-port.cc is incorrectly
# ordered. See
# https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ.
cflags = [ "-Wno-reorder" ]
}
}
configs += [ ":gtest_warnings" ]
}
source_set("gtest_main") {
......
......@@ -28,8 +28,11 @@ android_java_prebuilt("uiautomator_java") {
jar_path = "$android_sdk/uiautomator.jar"
}
android_java_prebuilt("android_support_annotations_javalib") {
jar_path = "$android_sdk_root/extras/android/support/annotations/android-support-annotations.jar"
}
java_prebuilt("android_support_multidex_java") {
supports_android = true
jar_path = "$android_sdk_root/extras/android/support/multidex/library/libs/android-support-multidex.jar"
}
......@@ -64,8 +67,8 @@ android_resources("android_support_v7_mediarouter_resources") {
android_java_prebuilt("android_support_v7_mediarouter_java") {
deps = [
":android_support_v7_appcompat_java",
":android_support_v7_mediarouter_resources",
":android_support_v7_appcompat_java",
]
jar_path = "$android_sdk_root/extras/android/support/v7/mediarouter/libs/android-support-v7-mediarouter.jar"
}
......@@ -93,7 +96,9 @@ android_resources("google_play_services_default_resources") {
android_java_prebuilt("google_play_services_default_java") {
deps = [
":android_support_v13_java",
":android_support_v7_mediarouter_java",
":google_play_services_default_resources",
]
proguard_preprocess = false
jar_path = "$android_sdk_root/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
}
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
declare_args() {
use_system_libsrtp = false
use_srtp_boringssl = true
}
config("libsrtp_config") {
defines = [
"HAVE_CONFIG_H",
"HAVE_STDLIB_H",
"HAVE_STRING_H",
"TESTAPP_SOURCE",
]
include_dirs = [
"config",
"srtp/include",
"srtp/crypto/include",
]
if (use_srtp_boringssl) {
defines += [ "OPENSSL" ]
}
if (is_posix) {
defines += [
"HAVE_INT16_T",
"HAVE_INT32_T",
"HAVE_INT8_T",
"HAVE_UINT16_T",
"HAVE_UINT32_T",
"HAVE_UINT64_T",
"HAVE_UINT8_T",
"HAVE_STDINT_H",
"HAVE_INTTYPES_H",
"HAVE_NETINET_IN_H",
"HAVE_ARPA_INET_H",
"HAVE_UNISTD_H",
]
cflags = [ "-Wno-unused-variable" ]
}
if (is_win) {
defines += [
"HAVE_BYTESWAP_METHODS_H",
# All Windows architectures are this way.
"SIZEOF_UNSIGNED_LONG=4",
"SIZEOF_UNSIGNED_LONG_LONG=8",
]
}
if (current_cpu == "x64" || current_cpu == "x86" || current_cpu == "arm") {
defines += [
# TODO(leozwang): CPU_RISC doesn"t work properly on android/arm
# platform for unknown reasons, need to investigate the root cause
# of it. CPU_RISC is used for optimization only, and CPU_CISC should
# just work just fine, it has been tested on android/arm with srtp
# test applications and libjingle.
"CPU_CISC",
]
}
if (current_cpu == "mipsel") {
defines += [ "CPU_RISC" ]
}
}
config("system_libsrtp_config") {
defines = [ "USE_SYSTEM_LIBSRTP" ]
include_dirs = [ "/usr/include/srtp" ]
}
if (use_system_libsrtp) {
group("libsrtp") {
public_configs = [
":libsrtp_config",
":system_libsrtp_config",
]
libs = [ "-lsrtp" ]
}
} else {
static_library("libsrtp") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":libsrtp_config" ]
sources = [
# includes
"srtp/include/ekt.h",
"srtp/include/getopt_s.h",
"srtp/include/rtp.h",
"srtp/include/rtp_priv.h",
"srtp/include/srtp.h",
"srtp/include/srtp_priv.h",
"srtp/include/ut_sim.h",
# headers
"srtp/crypto/include/aes.h",
"srtp/crypto/include/aes_cbc.h",
"srtp/crypto/include/aes_icm.h",
"srtp/crypto/include/alloc.h",
"srtp/crypto/include/auth.h",
"srtp/crypto/include/cipher.h",
"srtp/crypto/include/crypto.h",
"srtp/crypto/include/crypto_kernel.h",
"srtp/crypto/include/crypto_math.h",
"srtp/crypto/include/crypto_types.h",
"srtp/crypto/include/cryptoalg.h",
"srtp/crypto/include/datatypes.h",
"srtp/crypto/include/err.h",
"srtp/crypto/include/gf2_8.h",
"srtp/crypto/include/hmac.h",
"srtp/crypto/include/integers.h",
"srtp/crypto/include/kernel_compat.h",
"srtp/crypto/include/key.h",
"srtp/crypto/include/null_auth.h",
"srtp/crypto/include/null_cipher.h",
"srtp/crypto/include/prng.h",
"srtp/crypto/include/rand_source.h",
"srtp/crypto/include/rdb.h",
"srtp/crypto/include/rdbx.h",
"srtp/crypto/include/sha1.h",
"srtp/crypto/include/stat.h",
"srtp/crypto/include/xfm.h",
# sources
"srtp/crypto/cipher/aes.c",
"srtp/crypto/cipher/aes_cbc.c",
"srtp/crypto/cipher/aes_icm.c",
"srtp/crypto/cipher/cipher.c",
"srtp/crypto/cipher/null_cipher.c",
"srtp/crypto/hash/auth.c",
"srtp/crypto/hash/hmac.c",
"srtp/crypto/hash/null_auth.c",
"srtp/crypto/hash/sha1.c",
"srtp/crypto/kernel/alloc.c",
"srtp/crypto/kernel/crypto_kernel.c",
"srtp/crypto/kernel/err.c",
"srtp/crypto/kernel/key.c",
"srtp/crypto/math/datatypes.c",
"srtp/crypto/math/gf2_8.c",
"srtp/crypto/math/stat.c",
"srtp/crypto/replay/rdb.c",
"srtp/crypto/replay/rdbx.c",
"srtp/crypto/replay/ut_sim.c",
"srtp/crypto/rng/ctr_prng.c",
"srtp/crypto/rng/prng.c",
"srtp/crypto/rng/rand_source.c",
"srtp/srtp/ekt.c",
"srtp/srtp/srtp.c",
]
if (is_clang) {
cflags = [ "-Wno-implicit-function-declaration" ]
}
if (use_srtp_boringssl) {
deps = [
"//third_party/boringssl:boringssl",
]
public_deps = [
"//third_party/boringssl:boringssl",
]
sources -= [
"srtp/crypto/cipher/aes_cbc.c",
"srtp/crypto/cipher/aes_icm.c",
"srtp/crypto/hash/hmac.c",
"srtp/crypto/hash/sha1.c",
"srtp/crypto/rng/ctr_prng.c",
"srtp/crypto/rng/prng.c",
]
sources += [
"srtp/crypto/cipher/aes_gcm_ossl.c",
"srtp/crypto/cipher/aes_icm_ossl.c",
"srtp/crypto/hash/hmac_ossl.c",
"srtp/crypto/include/aes_gcm_ossl.h",
"srtp/crypto/include/aes_icm_ossl.h",
]
}
}
# TODO(GYP): A bunch of these tests don't compile (in gyp either). They're
# not very broken, so could probably be made to work if it's useful.
if (!is_win) {
executable("rdbx_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/include/getopt_s.h",
"srtp/test/getopt_s.c",
"srtp/test/rdbx_driver.c",
]
}
executable("srtp_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/include/getopt_s.h",
"srtp/include/srtp_priv.h",
"srtp/test/getopt_s.c",
"srtp/test/srtp_driver.c",
]
}
executable("roc_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/include/rdbx.h",
"srtp/include/ut_sim.h",
"srtp/test/roc_driver.c",
]
}
executable("replay_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/include/rdbx.h",
"srtp/include/ut_sim.h",
"srtp/test/replay_driver.c",
]
}
executable("rtpw") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/include/datatypes.h",
"srtp/include/getopt_s.h",
"srtp/include/rtp.h",
"srtp/include/srtp.h",
"srtp/test/getopt_s.c",
"srtp/test/rtp.c",
"srtp/test/rtpw.c",
]
if (is_android) {
defines = [ "HAVE_SYS_SOCKET_H" ]
}
if (is_clang) {
cflags = [ "-Wno-implicit-function-declaration" ]
}
}
executable("srtp_test_cipher_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/cipher_driver.c",
"srtp/include/getopt_s.h",
"srtp/test/getopt_s.c",
]
}
executable("srtp_test_datatypes_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/datatypes_driver.c",
]
}
executable("srtp_test_stat_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/stat_driver.c",
]
}
executable("srtp_test_sha1_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/sha1_driver.c",
]
}
executable("srtp_test_kernel_driver") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/kernel_driver.c",
"srtp/include/getopt_s.h",
"srtp/test/getopt_s.c",
]
}
executable("srtp_test_aes_calc") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/aes_calc.c",
]
}
executable("srtp_test_rand_gen") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/rand_gen.c",
"srtp/include/getopt_s.h",
"srtp/test/getopt_s.c",
]
}
executable("srtp_test_rand_gen_soak") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/rand_gen_soak.c",
"srtp/include/getopt_s.h",
"srtp/test/getopt_s.c",
]
}
executable("srtp_test_env") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
deps = [
":libsrtp",
]
sources = [
"srtp/crypto/test/env.c",
]
}
group("srtp_runtest") {
deps = [
":rdbx_driver",
":srtp_driver",
":roc_driver",
":replay_driver",
":rtpw",
":srtp_test_cipher_driver",
":srtp_test_datatypes_driver",
":srtp_test_stat_driver",
":srtp_test_sha1_driver",
":srtp_test_kernel_driver",
":srtp_test_aes_calc",
":srtp_test_rand_gen",
":srtp_test_rand_gen_soak",
":srtp_test_env",
]
}
}
}
此差异已折叠。
......@@ -11,11 +11,10 @@
# Path to .grd file.
#
# outputs (required)
# List of outputs from grit, relative to the target_gen_dir. If supplied,
# a call to Grit to compute the outputs can be skipped which will make
# GN run faster. Grit will verify at build time that this list is correct
# and will fail if there is a mismatch between the outputs specified by
# the .grd file and the outputs list here.
# List of outputs from grit, relative to the target_gen_dir. Grit will
# verify at build time that this list is correct and will fail if there
# is a mismatch between the outputs specified by the .grd file and the
# outputs list here.
#
# To get this list, you can look in the .grd file for
# <output filename="..." and put those filename here. The base directory
......@@ -50,6 +49,10 @@
# output_dir, but if multiple targets with the same name end up in
# the same output_dir, they can collide.
#
# depfile_dir (optional)
# If set, used to store the depfile and corresponding stamp file.
# Defaults to output_dir
#
# use_qualified_include (optional)
# If set, output_dir is not added to include_dirs.
#
......@@ -76,6 +79,7 @@
# # files.
# }
import("//build/config/chrome_build.gni")
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
......@@ -106,6 +110,15 @@ if (is_chrome_branded) {
]
}
if (is_chromeos) {
grit_defines += [
"-D",
"chromeos",
"-D",
"scale_factors=2x",
]
}
if (is_desktop_linux) {
grit_defines += [
"-D",
......@@ -113,6 +126,34 @@ if (is_desktop_linux) {
]
}
if (toolkit_views) {
grit_defines += [
"-D",
"toolkit_views",
]
}
if (use_aura) {
grit_defines += [
"-D",
"use_aura",
]
}
if (use_ash) {
grit_defines += [
"-D",
"use_ash",
]
}
if (use_nss_certs) {
grit_defines += [
"-D",
"use_nss_certs",
]
}
if (use_ozone) {
grit_defines += [
"-D",
......@@ -120,6 +161,20 @@ if (use_ozone) {
]
}
if (enable_image_loader_extension) {
grit_defines += [
"-D",
"image_loader_extension",
]
}
if (enable_remoting) {
grit_defines += [
"-D",
"remoting",
]
}
if (is_android) {
grit_defines += [
"-t",
......@@ -147,6 +202,106 @@ if (is_ios) {
]
}
if (enable_extensions) {
grit_defines += [
"-D",
"enable_extensions",
]
}
if (enable_media_router) {
grit_defines += [
"-D",
"enable_media_router",
]
}
if (enable_plugins) {
grit_defines += [
"-D",
"enable_plugins",
]
}
if (enable_basic_printing || enable_print_preview) {
grit_defines += [
"-D",
"enable_printing",
]
if (enable_print_preview) {
grit_defines += [
"-D",
"enable_print_preview",
]
}
}
if (enable_themes) {
grit_defines += [
"-D",
"enable_themes",
]
}
if (enable_app_list) {
grit_defines += [
"-D",
"enable_app_list",
]
}
if (enable_settings_app) {
grit_defines += [
"-D",
"enable_settings_app",
]
}
if (enable_google_now) {
grit_defines += [
"-D",
"enable_google_now",
]
}
# Note: use_concatenated_impulse_responses is omitted. It is never used and
# should probably be removed from GYP build.
if (enable_webrtc) {
grit_defines += [
"-D",
"enable_webrtc",
]
}
if (enable_hangout_services_extension) {
grit_defines += [
"-D",
"enable_hangout_services_extension",
]
}
if (enable_task_manager) {
grit_defines += [
"-D",
"enable_task_manager",
]
}
if (enable_notifications) {
grit_defines += [
"-D",
"enable_notifications",
]
}
if (enable_wifi_bootstrapping) {
grit_defines += [
"-D",
"enable_wifi_bootstrapping",
]
}
if (enable_service_discovery) {
grit_defines += [
"-D",
"enable_service_discovery",
]
}
if (mac_views_browser) {
grit_defines += [
"-D",
"mac_views_browser",
]
}
grit_resource_id_file = "//tools/gritsettings/resource_ids"
grit_info_script = "//tools/grit/grit_info.py"
......@@ -179,6 +334,12 @@ template("grit") {
grit_output_name = target_name
}
if (defined(invoker.depfile_dir)) {
depfile_dir = invoker.depfile_dir
} else {
depfile_dir = output_dir
}
# These are all passed as arguments to the script so have to be relative to
# the build directory.
if (resource_ids != "") {
......@@ -231,7 +392,7 @@ template("grit") {
script = "//tools/grit/grit.py"
inputs = grit_inputs
depfile = "$output_dir/${grit_output_name}_stamp.d"
depfile = "$depfile_dir/${grit_output_name}_stamp.d"
outputs = [ "${depfile}.stamp" ] + grit_outputs
args = [
......
......@@ -189,7 +189,7 @@ class WatcherThreadManager {
typedef std::vector<RequestData> Requests;
friend struct base::DefaultSingletonTraits<WatcherThreadManager>;
friend struct DefaultSingletonTraits<WatcherThreadManager>;
WatcherThreadManager();
......@@ -221,7 +221,7 @@ WatcherThreadManager::~WatcherThreadManager() {
}
WatcherThreadManager* WatcherThreadManager::GetInstance() {
return base::Singleton<WatcherThreadManager>::get();
return Singleton<WatcherThreadManager>::get();
}
WatcherID WatcherThreadManager::StartWatching(
......
......@@ -22,7 +22,7 @@ copy("sky_shell") {
]
deps = [
"//sky/shell:shell_application_struct",
"//sky/shell",
]
} else if (!is_ios) {
sources = [
......
......@@ -23,7 +23,6 @@ source_set("libraries") {
"//mojo/public/platform/dart:mojo_internal_impl",
"//skia",
"//sky/engine/wtf",
"//third_party:jpeg",
"//third_party/iccjpeg",
"//third_party/libpng",
"//third_party/qcms",
......@@ -39,14 +38,13 @@ source_set("libraries") {
source_set("prerequisites") {
deps = [
":libraries",
"//sky/engine/platform",
]
public_deps = [
":libraries",
]
forward_dependent_configs_from = [ ":libraries" ]
public_configs = [
direct_dependent_configs = [
"//sky/engine:config",
"//sky/engine:inside_blink",
"//build/config/compiler:wexit_time_destructors",
......@@ -102,7 +100,7 @@ static_library("core") {
rebase_path("//dart/runtime"),
]
public_deps = [ ":libraries" ]
forward_dependent_configs_from = [ ":libraries" ]
# core and core_generated are really the same thing.
allow_circular_includes_from = [
......
......@@ -354,13 +354,17 @@ source_set("platform") {
"//mojo/public/cpp/system",
"//mojo/public/cpp/utility",
"//mojo/services/network/interfaces",
"//skia",
"//sky/engine/wtf",
"//third_party/harfbuzz-ng",
"//third_party/iccjpeg",
"//third_party/icu",
"//third_party/libpng",
"//third_party/qcms",
"//third_party:jpeg",
]
public_deps = [
forward_dependent_configs_from = [
"//skia",
"//third_party:jpeg",
"//third_party/iccjpeg",
......@@ -379,7 +383,7 @@ source_set("platform") {
}
if (is_linux) {
public_configs = [ "//build/config/linux:fontconfig" ]
direct_dependent_configs = [ "//build/config/linux:fontconfig" ]
}
}
......
......@@ -4,7 +4,7 @@
import("//testing/test.gni")
source_set("wtf") {
component("wtf") {
sources = [
"ASCIICType.h",
"AddressSpaceRandomization.cpp",
......@@ -225,16 +225,15 @@ source_set("wtf") {
defines = [ "WTF_IMPLEMENTATION=1" ]
public_configs = [ "//sky/engine:features" ]
direct_dependent_configs = [ "//sky/engine:features" ]
deps = [
"//base",
]
public_deps = [
"//third_party/icu",
]
forward_dependent_configs_from = [ "//third_party/icu" ]
if (is_android) {
libs = [ "log" ]
}
......
......@@ -5,12 +5,12 @@
import("//mojo/public/tools/bindings/mojom.gni")
group("activity") {
public_deps = [
deps = [
":interfaces",
]
if (is_android || is_ios) {
public_deps += [ ":activity_lib" ]
deps += [ ":activity_lib" ]
}
}
......
......@@ -5,12 +5,12 @@
import("//mojo/public/tools/bindings/mojom.gni")
group("editing") {
public_deps = [
deps = [
":interfaces",
]
if (is_android || is_ios) {
public_deps += [ ":editing_lib" ]
deps += [ ":editing_lib" ]
}
}
......
......@@ -5,12 +5,12 @@
import("//mojo/public/tools/bindings/mojom.gni")
group("media") {
public_deps = [
deps = [
":interfaces",
]
if (is_android || is_ios) {
public_deps += [ ":media_lib" ]
deps += [ ":media_lib" ]
}
}
......
......@@ -60,10 +60,10 @@ if (is_ios) {
}
group("platform") {
public_deps = [
deps = [
":interfaces"
]
if (is_android || is_ios) {
public_deps += [ ":platform_lib" ]
deps += [ ":platform_lib" ]
}
}
......@@ -5,10 +5,10 @@
import("//mojo/public/tools/bindings/mojom.gni")
group("vsync") {
public_deps = []
deps = []
if (is_android || is_ios) {
public_deps += [ ":vsync_lib" ]
deps += [ ":vsync_lib" ]
}
}
......
......@@ -67,8 +67,6 @@ source_set("common") {
"//sky/engine",
"//sky/engine/bindings",
"//sky/engine/core:core",
"//sky/engine/platform",
"//sky/engine/public/sky",
"//sky/engine/wtf",
"//sky/services/editing:interfaces",
"//sky/services/engine:interfaces",
......@@ -315,71 +313,71 @@ if (is_android) {
]
}
framework_dir = "$root_out_dir/Flutter.framework"
group("flutter_framework") {
framework_dir = "$root_out_dir/Flutter.framework"
copy("framework_dylib") {
sources = [ "$root_out_dir/libFlutter.dylib" ]
outputs = [ "$framework_dir/Flutter" ]
copy("framework_dylib") {
sources = [ "$root_out_dir/libFlutter.dylib" ]
outputs = [ "$framework_dir/Flutter" ]
deps = [
":flutter_framework_dylib",
]
}
deps = [
":flutter_framework_dylib",
]
}
action("framework_install_name") {
stamp_file = "$root_out_dir/flutter_install_name_stamp"
script = "//sky/tools/change_install_name.py"
action("framework_install_name") {
stamp_file = "$root_out_dir/flutter_install_name_stamp"
script = "//sky/tools/change_install_name.py"
inputs = [ "$framework_dir/Flutter" ]
outputs = [ stamp_file ]
inputs = [ "$framework_dir/Flutter" ]
outputs = [ stamp_file ]
args = [
"--dylib",
rebase_path("$framework_dir/Flutter"),
"--install_name",
"@rpath/Flutter.framework/Flutter",
"--stamp",
rebase_path(stamp_file),
]
args = [
"--dylib",
rebase_path("$framework_dir/Flutter"),
"--install_name",
"@rpath/Flutter.framework/Flutter",
"--stamp",
rebase_path(stamp_file),
]
deps = [
":framework_dylib"
]
}
deps = [
":framework_dylib"
]
}
copy("framework_info_plist") {
sources = [ "platform/ios/framework/Info.plist" ]
outputs = [ "$framework_dir/Info.plist" ]
}
copy("framework_info_plist") {
sources = [ "platform/ios/framework/Info.plist" ]
outputs = [ "$framework_dir/Info.plist" ]
}
copy("framework_module_map") {
sources = [ "platform/ios/framework/module.modulemap" ]
outputs = [ "$framework_dir/Modules/module.modulemap" ]
}
copy("framework_module_map") {
sources = [ "platform/ios/framework/module.modulemap" ]
outputs = [ "$framework_dir/Modules/module.modulemap" ]
}
copy("framework_headers") {
sources = [
"platform/ios/framework/Headers/Flutter.h",
"platform/ios/framework/Headers/FlutterAppDelegate.h",
"platform/ios/framework/Headers/FlutterAsyncMessageListener.h",
"platform/ios/framework/Headers/FlutterDartProject.h",
"platform/ios/framework/Headers/FlutterMacros.h",
"platform/ios/framework/Headers/FlutterMessageListener.h",
"platform/ios/framework/Headers/FlutterViewController.h",
]
outputs = [ "$framework_dir/Headers/{{source_file_part}}" ]
}
copy("framework_headers") {
sources = [
"platform/ios/framework/Headers/Flutter.h",
"platform/ios/framework/Headers/FlutterAppDelegate.h",
"platform/ios/framework/Headers/FlutterAsyncMessageListener.h",
"platform/ios/framework/Headers/FlutterDartProject.h",
"platform/ios/framework/Headers/FlutterMacros.h",
"platform/ios/framework/Headers/FlutterMessageListener.h",
"platform/ios/framework/Headers/FlutterViewController.h",
]
outputs = [ "$framework_dir/Headers/{{source_file_part}}" ]
}
copy("framework_icu") {
set_sources_assignment_filter([])
sources = [
"//third_party/icu/android/icudtl.dat",
]
set_sources_assignment_filter(sources_assignment_filter)
outputs = [ "$framework_dir/{{source_file_part}}" ]
}
copy("framework_icu") {
set_sources_assignment_filter([])
sources = [
"//third_party/icu/android/icudtl.dat",
]
set_sources_assignment_filter(sources_assignment_filter)
outputs = [ "$framework_dir/{{source_file_part}}" ]
}
group("flutter_framework") {
public_deps = [
":framework_dylib",
":framework_headers",
......@@ -471,20 +469,19 @@ if (is_android) {
]
}
resource_copy_mac("sky_resources") {
app_name = "SkyShell"
resources = [
"//third_party/icu/android/icudtl.dat",
]
bundle_directory = "."
}
mac_app("shell_application") {
app_name = "SkyShell"
info_plist = "platform/mac/Info.plist"
xibs = [ "platform/mac/sky_mac.xib" ]
resource_copy_mac("sky_resources") {
resources = [
"//third_party/icu/android/icudtl.dat",
]
bundle_directory = "."
}
deps = [
":mac_scaffolding",
":sky_resources",
......
......@@ -24,9 +24,9 @@ void CopyComplete(base::FilePath file, std::string uri, bool success) {
// Extract the scheme prefix ('package:' or 'file:' from )
static std::string ExtractSchemePrefix(std::string url) {
if (base::StartsWith(url, "package:", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(url, "package:", true)) {
return "package:";
} else if (base::StartsWith(url, "file:", base::CompareCase::SENSITIVE)) {
} else if (base::StartsWithASCII(url, "file:", true)) {
return "file:";
}
return "";
......@@ -34,9 +34,9 @@ static std::string ExtractSchemePrefix(std::string url) {
// Extract the path from a package: or file: url.
static std::string ExtractPath(std::string url) {
if (base::StartsWith(url, "package:", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(url, "package:", true)) {
base::ReplaceFirstSubstringAfterOffset(&url, 0, "package:", "");
} else if (base::StartsWith(url, "file:", base::CompareCase::SENSITIVE)) {
} else if (base::StartsWithASCII(url, "file:", true)) {
base::ReplaceFirstSubstringAfterOffset(&url, 0, "file:", "");
}
return url;
......@@ -100,11 +100,11 @@ void DartLibraryProviderFiles::GetLibraryAsStream(
Dart_Handle DartLibraryProviderFiles::CanonicalizeURL(Dart_Handle library,
Dart_Handle url) {
std::string string = blink::StdStringFromDart(url);
if (base::StartsWith(string, "dart:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(string, "dart:", true))
return url;
if (base::StartsWith(string, "package:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(string, "package:", true))
return url;
if (base::StartsWith(string, "file:", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(string, "file:", true)) {
base::ReplaceFirstSubstringAfterOffset(&string, 0, "file:", "");
return blink::StdStringToDart(string);;
}
......@@ -119,9 +119,9 @@ Dart_Handle DartLibraryProviderFiles::CanonicalizeURL(Dart_Handle library,
}
std::string DartLibraryProviderFiles::GetFilePathForURL(std::string url) {
if (base::StartsWith(url, "package:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(url, "package:", true))
return GetFilePathForPackageURL(url);
if (base::StartsWith(url, "file:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(url, "file:", true))
return GetFilePathForFileURL(url);
return url;
......@@ -129,7 +129,7 @@ std::string DartLibraryProviderFiles::GetFilePathForURL(std::string url) {
std::string DartLibraryProviderFiles::GetFilePathForPackageURL(
std::string url) {
DCHECK(base::StartsWith(url, "package:", base::CompareCase::SENSITIVE));
DCHECK(base::StartsWithASCII(url, "package:", true));
base::ReplaceFirstSubstringAfterOffset(&url, 0, "package:", "");
size_t slash = url.find('/');
if (slash == std::string::npos)
......@@ -139,7 +139,7 @@ std::string DartLibraryProviderFiles::GetFilePathForPackageURL(
std::string package_path = packages_map_.Resolve(package);
if (package_path.empty())
return std::string();
if (base::StartsWith(package_path, "file://", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(package_path, "file://", true)) {
base::ReplaceFirstSubstringAfterOffset(&package_path, 0, "file://", "");
return package_path + library_path;
}
......@@ -148,7 +148,7 @@ std::string DartLibraryProviderFiles::GetFilePathForPackageURL(
}
std::string DartLibraryProviderFiles::GetFilePathForFileURL(std::string url) {
DCHECK(base::StartsWith(url, "file://", base::CompareCase::SENSITIVE));
DCHECK(base::StartsWithASCII(url, "file://", true));
base::ReplaceFirstSubstringAfterOffset(&url, 0, "file://", "");
return url;
}
......
......@@ -12,11 +12,10 @@
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/lazy_instance.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/memory/discardable_memory.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/posix/eintr_wrapper.h"
#include "base/single_thread_task_runner.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "mojo/message_pump/message_pump_mojo.h"
#include "sky/engine/core/script/dart_init.h"
......@@ -46,12 +45,6 @@ class NonDiscardableMemory : public base::DiscardableMemory {
void Unlock() override {}
void* data() const override { return data_.get(); }
base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump(
const char* name,
base::trace_event::ProcessMemoryDump* pmd) const override {
return pmd->CreateAllocatorDump(name);
}
private:
std::unique_ptr<uint8_t[]> data_;
};
......
......@@ -20,9 +20,9 @@ namespace {
// Extract the scheme prefix ('package:' or 'file:' from )
static std::string ExtractSchemePrefix(std::string url) {
if (base::StartsWith(url, "package:", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(url, "package:", true)) {
return "package:";
} else if (base::StartsWith(url, "file:", base::CompareCase::SENSITIVE)) {
} else if (base::StartsWithASCII(url, "file:", true)) {
return "file:";
}
return "";
......@@ -30,9 +30,9 @@ static std::string ExtractSchemePrefix(std::string url) {
// Extract the path from a package: or file: url.
static std::string ExtractPath(std::string url) {
if (base::StartsWith(url, "package:", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(url, "package:", true)) {
base::ReplaceFirstSubstringAfterOffset(&url, 0, "package:", "");
} else if (base::StartsWith(url, "file:", base::CompareCase::SENSITIVE)) {
} else if (base::StartsWithASCII(url, "file:", true)) {
base::ReplaceFirstSubstringAfterOffset(&url, 0, "file:", "");
}
return url;
......@@ -107,11 +107,11 @@ void Loader::LoadPackagesMap(const base::FilePath& packages) {
Dart_Handle Loader::CanonicalizeURL(Dart_Handle library, Dart_Handle url) {
std::string string = StringFromDart(url);
if (base::StartsWith(string, "dart:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(string, "dart:", true))
return url;
if (base::StartsWith(string, "package:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(string, "package:", true))
return url;
if (base::StartsWith(string, "file:", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(string, "file:", true)) {
base::ReplaceFirstSubstringAfterOffset(&string, 0, "file:", "");
return StringToDart(string);;
}
......@@ -126,9 +126,9 @@ Dart_Handle Loader::CanonicalizeURL(Dart_Handle library, Dart_Handle url) {
}
std::string Loader::GetFilePathForURL(std::string url) {
if (base::StartsWith(url, "package:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(url, "package:", true))
return GetFilePathForPackageURL(url);
if (base::StartsWith(url, "file:", base::CompareCase::SENSITIVE))
if (base::StartsWithASCII(url, "file:", true))
return GetFilePathForFileURL(url);
return url;
......@@ -136,7 +136,7 @@ std::string Loader::GetFilePathForURL(std::string url) {
std::string Loader::GetFilePathForPackageURL(
std::string url) {
DCHECK(base::StartsWith(url, "package:", base::CompareCase::SENSITIVE));
DCHECK(base::StartsWithASCII(url, "package:", true));
base::ReplaceFirstSubstringAfterOffset(&url, 0, "package:", "");
size_t slash = url.find('/');
if (slash == std::string::npos)
......@@ -146,7 +146,7 @@ std::string Loader::GetFilePathForPackageURL(
std::string package_path = packages_map_->Resolve(package);
if (package_path.empty())
return std::string();
if (base::StartsWith(package_path, "file://", base::CompareCase::SENSITIVE)) {
if (base::StartsWithASCII(package_path, "file://", true)) {
base::ReplaceFirstSubstringAfterOffset(&package_path, 0, "file://", "");
return package_path + library_path;
}
......@@ -155,7 +155,7 @@ std::string Loader::GetFilePathForPackageURL(
}
std::string Loader::GetFilePathForFileURL(std::string url) {
DCHECK(base::StartsWith(url, "file://", base::CompareCase::SENSITIVE));
DCHECK(base::StartsWithASCII(url, "file://", true));
base::ReplaceFirstSubstringAfterOffset(&url, 0, "file://", "");
return url;
}
......
......@@ -31,12 +31,12 @@ group("jpeg") {
libs = [ "jpeg" ]
public_configs = [ ":system_libjpeg_config" ]
} else if (use_libjpeg_turbo) {
public_deps = [
deps = [
"//third_party/libjpeg_turbo:libjpeg",
]
public_configs = [ ":libjpeg_turbo_config" ]
} else {
public_deps = [
deps = [
"//third_party/libjpeg:libjpeg",
]
}
......
......@@ -180,5 +180,16 @@ if (use_system_harfbuzz) {
"src/hb-glib.h",
]
}
# See also chrome/browser/ui/libgtk2ui/BUILD.gn which pulls this.
config("pangoft2_link_hack") {
if (is_linux && use_pango && !is_chromeos && !is_official_build &&
current_cpu != "arm" && !is_component_build) {
# These symbols are referenced from libpangoft2, which will be
# dynamically linked later.
ldflags =
[ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
}
}
}
}
......@@ -61,6 +61,16 @@ source_set("libpng_sources") {
public_deps = [
"//third_party/zlib",
]
# Must be in a config because of how GN orders flags (otherwise -Wall will
# appear after this, and turn it back on).
config("clang_warnings") {
if (is_clang) {
# Upstream uses self-assignment to avoid warnings.
cflags = [ "-Wno-self-assign" ]
}
}
configs += [ ":clang_warnings" ]
}
if (is_win) {
......
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'libpng',
'dependencies': [
'../zlib/zlib.gyp:zlib',
],
'variables': {
# Upstream uses self-assignment to avoid warnings.
'clang_warning_flags': [ '-Wno-self-assign' ]
},
'defines': [
'CHROME_PNG_WRITE_SUPPORT',
'PNG_USER_CONFIG',
],
'sources': [
'png.c',
'png.h',
'pngconf.h',
'pngerror.c',
'pnggccrd.c',
'pngget.c',
'pngmem.c',
'pngpread.c',
'pngread.c',
'pngrio.c',
'pngrtran.c',
'pngrutil.c',
'pngset.c',
'pngtrans.c',
'pngusr.h',
'pngvcrd.c',
'pngwio.c',
'pngwrite.c',
'pngwtran.c',
'pngwutil.c',
],
'direct_dependent_settings': {
'include_dirs': [
'.',
],
'defines': [
'CHROME_PNG_WRITE_SUPPORT',
'PNG_USER_CONFIG',
],
},
'export_dependent_settings': [
'../zlib/zlib.gyp:zlib',
],
# TODO(jschuh): http://crbug.com/167187
'msvs_disabled_warnings': [ 4267 ],
'conditions': [
['OS!="win"', {'product_name': 'png'}],
['OS=="win"', {
'type': '<(component)',
}, {
# Chromium libpng does not support building as a shared_library
# on non-Windows platforms.
'type': 'static_library',
}],
['OS=="win" and component=="shared_library"', {
'defines': [
'PNG_BUILD_DLL',
'PNG_NO_MODULEDEF',
],
'direct_dependent_settings': {
'defines': [
'PNG_USE_DLL',
],
},
}],
['OS=="android"', {
'toolsets': ['target', 'host'],
'defines': [
'CHROME_PNG_READ_PACK_SUPPORT', # Required by freetype.
],
'direct_dependent_settings': {
'defines': [
'CHROME_PNG_READ_PACK_SUPPORT',
],
},
}],
],
},
]
}
jar@chromium.org
# On extended leave.
willchan@chromium.org
......@@ -98,3 +98,4 @@ Modifications:
- Changed DEFINE_foo macros to ignore envname unless ENABLE_PROFILING is defined
- Changed DEFINE_string to define const char*s instead of strings
- Disabled HEAPPROFILE envvar unless ENABLE_PROFILING is defined
- Add "ARMv8-a" to the supporting list of ARM architecture
......@@ -35,7 +35,12 @@
#ifndef ARM_INSTRUCTION_SET_SELECT_H_
#define ARM_INSTRUCTION_SET_SELECT_H_
#if defined(__ARM_ARCH_7__) || \
#if defined(__ARM_ARCH_8A__)
# define ARMV8 1
#endif
#if defined(ARMV8) || \
defined(__ARM_ARCH_7__) || \
defined(__ARM_ARCH_7R__) || \
defined(__ARM_ARCH_7A__)
# define ARMV7 1
......
......@@ -486,7 +486,7 @@ class MallocBlock {
// the address space could take more.
static size_t max_size_t = ~0;
if (size > max_size_t - sizeof(MallocBlock)) {
RAW_LOG(ERROR, "Massive size passed to malloc: %" PRIuS "", size);
RAW_LOG(ERROR, "Massive size passed to malloc: %"PRIuS"", size);
return NULL;
}
MallocBlock* b = NULL;
......@@ -965,7 +965,7 @@ static SpinLock malloc_trace_lock(SpinLock::LINKER_INITIALIZED);
do { \
if (FLAGS_malloctrace) { \
SpinLockHolder l(&malloc_trace_lock); \
TracePrintf(TraceFd(), "%s\t%" PRIuS "\t%p\t%" GPRIuPTHREAD, \
TracePrintf(TraceFd(), "%s\t%"PRIuS"\t%p\t%"GPRIuPTHREAD, \
name, size, addr, PRINTABLE_PTHREAD(pthread_self())); \
TraceStack(); \
TracePrintf(TraceFd(), "\n"); \
......@@ -1227,7 +1227,7 @@ extern "C" PERFTOOLS_DLL_DECL void* tc_new(size_t size) {
void* ptr = debug_cpp_alloc(size, MallocBlock::kNewType, false);
MallocHook::InvokeNewHook(ptr, size);
if (ptr == NULL) {
RAW_LOG(FATAL, "Unable to allocate %" PRIuS " bytes: new failed.", size);
RAW_LOG(FATAL, "Unable to allocate %"PRIuS" bytes: new failed.", size);
}
return ptr;
}
......@@ -1254,7 +1254,7 @@ extern "C" PERFTOOLS_DLL_DECL void* tc_newarray(size_t size) {
void* ptr = debug_cpp_alloc(size, MallocBlock::kArrayNewType, false);
MallocHook::InvokeNewHook(ptr, size);
if (ptr == NULL) {
RAW_LOG(FATAL, "Unable to allocate %" PRIuS " bytes: new[] failed.", size);
RAW_LOG(FATAL, "Unable to allocate %"PRIuS" bytes: new[] failed.", size);
}
return ptr;
}
......
此差异已折叠。
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ---
// Author: Sainbayar Sukhbaatar
// Dai Mikurube
//
// This file contains a class DeepHeapProfile and its public function
// DeepHeapProfile::DumpOrderedProfile(). The function works like
// HeapProfileTable::FillOrderedProfile(), but dumps directory to files.
//
// DeepHeapProfile::DumpOrderedProfile() dumps more detailed information about
// heap usage, which includes OS-level information such as memory residency and
// type information if the type profiler is available.
//
// DeepHeapProfile::DumpOrderedProfile() uses data stored in HeapProfileTable.
// Any code in DeepHeapProfile runs only when DumpOrderedProfile() is called.
// It has overhead in dumping, but no overhead in logging.
//
// It currently works only on Linux including Android. It does nothing in
// non-Linux environments.
// Note that uint64 is used to represent addresses instead of uintptr_t, and
// int is used to represent buffer sizes instead of size_t.
// It's for consistency with other TCMalloc functions. ProcMapsIterator uses
// uint64 for addresses, and HeapProfileTable::DumpOrderedProfile uses int
// for buffer sizes.
#ifndef BASE_DEEP_HEAP_PROFILE_H_
#define BASE_DEEP_HEAP_PROFILE_H_
#include "config.h"
#if defined(TYPE_PROFILING)
#include <typeinfo>
#endif
#if defined(__linux__) || defined(_WIN32) || defined(_WIN64)
#define USE_DEEP_HEAP_PROFILE 1
#endif
#include "addressmap-inl.h"
#include "heap-profile-table.h"
#include "memory_region_map.h"
class DeepHeapProfile {
public:
enum PageFrameType {
DUMP_NO_PAGEFRAME = 0, // Dumps nothing about pageframes
DUMP_PFN = 1, // Dumps only pageframe numbers (PFNs)
DUMP_PAGECOUNT = 2, // Dumps PFNs and pagecounts
};
// Constructs a DeepHeapProfile instance. It works as a wrapper of
// HeapProfileTable.
//
// |heap_profile| is a pointer to HeapProfileTable. DeepHeapProfile reads
// data in |heap_profile| and forwards operations to |heap_profile| if
// DeepHeapProfile is not available (non-Linux).
// |prefix| is a prefix of dumped file names.
// |pageframe_type| means what information is dumped for pageframes.
DeepHeapProfile(HeapProfileTable* heap_profile,
const char* prefix,
enum PageFrameType pageframe_type);
~DeepHeapProfile();
// Dumps a deep profile into |fd| with using |raw_buffer| of |buffer_size|.
//
// In addition, a list of buckets is dumped into a ".buckets" file in
// descending order of allocated bytes.
void DumpOrderedProfile(const char* reason,
char raw_buffer[],
int buffer_size,
RawFD fd);
private:
#ifdef USE_DEEP_HEAP_PROFILE
typedef HeapProfileTable::Stats Stats;
typedef HeapProfileTable::Bucket Bucket;
typedef HeapProfileTable::AllocValue AllocValue;
typedef HeapProfileTable::AllocationMap AllocationMap;
enum MapsRegionType {
// Bytes of memory which were not recognized with /proc/<pid>/maps.
// This size should be 0.
ABSENT,
// Bytes of memory which is mapped anonymously.
// Regions which contain nothing in the last column of /proc/<pid>/maps.
ANONYMOUS,
// Bytes of memory which is mapped to a executable/non-executable file.
// Regions which contain file paths in the last column of /proc/<pid>/maps.
FILE_EXEC,
FILE_NONEXEC,
// Bytes of memory which is labeled [stack] in /proc/<pid>/maps.
STACK,
// Bytes of memory which is labeled, but not mapped to any file.
// Regions which contain non-path strings in the last column of
// /proc/<pid>/maps.
OTHER,
NUMBER_OF_MAPS_REGION_TYPES
};
static const char* kMapsRegionTypeDict[NUMBER_OF_MAPS_REGION_TYPES];
// Manages a buffer to keep a text to be dumped to a file.
class TextBuffer {
public:
TextBuffer(char *raw_buffer, int size, RawFD fd)
: buffer_(raw_buffer),
size_(size),
cursor_(0),
fd_(fd) {
}
int Size();
int FilledBytes();
void Clear();
void Flush();
bool AppendChar(char value);
bool AppendString(const char* value, int width);
bool AppendInt(int value, int width, bool leading_zero);
bool AppendLong(long value, int width);
bool AppendUnsignedLong(unsigned long value, int width);
bool AppendInt64(int64 value, int width);
bool AppendBase64(uint64 value, int width);
bool AppendPtr(uint64 value, int width);
private:
bool ForwardCursor(int appended);
char *buffer_;
int size_;
int cursor_;
RawFD fd_;
DISALLOW_COPY_AND_ASSIGN(TextBuffer);
};
// Defines an interface for getting info about memory residence.
class MemoryResidenceInfoGetterInterface {
public:
virtual ~MemoryResidenceInfoGetterInterface();
// Initializes the instance.
virtual void Initialize() = 0;
// Returns the number of resident (including swapped) bytes of the given
// memory region from |first_address| to |last_address| inclusive.
virtual size_t CommittedSize(uint64 first_address,
uint64 last_address,
TextBuffer* buffer) const = 0;
// Creates a new platform specific MemoryResidenceInfoGetterInterface.
static MemoryResidenceInfoGetterInterface* Create(
PageFrameType pageframe_type);
virtual bool IsPageCountAvailable() const = 0;
protected:
MemoryResidenceInfoGetterInterface();
};
#if defined(_WIN32) || defined(_WIN64)
// TODO(peria): Implement this class.
class MemoryInfoGetterWindows : public MemoryResidenceInfoGetterInterface {
public:
MemoryInfoGetterWindows(PageFrameType) {}
virtual ~MemoryInfoGetterWindows() {}
virtual void Initialize();
virtual size_t CommittedSize(uint64 first_address,
uint64 last_address,
TextBuffer* buffer) const;
virtual bool IsPageCountAvailable() const;
};
#endif // defined(_WIN32) || defined(_WIN64)
#if defined(__linux__)
// Implements MemoryResidenceInfoGetterInterface for Linux.
class MemoryInfoGetterLinux : public MemoryResidenceInfoGetterInterface {
public:
MemoryInfoGetterLinux(PageFrameType pageframe_type)
: pageframe_type_(pageframe_type),
pagemap_fd_(kIllegalRawFD),
kpagecount_fd_(kIllegalRawFD) {}
virtual ~MemoryInfoGetterLinux() {}
// Opens /proc/<pid>/pagemap and stores its file descriptor.
// It keeps open while the process is running.
//
// Note that file descriptors need to be refreshed after fork.
virtual void Initialize();
// Returns the number of resident (including swapped) bytes of the given
// memory region from |first_address| to |last_address| inclusive.
virtual size_t CommittedSize(uint64 first_address,
uint64 last_address,
TextBuffer* buffer) const;
virtual bool IsPageCountAvailable() const;
private:
struct State {
uint64 pfn;
bool is_committed; // Currently, we use only this
bool is_present;
bool is_swapped;
bool is_shared;
bool is_mmap;
};
uint64 ReadPageCount(uint64 pfn) const;
// Seeks to the offset of the open pagemap file.
// It returns true if succeeded.
bool Seek(uint64 address) const;
// Reads a pagemap state from the current offset.
// It returns true if succeeded.
bool Read(State* state, bool get_pfn) const;
PageFrameType pageframe_type_;
RawFD pagemap_fd_;
RawFD kpagecount_fd_;
};
#endif // defined(__linux__)
// Contains extended information for HeapProfileTable::Bucket. These objects
// are managed in a hash table (DeepBucketTable) whose key is an address of
// a Bucket and other additional information.
struct DeepBucket {
public:
void UnparseForStats(TextBuffer* buffer);
void UnparseForBucketFile(TextBuffer* buffer);
Bucket* bucket;
#if defined(TYPE_PROFILING)
const std::type_info* type; // A type of the object
#endif
size_t committed_size; // A resident size of this bucket
bool is_mmap; // True if the bucket represents a mmap region
int id; // A unique ID of the bucket
bool is_logged; // True if the stracktrace is logged to a file
DeepBucket* next; // A reference to the next entry in the hash table
};
// Manages a hash table for DeepBucket.
class DeepBucketTable {
public:
DeepBucketTable(int size,
HeapProfileTable::Allocator alloc,
HeapProfileTable::DeAllocator dealloc);
~DeepBucketTable();
// Finds a DeepBucket instance corresponding to the given |bucket|, or
// creates a new DeepBucket object if it doesn't exist.
DeepBucket* Lookup(Bucket* bucket,
#if defined(TYPE_PROFILING)
const std::type_info* type,
#endif
bool is_mmap);
// Writes stats of the hash table to |buffer| for DumpOrderedProfile.
void UnparseForStats(TextBuffer* buffer);
// Writes all buckets for a bucket file with using |buffer|.
void WriteForBucketFile(const char* prefix,
int dump_count,
char raw_buffer[],
int buffer_size);
// Resets 'committed_size' members in DeepBucket objects.
void ResetCommittedSize();
// Resets all 'is_loggeed' flags in DeepBucket objects.
void ResetIsLogged();
private:
// Adds |add| to a |hash_value| for Lookup.
inline static void AddToHashValue(uintptr_t add, uintptr_t* hash_value);
inline static void FinishHashValue(uintptr_t* hash_value);
DeepBucket** table_;
size_t table_size_;
HeapProfileTable::Allocator alloc_;
HeapProfileTable::DeAllocator dealloc_;
int bucket_id_;
};
class RegionStats {
public:
RegionStats(): virtual_bytes_(0), committed_bytes_(0) {}
~RegionStats() {}
// Initializes 'virtual_bytes_' and 'committed_bytes_'.
void Initialize();
// Updates itself to contain the tallies of 'virtual_bytes' and
// 'committed_bytes' in the region from |first_adress| to |last_address|
// inclusive.
uint64 Record(
const MemoryResidenceInfoGetterInterface* memory_residence_info_getter,
uint64 first_address,
uint64 last_address,
TextBuffer* buffer);
// Writes stats of the region into |buffer| with |name|.
void Unparse(const char* name, TextBuffer* buffer);
size_t virtual_bytes() const { return virtual_bytes_; }
size_t committed_bytes() const { return committed_bytes_; }
void AddToVirtualBytes(size_t additional_virtual_bytes) {
virtual_bytes_ += additional_virtual_bytes;
}
void AddToCommittedBytes(size_t additional_committed_bytes) {
committed_bytes_ += additional_committed_bytes;
}
void AddAnotherRegionStat(const RegionStats& other) {
virtual_bytes_ += other.virtual_bytes_;
committed_bytes_ += other.committed_bytes_;
}
private:
size_t virtual_bytes_;
size_t committed_bytes_;
DISALLOW_COPY_AND_ASSIGN(RegionStats);
};
class GlobalStats {
public:
// Snapshots and calculates global stats from /proc/<pid>/maps and pagemap.
void SnapshotMaps(
const MemoryResidenceInfoGetterInterface* memory_residence_info_getter,
DeepHeapProfile* deep_profile,
TextBuffer* mmap_dump_buffer);
// Snapshots allocations by malloc and mmap.
void SnapshotAllocations(DeepHeapProfile* deep_profile);
// Writes global stats into |buffer|.
void Unparse(TextBuffer* buffer);
private:
// Records both virtual and committed byte counts of malloc and mmap regions
// as callback functions for AllocationMap::Iterate().
static void RecordAlloc(const void* pointer,
AllocValue* alloc_value,
DeepHeapProfile* deep_profile);
DeepBucket* GetInformationOfMemoryRegion(
const MemoryRegionMap::RegionIterator& mmap_iter,
const MemoryResidenceInfoGetterInterface* memory_residence_info_getter,
DeepHeapProfile* deep_profile);
// All RegionStats members in this class contain the bytes of virtual
// memory and committed memory.
// TODO(dmikurube): These regions should be classified more precisely later
// for more detailed analysis.
RegionStats all_[NUMBER_OF_MAPS_REGION_TYPES];
RegionStats unhooked_[NUMBER_OF_MAPS_REGION_TYPES];
// Total bytes of malloc'ed regions.
RegionStats profiled_malloc_;
// Total bytes of mmap'ed regions.
RegionStats profiled_mmap_;
};
// Writes reformatted /proc/<pid>/maps into a file "|prefix|.<pid>.maps"
// with using |raw_buffer| of |buffer_size|.
static void WriteProcMaps(const char* prefix,
char raw_buffer[],
int buffer_size);
// Appends the command line (/proc/pid/cmdline on Linux) into |buffer|.
bool AppendCommandLine(TextBuffer* buffer);
MemoryResidenceInfoGetterInterface* memory_residence_info_getter_;
// Process ID of the last dump. This can change by fork.
pid_t most_recent_pid_;
GlobalStats stats_; // Stats about total memory.
int dump_count_; // The number of dumps.
char* filename_prefix_; // Output file prefix.
char run_id_[128];
DeepBucketTable deep_table_;
enum PageFrameType pageframe_type_;
#endif // USE_DEEP_HEAP_PROFILE
HeapProfileTable* heap_profile_;
DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile);
};
#endif // BASE_DEEP_HEAP_PROFILE_H_
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TYPE_PROFILER_MAP_H_
#define TYPE_PROFILER_MAP_H_
#if defined(TYPE_PROFILING)
#include <typeinfo>
// PERFTOOLS_DLL_DECL is unnecessary, as it is Windows specific.
void InsertType(void* address, size_t size, const std::type_info& type);
void EraseType(void* address);
const std::type_info* LookupType(const void* address);
#endif // defined(TYPE_PROFILING)
#endif // TYPE_PROFILER_MAP_H_
......@@ -92,6 +92,9 @@ DEFINE_int32(heap_check_max_leaks,
// header of the dumped heap profile
static const char kProfileHeader[] = "heap profile: ";
static const char kProcSelfMapsHeader[] = "\nMAPPED_LIBRARIES:\n";
#if defined(TYPE_PROFILING)
static const char kTypeProfileStatsHeader[] = "type statistics:\n";
#endif // defined(TYPE_PROFILING)
//----------------------------------------------------------------------
......@@ -358,6 +361,29 @@ void HeapProfileTable::DumpMarkedObjects(AllocationMark mark,
RawClose(fd);
}
#if defined(TYPE_PROFILING)
void HeapProfileTable::DumpTypeStatistics(const char* file_name) const {
RawFD fd = RawOpenForWriting(file_name);
if (fd == kIllegalRawFD) {
RAW_LOG(ERROR, "Failed dumping type statistics to %s", file_name);
return;
}
AddressMap<TypeCount>* type_size_map;
type_size_map = new(alloc_(sizeof(AddressMap<TypeCount>)))
AddressMap<TypeCount>(alloc_, dealloc_);
address_map_->Iterate(TallyTypesItererator, type_size_map);
RawWrite(fd, kTypeProfileStatsHeader, strlen(kTypeProfileStatsHeader));
const DumpArgs args(fd, NULL);
type_size_map->Iterate<const DumpArgs&>(DumpTypesIterator, args);
RawClose(fd);
type_size_map->~AddressMap<TypeCount>();
dealloc_(type_size_map);
}
#endif // defined(TYPE_PROFILING)
void HeapProfileTable::IterateOrderedAllocContexts(
AllocContextIterator callback) const {
Bucket** list = MakeSortedBucketList();
......@@ -425,6 +451,41 @@ void HeapProfileTable::DumpBucketIterator(const Bucket* bucket,
"", NULL);
}
#if defined(TYPE_PROFILING)
// static
void HeapProfileTable::TallyTypesItererator(
const void* ptr,
AllocValue* value,
AddressMap<TypeCount>* type_size_map) {
const std::type_info* type = LookupType(ptr);
const void* key = NULL;
if (type)
key = type->name();
TypeCount* count = type_size_map->FindMutable(key);
if (count) {
count->bytes += value->bytes;
++count->objects;
} else {
type_size_map->Insert(key, TypeCount(value->bytes, 1));
}
}
// static
void HeapProfileTable::DumpTypesIterator(const void* ptr,
TypeCount* count,
const DumpArgs& args) {
char buf[1024];
int len;
const char* mangled_type_name = static_cast<const char*>(ptr);
len = snprintf(buf, sizeof(buf), "%6d: %8" PRId64 " @ %s\n",
count->objects, count->bytes,
mangled_type_name ? mangled_type_name : "(no_typeinfo)");
RawWrite(args.fd, buf, len);
}
#endif // defined(TYPE_PROFILING)
inline
void HeapProfileTable::DumpNonLiveIterator(const void* ptr, AllocValue* v,
const DumpArgs& args) {
......@@ -458,7 +519,7 @@ void HeapProfileTable::DumpMarkedIterator(const void* ptr, AllocValue* v,
b.depth = v->bucket()->depth;
b.stack = v->bucket()->stack;
char addr[16];
snprintf(addr, 16, "0x%08" PRIxPTR, ptr);
snprintf(addr, 16, "0x%08" PRIxPTR, reinterpret_cast<uintptr_t>(ptr));
char buf[1024];
int len = UnparseBucket(b, buf, 0, sizeof(buf), addr, NULL);
RawWrite(args.fd, buf, len);
......
......@@ -40,6 +40,10 @@
#include "base/logging.h" // for RawFD
#include "heap-profile-stats.h"
#if defined(TYPE_PROFILING)
#include <gperftools/type_profiler_map.h>
#endif // defined(TYPE_PROFILING)
// Table to maintain a heap profile data inside,
// i.e. the set of currently active heap memory allocations.
// thread-unsafe and non-reentrant code:
......@@ -219,7 +223,13 @@ class HeapProfileTable {
// used for leak checking (using HeapLeakChecker).
void DumpMarkedObjects(AllocationMark mark, const char* file_name);
#if defined(TYPE_PROFILING)
void DumpTypeStatistics(const char* file_name) const;
#endif // defined(TYPE_PROFILING)
private:
friend class DeepHeapProfile;
// data types ----------------------------
// Hash table bucket to hold (de)allocation stats
......@@ -318,6 +328,18 @@ class HeapProfileTable {
// mark unmarked allocations.
};
#if defined(TYPE_PROFILING)
struct TypeCount {
TypeCount(size_t bytes_arg, unsigned int objects_arg)
: bytes(bytes_arg),
objects(objects_arg) {
}
size_t bytes;
unsigned int objects;
};
#endif // defined(TYPE_PROFILING)
struct AllocationAddressIteratorArgs {
AllocationAddressIteratorArgs(AddressIterator callback_arg, void* data_arg)
: callback(callback_arg),
......@@ -387,6 +409,16 @@ class HeapProfileTable {
inline static void DumpMarkedIterator(const void* ptr, AllocValue* v,
const DumpMarkedArgs& args);
#if defined(TYPE_PROFILING)
inline static void TallyTypesItererator(const void* ptr,
AllocValue* value,
AddressMap<TypeCount>* type_size_map);
inline static void DumpTypesIterator(const void* ptr,
TypeCount* size,
const DumpArgs& args);
#endif // defined(TYPE_PROFILING)
// Helper for IterateOrderedAllocContexts and FillOrderedProfile.
// Creates a sorted list of Buckets whose length is num_buckets_.
// The caller is responsible for deallocating the returned list.
......
......@@ -68,6 +68,7 @@
#include "base/spinlock.h"
#include "base/low_level_alloc.h"
#include "base/sysinfo.h" // for GetUniquePathFromEnv()
#include "deep-heap-profile.h"
#include "heap-profile-table.h"
#include "memory_region_map.h"
......@@ -80,6 +81,38 @@
#endif
#endif
#if defined(__ANDROID__) || defined(ANDROID)
// On android, there are no environment variables.
// Instead, we use system properties, set via:
// adb shell setprop prop_name prop_value
// From <sys/system_properties.h>,
// PROP_NAME_MAX 32
// PROP_VALUE_MAX 92
#define HEAPPROFILE "heapprof"
#define HEAP_PROFILE_ALLOCATION_INTERVAL "heapprof.allocation_interval"
#define HEAP_PROFILE_DEALLOCATION_INTERVAL "heapprof.deallocation_interval"
#define HEAP_PROFILE_INUSE_INTERVAL "heapprof.inuse_interval"
#define HEAP_PROFILE_TIME_INTERVAL "heapprof.time_interval"
#define HEAP_PROFILE_MMAP_LOG "heapprof.mmap_log"
#define HEAP_PROFILE_MMAP "heapprof.mmap"
#define HEAP_PROFILE_ONLY_MMAP "heapprof.only_mmap"
#define DEEP_HEAP_PROFILE "heapprof.deep_heap_profile"
#define DEEP_HEAP_PROFILE_PAGEFRAME "heapprof.deep.pageframe"
#define HEAP_PROFILE_TYPE_STATISTICS "heapprof.type_statistics"
#else // defined(__ANDROID__) || defined(ANDROID)
#define HEAPPROFILE "HEAPPROFILE"
#define HEAP_PROFILE_ALLOCATION_INTERVAL "HEAP_PROFILE_ALLOCATION_INTERVAL"
#define HEAP_PROFILE_DEALLOCATION_INTERVAL "HEAP_PROFILE_DEALLOCATION_INTERVAL"
#define HEAP_PROFILE_INUSE_INTERVAL "HEAP_PROFILE_INUSE_INTERVAL"
#define HEAP_PROFILE_TIME_INTERVAL "HEAP_PROFILE_TIME_INTERVAL"
#define HEAP_PROFILE_MMAP_LOG "HEAP_PROFILE_MMAP_LOG"
#define HEAP_PROFILE_MMAP "HEAP_PROFILE_MMAP"
#define HEAP_PROFILE_ONLY_MMAP "HEAP_PROFILE_ONLY_MMAP"
#define DEEP_HEAP_PROFILE "DEEP_HEAP_PROFILE"
#define DEEP_HEAP_PROFILE_PAGEFRAME "DEEP_HEAP_PROFILE_PAGEFRAME"
#define HEAP_PROFILE_TYPE_STATISTICS "HEAP_PROFILE_TYPE_STATISTICS"
#endif // defined(__ANDROID__) || defined(ANDROID)
using STL_NAMESPACE::string;
using STL_NAMESPACE::sort;
......@@ -121,6 +154,20 @@ DEFINE_bool(only_mmap_profile,
EnvToBool(HEAP_PROFILE_ONLY_MMAP, false),
"If heap-profiling is on, only profile mmap, mremap, and sbrk; "
"do not profile malloc/new/etc");
DEFINE_bool(deep_heap_profile,
EnvToBool(DEEP_HEAP_PROFILE, false),
"If heap-profiling is on, profile deeper (Linux and Android)");
DEFINE_int32(deep_heap_profile_pageframe,
EnvToInt(DEEP_HEAP_PROFILE_PAGEFRAME, 0),
"Needs deeper profile. If 1, dump page frame numbers (PFNs). "
"If 2, dump page counts (/proc/kpagecount) with PFNs.");
#if defined(TYPE_PROFILING)
DEFINE_bool(heap_profile_type_statistics,
EnvToBool(HEAP_PROFILE_TYPE_STATISTICS, false),
"If heap-profiling is on, dump type statistics.");
#endif // defined(TYPE_PROFILING)
//----------------------------------------------------------------------
// Locking
//----------------------------------------------------------------------
......@@ -173,6 +220,7 @@ static int64 high_water_mark = 0; // In-use-bytes at last high-water dump
static int64 last_dump_time = 0; // The time of the last dump
static HeapProfileTable* heap_profile = NULL; // the heap profile table
static DeepHeapProfile* deep_profile = NULL; // deep memory profiler
// Callback to generate a stack trace for an allocation. May be overriden
// by an application to provide its own pseudo-stacks.
......@@ -253,11 +301,25 @@ static void DumpProfileLocked(const char* reason) {
reinterpret_cast<char*>(ProfilerMalloc(kProfileBufferSize));
}
char* profile =
DoGetHeapProfileLocked(global_profiler_buffer, kProfileBufferSize);
RawWrite(fd, profile, strlen(profile));
if (deep_profile) {
deep_profile->DumpOrderedProfile(reason, global_profiler_buffer,
kProfileBufferSize, fd);
} else {
char* profile = DoGetHeapProfileLocked(global_profiler_buffer,
kProfileBufferSize);
RawWrite(fd, profile, strlen(profile));
}
RawClose(fd);
#if defined(TYPE_PROFILING)
if (FLAGS_heap_profile_type_statistics) {
snprintf(file_name, sizeof(file_name), "%s.%05d.%04d.type",
filename_prefix, getpid(), dump_count);
RAW_VLOG(0, "Dumping type statistics to %s", file_name);
heap_profile->DumpTypeStatistics(file_name);
}
#endif // defined(TYPE_PROFILING)
dumping = false;
}
......@@ -467,6 +529,14 @@ extern "C" void HeapProfilerStart(const char* prefix) {
high_water_mark = 0;
last_dump_time = 0;
if (FLAGS_deep_heap_profile) {
// Initialize deep memory profiler
RAW_VLOG(0, "[%d] Starting a deep memory profiler", getpid());
deep_profile = new(ProfilerMalloc(sizeof(DeepHeapProfile)))
DeepHeapProfile(heap_profile, prefix, DeepHeapProfile::PageFrameType(
FLAGS_deep_heap_profile_pageframe));
}
// We do not reset dump_count so if the user does a sequence of
// HeapProfilerStart/HeapProfileStop, we will get a continuous
// sequence of profiles.
......@@ -528,6 +598,13 @@ extern "C" void HeapProfilerStop() {
RAW_CHECK(MallocHook::RemoveMunmapHook(&MunmapHook), "");
}
if (deep_profile) {
// free deep memory profiler
deep_profile->~DeepHeapProfile();
ProfilerFree(deep_profile);
deep_profile = NULL;
}
// free profile
heap_profile->~HeapProfileTable();
ProfilerFree(heap_profile);
......
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#if defined(TYPE_PROFILING)
#include <config.h>
#include <new>
#include <stddef.h>
#include <typeinfo>
#include <gperftools/type_profiler_map.h>
#include "addressmap-inl.h"
#include "base/logging.h"
#include "base/low_level_alloc.h"
#include "base/spinlock.h"
#include "tcmalloc_guard.h"
namespace {
const TCMallocGuard tcmalloc_initializer;
//----------------------------------------------------------------------
// A struct to store size and type_info of an object
//----------------------------------------------------------------------
struct ObjectInfo {
public:
ObjectInfo(): size(0), type(NULL) {}
ObjectInfo(size_t size_arg, const std::type_info* type_arg)
: size(size_arg),
type(type_arg) {
}
size_t size;
const std::type_info* type;
};
//----------------------------------------------------------------------
// Locking
//----------------------------------------------------------------------
SpinLock g_type_profiler_lock(SpinLock::LINKER_INITIALIZED);
//----------------------------------------------------------------------
// Simple allocator for type_info map's internal memory
//----------------------------------------------------------------------
LowLevelAlloc::Arena* g_type_profiler_map_memory = NULL;
void* TypeProfilerMalloc(size_t bytes) {
return LowLevelAlloc::AllocWithArena(bytes, g_type_profiler_map_memory);
}
void TypeProfilerFree(void* p) {
LowLevelAlloc::Free(p);
}
//----------------------------------------------------------------------
// Profiling control/state data
//----------------------------------------------------------------------
AddressMap<ObjectInfo>* g_type_profiler_map = NULL;
//----------------------------------------------------------------------
// Manage type_info map
//----------------------------------------------------------------------
void InitializeTypeProfilerMemory() {
if (g_type_profiler_map_memory != NULL) {
RAW_DCHECK(g_type_profiler_map != NULL, "TypeProfilerMap is NULL");
return;
}
g_type_profiler_map_memory =
LowLevelAlloc::NewArena(0, LowLevelAlloc::DefaultArena());
g_type_profiler_map =
new(TypeProfilerMalloc(sizeof(*g_type_profiler_map)))
AddressMap<ObjectInfo>(TypeProfilerMalloc, TypeProfilerFree);
}
} // namespace
void InsertType(void* address, size_t size, const std::type_info& type) {
SpinLockHolder lock(&g_type_profiler_lock);
InitializeTypeProfilerMemory();
g_type_profiler_map->Insert(address, ObjectInfo(size, &type));
}
void EraseType(void* address) {
SpinLockHolder lock(&g_type_profiler_lock);
InitializeTypeProfilerMemory();
ObjectInfo obj;
g_type_profiler_map->FindAndRemove(address, &obj);
}
const std::type_info* LookupType(const void* address) {
SpinLockHolder lock(&g_type_profiler_lock);
InitializeTypeProfilerMemory();
const ObjectInfo* found = g_type_profiler_map->Find(address);
if (found == NULL)
return NULL;
return found->type;
}
#endif // defined(TYPE_PROFILING)
......@@ -67,6 +67,13 @@ static_library("zlib") {
if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
sources += [ "x86.c" ]
config("zlib_warnings") {
if (is_clang) {
cflags = [ "-Wno-incompatible-pointer-types" ]
}
}
configs += [ ":zlib_warnings" ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
......@@ -102,17 +109,20 @@ static_library("minizip") {
defines = [ "USE_FILE32API" ]
}
if (is_clang) {
# zlib uses `if ((a == b))` for some reason.
cflags = [ "-Wno-parentheses-equality" ]
}
deps = [
":zlib",
]
config("minizip_warnings") {
if (is_clang) {
# zlib uses `if ((a == b))` for some reason.
cflags = [ "-Wno-parentheses-equality" ]
}
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":minizip_warnings" ]
public_configs = [ ":zlib_config" ]
}
......
include_rules = [
'+base',
'+testing',
]
......@@ -56,7 +56,7 @@ bool AddEntryToZip(zipFile zip_file, const base::FilePath& path,
DCHECK(result);
std::string str_path = relative_path.AsUTF8Unsafe();
#if defined(OS_WIN)
ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/");
base::ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/");
#endif
bool is_directory = base::DirectoryExists(path);
......
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'zip',
'type': 'static_library',
'dependencies': [
'../zlib.gyp:minizip',
'../../../base/base.gyp:base',
],
'include_dirs': [
'../../..',
],
'sources': [
'zip.cc',
'zip.h',
'zip_internal.cc',
'zip_internal.h',
'zip_reader.cc',
'zip_reader.h',
],
},
],
}
......@@ -131,8 +131,8 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip,
original_size_ = raw_file_info.uncompressed_size;
// Directory entries in zip files end with "/".
is_directory_ =
base::EndsWith(file_name_in_zip, "/", base::CompareCase::SENSITIVE);
is_directory_ = base::EndsWith(file_name_in_zip, "/",
base::CompareCase::INSENSITIVE_ASCII);
// Check the file name here for directory traversal issues.
is_unsafe_ = file_path_.ReferencesParent();
......@@ -147,7 +147,7 @@ ZipReader::EntryInfo::EntryInfo(const std::string& file_name_in_zip,
// We also consider that the file name is unsafe, if it's absolute.
// On Windows, IsAbsolute() returns false for paths starting with "/".
if (file_path_.IsAbsolute() ||
base::StartsWith(file_name_in_zip, "/", base::CompareCase::SENSITIVE))
base::StartsWithASCII(file_name_in_zip, "/", false))
is_unsafe_ = true;
// Construct the last modified time. The timezone info is not present in
......@@ -358,12 +358,10 @@ void ZipReader::ExtractCurrentEntryToFilePathAsync(
// If this is a directory, just create it and return.
if (current_entry_info()->is_directory()) {
if (base::CreateDirectory(output_file_path)) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
success_callback);
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, success_callback);
} else {
DVLOG(1) << "Unzip failed: unable to create directory.";
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
failure_callback);
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, failure_callback);
}
return;
}
......
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name' : 'zlib_x86_simd',
'type': 'static_library',
'conditions': [
['OS!="ios" and (target_arch=="ia32" or target_arch=="x64")', {
'cflags' : ['-msse4.2', '-mpclmul'],
'xcode_settings' : {
'OTHER_CFLAGS' : ['-msse4.2', '-mpclmul'],
},
'sources' : [
'crc_folding.c',
'fill_window_sse.c',
],
'conditions': [
['OS=="win" and clang==1', {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [ '-msse4.2', '-mpclmul' ],
},
},
}],
],
}, {
'sources' : [ 'simd_stub.c' ],
}],
['OS=="android"', {
'toolsets': ['target', 'host'],
}],
],
},
{
'target_name': 'zlib',
'type': 'static_library',
'sources': [
'adler32.c',
'compress.c',
'crc32.c',
'crc32.h',
'deflate.c',
'deflate.h',
'gzclose.c',
'gzguts.h',
'gzlib.c',
'gzread.c',
'gzwrite.c',
'infback.c',
'inffast.c',
'inffast.h',
'inffixed.h',
'inflate.c',
'inflate.h',
'inftrees.c',
'inftrees.h',
'mozzconf.h',
'trees.c',
'trees.h',
'uncompr.c',
'x86.h',
'zconf.h',
'zlib.h',
'zutil.c',
'zutil.h',
],
'dependencies' : [
'zlib_x86_simd'
],
'include_dirs': [
'.',
],
'direct_dependent_settings': {
'include_dirs': [
'.',
],
},
'conditions': [
['OS!="ios" and (target_arch=="ia32" or target_arch=="x64")', {
'sources' : [ 'x86.c', ],
'variables': {
'clang_warning_flags': [
'-Wno-incompatible-pointer-types',
],
},
}],
['OS!="win"', {
'product_name': 'chrome_zlib',
}], ['OS=="android"', {
'toolsets': ['target', 'host'],
}],
],
},
{
'target_name': 'minizip',
'type': 'static_library',
'sources': [
'contrib/minizip/ioapi.c',
'contrib/minizip/ioapi.h',
'contrib/minizip/iowin32.c',
'contrib/minizip/iowin32.h',
'contrib/minizip/unzip.c',
'contrib/minizip/unzip.h',
'contrib/minizip/zip.c',
'contrib/minizip/zip.h',
],
'dependencies': [
'zlib',
],
'include_dirs': [
'.',
'../..',
],
'direct_dependent_settings': {
'include_dirs': [
'.',
],
},
'variables': {
'clang_warning_flags': [
# zlib uses `if ((a == b))` for some reason.
'-Wno-parentheses-equality',
],
},
'conditions': [
['OS!="win"', {
'sources!': [
'contrib/minizip/iowin32.c'
],
}],
['OS=="android"', {
'toolsets': ['target', 'host'],
}],
['OS=="mac" or OS=="ios" or os_bsd==1 or OS=="android"', {
# Mac, Android and the BSDs don't have fopen64, ftello64, or
# fseeko64. We use fopen, ftell, and fseek instead on these
# systems.
'defines': [
'USE_FILE32API'
],
}],
],
},
],
}
......@@ -17,7 +17,7 @@ GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str)
minor_version(0),
is_es3(false) {
if (version_str) {
std::string lstr(base::ToLowerASCII(std::string(version_str)));
std::string lstr(base::StringToLowerASCII(std::string(version_str)));
is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es");
if (is_es)
lstr = lstr.substr(10, 3);
......@@ -35,7 +35,7 @@ GLVersionInfo::GLVersionInfo(const char* version_str, const char* renderer_str)
is_es3 = true;
}
if (renderer_str) {
is_angle = base::StartsWith(renderer_str, "ANGLE", base::CompareCase::SENSITIVE);
is_angle = base::StartsWithASCII(renderer_str, "ANGLE", true);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册