summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen <jochen@chromium.org>2015-12-03 23:29:20 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-04 07:30:17 +0000
commit3c2d33560c6ab491e6c689474128656785b9bb8f (patch)
tree098525e27144a6316097cdc4ff66f93f489134e5
parentba02d22e594ec2a719c499c988a3e049353ef9cd (diff)
downloadchromium_src-3c2d33560c6ab491e6c689474128656785b9bb8f.zip
chromium_src-3c2d33560c6ab491e6c689474128656785b9bb8f.tar.gz
chromium_src-3c2d33560c6ab491e6c689474128656785b9bb8f.tar.bz2
Revert of Move ENABLE_PROFILING to build flags system. (patchset #3 id:40001 of https://codereview.chromium.org/1499773002/ )
Reason for revert: breaks Mac compile: debug/profiler.cc:9:10: fatal error: 'base/debug/debugging_flags.h' file not found #include "base/debug/debugging_flags.h" Original issue's description: > Move ENABLE_PROFILING to build flags system. > > This flag is only used in 3 files so having a global define is unnecessary. > > Moves the build flag to compiler.gni so it can be included by the new target in base that generates the header, as well as the tcmalloc target. > > The tcmalloc target now conditionally compiles the profiler depending on this flag. This is something the GYP build does but was inconsistent in GN. This results in the tcmalloc source files not being compiled in normal builds. > > This should remove the static initializer in tcmalloc profiling in the normal build. > > Independently, remove an iostream use in gin logging. Use printf instead. > > BUG=559766 > NOPRESUBMIT=true > (on account of changing the printf, which I did not add) > > Committed: https://crrev.com/41619210895837ee1a0063b786fed2b587ccc362 > Cr-Commit-Position: refs/heads/master@{#363156} TBR=dpranke@chromium.org,brettw@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=559766 Review URL: https://codereview.chromium.org/1497953002 Cr-Commit-Position: refs/heads/master@{#363161}
-rw-r--r--base/allocator/BUILD.gn31
-rw-r--r--base/base.gyp14
-rw-r--r--base/debug/BUILD.gn10
-rw-r--r--base/debug/profiler.cc5
-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
11 files changed, 31 insertions, 54 deletions
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn
index 7c94b5d..ad781f8 100644
--- a/base/allocator/BUILD.gn
+++ b/base/allocator/BUILD.gn
@@ -3,7 +3,6 @@
# 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,
@@ -148,6 +147,8 @@ 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",
@@ -174,6 +175,11 @@ 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",
@@ -233,8 +239,16 @@ 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 -= [
@@ -248,19 +262,6 @@ 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 8fa0524..6ab4b36 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -21,7 +21,6 @@
'optimize': 'max',
},
'dependencies': [
- 'base_debugging_flags',
'base_static',
'allocator/allocator.gyp:allocator_extension_thunks',
'../testing/gtest.gyp:gtest_prod',
@@ -1077,18 +1076,6 @@
}],
],
},
- {
- # 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"', {
@@ -1144,7 +1131,6 @@
'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/debug/BUILD.gn b/base/debug/BUILD.gn
index ec9298a..be8084e 100644
--- a/base/debug/BUILD.gn
+++ b/base/debug/BUILD.gn
@@ -2,9 +2,6 @@
# 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",
@@ -61,7 +58,6 @@ source_set("debug") {
configs += [ "//base:base_implementation" ]
deps = [
- ":debugging_flags",
"//base:base_static",
"//base/memory",
"//base/process",
@@ -79,9 +75,3 @@ 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 b499c14..924c769 100644
--- a/base/debug/profiler.cc
+++ b/base/debug/profiler.cc
@@ -6,7 +6,6 @@
#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"
@@ -16,7 +15,7 @@
#endif // defined(OS_WIN)
// TODO(peria): Enable profiling on Windows.
-#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
+#if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
#include "third_party/tcmalloc/chromium/src/gperftools/profiler.h"
#endif
@@ -24,7 +23,7 @@ namespace base {
namespace debug {
// TODO(peria): Enable profiling on Windows.
-#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
+#if defined(ENABLE_PROFILING) && !defined(NO_TCMALLOC) && !defined(OS_WIN)
static int profile_count = 0;
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 49b3737..af3dd13 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -39,6 +39,10 @@ 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
@@ -205,6 +209,11 @@ 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 cc7463e..5adc470 100644
--- a/build/config/compiler/compiler.gni
+++ b/build/config/compiler/compiler.gni
@@ -13,10 +13,6 @@ 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 4d67820..349a53d 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -46,7 +46,6 @@ 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 ac6ec7d..b6f7942 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -7,7 +7,6 @@
#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"
@@ -1280,7 +1279,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 BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC)
+#if defined (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 f25c0fd..93f8704 100644
--- a/chrome/browser/ui/toolbar/app_menu_model.cc
+++ b/chrome/browser/ui/toolbar/app_menu_model.cc
@@ -8,7 +8,6 @@
#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"
@@ -323,7 +322,7 @@ void ToolsMenuModel::Build(Browser* browser) {
AddSeparator(ui::NORMAL_SEPARATOR);
AddItemWithStringId(IDC_DEV_TOOLS, IDS_DEV_TOOLS);
-#if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC)
+#if defined(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 2fd31c4..816ddb3 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -2807,7 +2807,6 @@
'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 63fc41e..231d8fc 100644
--- a/gin/modules/console.cc
+++ b/gin/modules/console.cc
@@ -4,7 +4,7 @@
#include "gin/modules/console.h"
-#include <stdio.h>
+#include <iostream>
#include "base/strings/string_util.h"
#include "gin/arguments.h"
@@ -25,7 +25,7 @@ void Log(Arguments* args) {
args->ThrowError();
return;
}
- printf("%s\n", base::JoinString(messages, " ").c_str());
+ std::cout << base::JoinString(messages, " ") << std::endl;
}
WrapperInfo g_wrapper_info = { kEmbedderNativeGin };