Roll chromium_revision f86fb54ec3..dd442d4812 (420104:421425)

Add a copy of Chromium's build/common.gypi @ fa8868418ffe9da48614de5bff07b72f97760f51
as webrtc/build/chromium_common.gypi to preserve GYP behavior.
Update webrtc/build/gyp_webrtc.py to include it during GYP invocation.

Change log: https://chromium.googlesource.com/chromium/src/+log/f86fb54ec3..dd442d4812
Full diff: https://chromium.googlesource.com/chromium/src/+/f86fb54ec3..dd442d4812

Changed dependencies:
* src/buildtools: https://chromium.googlesource.com/chromium/buildtools.git/+log/57649e5e20..86f7e41d94
* src/third_party/boringssl/src: https://boringssl.googlesource.com/boringssl.git/+log/ed6c5d3910..0d81373f91
* src/third_party/libsrtp: https://chromium.googlesource.com/chromium/deps/libsrtp.git/+log/48bdd208dc..b17c065a8a
* src/third_party/libvpx/source/libvpx: https://chromium.googlesource.com/webm/libvpx.git/+log/4282d29355..99ef84c65a
DEPS diff: https://chromium.googlesource.com/chromium/src/+/f86fb54ec3..dd442d4812/DEPS

Clang version changed 280836:282487
Details: https://chromium.googlesource.com/chromium/src/+/f86fb54ec3..dd442d4812/tools/clang/scripts/update.py

TBR=marpan@webrtc.org,
BUG=None
NOTRY=True

Review URL: https://codereview.webrtc.org/2380533002 .

Cr-Commit-Position: refs/heads/master@{#14409}
diff --git a/webrtc/build/gyp_webrtc.py b/webrtc/build/gyp_webrtc.py
index 0572948..aab8444 100755
--- a/webrtc/build/gyp_webrtc.py
+++ b/webrtc/build/gyp_webrtc.py
@@ -12,9 +12,11 @@
 # main function from the src/build/gyp_chromium.py file while other parts are
 # reused to minimize code duplication.
 
+import argparse
 import gc
 import glob
 import os
+import shlex
 import sys
 
 script_dir = os.path.dirname(os.path.realpath(__file__))
@@ -40,6 +42,56 @@
   return glob.glob(os.path.join(checkout_root, '*', 'supplement.gypi'))
 
 
+def GetOutputDirectory():
+  """Returns the output directory that GYP will use."""
+
+  # Handle command line generator flags.
+  parser = argparse.ArgumentParser()
+  parser.add_argument('-G', dest='genflags', default=[], action='append')
+  genflags = parser.parse_known_args()[0].genflags
+
+  # Handle generator flags from the environment.
+  genflags += shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
+
+  needle = 'output_dir='
+  for item in genflags:
+    if item.startswith(needle):
+      return item[len(needle):]
+
+  return 'out'
+
+
+def additional_include_files(supplemental_files, args=None):
+  """
+  Returns a list of additional (.gypi) files to include, without duplicating
+  ones that are already specified on the command line. The list of supplemental
+  include files is passed in as an argument.
+  """
+  # Determine the include files specified on the command line.
+  # This doesn't cover all the different option formats you can use,
+  # but it's mainly intended to avoid duplicating flags on the automatic
+  # makefile regeneration which only uses this format.
+  specified_includes = set()
+  args = args or []
+  for arg in args:
+    if arg.startswith('-I') and len(arg) > 2:
+      specified_includes.add(os.path.realpath(arg[2:]))
+  result = []
+  def AddInclude(path):
+    if os.path.realpath(path) not in specified_includes:
+      result.append(path)
+  if os.environ.get('GYP_INCLUDE_FIRST') != None:
+    AddInclude(os.path.join(checkout_root, os.environ.get('GYP_INCLUDE_FIRST')))
+  # Always include Chromium's common.gypi, which we now have a copy of.
+  AddInclude(os.path.join(script_dir, 'chromium_common.gypi'))
+  # Optionally add supplemental .gypi files if present.
+  for supplement in supplemental_files:
+    AddInclude(supplement)
+  if os.environ.get('GYP_INCLUDE_LAST') != None:
+    AddInclude(os.path.join(checkout_root, os.environ.get('GYP_INCLUDE_LAST')))
+  return result
+
+
 def main():
   # Disabling garbage collection saves about 5% processing time. Since this is a
   # short-lived process it's not a problem.
@@ -102,9 +154,8 @@
           'GYP_CROSSCOMPILE' not in os.environ)):
     os.environ['GYP_CROSSCOMPILE'] = '1'
 
-  args.extend(['-I' + i for i in
-               gyp_chromium.additional_include_files(supplemental_includes,
-                                                     args)])
+  args.extend(['-I' + i for i in additional_include_files(supplemental_includes,
+                                                          args)])
 
   # Set the gyp depth variable to the root of the checkout.
   args.append('--depth=' + os.path.relpath(checkout_root))
@@ -119,7 +170,7 @@
     # pylint: disable=unpacking-non-sequence
     x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
     vs_toolchain.CopyVsRuntimeDlls(
-        os.path.join(checkout_root, gyp_chromium.GetOutputDirectory()),
+        os.path.join(checkout_root, GetOutputDirectory()),
         (x86_runtime, x64_runtime))
 
   sys.exit(gyp_rc)