Update from https://crrev.com/318214

TBR=qsr@chromium.org

Review URL: https://codereview.chromium.org/960873002
diff --git a/build/all.gyp b/build/all.gyp
index 8ad63b3..17958a0 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -516,6 +516,156 @@
     ['OS!="ios" and OS!="android"', {
       'targets': [
         {
+          # TODO(GYP) - make gyp_all and gn_all work on iOS and Android also.
+          'target_name': 'gyp_all',
+          'type': 'none',
+          'dependencies': [
+            ':gn_all',
+            '../chrome/chrome.gyp:chromedriver_unittests',
+            '../components/components_tests.gyp:components_browsertests',
+            # '../components/nacl.gyp:nacl_loader_unittests',  # TODO(GYP)
+            # '../remoting/remoting.gyp:remoting_unittests',  # TODO(GYP)
+            '../ui/compositor/compositor.gyp:compositor_unittests',
+          ],
+          'conditions': [
+            ['OS!="android"', {
+              'dependencies': [
+                # '../device/device_tests.gyp:device_unittests',  # TODO(GYP)
+                # '../google_apis/google_apis.gyp:google_apis_unittests',  # TODO(GYP)
+              ],
+            }],
+          ],
+        },
+        {
+          'target_name': 'gn_all',
+          'type': 'none',
+
+          'dependencies': [
+            '../base/base.gyp:base_unittests',
+            '../cc/cc_tests.gyp:cc_unittests',
+            '../chrome/chrome.gyp:chrome',
+            '../chrome/chrome.gyp:browser_tests',
+            '../chrome/chrome.gyp:interactive_ui_tests',
+            '../chrome/chrome.gyp:sync_integration_tests',
+            '../chrome/chrome.gyp:unit_tests',
+            '../components/components_tests.gyp:components_unittests',
+            '../content/content_shell_and_tests.gyp:content_shell',
+            '../content/content_shell_and_tests.gyp:content_browsertests',
+            '../content/content_shell_and_tests.gyp:content_perftests',
+            '../content/content_shell_and_tests.gyp:content_unittests',
+            '../crypto/crypto.gyp:crypto_unittests',
+            '../extensions/extensions_tests.gyp:extensions_browsertests',
+            '../extensions/extensions_tests.gyp:extensions_unittests',
+            '../google_apis/gcm/gcm.gyp:gcm_unit_tests',
+            '../gpu/gpu.gyp:gpu_unittests',
+            '../ipc/ipc.gyp:ipc_tests',
+            '../ipc/mojo/ipc_mojo.gyp:ipc_mojo_unittests',
+            '../jingle/jingle.gyp:jingle_unittests',
+            '../media/media.gyp:media_unittests',
+            '../media/cast/cast.gyp:cast_unittests',
+            '../mojo/mojo.gyp:mojo',
+            '../mojo/mojo_base.gyp:mojo_common_unittests',
+            '../net/net.gyp:net_unittests',
+            '../ppapi/ppapi_internal.gyp:ppapi_tests',
+            '../printing/printing.gyp:printing_unittests',
+            '../sql/sql.gyp:sql_unittests',
+            '../skia/skia_tests.gyp:skia_unittests',
+            '../sync/sync.gyp:sync_unit_tests',
+
+            # TODO(GYP): the Blink test targets should be public, but
+            # currently aren't. all_blink puls them in, though
+            # "//third_party/WebKit/Source/platform:heap_unittests",
+            # "//third_party/WebKit/Source/platform:platform_unittests",
+            # "//third_party/WebKit/Source/wtf:wtf_unittests",
+            '../third_party/WebKit/public/all.gyp:all_blink',
+
+            '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+
+            # TODO(GYP): Needed only w/ cld_version==1. What configs set that?
+            '../third_party/cld/cld.gyp:cld',
+
+            # TODO(GYP): This is needed only w/ use_system_fontconfig==0. What configs set that?
+            #'../third_party/fontconfig/fontconfig.gyp:fontconfig',
+
+            # TODO(GYP): This will be pulled in automatically when enable_webrtc==true.
+            # For now pull it in manually so that it doesn't regress.
+            '../third_party/libsrtp/libsrtp.gyp:libsrtp',
+
+            '../third_party/mojo/mojo_edk_tests.gyp:mojo_system_unittests',
+            '../third_party/mojo/mojo_edk_tests.gyp:mojo_public_bindings_unittests',
+            '../third_party/mojo/mojo_edk_tests.gyp:mojo_public_environment_unittests',
+            '../third_party/mojo/mojo_edk_tests.gyp:mojo_public_system_perftests',
+            '../third_party/mojo/mojo_edk_tests.gyp:mojo_public_system_unittests',
+            '../third_party/mojo/mojo_edk_tests.gyp:mojo_public_utility_unittests',
+            '../third_party/pdfium/samples/samples.gyp:pdfium_test',
+
+            # TODO(GYP): Verify that this is no longer needed.
+            '../third_party/smhasher/smhasher.gyp:pmurhash',
+
+            # TODO(GYP): This will be pulled in automatically when enable_webrtc==true.
+            # For now pull it in manually so that it doesn't regress.
+            '../third_party/usrsctp/usrsctp.gyp:usrsctplib',
+
+            '../tools/gn/gn.gyp:gn',
+            '../tools/gn/gn.gyp:gn_unittests',
+            '../ui/accessibility/accessibility.gyp:accessibility_unittests',
+            '../ui/app_list/app_list.gyp:app_list_unittests',
+            '../ui/base/ui_base_tests.gyp:ui_base_unittests',
+            '../ui/display/display.gyp:display_unittests',
+            '../ui/events/events.gyp:events_unittests',
+            '../ui/gfx/gfx_tests.gyp:gfx_unittests',
+            '../ui/touch_selection/ui_touch_selection.gyp:ui_touch_selection_unittests',
+            '../url/url.gyp:url_unittests',
+          ],
+          'conditions': [
+            ['OS!="win"', {
+              'dependencies': [
+                '../breakpad/breakpad.gyp:symupload',
+              ],
+            }],
+            ['use_x11==1', {
+              'dependencies': [
+                '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
+              ],
+            }],
+            ['toolkit_views==1', {
+              'dependencies': [
+                '../ui/views/views.gyp:views_unittests',
+              ],
+            }],
+            ['use_aura==1', {
+              'dependencies': [
+                '../ui/wm/wm.gyp:wm_unittests',
+              ],
+            }],
+            ['use_ozone==1', {
+              'dependencies': [
+                '../ui/ozone/ozone.gyp:ozone',
+              ],
+            }],
+            ['OS=="win" or OS=="mac" or OS=="android"', {
+              'dependencies': [
+                '../rlz/rlz.gyp:rlz_lib',
+              ],
+            }],
+            ['OS=="android"', {
+              'dependencies': [
+                '../chrome/chrome.gyp:chrome_shell_apk',
+                '../content/content_shell_and_tests.gyp:content_shell_apk',
+              ],
+              'dependencies!': [
+                '../url/url.gyp:url_unittests',
+              ],
+            }],
+            ['OS=="linux"', {
+              'dependencies': [
+                '../dbus/dbus.gyp:dbus_unittests',
+                '../sandbox/sandbox.gyp:sandbox_linux_unittests',
+              ],
+            }],
+          ],
+        },
+        {
           'target_name': 'chromium_builder_nacl_win_integration',
           'type': 'none',
           'dependencies': [
diff --git a/build/android/gyp/dex.py b/build/android/gyp/dex.py
index d89c7c2..4e62332 100755
--- a/build/android/gyp/dex.py
+++ b/build/android/gyp/dex.py
@@ -50,9 +50,8 @@
   parser.add_option('--no-locals',
                     help='Exclude locals list from the dex file.')
   parser.add_option('--inputs', help='A list of additional input paths.')
-  parser.add_option('--excluded-paths-file',
-                    help='Path to a file containing a list of paths to exclude '
-                    'from the dex file.')
+  parser.add_option('--excluded-paths',
+                    help='A list of paths to exclude from the dex file.')
 
   options, paths = parser.parse_args(args)
 
@@ -63,13 +62,13 @@
       and options.configuration_name == 'Release'):
     paths = [options.proguard_enabled_input_path]
 
-  if options.excluded_paths_file:
-    exclude_paths = build_utils.ReadJson(options.excluded_paths_file)
-    paths = [p for p in paths if not p in exclude_paths]
-
   if options.inputs:
     paths += build_utils.ParseGypList(options.inputs)
 
+  if options.excluded_paths:
+    exclude_paths = build_utils.ParseGypList(options.excluded_paths)
+    paths = [p for p in paths if not p in exclude_paths]
+
   DoDex(options, paths)
 
   if options.depfile:
diff --git a/build/android/gyp/java_cpp_enum.py b/build/android/gyp/java_cpp_enum.py
index 46417ec..1603959 100755
--- a/build/android/gyp/java_cpp_enum.py
+++ b/build/android/gyp/java_cpp_enum.py
@@ -228,16 +228,21 @@
   return os.sep.join(script_components[build_index:])
 
 
-def DoGenerate(options, source_paths):
+def DoGenerate(output_dir, source_paths, print_output_only=False):
   output_paths = []
   for source_path in source_paths:
     enum_definitions = DoParseHeaderFile(source_path)
+    if not enum_definitions:
+      raise Exception('No enums found in %s\n'
+                      'Did you forget prefixing enums with '
+                      '"// GENERATED_JAVA_ENUM_PACKAGE: foo"?' %
+                      source_path)
     for enum_definition in enum_definitions:
       package_path = enum_definition.enum_package.replace('.', os.path.sep)
       file_name = enum_definition.class_name + '.java'
-      output_path = os.path.join(options.output_dir, package_path, file_name)
+      output_path = os.path.join(output_dir, package_path, file_name)
       output_paths.append(output_path)
-      if not options.print_output_only:
+      if not print_output_only:
         build_utils.MakeDirectory(os.path.dirname(output_path))
         DoWriteOutput(source_path, output_path, enum_definition)
   return output_paths
@@ -300,24 +305,32 @@
                     'add %s and remove %s.' % (need_to_add, need_to_remove))
 
 def DoMain(argv):
-  parser = optparse.OptionParser()
+  usage = 'usage: %prog [options] output_dir input_file(s)...'
+  parser = optparse.OptionParser(usage=usage)
 
   parser.add_option('--assert_file', action="append", default=[],
                     dest="assert_files_list", help='Assert that the given '
                     'file is an output. There can be multiple occurrences of '
                     'this flag.')
-  parser.add_option('--output_dir', help='Base path for generated files.')
   parser.add_option('--print_output_only', help='Only print output paths.',
                     action='store_true')
+  parser.add_option('--verbose', help='Print more information.',
+                    action='store_true')
 
   options, args = parser.parse_args(argv)
-
-  output_paths = DoGenerate(options, args)
+  if len(args) < 2:
+    parser.error('Need to specify output directory and at least one input file')
+  output_paths = DoGenerate(args[0], args[1:],
+                            print_output_only=options.print_output_only)
 
   if options.assert_files_list:
     AssertFilesList(output_paths, options.assert_files_list)
 
-  return " ".join(output_paths)
+  if options.verbose:
+    print 'Output paths:'
+    print '\n'.join(output_paths)
+
+  return ' '.join(output_paths)
 
 if __name__ == '__main__':
   DoMain(sys.argv[1:])
diff --git a/build/android/gyp/java_cpp_enum_tests.py b/build/android/gyp/java_cpp_enum_tests.py
index 75e6671..44f9766 100755
--- a/build/android/gyp/java_cpp_enum_tests.py
+++ b/build/android/gyp/java_cpp_enum_tests.py
@@ -14,6 +14,7 @@
 import sys
 import unittest
 
+import java_cpp_enum
 from java_cpp_enum import EnumDefinition, GenerateOutput, GetScriptName
 from java_cpp_enum import HeaderParser
 
@@ -151,6 +152,14 @@
     with self.assertRaises(Exception):
       HeaderParser(test_data).ParseDefinitions()
 
+  def testParseReturnsEmptyListWithoutDirectives(self):
+    test_data = """
+      enum EnumName {
+        VALUE_ONE,
+      };
+    """.split('\n')
+    self.assertEqual([], HeaderParser(test_data).ParseDefinitions())
+
   def testParseEnumClass(self):
     test_data = """
       // GENERATED_JAVA_ENUM_PACKAGE: test.namespace
@@ -403,6 +412,15 @@
     definition.Finalize()
     self.assertEqual(['A', 'B', 'NAME_LAST'], definition.entries.keys())
 
+  def testGenerateThrowsOnEmptyInput(self):
+    with self.assertRaises(Exception):
+      original_do_parse = java_cpp_enum.DoParseHeaderFile
+      try:
+        java_cpp_enum.DoParseHeaderFile = lambda _: []
+        java_cpp_enum.DoGenerate('dir', ['file'])
+      finally:
+        java_cpp_enum.DoParseHeaderFile = original_do_parse
+
 def main(argv):
   parser = optparse.OptionParser()
   parser.add_option("--stamp", help="File to touch on success.")
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py
index c8aef92..953ea54 100755
--- a/build/android/gyp/lint.py
+++ b/build/android/gyp/lint.py
@@ -20,7 +20,7 @@
 
 
 def _RunLint(lint_path, config_path, processed_config_path, manifest_path,
-             result_path, product_dir, sources, jar_path):
+             result_path, product_dir, sources, jar_path, resource_dir=None):
 
   def _RelativizePath(path):
     """Returns relative path to top-level src dir.
@@ -80,6 +80,8 @@
         '--classpath', _RelativizePath(jar_path),
         '--xml', _RelativizePath(result_path),
     ]
+    if resource_dir:
+      cmd.extend(['--resources', _RelativizePath(resource_dir)])
 
     # There may be multiple source files with the same basename (but in
     # different directories). It is difficult to determine what part of the path
@@ -164,6 +166,7 @@
   parser.add_option('--src-dirs', help='Directories containing java files.')
   parser.add_option('--java-files', help='Paths to java files.')
   parser.add_option('--jar-path', help='Jar file containing class files.')
+  parser.add_option('--resource-dir', help='Path to resource dir.')
   parser.add_option('--stamp', help='Path to touch on success.')
   parser.add_option('--enable', action='store_true',
                     help='Run lint instead of just touching stamp.')
@@ -191,7 +194,8 @@
     rc = _RunLint(options.lint_path, options.config_path,
                   options.processed_config_path,
                   options.manifest_path, options.result_path,
-                  options.product_dir, sources, options.jar_path)
+                  options.product_dir, sources, options.jar_path,
+                  options.resource_dir)
 
   if options.depfile:
     build_utils.WriteDepfile(
diff --git a/build/android/java_cpp_enum.gypi b/build/android/java_cpp_enum.gypi
index 3d6b326..b51351b 100644
--- a/build/android/java_cpp_enum.gypi
+++ b/build/android/java_cpp_enum.gypi
@@ -24,7 +24,7 @@
     # Location where all generated Java sources will be placed.
     'output_dir': '<(SHARED_INTERMEDIATE_DIR)/enums/<(_target_name)',
     'generator_path': '<(DEPTH)/build/android/gyp/java_cpp_enum.py',
-    'generator_args': '--output_dir=<(output_dir) <(source_file)',
+    'generator_args': '<(output_dir) <(source_file)',
   },
   'direct_dependent_settings': {
     'variables': {
diff --git a/build/android/lint/suppressions.xml b/build/android/lint/suppressions.xml
index d8422a7..5a169c1 100644
--- a/build/android/lint/suppressions.xml
+++ b/build/android/lint/suppressions.xml
@@ -41,6 +41,22 @@
   <issue id="HandlerLeak">
     <ignore path="remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java"/>
   </issue>
+  <issue id="IconDensities">
+    <!-- crbug.com/457918 is tracking missing assets -->
+    <ignore path="content/public/android/java/res/drawable-xxhdpi"/>
+    <ignore path="content/public/android/java/res/drawable-xxxhdpi"/>
+    <ignore path="chrome/android/java/res/drawable-xxhdpi"/>
+    <ignore path="chrome/android/java/res/drawable-xxxhdpi"/>
+    <ignore path="ui/android/java/res/drawable-xxhdpi"/>
+    <ignore path="ui/android/java/res/drawable-xxxhdpi"/>
+  </issue>
+  <!-- It is OK for content_shell_apk and chrome_shell_apk to have missing assets. -->
+  <issue id="IconLocation">
+    <ignore path="content/shell/android/java/res/"/>
+    <ignore path="chrome/android/shell/res/"/>
+  </issue>
+  <issue id="InconsistentLayout" severity="ignore"/>
+  <issue id="InflateParams" severity="ignore"/>
   <issue id="MissingApplicationIcon" severity="ignore"/>
   <issue id="MissingRegistered" severity="ignore"/>
   <issue id="MissingVersion">
@@ -52,12 +68,27 @@
   <issue id="OldTargetApi">
     <ignore path="AndroidManifest.xml"/>
   </issue>
+  <issue id="Overdraw" severity="ignore"/>
   <issue id="Recycle" severity="ignore"/>
   <issue id="Registered" severity="ignore"/>
+  <issue id="RtlCompat" severity="ignore"/>
+  <issue id="RtlEnabled" severity="ignore"/>
+  <issue id="RtlSymmetry" severity="ignore"/>
   <issue id="SdCardPath">
     <ignore path="content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java"/>
   </issue>
   <issue id="SetJavaScriptEnabled" severity="ignore"/>
+  <issue id="UnusedResources">
+    <!-- TODO(aurimas): remove suppression once crbug.com/458328 is fixed. -->
+    <ignore path="content/public/android/java/res/layout/validation_message_bubble.xml" />
+
+    <!-- These files are used by chrome_shell_apk and chrome_apk targets. -->
+    <ignore path="chrome/android/java/res/layout/accessibility_tab_switcher.xml" />
+    <ignore path="chrome/android/java/res/drawable/btn_back.xml" />
+    <ignore path="chrome/android/java/res/drawable/btn_forward.xml" />
+  </issue>
+  <issue id="SignatureOrSystemPermissions" severity="ignore"/>
+  <issue id="UnusedAttribute" severity="ignore"/>
   <issue id="ViewConstructor" severity="ignore"/>
   <issue id="WrongCall" severity="ignore"/>
 </lint>
diff --git a/build/android/lint_action.gypi b/build/android/lint_action.gypi
index 186d64c..e042130 100644
--- a/build/android/lint_action.gypi
+++ b/build/android/lint_action.gypi
@@ -15,13 +15,14 @@
       }, {
         'is_enabled': '',
       }]
-    ]
+    ],
+    'android_manifest_path%': '<(DEPTH)/build/android/AndroidManifest.xml',
+    'resource_dir%': '<(DEPTH)/build/android/ant/empty/res',
   },
   'inputs': [
     '<(DEPTH)/build/android/gyp/util/build_utils.py',
     '<(DEPTH)/build/android/gyp/lint.py',
     '<(DEPTH)/build/android/lint/suppressions.xml',
-    '<(DEPTH)/build/android/AndroidManifest.xml',
     '<(lint_jar_path)',
   ],
   'action': [
@@ -29,8 +30,9 @@
     '--lint-path=<(android_sdk_root)/tools/lint',
     '--config-path=<(DEPTH)/build/android/lint/suppressions.xml',
     '--processed-config-path=<(config_path)',
-    '--manifest-path=<(DEPTH)/build/android/AndroidManifest.xml',
+    '--manifest-path=<(android_manifest_path)',
     '--result-path=<(result_path)',
+    '--resource-dir=<(resource_dir)',
     '--product-dir=<(PRODUCT_DIR)',
     '--src-dirs=>(src_dirs)',
     '--jar-path=<(lint_jar_path)',
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index 824e642..4835073 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -25,6 +25,7 @@
 from pylib.device import device_errors
 from pylib.device import device_utils
 from pylib.utils import run_tests_helper
+from pylib.utils import timeout_retry
 
 sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT,
                              'third_party', 'android_testrunner'))
