Update from https://crrev.com/305340

Added a few #includes of base/compiler_specific.h for upstream cleanup.

Changed callers for cc::BeginFrameArgs and cc::RendererSettings API
changes.

Review URL: https://codereview.chromium.org/754433003
diff --git a/tools/clang/scripts/generate_win_compdb.py b/tools/clang/scripts/generate_win_compdb.py
new file mode 100755
index 0000000..32f5f75
--- /dev/null
+++ b/tools/clang/scripts/generate_win_compdb.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# 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.
+
+"""
+Clang tools on Windows are still a bit busted. The tooling can't handle
+backslashes in paths, doesn't understand how to read .rsp files, etc. In
+addition, ninja generates compile commands prefixed with the ninja msvc helper,
+which also confuses clang. This script generates a compile DB that should mostly
+work until clang tooling can be improved upstream.
+"""
+
+import os
+import re
+import json
+import shlex
+import subprocess
+import sys
+
+
+_NINJA_MSVC_WRAPPER = re.compile('ninja -t msvc -e .+? -- ')
+_RSP_RE = re.compile(r' (@(.+?\.rsp)) ')
+
+
+def _ProcessEntry(e):
+  # Strip off the ninja -t msvc wrapper.
+  e['command'] = _NINJA_MSVC_WRAPPER.sub('', e['command'])
+
+  # Prepend --driver-mode=cl to the command's arguments.
+  # Escape backslashes so shlex doesn't try to interpret them.
+  escaped_command = e['command'].replace('\\', '\\\\')
+  split_command = shlex.split(escaped_command)
+  e['command'] = ' '.join(
+      split_command[:1] + ['--driver-mode=cl'] + split_command[1:])
+
+  # Expand the contents of the response file, if any.
+  # http://llvm.org/bugs/show_bug.cgi?id=21634
+  try:
+    match = _RSP_RE.search(e['command'])
+    rsp_path = os.path.join(e['directory'], match.group(2))
+    rsp_contents = file(rsp_path).read()
+    e['command'] = ''.join([
+        e['command'][:match.start(1)],
+        rsp_contents,
+        e['command'][match.end(1):]])
+  except IOError:
+    pass
+
+  # TODO(dcheng): This should be implemented in Clang tooling.
+  # http://llvm.org/bugs/show_bug.cgi?id=19687
+  # Finally, use slashes instead of backslashes to avoid bad escaping by the
+  # tooling. This should really only matter for command, but we do it for all
+  # keys for consistency.
+  e['directory'] = e['directory'].replace('\\', '/')
+  e['command'] = e['command'].replace('\\', '/')
+  e['file'] = e['file'].replace('\\', '/')
+
+  return e
+
+
+def main(argv):
+  # First, generate the compile database.
+  print 'Generating compile DB with ninja...'
+  compile_db_as_json = subprocess.check_output(shlex.split(
+      'ninja -C out/Debug -t compdb cc cxx objc objcxx'))
+
+  compile_db = json.loads(compile_db_as_json)
+  print 'Read in %d entries from the compile db' % len(compile_db)
+  compile_db = [_ProcessEntry(e) for e in compile_db]
+  original_length = len(compile_db)
+
+  # Filter out NaCl stuff. The clang tooling chokes on them.
+  compile_db = [e for e in compile_db if '_nacl.cc.pdb' not in e['command']
+      and '_nacl_win64.cc.pdb' not in e['command']]
+  print 'Filtered out %d entries...' % (original_length - len(compile_db))
+  f = file('out/Debug/compile_commands.json', 'w')
+  f.write(json.dumps(compile_db, indent=2))
+  print 'Done!'
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv[1:]))
diff --git a/tools/clang/scripts/run_tool.py b/tools/clang/scripts/run_tool.py
index 61417e4..3725ca3 100755
--- a/tools/clang/scripts/run_tool.py
+++ b/tools/clang/scripts/run_tool.py
@@ -9,6 +9,9 @@
 If you want to run the tool across all Chromium code:
 run_tool.py <tool> <path/to/compiledb>
 
+If you want to include all files mentioned in the compilation database:
+run_tool.py <tool> <path/to/compiledb> --all
+
 If you only want to run the tool across just chrome/browser and content/browser:
 run_tool.py <tool> <path/to/compiledb> chrome/browser content/browser
 
@@ -37,6 +40,7 @@
 
 import collections
 import functools
+import json
 import multiprocessing
 import os.path
 import pipes
@@ -67,6 +71,20 @@
   return [os.path.realpath(p) for p in output.splitlines()]
 
 
+def _GetFilesFromCompileDB(build_directory):
+  """ Gets the list of files mentioned in the compilation database.
+
+  Args:
+    build_directory: Directory that contains the compile database.
+  """
+  compiledb_path = os.path.join(build_directory, 'compile_commands.json')
+  with open(compiledb_path, 'rb') as compiledb_file:
+    json_commands = json.load(compiledb_file)
+
+  return [os.path.join(entry['directory'], entry['file'])
+          for entry in json_commands]
+
+
 def _ExtractEditsFromStdout(build_directory, stdout):
   """Extracts generated list of edits from the tool's stdout.
 
@@ -295,7 +313,10 @@
   if not os.path.isfile(clang_format_diff_path) or sys.platform == 'win32':
     clang_format_diff_path = None
 
-  filenames = frozenset(_GetFilesFromGit(argv[2:]))
+  if len(argv) == 3 and argv[2] == '--all':
+    filenames = frozenset(_GetFilesFromCompileDB(argv[1]))
+  else:
+    filenames = frozenset(_GetFilesFromGit(argv[2:]))
   # Filter out files that aren't C/C++/Obj-C/Obj-C++.
   extensions = frozenset(('.c', '.cc', '.m', '.mm'))
   dispatcher = _CompilerDispatcher(argv[0], argv[1],
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index e576cac..ad534ad 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -704,7 +704,8 @@
       --platform=android-14 \
       --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
       --system=linux-x86_64 \
-      --stl=stlport
+      --stl=stlport \
+      --toolchain=arm-linux-androideabi-4.9
 
   # Android NDK r9d copies a broken unwind.h into the toolchain, see
   # http://crbug.com/357890