GN: fix bootstrap

//base/trace_event/memory_dump_manager.cc now needs the generated
//base/debug/debugging_flags.h file.

Generating that file when building manually with ninja fixes
bootstrapping.

R=brettw@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/1929403002
Cr-Original-Commit-Position: refs/heads/master@{#391055}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c86fe9393074586d43d9b83ee2866cfa201ad7d4
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 523a3c0..2262ab4 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -114,23 +114,32 @@
   return 0
 
 
-def build_gn_with_ninja_manually(tempdir, options):
-  root_gen_dir = os.path.join(tempdir, 'gen')
-  mkdir_p(root_gen_dir)
-
-  mkdir_p(os.path.join(root_gen_dir, 'base', 'allocator'))
+def write_buildflag_header_manually(root_gen_dir, header, flags):
+  mkdir_p(os.path.join(root_gen_dir, os.path.dirname(header)))
   with tempfile.NamedTemporaryFile() as f:
-    f.write('--flags USE_EXPERIMENTAL_ALLOCATOR_SHIM=%s'
-            % ('true' if is_linux else 'false'))
+    f.write('--flags')
+    for name,value in flags.items():
+      f.write(' ' + name + '=' + value)
     f.flush()
 
     check_call([
         os.path.join(SRC_ROOT, 'build', 'write_buildflag_header.py'),
-        '--output', 'base/allocator/features.h',
+        '--output', header,
         '--gen-dir', root_gen_dir,
         '--definitions', f.name,
     ])
 
+
+def build_gn_with_ninja_manually(tempdir, options):
+  root_gen_dir = os.path.join(tempdir, 'gen')
+  mkdir_p(root_gen_dir)
+
+  write_buildflag_header_manually(root_gen_dir, 'base/allocator/features.h',
+      {'USE_EXPERIMENTAL_ALLOCATOR_SHIM': 'true' if is_linux else 'false'})
+
+  write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h',
+      {'ENABLE_PROFILING': 'false'})
+
   if is_mac:
     # //base/build_time.cc needs base/generated_build_date.h,
     # and this file is only included for Mac builds.