@@ -84,8 +85,9 @@
   device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')])
   # Launch adb_reboot
   logging.info('  Launching adb_reboot ...')
-  device.old_interface.GetAndroidToolStatusAndOutput(
-      '/data/local/tmp/adb_reboot')
+  device.RunShellCommand([
+      device.GetDevicePieWrapper(),
+      '/data/local/tmp/adb_reboot'])
 
 
 def _ConfigureLocalProperties(device, java_debug=True):
@@ -149,6 +151,20 @@
     pass
 
 
+def ChargeDeviceToLevel(device, level):
+  def device_charged():
+    battery_level = device.GetBatteryInfo().get('level')
+    if battery_level is None:
+      logging.warning('Unable to find current battery level.')
+      battery_level = 100
+    else:
+      logging.info('current battery level: %d', battery_level)
+      battery_level = int(battery_level)
+    return battery_level >= level
+
+  timeout_retry.WaitFor(device_charged, wait_period=60)
+
+
 def ProvisionDevice(device, options):
   if options.reboot_timeout:
     reboot_timeout = options.reboot_timeout
@@ -180,23 +196,11 @@
           device, device_settings.NETWORK_DISABLED_SETTINGS)
     if options.min_battery_level is not None:
       try:
-        battery_info = device.old_interface.GetBatteryInfo()
-      except Exception as e:
-        battery_info = {}
-        logging.error('Unable to obtain battery info for %s, %s',
-                      str(device), e)
+        device.SetUsbCharging(True)
+        ChargeDeviceToLevel(device, options.min_battery_level)
+      except device_errors.CommandFailedError as e:
+        logging.exception('Unable to charge device to specified level.')
 
