summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/allocator/BUILD.gn31
-rw-r--r--base/base.gyp14
-rw-r--r--base/base_nacl.gyp4
-rw-r--r--base/debug/BUILD.gn10
-rw-r--r--base/debug/profiler.cc5
-rw-r--r--build/buildflag_header.gypi5
-rw-r--r--build/config/compiler/BUILD.gn9
-rw-r--r--build/config/compiler/compiler.gni4
-rw-r--r--chrome/browser/ui/BUILD.gn1
-rw-r--r--chrome/browser/ui/browser_command_controller.cc3
-rw-r--r--chrome/browser/ui/toolbar/app_menu_model.cc3
-rw-r--r--chrome/chrome_browser_ui.gypi1
-rw-r--r--gin/modules/console.cc4
13 files changed, 63 insertions, 31 deletions
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn
index ad781f8..7c94b5d 100644
--- a/base/allocator/BUILD.gn
+++ b/base/allocator/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/allocator.gni")
+import("//build/config/compiler/compiler.gni")
declare_args() {
# Provide a way to force disable debugallocation in Debug builds,
@@ -147,8 +148,6 @@ if (use_allocator == "tcmalloc") {
"$tcmalloc_dir/src/base/synchronization_profiling.h",
"$tcmalloc_dir/src/base/sysinfo.cc",
"$tcmalloc_dir/src/base/sysinfo.h",
- "$tcmalloc_dir/src/base/thread_lister.c",
- "$tcmalloc_dir/src/base/thread_lister.h",
"$tcmalloc_dir/src/base/vdso_support.cc",
"$tcmalloc_dir/src/base/vdso_support.h",
"$tcmalloc_dir/src/central_freelist.cc",
@@ -175,11 +174,6 @@ if (use_allocator == "tcmalloc") {
"$tcmalloc_dir/src/memory_region_map.h",
"$tcmalloc_dir/src/page_heap.cc",
"$tcmalloc_dir/src/page_heap.h",
- "$tcmalloc_dir/src/profile-handler.cc",
- "$tcmalloc_dir/src/profile-handler.h",
- "$tcmalloc_dir/src/profiledata.cc",
- "$tcmalloc_dir/src/profiledata.h",
- "$tcmalloc_dir/src/profiler.cc",
"$tcmalloc_dir/src/raw_printer.cc",
"$tcmalloc_dir/src/raw_printer.h",
"$tcmalloc_dir/src/sampler.cc",
@@ -239,16 +233,8 @@ if (use_allocator == "tcmalloc") {
"$tcmalloc_dir/src/symbolize.h",
"$tcmalloc_dir/src/system-alloc.cc",
"$tcmalloc_dir/src/system-alloc.h",
-
- # cpuprofiler
- "$tcmalloc_dir/src/base/thread_lister.c",
- "$tcmalloc_dir/src/base/thread_lister.h",
- "$tcmalloc_dir/src/profile-handler.cc",
- "$tcmalloc_dir/src/profile-handler.h",
- "$tcmalloc_dir/src/profiledata.cc",
- "$tcmalloc_dir/src/profiledata.h",
- "$tcmalloc_dir/src/profiler.cc",
]
+
defines += [ "PERFTOOLS_DLL_DECL=" ]
configs -= [
@@ -262,6 +248,19 @@ if (use_allocator == "tcmalloc") {
deps += [ ":prep_libc" ]
}
+ if (enable_profiling) {
+ sources += [
+ "$tcmalloc_dir/src/base/thread_lister.c",
+ "$tcmalloc_dir/src/base/thread_lister.h",
+ "$tcmalloc_dir/src/profile-handler.cc",
+ "$tcmalloc_dir/src/profile-handler.h",
+ "$tcmalloc_dir/src/profiledata.cc",
+ "$tcmalloc_dir/src/profiledata.h",
+ "$tcmalloc_dir/src/profiler.cc",
+ ]
+ defines += [ "ENABLE_PROFILING=1" ]
+ }
+
if (is_linux || is_android) {
sources -= [
"$tcmalloc_dir/src/system-alloc.h",
diff --git a/base/base.gyp b/base/base.gyp
index 6ab4b36..8fa0524 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -21,6 +21,7 @@
'optimize': 'max',
},
'dependencies': [
+ 'base_debugging_flags',
'base_static',
'allocator/allocator.gyp:allocator_extension_thunks',
'../testing/gtest.gyp:gtest_prod',
@@ -1076,6 +1077,18 @@
}],
],
},
+ {
+ # GN version: //base/debug:debugging_flags
+ 'target_name': 'base_debugging_flags',
+ 'toolsets': ['host', 'target'],
+ 'includes': [ '../build/buildflag_header.gypi' ],
+ 'variables': {
+ 'buildflag_header_path': 'base/debug/debugging_flags.h',
+ 'buildflag_flags': [
+ 'ENABLE_PROFILING=<(profiling)',
+ ],
+ },
+ },
],
'conditions': [
['OS=="ios" and "<(GENERATOR)"=="ninja"', {
@@ -1131,6 +1144,7 @@
'base_target': 1,
},
'dependencies': [
+ 'base_debugging_flags',
'base_static_win64',
'allocator/allocator.gyp:allocator_extension_thunks_win64',
'../third_party/modp_b64/modp_b64.gyp:modp_b64_win64',
diff --git a/base/base_nacl.gyp b/base/base_nacl.gyp
index b2b4b7f..7010256 100644
--- a/base/base_nacl.gyp
+++ b/base/base_nacl.gyp
@@ -39,6 +39,9 @@
'-fno-strict-aliasing',
],
},
+ 'dependencies': [
+ 'base.gyp:base_debugging_flags',
+ ],
},
{
'target_name': 'base_i18n_nacl',
@@ -115,6 +118,7 @@
],
'dependencies': [
'../third_party/libevent/libevent_nacl_nonsfi.gyp:event_nacl_nonsfi',
+ 'base.gyp:base_debugging_flags',
],
},
{
diff --git a/base/debug/BUILD.gn b/base/debug/BUILD.gn
index be8084e..ec9298a 100644
--- a/base/debug/BUILD.gn
+++ b/base/debug/BUILD.gn
@@ -2,6 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/buildflag_header.gni")
+import("//build/config/compiler/compiler.gni")
+
source_set("debug") {
sources = [
"alias.cc",
@@ -58,6 +61,7 @@ source_set("debug") {
configs += [ "//base:base_implementation" ]
deps = [
+ ":debugging_flags",
"//base:base_static",
"//base/memory",
"//base/process",
@@ -75,3 +79,9 @@ source_set("debug") {
visibility = [ "//base/*" ]
}
+
+buildflag_header("debugging_flags") {
+ header = "debugging_flags.h"
+
+ flags = [ "ENABLE_PROFILING=$enable_profiling" ]
+}
diff --git a/base/debug/profiler.cc b/base/debug/profiler.cc
index 924c769..b499c14 100644
--- a/base/debug/profiler.cc
+++ b/base/debug/profiler.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/debug/debugging_flags.h"
#include "base/process/process_handle.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -15,7 +16,7 @@
#endif // defined(OS_WIN)
// TODO(peria): Enable profiling on Windows.
-#if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
+#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
#include "third_party/tcmalloc/chromium/src/gperftools/profiler.h"
#endif
@@ -23,7 +24,7 @@ namespace base {
namespace debug {
// TODO(peria): Enable profiling on Windows.
-#if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
+#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
static int profile_count = 0;
diff --git a/build/buildflag_header.gypi b/build/buildflag_header.gypi
index af86677..83b505a 100644
--- a/build/buildflag_header.gypi
+++ b/build/buildflag_header.gypi
@@ -115,4 +115,9 @@
],
}
],
+
+ # Allow the file to be included based on the given buildflag_header_path.
+ 'direct_dependent_settings': {
+ 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
+ },
}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index af3dd13..49b3737 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -39,10 +39,6 @@ declare_args() {
binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
root_build_dir)
- # Compile in such a way as to enable profiling of the generated code. For
- # example, don't omit the frame pointer and leave in symbols.
- enable_profiling = false
-
# Compile in such a way as to make it possible for the profiler to unwind full
# stack frames. Setting this flag has a large effect on the performance of the
# generated code than just setting profiling, but gives the profiler more
@@ -209,11 +205,6 @@ config("compiler") {
# -----------------------------------
if (is_posix && !(is_mac || is_ios)) {
if (enable_profiling && !is_debug) {
- # The GYP build spams this define into every compilation unit, as we do
- # here, but it only appears to be used in base and a couple other places.
- # TODO(abarth): Should we move this define closer to where it's used?
- defines += [ "ENABLE_PROFILING" ]
-
cflags += [
"-fno-omit-frame-pointer",
"-g",
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
index 5adc470..cc7463e 100644
--- a/build/config/compiler/compiler.gni
+++ b/build/config/compiler/compiler.gni
@@ -13,6 +13,10 @@ declare_args() {
# 0 means no symbols.
# -1 means auto-set according to debug/release and platform.
symbol_level = -1
+
+ # Compile in such a way as to enable profiling of the generated code. For
+ # example, don't omit the frame pointer and leave in symbols.
+ enable_profiling = false
}
# If it wasn't manually set, set to an appropriate default.
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 3ac381a..91825ea 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -46,6 +46,7 @@ source_set("ui") {
deps = [
# NOTE: New dependencies should generally be added in the OS!="ios"
# dependencies block below, rather than here.
+ "//base/debug:debugging_flags",
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index b6f7942..ac6ec7d 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/command_line.h"
+#include "base/debug/debugging_flags.h"
#include "base/prefs/pref_service.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
@@ -1279,7 +1280,7 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode() {
command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui);
-#if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC)
+#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC)
command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui);
#endif
diff --git a/chrome/browser/ui/toolbar/app_menu_model.cc b/chrome/browser/ui/toolbar/app_menu_model.cc
index 93f8704..f25c0fd 100644
--- a/chrome/browser/ui/toolbar/app_menu_model.cc
+++ b/chrome/browser/ui/toolbar/app_menu_model.cc
@@ -8,6 +8,7 @@
#include <cmath>
#include "base/command_line.h"
+#include "base/debug/debugging_flags.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
@@ -322,7 +323,7 @@ void ToolsMenuModel::Build(Browser* browser) {
AddSeparator(ui::NORMAL_SEPARATOR);
AddItemWithStringId(IDC_DEV_TOOLS, IDS_DEV_TOOLS);
-#if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC)
+#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC)
AddSeparator(ui::NORMAL_SEPARATOR);
AddCheckItemWithStringId(IDC_PROFILING_ENABLED, IDS_PROFILING_ENABLED);
#endif
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 22a5fad..c3d58c9 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -2822,6 +2822,7 @@
'chrome_resources.gyp:platform_locale_settings',
'chrome_resources.gyp:theme_resources',
'common',
+ '../base/base.gyp:base_debugging_flags',
'../components/components.gyp:auto_login_parser',
'../components/components.gyp:certificate_reporting',
'../components/components.gyp:device_event_log_component',
diff --git a/gin/modules/console.cc b/gin/modules/console.cc
index 231d8fc..63fc41e 100644
--- a/gin/modules/console.cc
+++ b/gin/modules/console.cc
@@ -4,7 +4,7 @@
#include "gin/modules/console.h"
-#include <iostream>
+#include <stdio.h>
#include "base/strings/string_util.h"
#include "gin/arguments.h"
@@ -25,7 +25,7 @@ void Log(Arguments* args) {
args->ThrowError();
return;
}
- std::cout << base::JoinString(messages, " ") << std::endl;
+ printf("%s\n", base::JoinString(messages, " ").c_str());
}
WrapperInfo g_wrapper_info = { kEmbedderNativeGin };