-      while int(battery_info.get('level', 100)) < options.min_battery_level:
-        if not device.old_interface.IsDeviceCharging():
-          if device.old_interface.CanControlUsbCharging():
-            device.old_interface.EnableUsbCharging()
-          else:
-            logging.error('Device is not charging')
-            break
-        logging.info('Waiting for device to charge. Current level=%s',
-                     battery_info.get('level', 0))
-        time.sleep(60)
-        battery_info = device.old_interface.GetBatteryInfo()
     if not options.skip_wipe:
       device.Reboot(True, timeout=reboot_timeout, retries=0)
     device.RunShellCommand('date -s %s' % time.strftime('%Y%m%d.%H%M%S',
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index fb882e7..4d77fa8 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -44,6 +44,30 @@
 # the timeout_retry decorators.
 DEFAULT = object()
 
+_CONTROL_USB_CHARGING_COMMANDS = [
+  {
+    # Nexus 4
+    'witness_file': '/sys/module/pm8921_charger/parameters/disabled',
+    'enable_command': 'echo 0 > /sys/module/pm8921_charger/parameters/disabled',
+    'disable_command':
+        'echo 1 > /sys/module/pm8921_charger/parameters/disabled',
+  },
+  {
+    # Nexus 5
+    # Setting the HIZ bit of the bq24192 causes the charger to actually ignore
+    # energy coming from USB. Setting the power_supply offline just updates the
+    # Android system to reflect that.
+    'witness_file': '/sys/kernel/debug/bq24192/INPUT_SRC_CONT',
+    'enable_command': (
+        'echo 0x4A > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && '
+        'echo 1 > /sys/class/power_supply/usb/online'),
+    'disable_command': (
+        'echo 0xCA > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && '
+        'chmod 644 /sys/class/power_supply/usb/online && '
+        'echo 0 > /sys/class/power_supply/usb/online'),
+  },
+]
+
 
 @decorators.WithExplicitTimeoutAndRetries(
     _DEFAULT_TIMEOUT, _DEFAULT_RETRIES)
@@ -143,6 +167,10 @@
     assert hasattr(self, decorators.DEFAULT_TIMEOUT_ATTR)
     assert hasattr(self, decorators.DEFAULT_RETRIES_ATTR)
 
+  def __str__(self):
+    """Returns the device serial."""
+    return self.adb.GetDeviceSerial()
+
   @decorators.WithTimeoutAndRetriesFromInstance()
   def IsOnline(self, timeout=None, retries=None):
     """Checks whether the device is online.
@@ -1370,9 +1398,67 @@
     """
     return logcat_monitor.LogcatMonitor(self.adb, *args, **kwargs)
 
-  def __str__(self):
-    """Returns the device serial."""
-    return self.adb.GetDeviceSerial()
+  @decorators.WithTimeoutAndRetriesFromInstance()
+  def GetBatteryInfo(self, timeout=None, retries=None):
+    """Gets battery info for the device.
+
+    Args:
+      timeout: timeout in seconds
+      retries: number of retries
+    Returns:
+      A dict containing various battery information as reported by dumpsys
+      battery.
+    """
+    result = {}
+    # Skip the first line, which is just a header.
+    for line in self.RunShellCommand(
+        ['dumpsys', 'battery'], check_return=True)[1:]:
+      k, v = line.split(': ', 1)
+      result[k.strip()] = v.strip()
+    return result
+
+  @decorators.WithTimeoutAndRetriesFromInstance()
+  def GetUsbCharging(self, timeout=None, retries=None):
+    """Gets the USB charging state of the device.
+
+    Args:
+      timeout: timeout in seconds
+      retries: number of retries
+    Returns:
+      True if the device is charging via USB, false otherwise.
+    """
+    return (self.GetBatteryInfo().get('USB powered', '').lower()
+            in ('true', '1', 'yes'))
+
+  @decorators.WithTimeoutAndRetriesFromInstance()
+  def SetUsbCharging(self, enabled, timeout=None, retries=None):
+    """Enables or disables USB charging on the device.
+
+    Args:
+      enabled: A boolean indicating whether USB charging should be enabled or
+        disabled.
+      timeout: timeout in seconds
+      retries: number of retries
+    """
+    if 'usb_charging_config' not in self._cache:
+      for c in _CONTROL_USB_CHARGING_COMMANDS:
+        if self.FileExists(c['witness_file']):
+          self._cache['usb_charging_config'] = c
+          break
+      else:
+        raise device_errors.CommandFailedError(
+            'Unable to find charging commands.')
+
+    if enabled:
+      command = self._cache['usb_charging_config']['enable_command']
+    else:
+      command = self._cache['usb_charging_config']['disable_command']
+
+    def set_and_verify_usb_charging():
+      self.RunShellCommand(command)
+      return self.GetUsbCharging() == enabled
+
+    timeout_retry.WaitFor(set_and_verify_usb_charging, wait_period=1)
 
   @decorators.WithTimeoutAndRetriesFromInstance()
   def GetDevicePieWrapper(self, timeout=None, retries=None):
diff --git a/build/android/pylib/device/device_utils_test.py b/build/android/pylib/device/device_utils_test.py
index 3f4ef59..1b4d1cf 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -1382,6 +1382,83 @@
           self.device.GetMemoryUsageForPid(4321))
 
 
+class DeviceUtilsGetBatteryInfoTest(DeviceUtilsTest):
+  def testGetBatteryInfo_normal(self):
+    with self.assertCall(
+        self.call.device.RunShellCommand(
+            ['dumpsys', 'battery'], check_return=True),
+        [
+          'Current Battery Service state:',
+          '  AC powered: false',
+          '  USB powered: true',
+          '  level: 100',
+          '  temperature: 321',
+        ]):
+      self.assertEquals(
+          {
+            'AC powered': 'false',
+            'USB powered': 'true',
+            'level': '100',
+            'temperature': '321',
+          },
+          self.device.GetBatteryInfo())
+
+
+  def testGetBatteryInfo_nothing(self):
+    with self.assertCall(
+        self.call.device.RunShellCommand(
+            ['dumpsys', 'battery'], check_return=True), []):
+      self.assertEquals({}, self.device.GetBatteryInfo())
+
+
+class DeviceUtilsGetUsbChargingTest(DeviceUtilsTest):
+  def testGetUsbCharging_true(self):
+    with self.assertCall(
+        self.call.device.GetBatteryInfo(), {'USB powered': 'true'}):
+      self.assertTrue(self.device.GetUsbCharging())
+
+  def testGetUsbCharging_false(self):
+    with self.assertCall(
+        self.call.device.GetBatteryInfo(), {'USB powered': 'false'}):
+      self.assertFalse(self.device.GetUsbCharging())
+
+  def testGetUsbCharging_unknown(self):
+    with self.assertCall(
+        self.call.device.GetBatteryInfo(), {'AC powered': 'true'}):
+      self.assertFalse(self.device.GetUsbCharging())
+
+
+class DeviceUtilsSetUsbChargingTest(DeviceUtilsTest):
+
+  @mock.patch('time.sleep', mock.Mock())
+  def testSetUsbCharging_enabled(self):
+    with self.assertCalls(
+        (self.call.device.FileExists(mock.ANY), True),
+        (self.call.device.RunShellCommand(mock.ANY), []),
+        (self.call.device.GetUsbCharging(), False),
+        (self.call.device.RunShellCommand(mock.ANY), []),
+        (self.call.device.GetUsbCharging(), True)):
+      self.device.SetUsbCharging(True)
+
+  def testSetUsbCharging_alreadyEnabled(self):
+    with self.assertCalls(
+        (self.call.device.FileExists(mock.ANY), True),
+        (self.call.device.RunShellCommand(mock.ANY), []),
+        (self.call.device.GetUsbCharging(), True)):
+      self.device.SetUsbCharging(True)
+
+  @mock.patch('time.sleep', mock.Mock())
+  def testSetUsbCharging_disabled(self):
+    with self.assertCalls(
+        (self.call.device.FileExists(mock.ANY), True),
+        (self.call.device.RunShellCommand(mock.ANY), []),
+        (self.call.device.GetUsbCharging(), True),
+        (self.call.device.RunShellCommand(mock.ANY), []),
+        (self.call.device.GetUsbCharging(), False)):
+      self.device.SetUsbCharging(False)
+
+
+
 class DeviceUtilsStrTest(DeviceUtilsTest):
 
   def testStr_returnsSerial(self):
diff --git a/build/android/pylib/gtest/filter/content_browsertests_disabled b/build/android/pylib/gtest/filter/content_browsertests_disabled
index 0314f5f..1e3d523 100644
--- a/build/android/pylib/gtest/filter/content_browsertests_disabled
+++ b/build/android/pylib/gtest/filter/content_browsertests_disabled
@@ -16,6 +16,10 @@
 RenderFrameHostManagerTest.IgnoreRendererDebugURLsWhenCrashed
 RenderFrameHostManagerTest.ProcessExitWithSwappedOutViews
 
+# Crashes due to using --disable-gpu.
+# Needs to investigate more in http://crbug.com/461624.
+ScreenOrientationBrowserTest.*
+
 # Failures
 RenderViewHostTest.BaseURLParam
 OffTheRecordClipboardTest.ClearContentData
@@ -93,13 +97,6 @@
 BrowserGpuChannelHostFactoryTest.CrashAndRecover
 BrowserGpuChannelHostFactoryTest.EstablishAndTerminate
 
-# http://crbug.com/338011
-TouchInputBrowserTest.MultiPointTouchPress
-TouchInputBrowserTest.TouchHandlerConsume
-TouchInputBrowserTest.TouchHandlerNoConsume
-TouchInputBrowserTest.TouchNoHandler
-TouchActionBrowserTest.*
-
 # http://crbug.com/338408
 TracingControllerTest.EnableCaptureAndDisableMonitoring
 
diff --git a/build/android/pylib/utils/isolator.py b/build/android/pylib/utils/isolator.py
index 845d093..60d326e 100644
--- a/build/android/pylib/utils/isolator.py
+++ b/build/android/pylib/utils/isolator.py
@@ -41,7 +41,7 @@
     'use_instrumented_libraries': '0',
     'use_openssl': '0',
     'use_ozone': '0',
-    'v8_use_external_startup_data': '0',
+    'v8_use_external_startup_data': '1',
   }
 
 
diff --git a/build/common.gypi b/build/common.gypi
index 55dad68..4c2d696 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -512,6 +512,9 @@
       # Webrtc compilation is enabled by default. Set to 0 to disable.
       'enable_webrtc%': 1,
 
+      # Media router support is enabled by default. Set to 0 to disable.
+      'enable_media_router%': 1,
+
       # Enables use of the session service, which is enabled by default.
       # Support for disabling depends on the platform.
       'enable_session_service%': 1,
@@ -870,8 +873,10 @@
 
         ['OS=="android" or OS=="ios"', {
           'enable_captive_portal_detection%': 0,
+          'enable_media_router%': 0,
         }, {
           'enable_captive_portal_detection%': 1,
+          'enable_media_router%': 1,
         }],
 
         # Enable Skia UI text drawing incrementally on different platforms.
@@ -1111,6 +1116,7 @@
     'remoting%': '<(remoting)',
     'enable_one_click_signin%': '<(enable_one_click_signin)',
     'enable_pre_sync_backup%': '<(enable_pre_sync_backup)',
+    'enable_media_router%': '<(enable_media_router)',
     'enable_webrtc%': '<(enable_webrtc)',
     'chromium_win_pch%': '<(chromium_win_pch)',
     'configuration_policy%': '<(configuration_policy)',
@@ -1929,7 +1935,7 @@
             # Turn on multiple dll by default on Windows when in static_library.
             'chrome_multiple_dll%': 1,
           }],
-          ['asan==1', {
+          ['asan==1 or syzyasan==1', {
             'win_use_allocator_shim%': 0,
           }],
           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
@@ -2076,10 +2082,13 @@
             'host_os%': "mac",
           }],
 
+          # Use the version of clang shipped with Xcode when building official
+          # version of Chrome for iOS.
+          #
           # TODO(eugenebut): Remove enable_coverage check once
           # libclang_rt.profile_ios.a is bundled with Chromium's clang.
           # http://crbug.com/450379
-          ['enable_coverage or "<(GENERATOR)"=="xcode"', {
+          ['buildtype=="Official" or enable_coverage', {
             'clang_xcode%': 1,
           }],
         ],
@@ -2111,6 +2120,9 @@
       ['use_concatenated_impulse_responses==1', {
         'grit_defines': ['-D', 'use_concatenated_impulse_responses'],
       }],
+      ['enable_media_router==1', {
+        'grit_defines': ['-D', 'enable_media_router'],
+      }],
       ['enable_webrtc==1', {
         'grit_defines': ['-D', 'enable_webrtc'],
       }],
@@ -2361,6 +2373,10 @@
     # contains the destination location for each of the files.  When a crx
     # is added or removed from the list, the chrome/browser/resources/
     # default_apps/external_extensions.json file must also be updated.
+    #
+    # README: GN version of these is in the target //chrome:default_apps
+    # (there's no global variable like in GYP). Be sure to update that target
+    # if you change these lists!
     'default_apps_list': [
       'browser/resources/default_apps/external_extensions.json',
       'browser/resources/default_apps/gmail.crx',
@@ -3590,7 +3606,9 @@
               '-gdwarf-4',
             ],
             'conditions' : [
-              ['OS=="android"', {
+              ['OS=="android" and target_arch!="mipsel" and target_arch!="mips64el"', {
+                # TODO(jdduke) Re-enable on mips after resolving linking
+                # issues with libc++ (crbug.com/456380).
                 'ldflags': [
                   # Warn in case of text relocations.
                   '-Wl,--warn-shared-textrel',
@@ -3683,15 +3701,19 @@
                   '-fomit-frame-pointer',
                 ]
               }],
-              ['OS=="android"', {
-                'variables': {
-                  'release_optimize%': 's',
-                },
+              ['OS=="android" and target_arch!="mipsel" and target_arch!="mips64el"', {
+                # TODO(jdduke) Re-enable on mips after resolving linking
+                # issues with libc++ (crbug.com/456380).
                 'ldflags': [
                   # Warn in case of text relocations.
                   '-Wl,--warn-shared-textrel',
                 ],
               }],
+              ['OS=="android"', {
+                'variables': {
+                  'release_optimize%': 's',
+                },
+              }],
               ['profiling==1', {
                 'cflags': [
                   '-fno-omit-frame-pointer',
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index cd10730..7c06e59 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -121,6 +121,7 @@
 }
 
 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed.
+assert(current_cpu == cpu_arch)
 assert(current_os == os)
 
 # =============================================================================
@@ -547,6 +548,12 @@
 } else if (is_ios) {
   host_toolchain = "//build/toolchain/mac:host_clang"
   set_default_toolchain("//build/toolchain/mac:clang")
+} else if (is_nacl) {
+  # TODO(GYP): This will need to change when we get NaCl working
+  # on multiple platforms, but this whole block of code (how we define
+  # host_toolchain) needs to be reworked regardless to key off of build_os
+  # and build_cpu_arch rather than the is_* variables.
+  host_toolchain = "//build/toolchain/linux:clang_x64"
 }
 
 # ==============================================================================
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index c31d40e..8920e95 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -1093,5 +1093,9 @@
     output = invoker.dex_path
     dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files"
     args = [ "--inputs=@FileArg($dex_arg_key)" ]
+    if (defined(invoker.excluded_jars)) {
+      excluded_jars = rebase_path(invoker.excluded_jars, root_build_dir)
+      args += [ "--excluded-paths=${excluded_jars}" ]
+    }
   }
 }
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 8ca0642..aa1fd2a 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -67,6 +67,7 @@
       rebase_path(jni_output_dir, root_build_dir),
       "--includes",
       rebase_path(jni_generator_include, "//"),
+      "--native_exports_optional",
     ]
     if (defined(invoker.jni_generator_jarjar_file)) {
       args += [
@@ -74,12 +75,6 @@
         rebase_path(jni_generator_jarjar_file, root_build_dir),
       ]
     }
-    if (!is_clang) {
-      # Clang builds currently fail with --native_exports_optional due to
-      # http://llvm.org/bugs/show_bug.cgi?id=22602 - only enable for gcc.
-      # http://crbug.com/442327
-      args += [ "--native_exports_optional" ]
-    }
   }
 
   config("jni_includes_${target_name}") {
@@ -189,13 +184,8 @@
         rebase_path(jni_output_dir, root_build_dir),
         "--includes",
         rebase_path(jni_generator_include, root_build_dir),
+        "--native_exports_optional",
       ]
-      if (!is_clang) {
-        # Clang builds currently fail with --native_exports_optional due to
-        # http://llvm.org/bugs/show_bug.cgi?id=22602 - only enable for gcc.
-        # http://crbug.com/442327
-        args += [ "--native_exports_optional" ]
-      }
     }
   }
 
@@ -335,8 +325,8 @@
 #
 #   outputs: list of outputs, relative to the output_dir. These paths are
 #     verified at build time by the script. To get the list programatically run:
-#       python build/android/gyp/java_cpp_enum.py --output_dir=. \
-#         --print_output_only path/to/header/file.h
+#       python build/android/gyp/java_cpp_enum.py \
+#         --print_output_only . path/to/header/file.h
 #
 # Example
 #   java_cpp_enum("foo_generated_enum") {
@@ -366,16 +356,14 @@
     outputs =
         get_path_info(rebase_path(invoker.outputs, ".", gen_dir), "abspath")
 
-    args = [
-      "--output_dir",
-      rebase_path(gen_dir, root_build_dir),
-    ]
+    args = []
     foreach(output, rebase_path(outputs, root_build_dir)) {
       args += [
         "--assert_file",
         output,
       ]
     }
+    args += [ rebase_path(gen_dir, root_build_dir) ]
     args += rebase_path(invoker.sources, root_build_dir)
   }
 
@@ -1044,6 +1032,9 @@
   deps_dex(target_name) {
     deps = invoker.deps
     dex_path = invoker.dex_path
+    if (defined(invoker.excluded_jars)) {
+      excluded_jars = invoker.excluded_jars
+    }
   }
 }
 
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 8cb4088..5cf0331 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -554,10 +554,12 @@
       "__GNU_SOURCE=1",  # Necessary for clone().
     ]
 
-    ldflags += [
-      "-Wl,--warn-shared-textrel",
-      "-nostdlib",
-    ]
+    # TODO(jdduke) Re-enable on mips after resolving linking
+    # issues with libc++ (crbug.com/456380).
+    if (cpu_arch != "mipsel" && cpu_arch != "mips64el") {
+      ldflags += [ "-Wl,--warn-shared-textrel" ]
+    }
+    ldflags += [ "-nostdlib" ]
 
     # NOTE: The stlport header include paths below are specified in cflags
     # rather than include_dirs because they need to come after include_dirs.
@@ -949,10 +951,15 @@
     if (!using_sanitizer) {
       common_optimize_on_cflags += [ "-fomit-frame-pointer" ]
     }
-    common_optimize_on_ldflags += [
-      # Warn in case of text relocations.
-      "-Wl,--warn-shared-textrel",
-    ]
+
+    # TODO(jdduke) Re-enable on mips after resolving linking
+    # issues with libc++ (crbug.com/456380).
+    if (cpu_arch != "mipsel" && cpu_arch != "mips64el") {
+      common_optimize_on_ldflags += [
+        # Warn in case of text relocations.
+        "-Wl,--warn-shared-textrel",
+      ]
+    }
   }
 
   if (is_mac) {
diff --git a/build/config/features.gni b/build/config/features.gni
index ba69371..5ee92f7 100644
--- a/build/config/features.gni
+++ b/build/config/features.gni
@@ -22,9 +22,20 @@
   enable_plugins = !is_android && !is_ios
 
   # Enables Native Client support.
-  # TODO(GYP) enable this when nacl works in GN.
+  # TODO(GYP): Get NaCl linking on other platforms.
+  # Also, see if we can always get rid of enable_nacl_untrusted and
+  # enable_pnacl and always build them if enable_nacl is true.
+  # The "is_nacl" part of the condition is needed to ensure that
+  # the untrusted code is built properly; arguably it should be
+  # guarded by "is_nacl" directly rather than enable_nacl_untrusted, but
+  # this will go away when Mac and Win are working and we can just use
+  # the commented out logic.
+  # enable_nacl = !is_ios && !is_android
+  # Currently this *should* work:
+  # enable_nacl = (is_linux && build_cpu_arch == "x64") || is_nacl
   enable_nacl = false
-  #enable_nacl = (!is_ios && !is_android)
+  enable_nacl_untrusted = enable_nacl
+  enable_pnacl = enable_nacl_untrusted
 
   # If debug_devtools is set to true, JavaScript files for DevTools are stored
   # as is and loaded from disk. Otherwise, a concatenated file is stored in
@@ -33,9 +44,8 @@
   debug_devtools = false
 
   # Enables WebRTC.
-  #enable_webrtc = !is_ios  TODO(GYP) use this condition when WebRTC works in
-  #                         the GN build.
-  enable_webrtc = false
+  # TODO(GYP) make mac and android work.
+  enable_webrtc = !is_ios && !is_mac && !is_android
 
   # Enables proprietary codecs and demuxers; e.g. H264, MOV, AAC, and MP3.
   proprietary_codecs = false
@@ -156,6 +166,8 @@
 # Use brlapi from brltty for braille display support.
 use_brlapi = is_chromeos
 
+enable_media_router = !is_ios && !is_android
+
 # Option controlling the use of GConf (the classic GNOME configuration
 # system).
 # TODO(GYP) also require !embedded to enable.
diff --git a/build/download_sdk_extras.py b/build/download_sdk_extras.py
index d22d885..d7c5d6c 100755
--- a/build/download_sdk_extras.py
+++ b/build/download_sdk_extras.py
@@ -59,9 +59,9 @@
       try:
         subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7',
                                'cp', package_zip, local_zip])
-      except AccessDeniedException:
-        print ('WARNING: Bot does not have permission to download SDK packages.'
-               ' If this bot compiles for Android, it may have errors.')
+      except subprocess.CalledProcessError:
+        print ('WARNING: Failed to download SDK packages. If this bot compiles '
+               'for Android, it may have errors.')
         return 0
     # Always clean dir and extract zip to ensure correct contents.
     clean_and_extract(package['dir_name'], package['package'], package['zip'])
diff --git a/build/jar_file_jni_generator.gypi b/build/jar_file_jni_generator.gypi
index 9472c10..6f5d2f1 100644
--- a/build/jar_file_jni_generator.gypi
+++ b/build/jar_file_jni_generator.gypi
@@ -26,7 +26,7 @@
     'jni_generator_includes%': (
         'base/android/jni_generator/jni_generator_helper.h'
     ),
-    'native_exports%': '',
+    'native_exports%': '--native_exports_optional',
   },
   'actions': [
     {
@@ -73,13 +73,5 @@
         '<(DEPTH)/build/android/android_exports.gyp:android_exports',
       ],
     }],
-    ['clang==0', {
-      # Clang builds currently fail with --native_exports_optional due to
-      # http://llvm.org/bugs/show_bug.cgi?id=22602 - only enable for gcc.
-      # http://crbug.com/442327
-      'variables': {
-        'native_exports%': '--native_exports_optional',
-      },
-    }],
   ],
 }
diff --git a/build/java.gypi b/build/java.gypi
index af0bf0e..061dff2 100644
--- a/build/java.gypi
+++ b/build/java.gypi
@@ -113,9 +113,9 @@
     }],
     ['has_java_resources == 1', {
       'variables': {
-        'res_dir': '<(java_in_dir)/res',
-        'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'],
-        'resource_input_paths': ['<!@(find <(res_dir) -type f)'],
+        'resource_dir': '<(java_in_dir)/res',
+        'res_input_dirs': ['<(resource_dir)', '<@(res_extra_dirs)'],
+        'resource_input_paths': ['<!@(find <(resource_dir) -type f)'],
 
         'R_dir': '<(intermediate_dir)/java_R',
         'R_text_file': '<(R_dir)/R.txt',
diff --git a/build/java_apk.gypi b/build/java_apk.gypi
index 8d55307..c5e7ae3 100644
--- a/build/java_apk.gypi
+++ b/build/java_apk.gypi
@@ -811,7 +811,7 @@
         ['is_test_apk == 1 and tested_apk_dex_path != "/"', {
           'variables': {
             'dex_additional_options': [
-              '--excluded-paths-file', '>(tested_apk_dex_path).inputs'
+              '--excluded-paths', '@FileArg(>(tested_apk_dex_path).inputs)'
             ],
           },
           'inputs': [
diff --git a/build/jni_generator.gypi b/build/jni_generator.gypi
index 853b5f6..c2c71e7 100644
--- a/build/jni_generator.gypi
+++ b/build/jni_generator.gypi
@@ -36,7 +36,7 @@
     'jni_generator_includes%': (
         'base/android/jni_generator/jni_generator_helper.h'
     ),
-    'native_exports%': '',
+    'native_exports%': '--native_exports_optional',
   },
   'rules': [
     {
@@ -92,14 +92,6 @@
         '<(DEPTH)/build/android/android_exports.gyp:android_exports',
       ],
     }],
-    ['clang==0', {
-      # Clang builds currently fail with --native_exports_optional due to
-      # http://llvm.org/bugs/show_bug.cgi?id=22602 - only enable for gcc.
-      # http://crbug.com/442327
-      'variables': {
-        'native_exports%': '--native_exports_optional',
-      },
-    }],
   ],
 }
 
diff --git a/build/rmdir_and_stamp.py b/build/rmdir_and_stamp.py
new file mode 100755
index 0000000..6aa11f8
--- /dev/null
+++ b/build/rmdir_and_stamp.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Wipes out a directory recursively and then touches a stamp file.
+
+This odd pairing of operations is used to support build scripts which
+slurp up entire directories (e.g. build/android/javac.py when handling
+generated sources) as inputs.
+
+The general pattern of use is:
+
+  - Add a target which generates |gen_sources| into |out_path| from |inputs|.
+  - Include |stamp_file| as an input for that target or any of its rules which
+    generate files in |out_path|.
+  - Add an action which depends on |inputs| and which outputs |stamp_file|;
+    the action should run this script and pass |out_path| and |stamp_file| as
+    its arguments.
+
+The net result is that you will force |out_path| to be wiped and all
+|gen_sources| to be regenerated any time any file in |inputs| changes.
+
+See //third_party/mojo/mojom_bindings_generator.gypi for an example use case.
+
+"""
+
+import errno
+import os
+import shutil
+import sys
+
+
+def Main(dst_dir, stamp_file):
+  try:
+    shutil.rmtree(os.path.normpath(dst_dir))
+  except OSError as e:
+    # Ignore only "not found" errors.
+    if e.errno != errno.ENOENT:
+      raise e
+  with open(stamp_file, 'a'):
+    os.utime(stamp_file, None)
+
+if __name__ == '__main__':
+  sys.exit(Main(sys.argv[1], sys.argv[2]))
diff --git a/build/sanitizers/sanitizer_options.cc b/build/sanitizers/sanitizer_options.cc
index 6668c1e..33090fb 100644
--- a/build/sanitizers/sanitizer_options.cc
+++ b/build/sanitizers/sanitizer_options.cc
@@ -66,6 +66,8 @@
 //     so the slow unwinder may not work properly.
 //   detect_stack_use_after_return=1 - use fake stack to delay the reuse of
 //     stack allocations and detect stack-use-after-return errors.
+//   detect_container_overflow=0 - do not detect overflows in containers
+//     until crbug.com/459632 is fixed.
 #if defined(OS_LINUX)
 #if defined(GOOGLE_CHROME_BUILD)
 // Default AddressSanitizer options for the official build. These do not affect
@@ -74,20 +76,22 @@
 const char kAsanDefaultOptions[] =
     "legacy_pthread_cond=1 malloc_context_size=5 strict_memcmp=0 "
     "symbolize=false check_printf=1 use_sigaltstack=1 detect_leaks=0 "
-    "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1";
+    "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 "
+    "detect_container_overflow=0 ";
 #else
 // Default AddressSanitizer options for buildbots and non-official builds.
 const char *kAsanDefaultOptions =
     "strict_memcmp=0 symbolize=false check_printf=1 use_sigaltstack=1 "
     "detect_leaks=0 strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 "
-    "detect_stack_use_after_return=1 ";
+    "detect_stack_use_after_return=1 detect_container_overflow=0 ";
 #endif  // GOOGLE_CHROME_BUILD
 
 #elif defined(OS_MACOSX)
 const char *kAsanDefaultOptions =
     "strict_memcmp=0 replace_intrin=0 check_printf=1 use_sigaltstack=1 "
     "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 "
-    "detect_stack_use_after_return=1 detect_odr_violation=0 ";
+    "detect_stack_use_after_return=1 detect_odr_violation=0 "
+    "detect_container_overflow=0 ";
 static const char kNaClDefaultOptions[] = "handle_segv=0";
 static const char kNaClFlag[] = "--type=nacl-loader";
 #endif  // OS_LINUX
diff --git a/build/secondary/tools/grit/grit_rule.gni b/build/secondary/tools/grit/grit_rule.gni
index cdaf0f2..626fd74 100644
--- a/build/secondary/tools/grit/grit_rule.gni
+++ b/build/secondary/tools/grit/grit_rule.gni
@@ -53,6 +53,8 @@
 #   use_qualified_include (optional)
 #       If set, output_dir is not added to include_dirs.
 #
+#   configs (optional)
+#       List of additional configs to be applied to the generated target.
 #   deps  (optional)
 #   inputs  (optional)
 #       List of additional files, required for grit to process source file.
@@ -438,6 +440,10 @@
       public_configs += invoker.public_configs
     }
 
+    if (defined(invoker.configs)) {
+      configs += invoker.configs
+    }
+
     if (defined(invoker.visibility)) {
       visibility = invoker.visibility
     }
diff --git a/build/win/dbghelp_xp/README.chromium b/build/win/dbghelp_xp/README.chromium
new file mode 100644
index 0000000..a52cfad
--- /dev/null
+++ b/build/win/dbghelp_xp/README.chromium
@@ -0,0 +1,2 @@
+This dbghelp.dll is the redistributable version from the Windows 7 SDK, the

+last one to work on Windows XP.

diff --git a/build/win/dbghelp_xp/dbghelp.dll b/build/win/dbghelp_xp/dbghelp.dll
new file mode 100755
index 0000000..9f52a5d
--- /dev/null
+++ b/build/win/dbghelp_xp/dbghelp.dll
Binary files differ