Import Cobalt 12.78263
diff --git a/src/base/allocator/allocator.gyp b/src/base/allocator/allocator.gyp
index f5bda73..7ab45bd 100644
--- a/src/base/allocator/allocator.gyp
+++ b/src/base/allocator/allocator.gyp
@@ -26,6 +26,9 @@
         '<(tcmalloc_dir)/src',
         '../..',
       ],
+      'defines': [
+        'NO_HEAP_CHECK',
+      ],
       'direct_dependent_settings': {
         'configurations': {
           'Common_Base': {
@@ -120,8 +123,6 @@
         '<(tcmalloc_dir)/src/gperftools/profiler.h',
         '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
         '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
-        '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
-        '<(tcmalloc_dir)/src/heap-checker.cc',
         '<(tcmalloc_dir)/src/heap-profile-table.cc',
         '<(tcmalloc_dir)/src/heap-profile-table.h',
         '<(tcmalloc_dir)/src/heap-profiler.cc',
@@ -376,8 +377,6 @@
             '<(tcmalloc_dir)/src/base/thread_lister.h',
             '<(tcmalloc_dir)/src/deep-heap-profile.cc',
             '<(tcmalloc_dir)/src/deep-heap-profile.h',
-            '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
-            '<(tcmalloc_dir)/src/heap-checker.cc',
             '<(tcmalloc_dir)/src/heap-profiler.cc',
             '<(tcmalloc_dir)/src/heap-profile-table.cc',
             '<(tcmalloc_dir)/src/heap-profile-table.h',
@@ -434,30 +433,6 @@
             '-fvtable-verify=preinit',
           ],
         }],
-        [ 'linux_keep_shadow_stacks==1', {
-          'sources': [
-            '<(tcmalloc_dir)/src/linux_shadow_stacks.cc',
-            '<(tcmalloc_dir)/src/linux_shadow_stacks.h',
-            '<(tcmalloc_dir)/src/stacktrace_shadow-inl.h',
-          ],
-          'cflags': [
-            '-finstrument-functions',
-          ],
-          'defines': [
-            'KEEP_SHADOW_STACKS',
-          ],
-        }],
-        [ 'linux_use_heapchecker==0', {
-          # Do not compile and link the heapchecker source.
-          'sources!': [
-            '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
-            '<(tcmalloc_dir)/src/heap-checker.cc',
-          ],
-          # Disable the heap checker in tcmalloc.
-          'defines': [
-            'NO_HEAP_CHECK',
-           ],
-        }],
         [ 'clang==1', {
           'cflags': [
             '-Wno-non-literal-null-conversion',
diff --git a/src/base/base_untrusted.gyp b/src/base/base_untrusted.gyp
index 8b64c7d..df90bb2 100644
--- a/src/base/base_untrusted.gyp
+++ b/src/base/base_untrusted.gyp
@@ -11,7 +11,7 @@
     'base.gypi',
   ],
   'conditions': [
-    ['disable_nacl==0 and disable_nacl_untrusted==0', {
+    ['disable_nacl==0', {
       'targets': [
         {
           'target_name': 'base_untrusted',
diff --git a/src/build/common.gypi b/src/build/common.gypi
index 6f02d54..c72e66b 100644
--- a/src/build/common.gypi
+++ b/src/build/common.gypi
@@ -9,96 +9,18 @@
   # Variables expected to be overriden in the platform's gyp_configuration.gypi.
   'variables': {
     # Putting a variables dict inside another variables dict looks kind of
-    # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as
-    # variables within the outer variables dict here.  This is necessary
-    # to get these variables defined for the conditions within this variables
-    # dict that operate on these variables.
+    # weird.  This is done so that 'host_arch', 'android_build_type', etc are
+    # defined as variables within the outer variables dict here.  This is
+    # necessary to get these variables defined for the conditions within this
+    # variables dict that operate on these variables.
     'variables': {
       'variables': {
         'variables': {
-          'variables': {
-            # Whether we're building a ChromeOS build.
-            'chromeos%': 0,
-
-            # Whether or not we are using the Aura windowing framework.
-            'use_aura%': 0,
-
-            # Whether or not we are building the Ash shell.
-            'use_ash%': 0,
-          },
-          # Copy conditionally-set variables out one scope.
-          'chromeos%': '<(chromeos)',
-          'use_aura%': '<(use_aura)',
-          'use_ash%': '<(use_ash)',
-
-          # Whether we are using Views Toolkit
-          'toolkit_views%': 0,
-
-          # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
-          'use_openssl%': 0,
-
-          'use_ibus%': 0,
-
-          # Disable viewport meta tag by default.
-          'enable_viewport%': 0,
-
-          # Enable HiDPI support.
-          'enable_hidpi%': 0,
-
-          # Enable touch optimized art assets and metrics.
-          'enable_touch_ui%': 0,
-
-          # Override buildtype to select the desired build flavor.
-          # Dev - everyday build for development/testing
-          # Official - release build (generally implies additional processing)
-          # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
-          # conversion is done), some of the things which are now controlled by
-          # 'branding', such as symbol generation, will need to be refactored
-          # based on 'buildtype' (i.e. we don't care about saving symbols for
-          # non-Official # builds).
-          'buildtype%': 'Dev',
-
-          'conditions': [
-            # ChromeOS implies ash.
-            ['chromeos==1', {
-              'use_ash%': 1,
-              'use_aura%': 1,
-            }],
-
-            # For now, Windows builds that |use_aura| should also imply using
-            # ash. This rule should be removed for the future when Windows is
-            # using the aura windows without the ash interface.
-            ['use_aura==1 and OS=="win"', {
-              'use_ash%': 1,
-            }],
-            ['use_ash==1', {
-              'use_aura%': 1,
-            }],
-
-            # Compute the architecture that we're building on.
-            ['OS=="win" or OS=="mac" or OS=="ios"', {
-              'host_arch%': 'ia32',
-            }, {
-              # This handles the Unix platforms for which there is some support.
-              # Anything else gets passed through, which probably won't work
-              # very well; such hosts should pass an explicit target_arch to
-              # gyp.
-              'host_arch%':
-                '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")',
-            }],
-          ],
+          'host_arch%':
+            '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/")',
         },
 
         # Copy conditionally-set variables out one scope.
-        'chromeos%': '<(chromeos)',
-        'use_aura%': '<(use_aura)',
-        'use_ash%': '<(use_ash)',
-        'use_openssl%': '<(use_openssl)',
-        'use_ibus%': '<(use_ibus)',
-        'enable_viewport%': '<(enable_viewport)',
-        'enable_hidpi%': '<(enable_hidpi)',
-        'enable_touch_ui%': '<(enable_touch_ui)',
-        'buildtype%': '<(buildtype)',
         'host_arch%': '<(host_arch)',
 
         # Default architecture we're building for is the architecture we're
@@ -109,90 +31,16 @@
         # Ant, value 0), or as part of the Android system (and hence with the
         # Android build system, value 1).
         'android_build_type%': 0,
-
-        'conditions': [
-          # Set default value of toolkit_views based on OS.
-          ['OS=="win" or chromeos==1 or use_aura==1', {
-            'toolkit_views%': 1,
-          }, {
-            'toolkit_views%': 0,
-          }],
-
-          # Set toolkit_uses_gtk for the Chromium browser on Linux.
-          ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', {
-            'toolkit_uses_gtk%': 1,
-          }, {
-            'toolkit_uses_gtk%': 0,
-          }],
-
-          # Enable HiDPI on Mac OS and Chrome OS.
-          ['OS=="mac" or chromeos==1', {
-            'enable_hidpi%': 1,
-          }],
-
-          # Enable touch UI on Metro.
-          ['OS=="win"', {
-            'enable_touch_ui%': 1,
-          }],
-
-          # Enable App Launcher only on ChromeOS and Windows for now.
-          ['use_ash==1 or OS=="win"', {
-            'enable_app_list%': 1,
-          }, {
-            'enable_app_list%': 0,
-          }],
-
-          ['use_aura==1 or (OS!="win" and OS!="mac" and OS!="ios" and OS!="android")', {
-            'use_default_render_theme%': 1,
-          }, {
-            'use_default_render_theme%': 0,
-          }],
-        ],
       },
 
       # Copy conditionally-set variables out one scope.
-      'chromeos%': '<(chromeos)',
       'host_arch%': '<(host_arch)',
       'target_arch%': '<(target_arch)',
-      'toolkit_views%': '<(toolkit_views)',
-      'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
-      'use_aura%': '<(use_aura)',
-      'use_ash%': '<(use_ash)',
-      'use_openssl%': '<(use_openssl)',
-      'use_ibus%': '<(use_ibus)',
-      'enable_viewport%': '<(enable_viewport)',
-      'enable_hidpi%': '<(enable_hidpi)',
-      'enable_touch_ui%': '<(enable_touch_ui)',
       'android_build_type%': '<(android_build_type)',
-      'enable_app_list%': '<(enable_app_list)',
-      'use_default_render_theme%': '<(use_default_render_theme)',
-      'buildtype%': '<(buildtype)',
-
-      # We used to provide a variable for changing how libraries were built.
-      # This variable remains until we can clean up all the users.
-      # This needs to be one nested variables dict in so that dependent
-      # gyp files can make use of it in their outer variables.  (Yikes!)
-      # http://code.google.com/p/chromium/issues/detail?id=83308
-      'library%': 'static_library',
-
-      # Override branding to select the desired branding flavor.
-      'branding%': 'Chromium',
-
-      # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
-      # are built under a chromium full build (1) or a webkit.org chromium
-      # build (0).
-      'inside_chromium_build%': 1,
-
-      # Set to 1 to enable fast builds. It disables debug info for fastest
-      # compilation.
-      'fastbuild%': 0,
 
       # Set to 1 to enable dcheck in release without having to use the flag.
       'dcheck_always_on%': 0,
 
-      # Disable file manager component extension by default.
-      'file_manager_extension%': 0,
-
       # Python version.
       'python_ver%': '2.6',
 
@@ -205,12 +53,6 @@
       # The system root for cross-compiles. Default: none.
       'sysroot%': '',
 
-      # The system libdir used for this ABI.
-      'system_libdir%': 'lib',
-
-      # On Linux, we build with sse2 for Chromium builds.
-      'disable_sse2%': 0,
-
       # Use libjpeg-turbo as the JPEG codec used by Chromium.
       'use_libjpeg_turbo%': 1,
 
@@ -225,39 +67,6 @@
       # it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
       'component%': 'static_library',
 
-      # Set to select the Title Case versions of strings in GRD files.
-      'use_titlecase_in_grd_files%': 0,
-
-      # Use translations provided by volunteers at launchpad.net.  This
-      # currently only works on Linux.
-      'use_third_party_translations%': 0,
-
-      # Remoting compilation is enabled by default. Set to 0 to disable.
-      'remoting%': 1,
-
-      # Configuration policy is enabled by default. Set to 0 to disable.
-      'configuration_policy%': 1,
-
-      # Variable safe_browsing is used to control the build time configuration
-      # for safe browsing feature. Safe browsing can be compiled in 3 different
-      # levels: 0 disables it, 1 enables it fully, and 2 enables only UI and
-      # reporting features without enabling phishing and malware detection. This
-      # is useful to integrate a third party phishing/malware detection to
-      # existing safe browsing logic.
-      'safe_browsing%': 1,
-
-      # Speech input is compiled in by default. Set to 0 to disable.
-      'input_speech%': 1,
-
-      # Notifications are compiled in by default. Set to 0 to disable.
-      'notifications%' : 1,
-
-      # If this is set, the clang plugins used on the buildbot will be used.
-      # Run tools/clang/scripts/update.sh to make sure they are compiled.
-      # This causes 'clang_chrome_plugins_flags' to be set.
-      # Has no effect if 'clang' is not set as well.
-      'clang_use_chrome_plugins%': 1,
-
       # Enable building with ASAN (Clang's -fsanitize=address option).
       # -fsanitize=address only works with clang, but asan=1 implies clang=1
       # See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer
@@ -267,7 +76,6 @@
       # -fsanitize=thread only works with clang, but tsan=1 implies clang=1
       # See http://clang.llvm.org/docs/ThreadSanitizer.html
       'tsan%': 0,
-      'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.txt',
 
       # Use a modified version of Clang to intercept allocated types and sizes
       # for allocated objects. clang_type_profiler=1 implies clang=1.
@@ -279,356 +87,16 @@
       # See src/third_party/cygprofile/cyg-profile.cc for details.
       'order_profiling%': 0,
 
-      # Use the provided profiled order file to link Chrome image with it.
-      # This makes Chrome faster by better using CPU cache when executing code.
-      # This is known as PGO (profile guided optimization).
-      # See https://sites.google.com/a/google.com/chrome-msk/dev/boot-speed-up-effort
-      'order_text_section%' : "",
-
-      # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
-      # libraries on linux x86-64 and arm, plus ASLR.
-      'linux_fpic%': 1,
-
-      # Whether one-click signin is enabled or not.
-      'enable_one_click_signin%': 0,
-
-      # Enable Web Intents support in WebKit.
-      'enable_web_intents%': 1,
-
-      # Enable Chrome browser extensions
-      'enable_extensions%': 1,
-
-      # Enable browser automation.
-      'enable_automation%': 1,
-
-      # Enable Google Now.
-      'enable_google_now%': 1,
-
-      # Enable language detection.
-      'enable_language_detection%': 1,
-
-      # Enable printing support and UI.
-      'enable_printing%': 1,
-
-      # Enable Web Intents web content registration via HTML element
-      # and WebUI managing such registrations.
-      'enable_web_intents_tag%': 0,
-
-      # Webrtc compilation is enabled by default. Set to 0 to disable.
-      'enable_webrtc%': 1,
-
-      # PPAPI by default does not support plugins making calls off the main
-      # thread. Set to 1 to turn on experimental support for out-of-process
-      # plugins to make call of the main thread.
-      'enable_pepper_threading%': 1,
-
-      # Enables use of the session service, which is enabled by default.
-      # Support for disabling depends on the platform.
-      'enable_session_service%': 1,
-
-      # Enables theme support, which is enabled by default.  Support for
-      # disabling depends on the platform.
-      'enable_themes%': 1,
-
-      # Uses OEM-specific wallpaper resources on Chrome OS.
-      'use_oem_wallpaper%': 0,
-
-      # Enables support for background apps.
-      'enable_background%': 1,
-
-      # Enable the task manager by default.
-      'enable_task_manager%': 1,
-
-      # Enable FTP support by default.
-      'disable_ftp_support%': 0,
-
-      # XInput2 multitouch support is disabled by default (use_xi2_mt=0).
-      # Setting to non-zero value enables XI2 MT. When XI2 MT is enabled,
-      # the input value also defines the required XI2 minor minimum version.
-      # For example, use_xi2_mt=2 means XI2.2 or above version is required.
-      'use_xi2_mt%': 0,
-
-      # Use of precompiled headers on Windows.
-      #
-      # This is on by default in VS 2010, but off by default for VS
-      # 2008 because of complications that it can cause with our
-      # trybots etc.
-      #
-      # This variable may be explicitly set to 1 (enabled) or 0
-      # (disabled) in ~/.gyp/include.gypi or via the GYP command line.
-      # This setting will override the default.
-      #
-      # Note that a setting of 1 is probably suitable for most or all
-      # Windows developers using VS 2008, since precompiled headers
-      # provide a build speedup of 20-25%.  There are a couple of
-      # small workarounds you may need to use when using VS 2008 (but
-      # not 2010), see
-      # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
-      # for details.
-      'chromium_win_pch%': 0,
-
       # Set this to true when building with Clang.
       # See http://code.google.com/p/chromium/wiki/Clang for details.
       'clang%': 0,
 
-      # Enable plug-in installation by default.
-      'enable_plugin_installation%': 1,
-
-      # Enable PPAPI and NPAPI by default.
-      # TODO(nileshagrawal): Make this flag enable/disable NPAPI as well
-      # as PPAPI; see crbug.com/162667.
-      'enable_plugins%': 1,
-
-      # Specifies whether to use canvas_skia.cc in place of platform
-      # specific implementations of gfx::Canvas. Affects text drawing in the
-      # Chrome UI.
-      # TODO(asvitkine): Enable this on all platforms and delete this flag.
-      #                  http://crbug.com/105550
-      'use_canvas_skia%': 0,
-
       # Set to "tsan", "memcheck", or "drmemory" to configure the build to work
       # with one of those tools.
       'build_for_tool%': '',
 
-      # Whether tests targets should be run, archived or just have the
-      # dependencies verified. All the tests targets have the '_run' suffix,
-      # e.g. base_unittests_run runs the target base_unittests. The test target
-      # always calls tools/swarm_client/isolate.py. See the script's --help for
-      # more information and the valid --mode values. Meant to be overriden with
-      # GYP_DEFINES.
-      # TODO(maruel): Converted the default from 'check' to 'noop' so work can
-      # be done while the builders are being reconfigured to check out test data
-      # files.
-      'test_isolation_mode%': 'noop',
-      # It must not be '<(PRODUCT_DIR)' alone, the '/' is necessary otherwise
-      # gyp will remove duplicate flags, causing isolate.py to be confused.
-      'test_isolation_outdir%': '<(PRODUCT_DIR)/isolate',
-
-      'sas_dll_path%': '<(DEPTH)/third_party/platformsdk_win7/files/redist/x86',
-      'wix_path%': '<(DEPTH)/third_party/wix',
-
-      'use_harfbuzz_ng%': 0,
-
-      'conditions': [
-        # TODO(epoger): Figure out how to set use_skia=1 for Mac outside of
-        # the 'conditions' clause.  Initial attempts resulted in chromium and
-        # webkit disagreeing on its setting.
-        ['OS=="mac"', {
-          'use_skia%': 1,
-        }, {
-          'use_skia%': 1,
-        }],
-
-        # A flag for POSIX platforms
-        ['OS=="win" or OS=="starboard"', {
-          'os_posix%': 0,
-        }, {
-          'os_posix%': 1,
-        }],
-
-        # A flag for BSD platforms
-        ['OS=="freebsd" or OS=="openbsd"', {
-          'os_bsd%': 1,
-        }, {
-          'os_bsd%': 0,
-        }],
-
-        # NSS usage.
-        ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
-          'use_nss%': 1,
-        }, {
-          'use_nss%': 0,
-        }],
-
-        # Flags to use X11 on non-Mac POSIX platforms
-        ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or OS=="lb_shell" or OS=="starboard"', {
-          'use_glib%': 0,
-          'use_x11%': 0,
-        }, {
-          'use_glib%': 1,
-          'use_x11%': 1,
-        }],
-
-        # We always use skia text rendering in Aura on Windows, since GDI
-        # doesn't agree with our BackingStore.
-        # TODO(beng): remove once skia text rendering is on by default.
-        ['use_aura==1 and OS=="win"', {
-          'enable_skia_text%': 1,
-        }],
-
-        # A flag to enable or disable our compile-time dependency
-        # on gnome-keyring. If that dependency is disabled, no gnome-keyring
-        # support will be available. This option is useful
-        # for Linux distributions and for Aura.
-        ['chromeos==1 or use_aura==1', {
-          'use_gnome_keyring%': 0,
-        }, {
-          'use_gnome_keyring%': 1,
-        }],
-
-        ['toolkit_uses_gtk==1 or OS=="mac" or OS=="ios"', {
-          # GTK+, Mac and iOS want Title Case strings
-          'use_titlecase_in_grd_files%': 1,
-        }],
-
-        # Enable file manager extension on Chrome OS.
-        ['chromeos==1', {
-          'file_manager_extension%': 1,
-        }, {
-          'file_manager_extension%': 0,
-        }],
-
-        ['OS=="win" or OS=="mac" or (OS=="linux" and use_aura==0)', {
-          'enable_one_click_signin%': 1,
-        }],
-
-        ['OS=="android"', {
-          'enable_extensions%': 0,
-          'enable_google_now%': 0,
-          'enable_language_detection%': 0,
-          'enable_printing%': 0,
-          'enable_themes%': 0,
-          'enable_webrtc%': 0,
-          'proprietary_codecs%': 1,
-          'remoting%': 0,
-        }],
-
-        ['OS=="ios"', {
-          'configuration_policy%': 0,
-          'disable_ftp_support%': 1,
-          'enable_automation%': 0,
-          'enable_extensions%': 0,
-          'enable_google_now%': 0,
-          'enable_language_detection%': 0,
-          'enable_printing%': 0,
-          'enable_session_service%': 0,
-          'enable_themes%': 0,
-          'enable_webrtc%': 0,
-          'notifications%': 0,
-          'remoting%': 0,
-          'safe_browsing%': 0,
-        }],
-
-        # Use GPU accelerated cross process image transport by default
-        # on linux builds with the Aura window manager
-        ['use_aura==1 and OS=="linux"', {
-          'ui_compositor_image_transport%': 1,
-        }, {
-          'ui_compositor_image_transport%': 0,
-        }],
-
-        # Turn precompiled headers on by default for VS 2010.
-        ['OS=="win" and MSVS_VERSION=="2010" and buildtype!="Official"', {
-          'chromium_win_pch%': 1
-        }],
-
-        ['use_aura==1 or chromeos==1 or OS=="android"', {
-          'enable_plugin_installation%': 0,
-        }, {
-          'enable_plugin_installation%': 1,
-        }],
-
-        ['OS=="android" or OS=="ios"', {
-          'enable_plugins%': 0,
-        }, {
-          'enable_plugins%': 1,
-        }],
-
-        # linux_use_gold_binary: whether to use the binary checked into
-        # third_party/gold.
-        ['OS=="linux"', {
-          'linux_use_gold_binary%': 1,
-        }, {
-          'linux_use_gold_binary%': 0,
-        }],
-
-        # linux_use_gold_flags: whether to use build flags that rely on gold.
-        # On by default for x64 Linux.  Temporarily off for ChromeOS as
-        # it failed on a buildbot.
-        ['OS=="linux" and chromeos==0', {
-          'linux_use_gold_flags%': 1,
-        }, {
-          'linux_use_gold_flags%': 0,
-        }],
-
-        ['OS=="android" or OS=="ios"', {
-          'enable_captive_portal_detection%': 0,
-        }, {
-          'enable_captive_portal_detection%': 1,
-        }],
-
-        # Enable Skia UI text drawing incrementally on different platforms.
-        # http://crbug.com/105550
-        #
-        # On Aura, this allows per-tile painting to be used in the browser
-        # compositor.
-        ['OS!="mac" and OS!="android"', {
-          'use_canvas_skia%': 1,
-        }],
-
-        ['chromeos==1', {
-          # When building for ChromeOS we dont want Chromium to use libjpeg_turbo.
-          'use_libjpeg_turbo%': 0,
-        }],
-
-        ['OS=="android"', {
-          # When building as part of the Android system, use system libraries
-          # where possible to reduce ROM size.
-          'use_system_libjpeg%': '<(android_build_type)',
-        }],
-
-        # Enable Settings App only on Windows.
-        ['enable_app_list==1 and OS=="win"', {
-          'enable_settings_app%': 1,
-        }, {
-          'enable_settings_app%': 0,
-        }],
-
-        ['OS=="linux" and target_arch=="arm" and chromeos==0', {
-          # Set some defaults for arm/linux chrome builds
-          'armv7%': 1,
-          'linux_breakpad%': 0,
-          'linux_use_tcmalloc%': 0,
-          'linux_use_gold_flags%': 0,
-          # sysroot needs to be an absolute path otherwise it generates
-          # incorrect results when passed to pkg-config
-          'sysroot%': '<!(cd <(DEPTH) && pwd -P)/arm-sysroot',
-        }], # OS=="linux" and target_arch=="arm" and chromeos==0
-      ],
-
-      # Set this to 1 to use the Google-internal file containing
-      # official API keys for Google Chrome even in a developer build.
-      # Setting this variable explicitly to 1 will cause your build to
-      # fail if the internal file is missing.
-      #
-      # Set this to 0 to not use the internal file, even when it
-      # exists in your checkout.
-      #
-      # Leave set to 2 to have this variable implicitly set to 1 if
-      # you have src/google_apis/internal/google_chrome_api_keys.h in
-      # your checkout, and implicitly set to 0 if not.
-      #
-      # Note that official builds always behave as if this variable
-      # was explicitly set to 1, i.e. they always use official keys,
-      # and will fail to build if the internal file is missing.
-      'use_official_google_api_keys%': 2,
-
-      # Set these to bake the specified API keys and OAuth client
-      # IDs/secrets into your build.
-      #
-      # If you create a build without values baked in, you can instead
-      # set environment variables to provide the keys at runtime (see
-      # src/google_apis/google_api_keys.h for details).  Features that
-      # require server-side APIs may fail to work if no keys are
-      # provided.
-      #
-      # Note that if you are building an official build or if
-      # use_official_google_api_keys has been set to 1 (explicitly or
-      # implicitly), these values will be ignored and the official
-      # keys will be used instead.
-      'google_api_key%': '',
-      'google_default_client_id%': '',
-      'google_default_client_secret%': '',
+      'os_posix%': 0,
+      'os_bsd%': 0,
     },
 
     # Make sure that cobalt is defined. This is needed in
@@ -637,160 +105,32 @@
     'cobalt%': 0,
 
     # Copy conditionally-set variables out one scope.
-    'branding%': '<(branding)',
-    'buildtype%': '<(buildtype)',
     'target_arch%': '<(target_arch)',
     'host_arch%': '<(host_arch)',
     'library%': 'static_library',
-    'toolkit_views%': '<(toolkit_views)',
-    'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
-    'use_aura%': '<(use_aura)',
-    'use_ash%': '<(use_ash)',
-    'use_openssl%': '<(use_openssl)',
-    'use_ibus%': '<(use_ibus)',
-    'use_nss%': '<(use_nss)',
     'os_bsd%': '<(os_bsd)',
     'os_posix%': '<(os_posix)',
-    'use_glib%': '<(use_glib)',
-    'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
-    'use_skia%': '<(use_skia)',
-    'use_x11%': '<(use_x11)',
-    'use_gnome_keyring%': '<(use_gnome_keyring)',
-    'linux_fpic%': '<(linux_fpic)',
-    'enable_pepper_threading%': '<(enable_pepper_threading)',
-    'chromeos%': '<(chromeos)',
-    'enable_viewport%': '<(enable_viewport)',
-    'enable_hidpi%': '<(enable_hidpi)',
-    'enable_touch_ui%': '<(enable_touch_ui)',
-    'use_xi2_mt%':'<(use_xi2_mt)',
-    'file_manager_extension%': '<(file_manager_extension)',
-    'inside_chromium_build%': '<(inside_chromium_build)',
-    'fastbuild%': '<(fastbuild)',
     'dcheck_always_on%': '<(dcheck_always_on)',
     'python_ver%': '<(python_ver)',
     'armv7%': '<(armv7)',
     'arm_neon%': '<(arm_neon)',
     'sysroot%': '<(sysroot)',
-    'system_libdir%': '<(system_libdir)',
     'component%': '<(component)',
-    'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
-    'use_third_party_translations%': '<(use_third_party_translations)',
-    'remoting%': '<(remoting)',
-    'enable_one_click_signin%': '<(enable_one_click_signin)',
-    'enable_webrtc%': '<(enable_webrtc)',
-    'chromium_win_pch%': '<(chromium_win_pch)',
-    'configuration_policy%': '<(configuration_policy)',
-    'safe_browsing%': '<(safe_browsing)',
-    'input_speech%': '<(input_speech)',
-    'notifications%': '<(notifications)',
-    'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
     'asan%': '<(asan)',
     'tsan%': '<(tsan)',
-    'tsan_blacklist%': '<(tsan_blacklist)',
     'clang_type_profiler%': '<(clang_type_profiler)',
     'order_profiling%': '<(order_profiling)',
-    'order_text_section%': '<(order_text_section)',
-    'enable_extensions%': '<(enable_extensions)',
-    'enable_web_intents%': '<(enable_web_intents)',
-    'enable_web_intents_tag%': '<(enable_web_intents_tag)',
-    'enable_plugin_installation%': '<(enable_plugin_installation)',
-    'enable_plugins%': '<(enable_plugins)',
-    'enable_session_service%': '<(enable_session_service)',
-    'enable_themes%': '<(enable_themes)',
-    'use_oem_wallpaper%': '<(use_oem_wallpaper)',
-    'enable_background%': '<(enable_background)',
-    'linux_use_gold_binary%': '<(linux_use_gold_binary)',
-    'linux_use_gold_flags%': '<(linux_use_gold_flags)',
-    'use_canvas_skia%': '<(use_canvas_skia)',
-    'test_isolation_mode%': '<(test_isolation_mode)',
-    'test_isolation_outdir%': '<(test_isolation_outdir)',
-    'enable_automation%': '<(enable_automation)',
-    'enable_printing%': '<(enable_printing)',
-    'enable_google_now%': '<(enable_google_now)',
-    'enable_language_detection%': '<(enable_language_detection)',
-    'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
-    'disable_ftp_support%': '<(disable_ftp_support)',
-    'enable_task_manager%': '<(enable_task_manager)',
-    'sas_dll_path%': '<(sas_dll_path)',
-    'wix_path%': '<(wix_path)',
     'use_libjpeg_turbo%': '<(use_libjpeg_turbo)',
     'use_system_libjpeg%': '<(use_system_libjpeg)',
     'android_build_type%': '<(android_build_type)',
-    'enable_app_list%': '<(enable_app_list)',
-    'use_default_render_theme%': '<(use_default_render_theme)',
-    'enable_settings_app%': '<(enable_settings_app)',
-    'use_official_google_api_keys%': '<(use_official_google_api_keys)',
-    'google_api_key%': '<(google_api_key)',
-    'google_default_client_id%': '<(google_default_client_id)',
-    'google_default_client_secret%': '<(google_default_client_secret)',
-    'use_harfbuzz_ng%': '<(use_harfbuzz_ng)',
 
     # Use system protobuf instead of bundled one.
     'use_system_protobuf%': 0,
 
-    # Use system yasm instead of bundled one.
-    'use_system_yasm%': 0,
-
-    # Default to enabled PIE; this is important for ASLR but we may need to be
-    # able to turn it off for various reasons.
-    'linux_disable_pie%': 0,
-
-    # The release channel that this build targets. This is used to restrict
-    # channel-specific build options, like which installer packages to create.
-    # The default is 'all', which does no channel-specific filtering.
-    'channel%': 'all',
-
-    # Override chromium_mac_pch and set it to 0 to suppress the use of
-    # precompiled headers on the Mac.  Prefix header injection may still be
-    # used, but prefix headers will not be precompiled.  This is useful when
-    # using distcc to distribute a build to compile slaves that don't
-    # share the same compiler executable as the system driving the compilation,
-    # because precompiled headers rely on pointers into a specific compiler
-    # executable's image.  Setting this to 0 is needed to use an experimental
-    # Linux-Mac cross compiler distcc farm.
-    'chromium_mac_pch%': 1,
-
-    # The default value for mac_strip in target_defaults. This cannot be
-    # set there, per the comment about variable% in a target_defaults.
-    'mac_strip_release%': 1,
-
-    # Set to 1 to enable code coverage.  In addition to build changes
-    # (e.g. extra CFLAGS), also creates a new target in the src/chrome
-    # project file called "coverage".
-    # Currently ignored on Windows.
-    'coverage%': 0,
-
-    # Set to 1 to force Visual C++ to use legacy debug information format /Z7.
-    # This is useful for parallel compilation tools which can't support /Zi.
-    # Only used on Windows.
-    'win_z7%' : 0,
-
-    # Although base/allocator lets you select a heap library via an
-    # environment variable, the libcmt shim it uses sometimes gets in
-    # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
-    #  'win_use_allocator_shim': 0,
-    #  'win_release_RuntimeLibrary': 2
-    # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
-    'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
-
-    # Whether usage of OpenMAX is enabled.
-    'enable_openmax%': 0,
-
     # Whether proprietary audio/video codecs are assumed to be included with
     # this build (only meaningful if branding!=Chrome).
     'proprietary_codecs%': 0,
 
-    # TODO(bradnelson): eliminate this when possible.
-    # To allow local gyp files to prevent release.vsprops from being included.
-    # Yes(1) means include release.vsprops.
-    # Once all vsprops settings are migrated into gyp, this can go away.
-    'msvs_use_common_release%': 1,
-
-    # TODO(bradnelson): eliminate this when possible.
-    # To allow local gyp files to override additional linker options for msvs.
-    # Yes(1) means set use the common linker options.
-    'msvs_use_common_linker_extras%': 1,
-
     # TODO(sgk): eliminate this if possible.
     # It would be nicer to support this via a setting in 'target_defaults'
     # in chrome/app/locales/locales.gypi overriding the setting in the
@@ -798,29 +138,6 @@
     # but that doesn't work as we'd like.
     'msvs_debug_link_incremental%': '2',
 
-    # Needed for some of the largest modules.
-    'msvs_debug_link_nonincremental%': '1',
-
-    # Turns on Use Library Dependency Inputs for linking chrome.dll on Windows
-    # to get incremental linking to be faster in debug builds.
-    'incremental_chrome_dll%': '0',
-
-    # The default settings for third party code for treating
-    # warnings-as-errors. Ideally, this would not be required, however there
-    # is some third party code that takes a long time to fix/roll. So, this
-    # flag allows us to have warnings as errors in general to prevent
-    # regressions in most modules, while working on the bits that are
-    # remaining.
-    'win_third_party_warn_as_error%': 'true',
-
-    # This is the location of the sandbox binary. Chrome looks for this before
-    # running the zygote process. If found, and SUID, it will be used to
-    # sandbox the zygote process and, thus, all renderer processes.
-    'linux_sandbox_path%': '',
-
-    # Set this to true to enable SELinux support.
-    'selinux%': 0,
-
     # Clang stuff.
     'clang%': '<(clang)',
     'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
@@ -834,40 +151,10 @@
     'clang_load%': '',
     'clang_add_plugin%': '',
 
-    # The default type of gtest.
-    'gtest_target_type%': 'executable',
-
     # Enable sampling based profiler.
     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
     'profiling%': '0',
 
-    # Enable strict glibc debug mode.
-    'glibcxx_debug%': 0,
-
-    # Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
-    'linux_breakpad%': 0,
-    # And if we want to dump symbols for Breakpad-enabled builds.
-    'linux_dump_symbols%': 0,
-    # And if we want to strip the binary after dumping symbols.
-    'linux_strip_binary%': 0,
-    # Strip the test binaries needed for Linux reliability tests.
-    'linux_strip_reliability_tests%': 0,
-
-    # Enable TCMalloc.
-    'linux_use_tcmalloc%': 1,
-
-    # Disable TCMalloc's heapchecker.
-    'linux_use_heapchecker%': 0,
-
-    # Disable shadow stack keeping used by heapcheck to unwind the stacks
-    # better.
-    'linux_keep_shadow_stacks%': 0,
-
-    # Set to 1 to link against libgnome-keyring instead of using dlopen().
-    'linux_link_gnome_keyring%': 0,
-    # Set to 1 to link against gsettings APIs instead of using dlopen().
-    'linux_link_gsettings%': 0,
-
     # Set Thumb compilation flags.
     'arm_thumb%': 0,
 
@@ -878,16 +165,6 @@
     # Set ARM float abi compilation flag.
     'arm_float_abi%': 'softfp',
 
-    # Enable new NPDevice API.
-    'enable_new_npdevice_api%': 0,
-
-    # Enable EGLImage support in OpenMAX
-    'enable_eglimage%': 1,
-
-    # Enable a variable used elsewhere throughout the GYP files to determine
-    # whether to compile in the sources for the GPU plugin / process.
-    'enable_gpu%': 1,
-
     # .gyp files or targets should set chromium_code to 1 if they build
     # Chromium-specific code, as opposed to external code.  This variable is
     # used to control such things as the set of warnings to enable, and
@@ -899,160 +176,18 @@
     # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
     'enable_wexit_time_destructors%': 0,
 
-    # Set to 1 to compile with the built in pdf viewer.
-    'internal_pdf%': 0,
-
-    # Set to 1 to compile with the OpenGL ES 2.0 conformance tests.
-    'internal_gles2_conform_tests%': 0,
-
-    # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
-    # so Cocoa is happy (http://crbug.com/20441).
-    'locales': [
-      'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
-      'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
-      'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
-      'ml', 'mr', 'ms', 'nb', 'nl', 'pl', 'pt-PT', 'ro', 'ru',
-      'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
-      'vi', 'zh-CN', 'zh-TW',
-    ],
-
-    # Pseudo locales are special locales which are used for testing and
-    # debugging. They don't get copied to the final app. For more info,
-    # check out https://sites.google.com/a/chromium.org/dev/Home/fake-bidi
-    'pseudo_locales': [
-      'fake-bidi',
-    ],
-
-    'grit_defines': [],
-
-    # If debug_devtools is set to 1, JavaScript files for DevTools are
-    # stored as is and loaded from disk. Otherwise, a concatenated file
-    # is stored in resources.pak. It is still possible to load JS files
-    # from disk by passing --debug-devtools cmdline switch.
-    'debug_devtools%': 0,
-
-    # The Java Bridge is not compiled in by default.
-    'java_bridge%': 0,
-
-    # Code signing for iOS binaries.  The bots need to be able to disable this.
-    'chromium_ios_signing%': 1,
-
-    # This flag is only used when disable_nacl==0 and disables all those
-    # subcomponents which would require the installation of a native_client
-    # untrusted toolchain.
-    'disable_nacl_untrusted%': 0,
-
-    # Disable Dart by default.
-    'enable_dart%': 0,
-
-    # The desired version of Windows SDK can be set in ~/.gyp/include.gypi.
-    'msbuild_toolset%': '',
-
     # Native Client is enabled by default.
     'disable_nacl%': 0,
 
-    # Whether to build full debug version for Debug configuration on Android.
-    # Compared to full debug version, the default Debug configuration on Android
-    # has no full v8 debug, has size optimization and linker gc section, so that
-    # we can build a debug version with acceptable size and performance.
-    'android_full_debug%': 0,
-
     # Sets the default version name and code for Android app, by default we
     # do a developer build.
     'android_app_version_name%': 'Developer Build',
     'android_app_version_code%': 0,
 
-    'sas_dll_exists': '<!(python <(DEPTH)/build/dir_exists.py <(sas_dll_path))',
-    'wix_exists': '<!(python <(DEPTH)/build/dir_exists.py <(wix_path))',
-
     'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/10',
-    'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files',
-
-    # Whether we are using the rlz library or not.  Platforms like Android send
-    # rlz codes for searches but do not use the library.
-    'enable_rlz%': 0,
 
     'conditions': [
-      ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(directx_sdk_default_path))"=="True"', {
-        'directx_sdk_path%': '<(directx_sdk_default_path)',
-      }, {
-        'directx_sdk_path%': '$(DXSDK_DIR)',
-      }],
-      ['OS=="win"', {
-        'windows_driver_kit_path%': '$(WDK_DIR)',
-      }],
-      # If use_official_google_api_keys is already set (to 0 or 1), we
-      # do none of the implicit checking.  If it is set to 1 and the
-      # internal keys file is missing, the build will fail at compile
-      # time.  If it is set to 0 and keys are not provided by other
-      # means, a warning will be printed at compile time.
-      ['use_official_google_api_keys==2', {
-        'use_official_google_api_keys%':
-            '<!(python <(DEPTH)/google_apis/build/check_internal.py <(DEPTH)/google_apis/internal/google_chrome_api_keys.h)',
-      }],
-      ['os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell"', {
-        # Figure out the python architecture to decide if we build pyauto.
-        'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/<(system_libdir)/libpython<(python_ver).so.1.0)',
-        'conditions': [
-          # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
-          # that it takes effect here.
-          ['clang==0 and asan==0 and tsan==0', {
-            # This will set gcc_version to XY if you are running gcc X.Y.*.
-            # This is used to tweak build flags for gcc 4.5.
-            'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
-          }, {
-            'gcc_version%': 0,
-          }],
-          ['branding=="Chrome"', {
-            'linux_breakpad%': 1,
-          }],
-          # All Chrome builds have breakpad symbols, but only process the
-          # symbols from official builds.
-          ['(branding=="Chrome" and buildtype=="Official")', {
-            'linux_dump_symbols%': 1,
-          }],
-        ],
-      }],  # os_posix==1 and OS!="mac" and OS!="ios"
-      ['OS=="ios"', {
-        'disable_nacl%': 1,
-        'enable_background%': 0,
-        'enable_gpu%': 0,
-        'enable_task_manager%': 0,
-        'icu_use_data_file_flag%': 1,
-        'use_system_bzip2%': 1,
-        'use_system_libxml%': 1,
-        'use_system_sqlite%': 1,
-
-        # The Mac SDK is set for iOS builds and passed through to Mac
-        # sub-builds. This allows the Mac sub-build SDK in an iOS build to be
-        # overridden from the command line the same way it is for a Mac build.
-        'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py 10.6)',
-
-        # iOS SDK and deployment target support.  The iOS 5.0 SDK is actually
-        # what is required, but the value is left blank so when it is set in
-        # the project files it will be the "current" iOS SDK.  Forcing 5.0
-        # even though it is "current" causes Xcode to spit out a warning for
-        # every single project file for not using the "current" SDK.
-        'ios_sdk%': '',
-        'ios_sdk_path%': '',
-        'ios_deployment_target%': '4.3',
-
-        'conditions': [
-          # ios_product_name is set to the name of the .app bundle as it should
-          # appear on disk.
-          ['branding=="Chrome"', {
-            'ios_product_name%': 'Chrome',
-          }, { # else: branding!="Chrome"
-            'ios_product_name%': 'Chromium',
-          }],
-          ['branding=="Chrome" and buildtype=="Official"', {
-            'ios_breakpad%': 1,
-          }, { # else: branding!="Chrome" or buildtype!="Official"
-            'ios_breakpad%': 0,
-          }],
-        ],
-      }],  # OS=="ios"
-      ['OS=="android" or ((OS=="lb_shell" or OS=="starboard") and target_arch=="android")', {
+      ['target_arch=="android"', {
         # Location of Android NDK.
         'variables': {
           'variables': {
@@ -1094,195 +229,22 @@
         # to specify the output directory for Ant in the Android build.
         'ant_build_out': '`cd <(PRODUCT_DIR) && pwd -P`',
 
-        # Uses Android's crash report system
-        'linux_breakpad%': 0,
-
-        # Always uses openssl.
-        'use_openssl%': 1,
-
         'proprietary_codecs%': '<(proprietary_codecs)',
-        'enable_task_manager%': 0,
-        'safe_browsing%': 2,
-        'configuration_policy%': 0,
-        'input_speech%': 0,
-        'enable_web_intents%': 0,
-        'enable_automation%': 0,
-        'java_bridge%': 1,
-        'build_ffmpegsumo%': 0,
-        'linux_use_tcmalloc%': 0,
 
         # Disable Native Client.
         'disable_nacl%': 1,
 
-        # Android does not support background apps.
-        'enable_background%': 0,
-
-        # Sessions are store separately in the Java side.
-        'enable_session_service%': 0,
-
-        # Set to 1 once we have a notification system for Android.
-        # http://crbug.com/115320
-        'notifications%': 0,
-
-        'p2p_apis%' : 0,
-
-        # TODO(jrg): when 'gtest_target_type'=='shared_library' and
-        # OS==android, make all gtest_targets depend on
-        # testing/android/native_test.gyp:native_test_apk.
-        'gtest_target_type%': 'shared_library',
-
-        # Uses system APIs for decoding audio and video.
-        'use_libffmpeg%': '0',
-
-        # Always use the chromium skia.
-        'use_system_skia%': '0',
-
-        # Configure crash reporting and build options based on release type.
-        'conditions': [
-          ['buildtype=="Official"', {
-            # Only report crash dumps for Official builds.
-            'linux_breakpad%': 1,
-          }, {
-            'linux_breakpad%': 0,
-          }],
-        ],
-
         # When building as part of the Android system, use system libraries
         # where possible to reduce ROM size.
         # TODO(steveblock): Investigate using the system version of sqlite.
         'use_system_sqlite%': 0,  # '<(android_build_type)',
-        'use_system_expat%': '<(android_build_type)',
         'use_system_icu%': '<(android_build_type)',
         'use_system_stlport%': '<(android_build_type)',
 
         # Copy it out one scope.
         'android_build_type%': '<(android_build_type)',
-      }],  # OS=="android"
-      ['OS=="mac"', {
-        'variables': {
-          # Mac OS X SDK and deployment target support.  The SDK identifies
-          # the version of the system headers that will be used, and
-          # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
-          # macro.  "Maximum allowed" refers to the operating system version
-          # whose APIs are available in the headers.  The deployment target
-          # identifies the minimum system version that the built products are
-          # expected to function on.  It corresponds to the
-          # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
-          # macros are available, #include <AvailabilityMacros.h>.  Additional
-          # documentation on these macros is available at
-          # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
-          # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
-          # deployment target to 10.6.  Other projects, such as O3D, may
-          # override these defaults.
+      }],  # target_arch=="android"
 
-          # Normally, mac_sdk_min is used to find an SDK that Xcode knows
-          # about that is at least the specified version. In official builds,
-          # the SDK must match mac_sdk_min exactly. If the SDK is installed
-          # someplace that Xcode doesn't know about, set mac_sdk_path to the
-          # path to the SDK; when set to a non-empty string, SDK detection
-          # based on mac_sdk_min will be bypassed entirely.
-          'mac_sdk_min%': '10.6',
-          'mac_sdk_path%': '',
-
-          'mac_deployment_target%': '10.6',
-        },
-
-        'mac_sdk_min': '<(mac_sdk_min)',
-        'mac_sdk_path': '<(mac_sdk_path)',
-        'mac_deployment_target': '<(mac_deployment_target)',
-
-        # Enable clang on mac by default!
-        'clang%': 1,
-
-        # Compile in Breakpad support by default so that it can be
-        # tested, even if it is not enabled by default at runtime.
-        'mac_breakpad_compiled_in%': 1,
-        'conditions': [
-          # mac_product_name is set to the name of the .app bundle as it should
-          # appear on disk.  This duplicates data from
-          # chrome/app/theme/chromium/BRANDING and
-          # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
-          # these names into the build system.
-          ['OS!="lb_shell"', {
-            'default_configuration': 'Debug',
-          }],
-          ['branding=="Chrome"', {
-            'mac_product_name%': 'Google Chrome',
-          }, { # else: branding!="Chrome"
-            'mac_product_name%': 'Chromium',
-          }],
-
-          ['branding=="Chrome" and buildtype=="Official"', {
-            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
-            # Enable uploading crash dumps.
-            'mac_breakpad_uploads%': 1,
-            # Enable dumping symbols at build time for use by Mac Breakpad.
-            'mac_breakpad%': 1,
-            # Enable Keystone auto-update support.
-            'mac_keystone%': 1,
-          }, { # else: branding!="Chrome" or buildtype!="Official"
-            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
-            'mac_breakpad_uploads%': 0,
-            'mac_breakpad%': 0,
-            'mac_keystone%': 0,
-          }],
-        ],
-      }],  # OS=="mac"
-      ['OS=="win"', {
-        'conditions': [
-          ['component=="shared_library"', {
-            'win_use_allocator_shim%': 0,
-          }],
-          ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
-            # Only enabled by default for ninja because it's buggy in VS.
-            # Not enabled for component=static_library because some targets
-            # are too large and the toolchain fails due to the size of the
-            # .obj files.
-            'incremental_chrome_dll%': 1,
-          }],
-          # Don't do incremental linking for large modules on 32-bit.
-          ['MSVS_OS_BITS==32', {
-            'msvs_large_module_debug_link_mode%': '1',  # No
-          },{
-            'msvs_large_module_debug_link_mode%': '2',  # Yes
-          }],
-          ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', {
-            'msvs_express%': 1,
-            'secure_atl%': 0,
-          },{
-            'msvs_express%': 0,
-            'secure_atl%': 1,
-          }],
-        ],
-        'nacl_win64_defines': [
-          # This flag is used to minimize dependencies when building
-          # Native Client loader for 64-bit Windows.
-          'NACL_WIN64',
-        ],
-      }],
-
-      ['os_posix==1 and chromeos==0 and OS!="android" and OS!="ios"', {
-        'use_cups%': 1,
-      }, {
-        'use_cups%': 0,
-      }],
-
-      # Native Client glibc toolchain is enabled by default except on arm.
-      ['target_arch=="arm"', {
-        'disable_glibc%': 1,
-      }, {
-        'disable_glibc%': 0,
-      }],
-
-      # Disable SSE2 when building for ARM or MIPS.
-      ['target_arch=="arm" or target_arch=="mipsel"', {
-        'disable_sse2%': 1,
-      }, {
-        'disable_sse2%': '<(disable_sse2)',
-      }],
-
-      # Set the relative path from this file to the GYP file of the JPEG
-      # library used by Chromium.
       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
         # Configuration for using the system libjeg is here.
         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
@@ -1290,120 +252,13 @@
         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
       }],
 
-      # Options controlling the use of GConf (the classic GNOME configuration
-      # system) and GIO, which contains GSettings (the new GNOME config system).
-      ['chromeos==1', {
-        'use_gconf%': 0,
-        'use_gio%': 0,
-      }, {
-        'use_gconf%': 1,
-        'use_gio%': 1,
-      }],
-
-      # Set up -D and -E flags passed into grit.
-      ['branding=="Chrome"', {
-        # TODO(mmoss) The .grd files look for _google_chrome, but for
-        # consistency they should look for google_chrome_build like C++.
-        'grit_defines': ['-D', '_google_chrome',
-                         '-E', 'CHROMIUM_BUILD=google_chrome'],
-      }, {
-        'grit_defines': ['-D', '_chromium',
-                         '-E', 'CHROMIUM_BUILD=chromium'],
-      }],
-      ['chromeos==1', {
-        'grit_defines': ['-D', 'chromeos', '-D', 'scale_factors=2x'],
-      }],
-      ['toolkit_views==1', {
-        'grit_defines': ['-D', 'toolkit_views'],
-      }],
-      ['use_aura==1', {
-        'grit_defines': ['-D', 'use_aura'],
-      }],
-      ['use_ash==1', {
-        'grit_defines': ['-D', 'use_ash'],
-      }],
-      ['use_nss==1', {
-        'grit_defines': ['-D', 'use_nss'],
-      }],
-      ['file_manager_extension==1', {
-        'grit_defines': ['-D', 'file_manager_extension'],
-      }],
-      ['remoting==1', {
-        'grit_defines': ['-D', 'remoting'],
-      }],
-      ['use_titlecase_in_grd_files==1', {
-        'grit_defines': ['-D', 'use_titlecase'],
-      }],
-      ['use_third_party_translations==1', {
-        'grit_defines': ['-D', 'use_third_party_translations'],
-        'locales': [
-          'ast', 'bs', 'ca@valencia', 'en-AU', 'eo', 'eu', 'gl', 'hy', 'ia',
-          'ka', 'ku', 'kw', 'ms', 'ug'
-        ],
-      }],
-      ['OS=="android"', {
-        'grit_defines': ['-D', 'android'],
-      }],
-      ['OS=="mac"', {
-        'grit_defines': ['-D', 'scale_factors=2x'],
-      }],
-      ['OS == "ios"', {
-        'grit_defines': [
-          # define for iOS specific resources.
-          '-D', 'ios',
-          # iOS uses a whitelist to filter resources.
-          '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
-        ],
-        # iOS uses pt instead of pt-BR.
-        'locales': ['pt'],
-      }, {  # OS != "ios"
-        'locales': ['pt-BR'],
-      }],
-      ['enable_extensions==1', {
-        'grit_defines': ['-D', 'enable_extensions'],
-      }],
-      ['enable_printing==1', {
-        'grit_defines': ['-D', 'enable_printing'],
-      }],
-      ['enable_themes==1', {
-        'grit_defines': ['-D', 'enable_themes'],
-      }],
-      ['use_oem_wallpaper==1', {
-        'grit_defines': ['-D', 'use_oem_wallpaper'],
-      }],
-      ['enable_app_list==1', {
-        'grit_defines': ['-D', 'enable_app_list'],
-      }],
-      ['enable_settings_app==1', {
-        'grit_defines': ['-D', 'enable_settings_app'],
-      }],
-      ['clang_use_chrome_plugins==1 and OS!="win"', {
-        'clang_chrome_plugins_flags': [
-          '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
-        ],
-      }],
-
-      ['enable_web_intents_tag==1', {
-        'grit_defines': ['-D', 'enable_web_intents_tag'],
-      }],
-
       ['asan==1 and OS!="win"', {
         'clang%': 1,
       }],
-      ['asan==1 and OS=="mac"', {
-        # See http://crbug.com/145503.
-        'component': "static_library",
-      }],
       ['tsan==1', {
         'clang%': 1,
       }],
 
-      ['OS=="linux" and clang_type_profiler==1', {
-        'clang%': 1,
-        'clang_use_chrome_plugins%': 0,
-        'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
-      }],
-
       # On valgrind bots, override the optimizer settings so we don't inline too
       # much and make the stacks harder to figure out.
       #
@@ -1456,33 +311,6 @@
         # Keep the code under #ifndef NVALGRIND.
         'release_valgrind_build': 1,
       }],
-
-      # Enable RLZ on Win, Mac and ChromeOS.
-      ['branding=="Chrome" and (OS=="win" or OS=="mac" or chromeos==1)', {
-        'enable_rlz%': 1,
-      }],
-    ],
-
-    # List of default apps to install in new profiles.  The first list contains
-    # the source files as found in svn.  The second list, used only for linux,
-    # 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.
-    'default_apps_list': [
-      'browser/resources/default_apps/external_extensions.json',
-      'browser/resources/default_apps/gmail.crx',
-      'browser/resources/default_apps/search.crx',
-      'browser/resources/default_apps/youtube.crx',
-      'browser/resources/default_apps/drive.crx',
-      'browser/resources/default_apps/docs.crx',
-    ],
-    'default_apps_list_linux_dest': [
-      '<(PRODUCT_DIR)/default_apps/external_extensions.json',
-      '<(PRODUCT_DIR)/default_apps/gmail.crx',
-      '<(PRODUCT_DIR)/default_apps/search.crx',
-      '<(PRODUCT_DIR)/default_apps/youtube.crx',
-      '<(PRODUCT_DIR)/default_apps/drive.crx',
-      '<(PRODUCT_DIR)/default_apps/docs.crx',
     ],
   },
   'target_defaults': {
@@ -1553,376 +381,30 @@
         '-Wno-unnamed-type-template-args',
       ],
 
-      'conditions': [
-        ['OS=="win" and component=="shared_library"', {
-          # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
-          'win_release_RuntimeLibrary%': '2', # 2 = /MD (nondebug DLL)
-          'win_debug_RuntimeLibrary%': '3',   # 3 = /MDd (debug DLL)
-        }, {
-          # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
-          'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
-          'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
-        }],
-        ['OS=="ios"', {
-          # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
-          'mac_release_optimization%': 's', # Use -Os unless overridden
-          'mac_debug_optimization%': '0',   # Use -O0 unless overridden
-        }, {
-          # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
-          'mac_release_optimization%': '3', # Use -O3 unless overridden
-          'mac_debug_optimization%': '0',   # Use -O0 unless overridden
-        }],
-      ],
+      # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
+      'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
+      'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
+
+      # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
+      'mac_release_optimization%': '3', # Use -O3 unless overridden
+      'mac_debug_optimization%': '0',   # Use -O0 unless overridden
     },
+    'defines': [
+      'USE_OPENSSL=1',
+    ],
     'conditions': [
-      ['OS=="linux" and linux_use_tcmalloc==1 and clang_type_profiler==1', {
-        'cflags_cc!': ['-fno-rtti'],
-        'cflags_cc+': [
-          '-frtti',
-          '-gline-tables-only',
-          '-fintercept-allocation-functions',
-        ],
-        'defines': ['TYPE_PROFILING'],
-        'dependencies': [
-          '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
-        ],
-      }],
-      ['OS=="win" and "<(msbuild_toolset)"!=""', {
-        'msbuild_toolset': '<(msbuild_toolset)',
-      }],
-      ['branding=="Chrome"', {
-        'defines': ['GOOGLE_CHROME_BUILD'],
-      }, {  # else: branding!="Chrome"
-        'defines': ['CHROMIUM_BUILD'],
-      }],
-      ['OS=="mac" and component=="shared_library"', {
-        'xcode_settings': {
-          'DYLIB_INSTALL_NAME_BASE': '@rpath',
-          'LD_RUNPATH_SEARCH_PATHS': [
-            # For unbundled binaries.
-            '@loader_path/.',
-            # For bundled binaries, to get back from Binary.app/Contents/MacOS.
-            '@loader_path/../../..',
-          ],
-        },
-      }],
-      ['enable_rlz==1', {
-        'defines': ['ENABLE_RLZ'],
-      }],
       ['component=="shared_library"', {
         'defines': ['COMPONENT_BUILD'],
       }],
-      ['toolkit_views==1', {
-        'defines': ['TOOLKIT_VIEWS=1'],
-      }],
-      ['ui_compositor_image_transport==1', {
-        'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
-      }],
-      ['use_aura==1', {
-        'defines': ['USE_AURA=1'],
-      }],
-      ['use_ash==1', {
-        'defines': ['USE_ASH=1'],
-      }],
-      ['use_default_render_theme==1', {
-        'defines': ['USE_DEFAULT_RENDER_THEME=1'],
-      }],
-      ['use_libjpeg_turbo==1', {
-        'defines': ['USE_LIBJPEG_TURBO=1'],
-      }],
-      ['use_nss==1', {
-        'defines': ['USE_NSS=1'],
-      }],
-      ['enable_one_click_signin==1', {
-        'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
-      }],
-      ['toolkit_uses_gtk==1 and toolkit_views==0', {
-        # TODO(erg): We are progressively sealing up use of deprecated features
-        # in gtk in preparation for an eventual porting to gtk3.
-        'defines': ['GTK_DISABLE_SINGLE_INCLUDES=1'],
-      }],
-      ['chromeos==1', {
-        'defines': ['OS_CHROMEOS=1'],
-      }],
-      ['use_xi2_mt!=0', {
-        'defines': ['USE_XI2_MT=<(use_xi2_mt)'],
-      }],
-      ['file_manager_extension==1', {
-        'defines': ['FILE_MANAGER_EXTENSION=1'],
-      }],
       ['profiling==1', {
         'defines': ['ENABLE_PROFILING=1'],
       }],
-      ['OS=="linux" and glibcxx_debug==1', {
-        'defines': ['_GLIBCXX_DEBUG=1',],
-        'cflags_cc+': ['-g'],
-      }],
-      ['remoting==1', {
-        'defines': ['ENABLE_REMOTING=1'],
-      }],
-      ['enable_webrtc==1', {
-        'defines': ['ENABLE_WEBRTC=1'],
-      }],
       ['proprietary_codecs==1', {
         'defines': ['USE_PROPRIETARY_CODECS'],
       }],
-      ['enable_pepper_threading==1', {
-        'defines': ['ENABLE_PEPPER_THREADING'],
-      }],
-      ['enable_viewport==1', {
-        'defines': ['ENABLE_VIEWPORT'],
-      }],
-      ['configuration_policy==1', {
-        'defines': ['ENABLE_CONFIGURATION_POLICY'],
-      }],
-      ['input_speech==1', {
-        'defines': ['ENABLE_INPUT_SPEECH'],
-      }],
-      ['notifications==1', {
-        'defines': ['ENABLE_NOTIFICATIONS'],
-      }],
-      ['enable_hidpi==1', {
-        'defines': ['ENABLE_HIDPI=1'],
-      }],
-      ['fastbuild!=0', {
-        # Clang creates chubby debug information, which makes linking very
-        # slow. For now, don't create debug information with clang.  See
-        # http://crbug.com/70000
-        'conditions': [
-          ['clang==1', {
-            'conditions': [
-              ['OS=="linux"', {
-                'variables': {
-                  'debug_extra_cflags': '-g0',
-                },
-              }],
-              # Android builds symbols on release by default, disable them.
-              ['OS=="android"', {
-                'variables': {
-                  'debug_extra_cflags': '-g0',
-                  'release_extra_cflags': '-g0',
-                },
-              }],
-            ],
-          }, { # else clang!=1
-            'conditions': [
-              # For Windows and Mac, we don't genererate debug information.
-              ['OS=="win"', {
-                'msvs_settings': {
-                  'VCLinkerTool': {
-                    'GenerateDebugInformation': 'false',
-                  },
-                  'VCCLCompilerTool': {
-                    'DebugInformationFormat': '0',
-                  },
-                },
-              }],
-              ['OS=="mac"', {
-                'xcode_settings': {
-                  'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
-                },
-              }],
-              ['OS=="linux"', {
-                'variables': {
-                  'debug_extra_cflags': '-g1',
-                },
-              }],
-              ['OS=="android"', {
-                'variables': {
-                  'debug_extra_cflags': '-g1',
-                  'release_extra_cflags': '-g1',
-                },
-              }],
-            ],
-          }], # clang!=1
-        ],
-      }],  # fastbuild!=0
       ['dcheck_always_on!=0', {
         'defines': ['DCHECK_ALWAYS_ON=1'],
       }],  # dcheck_always_on!=0
-      ['selinux==1', {
-        'defines': ['CHROMIUM_SELINUX=1'],
-      }],
-      ['win_use_allocator_shim==0', {
-        'conditions': [
-          ['OS=="win"', {
-            'defines': ['NO_TCMALLOC'],
-          }],
-        ],
-      }],
-      ['enable_gpu==1', {
-        'defines': [
-          'ENABLE_GPU=1',
-        ],
-      }],
-      ['use_openssl==1', {
-        'defines': [
-          'USE_OPENSSL=1',
-        ],
-      }],
-      ['enable_eglimage==1', {
-        'defines': [
-          'ENABLE_EGLIMAGE=1',
-        ],
-      }],
-      ['use_skia==1', {
-        'defines': [
-          'USE_SKIA=1',
-        ],
-      }],
-      ['asan==1 and OS=="win"', {
-        # Since asan on windows uses Syzygy, we need /PROFILE turned on to
-        # produce appropriate pdbs.
-        'msvs_settings': {
-          'VCLinkerTool': {
-            'Profile': 'true',
-          },
-        },
-        'defines': ['ADDRESS_SANITIZER'],
-      }],  # asan==1 and OS=="win"
-      ['coverage!=0', {
-        'conditions': [
-          ['OS=="mac" or OS=="ios"', {
-            'xcode_settings': {
-              'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
-              'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
-            },
-          }],
-          ['OS=="mac"', {
-            # Add -lgcov for types executable, shared_library, and
-            # loadable_module; not for static_library.
-            # This is a delayed conditional.
-            'target_conditions': [
-              ['_type!="static_library"', {
-                'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
-              }],
-            ],
-          }],
-          ['OS=="linux" or OS=="android"', {
-            'cflags': [ '-ftest-coverage',
-                        '-fprofile-arcs' ],
-            'link_settings': { 'libraries': [ '-lgcov' ] },
-          }],
-          ['OS=="win"', {
-            'variables': {
-              # Disable incremental linking for all modules.
-              # 0: inherit, 1: disabled, 2: enabled.
-              'msvs_debug_link_incremental': '1',
-              'msvs_large_module_debug_link_mode': '1',
-            },
-            'defines': [
-              # Disable iterator debugging (huge speed boost without any
-              # change in coverage results).
-              '_HAS_ITERATOR_DEBUGGING=0',
-            ],
-            'msvs_settings': {
-              'VCLinkerTool': {
-                # Enable profile information (necessary for coverage
-                # instrumentation). This is incompatible with incremental
-                # linking.
-                'Profile': 'true',
-              },
-            }
-         }],  # OS==win
-        ],  # conditions for coverage
-      }],  # coverage!=0
-      ['OS=="win"', {
-        'defines': [
-          '__STD_C',
-          '_CRT_SECURE_NO_DEPRECATE',
-          '_SCL_SECURE_NO_DEPRECATE',
-          # This define is required to pull in the new Win8 interfaces from
-          # system headers like ShObjIdl.h.
-          'NTDDI_VERSION=0x06020000',
-        ],
-        'include_dirs': [
-          '<(DEPTH)/third_party/wtl/include',
-        ],
-        'conditions': [
-          ['win_z7!=0', {
-            'msvs_settings': {
-              # Generates debug info when win_z7=1
-              # even if fastbuild=1 (that makes GenerateDebugInformation false).
-              'VCLinkerTool': {
-                'GenerateDebugInformation': 'true',
-              },
-              'VCCLCompilerTool': {
-                'DebugInformationFormat': '1',
-              }
-            }
-          }],
-          ['"<(GENERATOR)"=="msvs"', {
-            'msvs_settings': {
-              'VCLinkerTool': {
-                # Make the pdb name sane. Otherwise foo.exe and foo.dll both
-                # have foo.pdb. The ninja generator already defaults to this and
-                # can't handle the $(TargetPath) macro.
-                'ProgramDatabaseFile': '$(TargetPath).pdb',
-              }
-            },
-          }],
-        ],  # win_z7!=0
-      }],  # OS==win
-      ['enable_task_manager==1', {
-        'defines': [
-          'ENABLE_TASK_MANAGER=1',
-        ],
-      }],
-      ['enable_web_intents==1', {
-        'defines': [
-          'ENABLE_WEB_INTENTS=1',
-        ],
-      }],
-      ['enable_extensions==1', {
-        'defines': [
-          'ENABLE_EXTENSIONS=1',
-        ],
-      }],
-      ['OS=="win" and branding=="Chrome"', {
-        'defines': ['ENABLE_SWIFTSHADER'],
-      }],
-      ['enable_dart==1', {
-        'defines': ['WEBKIT_USING_DART=1'],
-      }],
-      ['enable_plugin_installation==1', {
-        'defines': ['ENABLE_PLUGIN_INSTALLATION=1'],
-      }],
-      ['enable_plugins==1', {
-        'defines': ['ENABLE_PLUGINS=1'],
-      }],
-      ['enable_session_service==1', {
-        'defines': ['ENABLE_SESSION_SERVICE=1'],
-      }],
-      ['enable_themes==1', {
-        'defines': ['ENABLE_THEMES=1'],
-      }],
-      ['enable_background==1', {
-        'defines': ['ENABLE_BACKGROUND=1'],
-      }],
-      ['enable_automation==1', {
-        'defines': ['ENABLE_AUTOMATION=1'],
-      }],
-      ['enable_google_now==1', {
-        'defines': ['ENABLE_GOOGLE_NOW=1'],
-      }],
-      ['enable_language_detection==1', {
-        'defines': ['ENABLE_LANGUAGE_DETECTION=1'],
-      }],
-      ['enable_printing==1', {
-        'defines': ['ENABLE_PRINTING=1'],
-      }],
-      ['enable_captive_portal_detection==1', {
-        'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
-      }],
-      ['enable_app_list==1', {
-        'defines': ['ENABLE_APP_LIST=1'],
-      }],
-      ['enable_settings_app==1', {
-        'defines': ['ENABLE_SETTINGS_APP=1'],
-      }],
-      ['disable_ftp_support==1', {
-        'defines': ['DISABLE_FTP_SUPPORT=1'],
-      }],
     ],  # conditions for 'target_defaults'
     'target_conditions': [
       ['enable_wexit_time_destructors==1', {
@@ -1939,74 +421,7 @@
           }],
         ],
       }],
-      ['chromium_code==0', {
-        'conditions': [
-          [ 'os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell"', {
-            # We don't want to get warnings from third-party code,
-            # so remove any existing warning-enabling flags like -Wall.
-            'cflags!': [
-              '-Wall',
-              '-Wextra',
-            ],
-            'cflags_cc': [
-              # Don't warn about hash_map in third-party code.
-              '-Wno-deprecated',
-            ],
-            'cflags': [
-              # Don't warn about printf format problems.
-              # This is off by default in gcc but on in Ubuntu's gcc(!).
-              '-Wno-format',
-            ],
-            'cflags_cc!': [
-              # TODO(fischman): remove this.
-              # http://code.google.com/p/chromium/issues/detail?id=90453
-              '-Wsign-compare',
-            ]
-          }],
-          # TODO: Fix all warnings on chromeos too.
-          [ 'os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell" and (clang!=1 or chromeos==1)', {
-            'cflags!': [
-              '-Werror',
-            ],
-          }],
-          [ 'os_posix==1 and os_bsd!=1 and OS!="mac" and OS!="android" and OS!="lb_shell"', {
-            'cflags': [
-              # Don't warn about ignoring the return value from e.g. close().
-              # This is off by default in some gccs but on by default in others.
-              # BSD systems do not support this option, since they are usually
-              # using gcc 4.2.1, which does not have this flag yet.
-              '-Wno-unused-result',
-            ],
-          }],
-          # TODO(darin): Unfortunately, some third_party code depends on base.
-          [ 'target_os=="win" and component=="shared_library"', {
-            'msvs_disabled_warnings': [
-              4251,  # class 'std::xx' needs to have dll-interface.
-            ],
-          }],
-          [ 'OS=="mac" or OS=="ios"', {
-            'xcode_settings': {
-              'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
-            },
-            'conditions': [
-              ['buildtype=="Official"', {
-                'xcode_settings': {
-                  'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',    # -Werror
-                },
-              }],
-            ],
-          }],
-          [ 'OS=="ios"', {
-            'xcode_settings': {
-              # TODO(ios): Fix remaining warnings in third-party code, then
-              # remove this; the Mac cleanup didn't get everything that's
-              # flagged in an iOS build.
-              'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
-              'RUN_CLANG_STATIC_ANALYZER': 'NO',
-            },
-          }],
-        ],
-      }, {
+      ['chromium_code!=0', {
         'includes': [
            # Rules for excluding e.g. foo_win.cc from the build on non-Windows.
           'filename_rules.gypi',
@@ -2142,15 +557,6 @@
           },
         },
         'conditions': [
-          ['OS=="linux" or OS=="android"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '<@(debug_extra_cflags)',
-                ],
-              }],
-            ],
-          }],
           # Disabled on iOS because it was causing a crash on startup.
           # TODO(michelea): investigate, create a reduced test and possibly
           # submit a radar.
@@ -2176,13 +582,8 @@
         'msvs_settings': {
           'VCCLCompilerTool': {
             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
+            'Optimization': '<(win_release_Optimization)',
             'conditions': [
-              # In official builds, each target will self-select
-              # an optimization level.
-              ['buildtype!="Official"', {
-                  'Optimization': '<(win_release_Optimization)',
-                },
-              ],
               # According to MSVS, InlineFunctionExpansion=0 means
               # "default inlining", not "/Ob0".
               # Thus, we have to handle InlineFunctionExpansion==0 separately.
@@ -2235,1570 +636,11 @@
               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
             ],
           }],
-          ['win_use_allocator_shim==0', {
-            'defines': ['NO_TCMALLOC'],
-          }],
-          ['os_posix==1 and chromium_code==1', {
-            # Non-chromium code is not guaranteed to compile cleanly
-            # with _FORTIFY_SOURCE. Also, fortified build may fail
-            # when optimizations are disabled, so only do that for Release
-            # build.
-            'defines': [
-              '_FORTIFY_SOURCE=2',
-            ],
-          }],
-          ['OS=="linux" or OS=="android"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '<@(release_extra_cflags)',
-                ],
-              }],
-            ],
-          }],
         ],
       },
-      'conditions': [
-        [ 'OS=="win"', {
-          # TODO(bradnelson): add a gyp mechanism to make this more graceful.
-          'Debug_x64': {
-            'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
-          },
-          'Release_x64': {
-            'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
-          },
-        }],
-      ],
     },
   },
   'conditions': [
-    ['os_posix==1 and OS!="lb_shell"', {
-      'target_defaults': {
-        'cflags': [
-          # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc
-          # supports it.
-          '-fstack-protector',
-          '--param=ssp-buffer-size=4',
-        ],
-        'ldflags': [
-          '-Wl,-z,now',
-          '-Wl,-z,relro',
-        ],
-      },
-    }],
-    ['os_posix==1 and OS!="mac" and OS!="ios" and OS!="lb_shell"', {
-      'target_defaults': {
-        # Enable -Werror by default, but put it in a variable so it can
-        # be disabled in ~/.gyp/include.gypi on the valgrind builders.
-        'variables': {
-          'werror%': '-Werror',
-          'libraries_for_target%': '',
-        },
-        'defines': [
-          '_FILE_OFFSET_BITS=64',
-        ],
-        'cflags': [
-          '<(werror)',  # See note above about the werror variable.
-          '-pthread',
-          '-fno-exceptions',
-          '-fno-strict-aliasing',  # See http://crbug.com/32204
-          '-Wall',
-          # TODO(evan): turn this back on once all the builds work.
-          # '-Wextra',
-          # Don't warn about unused function params.  We use those everywhere.
-          '-Wno-unused-parameter',
-          # Don't warn about the "struct foo f = {0};" initialization pattern.
-          '-Wno-missing-field-initializers',
-          # Don't export any symbols (for example, to plugins we dlopen()).
-          # Note: this is *required* to make some plugins work.
-          '-fvisibility=hidden',
-          '-pipe',
-        ],
-        'cflags_cc': [
-          '-fno-rtti',
-          '-fno-threadsafe-statics',
-          # Make inline functions have hidden visiblity by default.
-          # Surprisingly, not covered by -fvisibility=hidden.
-          '-fvisibility-inlines-hidden',
-          # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't,
-          # so we specify it explicitly.
-          # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it.
-          # http://code.google.com/p/chromium/issues/detail?id=90453
-          '-Wsign-compare',
-        ],
-        'ldflags': [
-          '-pthread', '-Wl,-z,noexecstack',
-        ],
-        'libraries' : [
-          '<(libraries_for_target)',
-        ],
-        'configurations': {
-          'Debug_Base': {
-            'variables': {
-              'debug_optimize%': '0',
-            },
-            'defines': [
-              '_DEBUG',
-            ],
-            'cflags': [
-              '-O>(debug_optimize)',
-              '-g',
-            ],
-            'conditions' : [
-              ['OS=="android" and android_full_debug==0', {
-                # Some configurations are copied from Release_Base to reduce
-                # the binary size.
-                'variables': {
-                  'debug_optimize%': 's',
-                },
-                'cflags': [
-                  '-fomit-frame-pointer',
-                  '-fdata-sections',
-                  '-ffunction-sections',
-                ],
-                'ldflags': [
-                  '-Wl,-O1',
-                  '-Wl,--as-needed',
-                  '-Wl,--gc-sections',
-                ],
-              }],
-            ],
-          },
-          'Release_Base': {
-            'variables': {
-              'release_optimize%': '2',
-              # Binaries become big and gold is unable to perform GC
-              # and remove unused sections for some of test targets
-              # on 32 bit platform.
-              # (This is currently observed only in chromeos valgrind bots)
-              # The following flag is to disable --gc-sections linker
-              # option for these bots.
-              'no_gc_sections%': 0,
-
-              # TODO(bradnelson): reexamine how this is done if we change the
-              # expansion of configurations
-              'release_valgrind_build%': 0,
-            },
-            'cflags': [
-              '-O<(release_optimize)',
-              # Don't emit the GCC version ident directives, they just end up
-              # in the .comment section taking up binary size.
-              '-fno-ident',
-              # Put data and code in their own sections, so that unused symbols
-              # can be removed at link time with --gc-sections.
-              '-fdata-sections',
-              '-ffunction-sections',
-            ],
-            'ldflags': [
-              # Specifically tell the linker to perform optimizations.
-              # See http://lwn.net/Articles/192624/ .
-              '-Wl,-O1',
-              '-Wl,--as-needed',
-            ],
-            'conditions' : [
-              ['no_gc_sections==0', {
-                'ldflags': [
-                  '-Wl,--gc-sections',
-                ],
-              }],
-              ['OS=="android"', {
-                'variables': {
-                  'release_optimize%': 's',
-                },
-                'cflags': [
-                  '-fomit-frame-pointer',
-                ],
-              }],
-              ['clang==1', {
-                'cflags!': [
-                  '-fno-ident',
-                ],
-              }],
-              ['profiling==1', {
-                'cflags': [
-                  '-fno-omit-frame-pointer',
-                  '-g',
-                ],
-              }],
-            ],
-          },
-        },
-        'variants': {
-          'coverage': {
-            'cflags': ['-fprofile-arcs', '-ftest-coverage'],
-            'ldflags': ['-fprofile-arcs'],
-          },
-          'profile': {
-            'cflags': ['-pg', '-g'],
-            'ldflags': ['-pg'],
-          },
-          'symbols': {
-            'cflags': ['-g'],
-          },
-        },
-        'conditions': [
-          ['target_arch=="ia32"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'asflags': [
-                  # Needed so that libs with .s files (e.g. libicudata.a)
-                  # are compatible with the general 32-bit-ness.
-                  '-32',
-                ],
-                # All floating-point computations on x87 happens in 80-bit
-                # precision.  Because the C and C++ language standards allow
-                # the compiler to keep the floating-point values in higher
-                # precision than what's specified in the source and doing so
-                # is more efficient than constantly rounding up to 64-bit or
-                # 32-bit precision as specified in the source, the compiler,
-                # especially in the optimized mode, tries very hard to keep
-                # values in x87 floating-point stack (in 80-bit precision)
-                # as long as possible. This has important side effects, that
-                # the real value used in computation may change depending on
-                # how the compiler did the optimization - that is, the value
-                # kept in 80-bit is different than the value rounded down to
-                # 64-bit or 32-bit. There are possible compiler options to
-                # make this behavior consistent (e.g. -ffloat-store would keep
-                # all floating-values in the memory, thus force them to be
-                # rounded to its original precision) but they have significant
-                # runtime performance penalty.
-                #
-                # -mfpmath=sse -msse2 makes the compiler use SSE instructions
-                # which keep floating-point values in SSE registers in its
-                # native precision (32-bit for single precision, and 64-bit
-                # for double precision values). This means the floating-point
-                # value used during computation does not change depending on
-                # how the compiler optimized the code, since the value is
-                # always kept in its specified precision.
-                'conditions': [
-                  ['branding=="Chromium" and disable_sse2==0', {
-                    'cflags': [
-                      '-march=pentium4',
-                      '-msse2',
-                      '-mfpmath=sse',
-                    ],
-                  }],
-                  # ChromeOS targets Pinetrail, which is sse3, but most of the
-                  # benefit comes from sse2 so this setting allows ChromeOS
-                  # to build on other CPUs.  In the future -march=atom would
-                  # help but requires a newer compiler.
-                  ['chromeos==1 and disable_sse2==0', {
-                    'cflags': [
-                      '-msse2',
-                    ],
-                  }],
-                  # Install packages have started cropping up with
-                  # different headers between the 32-bit and 64-bit
-                  # versions, so we have to shadow those differences off
-                  # and make sure a 32-bit-on-64-bit build picks up the
-                  # right files.
-                  # For android build, use NDK headers instead of host headers
-                  ['host_arch!="ia32" and OS!="android"', {
-                    'include_dirs+': [
-                      '/usr/include32',
-                    ],
-                  }],
-                ],
-                # -mmmx allows mmintrin.h to be used for mmx intrinsics.
-                # video playback is mmx and sse2 optimized.
-                'cflags': [
-                  '-m32',
-                  '-mmmx',
-                ],
-                'ldflags': [
-                  '-m32',
-                ],
-              }],
-            ],
-          }],
-          ['target_arch=="arm"', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags_cc': [
-                  # The codesourcery arm-2009q3 toolchain warns at that the ABI
-                  # has changed whenever it encounters a varargs function. This
-                  # silences those warnings, as they are not helpful and
-                  # clutter legitimate warnings.
-                  '-Wno-abi',
-                ],
-                'conditions': [
-                  ['arm_thumb==1', {
-                    'cflags': [
-                    '-mthumb',
-                    ]
-                  }],
-                  ['armv7==1', {
-                    'cflags': [
-                      '-march=armv7-a',
-                      '-mtune=cortex-a8',
-                      '-mfloat-abi=<(arm_float_abi)',
-                    ],
-                    'conditions': [
-                      ['arm_neon==1', {
-                        'cflags': [ '-mfpu=neon', ],
-                      }, {
-                        'cflags': [ '-mfpu=<(arm_fpu)', ],
-                      }],
-                    ],
-                  }],
-                  ['OS=="android"', {
-                    # Most of the following flags are derived from what Android
-                    # uses by default when building for arm, reference for which
-                    # can be found in the following file in the Android NDK:
-                    # toolchains/arm-linux-androideabi-4.4.3/setup.mk
-                    'cflags': [
-                      # The tree-sra optimization (scalar replacement for
-                      # aggregates enabling subsequent optimizations) leads to
-                      # invalid code generation when using the Android NDK's
-                      # compiler (r5-r7). This can be verified using
-                      # TestWebKitAPI's WTF.Checked_int8_t test.
-                      '-fno-tree-sra',
-                      '-fuse-ld=gold',
-                      '-Wno-psabi',
-                    ],
-                    # Android now supports .relro sections properly.
-                    # NOTE: While these flags enable the generation of .relro
-                    # sections, the generated libraries can still be loaded on
-                    # older Android platform versions.
-                    'ldflags': [
-                        '-Wl,-z,relro',
-                        '-Wl,-z,now',
-                        '-fuse-ld=gold',
-                    ],
-                    'conditions': [
-                      ['arm_thumb==1', {
-                        # Android toolchain doesn't support -mimplicit-it=thumb
-                        'cflags!': [ '-Wa,-mimplicit-it=thumb' ],
-                        'cflags': [ '-mthumb-interwork' ],
-                      }],
-                      ['armv7==0', {
-                        # Flags suitable for Android emulator
-                        'cflags': [
-                          '-march=armv5te',
-                          '-mtune=xscale',
-                          '-msoft-float',
-                        ],
-                        'defines': [
-                          '__ARM_ARCH_5__',
-                          '__ARM_ARCH_5T__',
-                          '__ARM_ARCH_5E__',
-                          '__ARM_ARCH_5TE__',
-                        ],
-                      }],
-                      ['profiling==1', {
-                        'cflags': [
-                          '-marm', # Probably reduntant, but recommend by "perf" docs.
-                          '-mapcs-frame', # Seems required by -fno-omit-frame-pointer.
-                        ],
-                      }],
-                      ['clang==1', {
-                        'cflags!': [
-                          # Clang does not support the following options.
-                          '-mthumb-interwork',
-                          '-finline-limit=64',
-                          '-fno-tree-sra',
-                          '-fuse-ld=gold',
-                          '-Wno-psabi',
-                        ],
-                      }],
-                    ],
-                    'target_conditions': [
-                      # ndk-build copies .a's around the filesystem, breaking
-                      # relative paths in thin archives.  Disable using thin
-                      # archives to avoid problems until one of these is fixed:
-                      # http://code.google.com/p/android/issues/detail?id=40302
-                      # http://code.google.com/p/android/issues/detail?id=40303
-                      ['_type=="static_library"', {
-                        'standalone_static_library': 1,
-                      }],
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['linux_fpic==1', {
-            'cflags': [
-              '-fPIC',
-            ],
-            'ldflags': [
-              '-fPIC',
-            ],
-          }],
-          ['sysroot!=""', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '--sysroot=<(sysroot)',
-                ],
-                'ldflags': [
-                  '--sysroot=<(sysroot)',
-                ],
-              }]]
-          }],
-          ['clang==1', {
-            'cflags': [
-              '-Wheader-hygiene',
-              # Clang spots more unused functions.
-              '-Wno-unused-function',
-              # Don't die on dtoa code that uses a char as an array index.
-              '-Wno-char-subscripts',
-              # Especially needed for gtest macros using enum values from Mac
-              # system headers.
-              # TODO(pkasting): In C++11 this is legal, so this should be
-              # removed when we change to that.  (This is also why we don't
-              # bother fixing all these cases today.)
-              '-Wno-unnamed-type-template-args',
-              # This (rightfully) complains about 'override', which we use
-              # heavily.
-              '-Wno-c++11-extensions',
-
-              # Warns on switches on enums that cover all enum values but
-              # also contain a default: branch. Chrome is full of that.
-              '-Wno-covered-switch-default',
-            ],
-            'cflags!': [
-              # Clang doesn't seem to know know this flag.
-              '-mfpmath=sse',
-            ],
-          }],
-          ['clang==1 and clang_use_chrome_plugins==1', {
-            'cflags': [
-              '<@(clang_chrome_plugins_flags)',
-            ],
-          }],
-          ['clang==1 and clang_load!=""', {
-            'cflags': [
-              '-Xclang', '-load', '-Xclang', '<(clang_load)',
-            ],
-          }],
-          ['clang==1 and clang_add_plugin!=""', {
-            'cflags': [
-              '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
-            ],
-          }],
-          ['clang==1 and "<(GENERATOR)"=="ninja"', {
-            'cflags': [
-              # See http://crbug.com/110262
-              '-fcolor-diagnostics',
-            ],
-          }],
-          ['asan==1', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '-fsanitize=address',
-                  '-fno-omit-frame-pointer',
-                  '-w',  # http://crbug.com/162783
-                ],
-                'ldflags': [
-                  '-fsanitize=address',
-                ],
-                'defines': [
-                  'ADDRESS_SANITIZER',
-                ],
-              }],
-            ],
-          }],
-          ['tsan==1', {
-            'target_conditions': [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '-fsanitize=thread',
-                  '-fno-omit-frame-pointer',
-                  '-fPIE',
-                  '-mllvm', '-tsan-blacklist=<(tsan_blacklist)',
-                ],
-                'ldflags': [
-                  '-fsanitize=thread',
-                ],
-                'defines': [
-                  'THREAD_SANITIZER',
-                  'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1',
-                  'WTF_USE_DYNAMIC_ANNOTATIONS_NOIMPL=1',
-                ],
-                'target_conditions': [
-                  ['_type=="executable"', {
-                    'ldflags': [
-                      '-pie',
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', {
-            'target_conditions' : [
-              ['_toolset=="target"', {
-                'cflags': [
-                  '-finstrument-functions',
-                  # Allow mmx intrinsics to inline, so that the
-                  # compiler can expand the intrinsics.
-                  '-finstrument-functions-exclude-file-list=mmintrin.h',
-                ],
-              }],
-            ],
-          }],
-          ['linux_breakpad==1', {
-            'cflags': [ '-g' ],
-            'defines': ['USE_LINUX_BREAKPAD'],
-            'conditions': [
-              ['target_arch=="ia32"', {
-                'target_conditions': [
-                  ['_toolset=="target"', {
-                    'ldflags': [
-                      # Workaround for linker OOM. http://crbug.com/160253.
-                      '-Wl,--no-keep-files-mapped',
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['linux_use_heapchecker==1', {
-            'variables': {'linux_use_tcmalloc%': 1},
-            'defines': ['USE_HEAPCHECKER'],
-          }],
-          ['linux_use_tcmalloc==0', {
-            'defines': ['NO_TCMALLOC'],
-          }],
-          ['linux_keep_shadow_stacks==1', {
-            'defines': ['KEEP_SHADOW_STACKS'],
-            'cflags': [
-              '-finstrument-functions',
-              # Allow mmx intrinsics to inline, so that the compiler can expand
-              # the intrinsics.
-              '-finstrument-functions-exclude-file-list=mmintrin.h',
-            ],
-          }],
-          ['linux_use_gold_flags==1', {
-            'ldflags': [
-              # Experimentation found that using four linking threads
-              # saved ~20% of link time.
-              # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
-              '-Wl,--threads',
-              '-Wl,--thread-count=4',
-            ],
-            'conditions': [
-              ['release_valgrind_build==0', {
-                'target_conditions': [
-                  ['_toolset=="target"', {
-                    'ldflags': [
-                      # There seems to be a conflict of --icf and -pie
-                      # in gold which can generate crashy binaries. As
-                      # a security measure, -pie takes precendence for
-                      # now.
-                      #'-Wl,--icf=safe',
-                      '-Wl,--icf=none',
-                    ],
-                  }],
-                ],
-              }],
-            ],
-          }],
-          ['linux_use_gold_binary==1', {
-            'variables': {
-              'conditions': [
-                ['inside_chromium_build==1', {
-                  # We pass the path to gold to the compiler.  gyp leaves
-                  # unspecified what the cwd is when running the compiler,
-                  # so the normal gyp path-munging fails us.  This hack
-                  # gets the right path.
-                  'gold_path': '<(PRODUCT_DIR)/../../third_party/gold',
-                }, {
-                  'gold_path': '<(PRODUCT_DIR)/../../Source/WebKit/chromium/third_party/gold',
-                }]
-              ]
-            },
-            'ldflags': [
-              # Put our gold binary in the search path for the linker.
-              '-B<(gold_path)',
-            ],
-          }],
-        ],
-      },
-    }],
-    # FreeBSD-specific options; note that most FreeBSD options are set above,
-    # with Linux.
-    ['OS=="freebsd"', {
-      'target_defaults': {
-        'ldflags': [
-          '-Wl,--no-keep-memory',
-        ],
-      },
-    }],
-    # Android-specific options; note that most are set above with Linux.
-    ['OS=="android"', {
-      'variables': {
-        # This is a unique identifier for a given build. It's used for
-        # identifying various build artifacts corresponding to a particular
-        # build of chrome (e.g. where to find archived symbols).
-        'chrome_build_id%': '',
-        'conditions': [
-          # Use shared stlport library when system one used.
-          # Figure this out early since it needs symbols from libgcc.a, so it
-          # has to be before that in the set of libraries.
-          ['use_system_stlport==1', {
-            'android_stlport_library': 'stlport',
-          }, {
-            'conditions': [
-              ['component=="shared_library"', {
-                  'android_stlport_library': 'stlport_shared',
-              }, {
-                  'android_stlport_library': 'stlport_static',
-              }],
-            ],
-          }],
-        ],
-
-        # Placing this variable here prevents from forking libvpx, used
-        # by remoting.  Remoting is off, so it needn't built,
-        # so forking it's deps seems like overkill.
-        # But this variable need defined to properly run gyp.
-        # A proper solution is to have an OS==android conditional
-        # in third_party/libvpx/libvpx.gyp to define it.
-        'libvpx_path': 'lib/linux/arm',
-      },
-      'target_defaults': {
-        'variables': {
-          'release_extra_cflags%': '',
-        },
-
-        'target_conditions': [
-          # Settings for building device targets using Android's toolchain.
-          # These are based on the setup.mk file from the Android NDK.
-          #
-          # The NDK Android executable link step looks as follows:
-          #  $LDFLAGS
-          #  $(TARGET_CRTBEGIN_DYNAMIC_O)  <-- crtbegin.o
-          #  $(PRIVATE_OBJECTS)            <-- The .o that we built
-          #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
-          #  $(TARGET_LIBGCC)              <-- libgcc.a
-          #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
-          #  $(PRIVATE_LDLIBS)             <-- System .so
-          #  $(TARGET_CRTEND_O)            <-- crtend.o
-          #
-          # For now the above are approximated for executables by adding
-          # crtbegin.o to the end of the ldflags and 'crtend.o' to the end
-          # of 'libraries'.
-          #
-          # The NDK Android shared library link step looks as follows:
-          #  $LDFLAGS
-          #  $(PRIVATE_OBJECTS)            <-- The .o that we built
-          #  -l,--whole-archive
-          #  $(PRIVATE_WHOLE_STATIC_LIBRARIES)
-          #  -l,--no-whole-archive
-          #  $(PRIVATE_STATIC_LIBRARIES)   <-- The .a that we built
-          #  $(TARGET_LIBGCC)              <-- libgcc.a
-          #  $(PRIVATE_SHARED_LIBRARIES)   <-- The .so that we built
-          #  $(PRIVATE_LDLIBS)             <-- System .so
-          #
-          # For now, assume that whole static libraries are not needed.
-          #
-          # For both executables and shared libraries, add the proper
-          # libgcc.a to the start of libraries which puts it in the
-          # proper spot after .o and .a files get linked in.
-          #
-          # TODO: The proper thing to do longer-tem would be proper gyp
-          # support for a custom link command line.
-          ['_toolset=="target"', {
-            'cflags!': [
-              '-pthread',  # Not supported by Android toolchain.
-            ],
-            'cflags': [
-              '-ffunction-sections',
-              '-funwind-tables',
-              '-g',
-              '-fstack-protector',
-              '-fno-short-enums',
-              '-finline-limit=64',
-              '-Wa,--noexecstack',
-              '<@(release_extra_cflags)',
-            ],
-            'defines': [
-              'ANDROID',
-              '__GNU_SOURCE=1',  # Necessary for clone()
-              'USE_STLPORT=1',
-              '_STLP_USE_PTR_SPECIALIZATIONS=1',
-              'CHROME_BUILD_ID="<(chrome_build_id)"',
-            ],
-            'ldflags!': [
-              '-pthread',  # Not supported by Android toolchain.
-            ],
-            'ldflags': [
-              '-nostdlib',
-              '-Wl,--no-undefined',
-              # Don't export symbols from statically linked libraries.
-              '-Wl,--exclude-libs=ALL',
-            ],
-            'libraries': [
-              '-l<(android_stlport_library)',
-              # Manually link the libgcc.a that the cross compiler uses.
-              '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
-              '-lc',
-              '-ldl',
-              '-lstdc++',
-              '-lm',
-            ],
-            'conditions': [
-              ['component=="shared_library"', {
-                'libraries': [
-                  '-lgnustl_shared',
-                ],
-                'ldflags!': [
-                  '-Wl,--exclude-libs=ALL',
-                ],
-              }],
-              ['clang==1', {
-                'cflags': [
-                  # Work around incompatibilities between bionic and clang
-                  # headers.
-                  '-D__compiler_offsetof=__builtin_offsetof',
-                  '-Dnan=__builtin_nan',
-                ],
-                'conditions': [
-                  ['target_arch=="arm"', {
-                    'cflags': [
-                      '-target arm-linux-androideabi',
-                      '-mllvm -arm-enable-ehabi',
-                    ],
-                    'ldflags': [
-                      '-target arm-linux-androideabi',
-                    ],
-                  }],
-                  ['target_arch=="ia32"', {
-                    'cflags': [
-                      '-target x86-linux-androideabi',
-                    ],
-                    'ldflags': [
-                      '-target x86-linux-androideabi',
-                    ],
-                  }],
-                ],
-              }],
-              ['asan==1', {
-                'cflags': [
-                  # Android build relies on -Wl,--gc-sections removing
-                  # unreachable code. ASan instrumentation for globals inhibits
-                  # this and results in a library with unresolvable relocations.
-                  # TODO(eugenis): find a way to reenable this.
-                  '-mllvm -asan-globals=0',
-                ],
-              }],
-              ['android_build_type==0', {
-                'defines': [
-                  # The NDK has these things, but doesn't define the constants
-                  # to say that it does. Define them here instead.
-                  'HAVE_SYS_UIO_H',
-                ],
-                'cflags': [
-                  '--sysroot=<(android_ndk_sysroot)',
-                ],
-                'ldflags': [
-                  '--sysroot=<(android_ndk_sysroot)',
-                ],
-              }],
-              ['android_build_type==1', {
-                'include_dirs': [
-                  # OpenAL headers from the Android tree.
-                  '<(android_src)/frameworks/wilhelm/include',
-                ],
-                'cflags': [
-                  # Android predefines this as 1; undefine it here so Chromium
-                  # can redefine it later to be 2 for chromium code and unset
-                  # for third party code. This works because cflags are added
-                  # before defines.
-                  '-U_FORTIFY_SOURCE',
-                  # Chromium builds its own (non-third-party) code with
-                  # -Werror to make all warnings into errors. However, Android
-                  # enables warnings that Chromium doesn't, so some of these
-                  # extra warnings trip and break things.
-                  # For now, we leave these warnings enabled but prevent them
-                  # from being treated as errors.
-                  #
-                  # Things that are part of -Wextra:
-                  '-Wno-error=extra', # Enabled by -Wextra, but no specific flag
-                  '-Wno-error=ignored-qualifiers',
-                  '-Wno-error=type-limits',
-                  # Other things unrelated to -Wextra:
-                  '-Wno-error=non-virtual-dtor',
-                  '-Wno-error=sign-promo',
-                ],
-                'cflags_cc': [
-                  # Disabling c++0x-compat should be handled in WebKit, but
-                  # this currently doesn't work because gcc_version is not set
-                  # correctly when building with the Android build system.
-                  # TODO(torne): Fix this in WebKit.
-                  '-Wno-error=c++0x-compat',
-                ],
-              }],
-              ['android_build_type==1 and chromium_code==0', {
-                'cflags': [
-                  # There is a class of warning which:
-                  #  1) Android always enables and also treats as errors
-                  #  2) Chromium ignores in third party code
-                  # For now, I am leaving these warnings enabled but preventing
-                  # them from being treated as errors here.
-                  '-Wno-error=address',
-                  '-Wno-error=format-security',
-                  '-Wno-error=non-virtual-dtor',
-                  '-Wno-error=return-type',
-                  '-Wno-error=sequence-point',
-                ],
-              }],
-              ['target_arch == "arm"', {
-                'ldflags': [
-                  # Enable identical code folding to reduce size.
-                  '-Wl,--icf=safe',
-                ],
-              }],
-              # NOTE: The stlport header include paths below are specified in
-              # cflags rather than include_dirs because they need to come
-              # after include_dirs. Think of them like system headers, but
-              # don't use '-isystem' because the arm-linux-androideabi-4.4.3
-              # toolchain (circa Gingerbread) will exhibit strange errors.
-              # The include ordering here is important; change with caution.
-              ['use_system_stlport==1', {
-                'cflags': [
-                  # For libstdc++/include, which is used by stlport.
-                  '-I<(android_src)/bionic',
-                  '-I<(android_src)/external/stlport/stlport',
-                ],
-              }, { # else: use_system_stlport!=1
-                'cflags': [
-                  '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport',
-                  '-I<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/include',
-                ],
-                'conditions': [
-                  ['target_arch=="arm" and armv7==1', {
-                    'ldflags': [
-                      '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7a',
-                      '-L<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a',
-                    ],
-                  }],
-                  ['target_arch=="arm" and armv7==0', {
-                    'ldflags': [
-                      '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi',
-                      '-L<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi',
-                    ],
-                  }],
-                  ['target_arch=="ia32"', {
-                    'ldflags': [
-                      '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86',
-                      '-L<(android_ndk_root)/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86',
-                    ],
-                  }],
-                ],
-              }],
-              ['target_arch=="ia32"', {
-                # The x86 toolchain currently has problems with stack-protector.
-                'cflags!': [
-                  '-fstack-protector',
-                ],
-                'cflags': [
-                  '-fno-stack-protector',
-                ],
-              }],
-            ],
-            'target_conditions': [
-              ['_type=="executable"', {
-                'ldflags': [
-                  '-Bdynamic',
-                  '-Wl,-dynamic-linker,/system/bin/linker',
-                  '-Wl,--gc-sections',
-                  '-Wl,-z,nocopyreloc',
-                  # crtbegin_dynamic.o should be the last item in ldflags.
-                  '<(android_ndk_lib)/crtbegin_dynamic.o',
-                ],
-                'libraries': [
-                  # crtend_android.o needs to be the last item in libraries.
-                  # Do not add any libraries after this!
-                  '<(android_ndk_lib)/crtend_android.o',
-                ],
-                'conditions': [
-                  ['asan==1', {
-                    'cflags': [
-                      '-fPIE',
-                    ],
-                    'ldflags': [
-                      '-pie',
-                    ],
-                  }],
-                ],
-              }],
-              ['_type=="shared_library" or _type=="loadable_module"', {
-                'ldflags': [
-                  '-Wl,-shared,-Bsymbolic',
-                  # crtbegin_so.o should be the last item in ldflags.
-                  '<(android_ndk_lib)/crtbegin_so.o',
-                ],
-                'libraries': [
-                  # crtend_so.o needs to be the last item in libraries.
-                  # Do not add any libraries after this!
-                  '<(android_ndk_lib)/crtend_so.o',
-                ],
-              }],
-            ],
-          }],
-          # Settings for building host targets using the system toolchain.
-          ['_toolset=="host"', {
-            'cflags!': [
-              # Due to issues in Clang build system, using ASan on 32-bit
-              # binaries on x86_64 host is problematic.
-              # TODO(eugenis): re-enable.
-              '-fsanitize=address',
-              '-w',  # http://crbug.com/162783
-            ],
-            'ldflags!': [
-              '-fsanitize=address',
-              '-Wl,-z,noexecstack',
-              '-Wl,--gc-sections',
-              '-Wl,-O1',
-              '-Wl,--as-needed',
-            ],
-            'sources/': [
-              ['exclude', '_android(_unittest)?\\.cc$'],
-              ['exclude', '(^|/)android/']
-            ],
-          }],
-        ],
-      },
-    }],
-    ['OS=="solaris"', {
-      'cflags!': ['-fvisibility=hidden'],
-      'cflags_cc!': ['-fvisibility-inlines-hidden'],
-    }],
-    ['OS=="mac" or OS=="ios"', {
-      'target_defaults': {
-        'mac_bundle': 0,
-        'xcode_settings': {
-          'ALWAYS_SEARCH_USER_PATHS': 'NO',
-          # Don't link in libarclite_macosx.a, see http://crbug.com/156530.
-          'CLANG_LINK_OBJC_RUNTIME': 'NO',          # -fno-objc-link-runtime
-          'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
-          'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
-          'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
-          'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
-          'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
-          # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
-          'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
-          'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
-          'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
-          'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
-          'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
-          'GCC_VERSION': '4.2',
-          'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
-          'USE_HEADERMAP': 'NO',
-          'WARNING_CFLAGS': [
-            '-Wall',
-            '-Wendif-labels',
-            '-Wextra',
-            # Don't warn about unused function parameters.
-            '-Wno-unused-parameter',
-            # Don't warn about the "struct foo f = {0};" initialization
-            # pattern.
-            '-Wno-missing-field-initializers',
-          ],
-          'conditions': [
-            ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
-                                 {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
-            ],
-            # Note that the prebuilt Clang binaries should not be used for iOS
-            # development except for ASan builds.
-            ['clang==1', {
-              'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
-              'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
-
-              # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
-              # when building with clang. This warning is triggered when the
-              # override keyword is used via the OVERRIDE macro from
-              # base/compiler_specific.h.
-              'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
-              # Warn if automatic synthesis is triggered with
-              # the -Wobjc-missing-property-synthesis flag.
-              'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
-              'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
-              'WARNING_CFLAGS': [
-                '-Wheader-hygiene',
-
-                # This warns on using ints as initializers for floats in
-                # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
-                # which happens in several places in chrome code. Not sure if
-                # this is worth fixing.
-                '-Wno-c++11-narrowing',
-
-                # This warns about code like |"0x%08"NACL_PRIxPTR| -- with C++11
-                # user-defined literals, this is now a string literal with a UD
-                # suffix. However, this is used heavily in NaCl code, so disable
-                # the warning for now.
-                '-Wno-reserved-user-defined-literal',
-
-                # Don't die on dtoa code that uses a char as an array index.
-                # This is required solely for base/third_party/dmg_fp/dtoa.cc.
-                '-Wno-char-subscripts',
-                # Clang spots more unused functions.
-                '-Wno-unused-function',
-
-                # Warns on switches on enums that cover all enum values but
-                # also contain a default: branch. Chrome is full of that.
-                '-Wno-covered-switch-default',
-              ],
-              'OTHER_CPLUSPLUSFLAGS': [
-                # gnu++11 instead of c++11 so that __ANSI_C__ doesn't get
-                # defined.  (Else e.g. finite() in base/float_util.h needs to
-                # be isfinite() which doesn't exist on the android bots.)
-                # typeof() is also disabled in c++11 (but we could use
-                # decltype() instead).
-                # TODO(thakis): Use CLANG_CXX_LANGUAGE_STANDARD instead once all
-                # bots use xcode 4 -- http://crbug.com/147515).
-                # TODO(thakis): Eventually switch this to c++11 instead of
-                # gnu++11 (once typeof can be removed, which is blocked on c++11
-                # being available everywhere).
-                '$(inherited)', '-std=gnu++11',
-              ],
-            }],
-            ['clang==1 and clang_use_chrome_plugins==1', {
-              'OTHER_CFLAGS': [
-                '<@(clang_chrome_plugins_flags)',
-              ],
-            }],
-            ['clang==1 and clang_load!=""', {
-              'OTHER_CFLAGS': [
-                '-Xclang', '-load', '-Xclang', '<(clang_load)',
-              ],
-            }],
-            ['clang==1 and clang_add_plugin!=""', {
-              'OTHER_CFLAGS': [
-                '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
-              ],
-            }],
-            ['clang==1 and "<(GENERATOR)"=="ninja"', {
-              'OTHER_CFLAGS': [
-                # See http://crbug.com/110262
-                '-fcolor-diagnostics',
-              ],
-            }],
-          ],
-        },
-        'conditions': [
-          ['clang==1', {
-            'variables': {
-              'clang_dir': '../third_party/llvm-build/Release+Asserts/bin',
-            },
-          }],
-          ['asan==1', {
-            'xcode_settings': {
-              'OTHER_CFLAGS': [
-                '-fsanitize=address',
-                '-w',  # http://crbug.com/162783
-              ],
-            },
-            'defines': [
-              'ADDRESS_SANITIZER',
-            ],
-          }],
-        ],
-        'target_conditions': [
-          ['_type!="static_library"', {
-            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
-            'conditions': [
-              ['asan==1', {
-                'xcode_settings': {
-                  'OTHER_LDFLAGS': [
-                    '-fsanitize=address',
-                  ],
-                },
-              }],
-            ],
-          }],
-          ['_mac_bundle', {
-            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
-          }],
-        ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="mac" or OS=="ios"
-    ['OS=="mac"', {
-      'target_defaults': {
-        'variables': {
-          # These should end with %, but there seems to be a bug with % in
-          # variables that are intended to be set to different values in
-          # different targets, like these.
-          'mac_pie': 1,        # Most executables can be position-independent.
-          'mac_real_dsym': 0,  # Fake .dSYMs are fine in most cases.
-          # Strip debugging symbols from the target.
-          'mac_strip': '<(mac_strip_release)',
-        },
-        'xcode_settings': {
-          'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
-                                                    # (Equivalent to -fPIC)
-          # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
-          'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
-          # Keep pch files below xcodebuild/.
-          'SHARED_PRECOMPS_DIR': '$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders',
-          'OTHER_CFLAGS': [
-            '-fno-strict-aliasing',  # See http://crbug.com/32204
-          ],
-        },
-        'target_conditions': [
-          ['_type=="executable"', {
-            'postbuilds': [
-              {
-                # Arranges for data (heap) pages to be protected against
-                # code execution when running on Mac OS X 10.7 ("Lion"), and
-                # ensures that the position-independent executable (PIE) bit
-                # is set for ASLR when running on Mac OS X 10.5 ("Leopard").
-                'variables': {
-                  # Define change_mach_o_flags in a variable ending in _path
-                  # so that GYP understands it's a path and performs proper
-                  # relativization during dict merging.
-                  'change_mach_o_flags_path':
-                      'mac/change_mach_o_flags_from_xcode.sh',
-                  'change_mach_o_flags_options%': [
-                  ],
-                  'target_conditions': [
-                    ['mac_pie==0 or release_valgrind_build==1', {
-                      # Don't enable PIE if it's unwanted. It's unwanted if
-                      # the target specifies mac_pie=0 or if building for
-                      # Valgrind, because Valgrind doesn't understand slide.
-                      # See the similar mac_pie/release_valgrind_build check
-                      # below.
-                      'change_mach_o_flags_options': [
-                        '--no-pie',
-                      ],
-                    }],
-                  ],
-                },
-                'postbuild_name': 'Change Mach-O Flags',
-                'action': [
-                  '<(change_mach_o_flags_path)',
-                  '>@(change_mach_o_flags_options)',
-                ],
-              },
-            ],
-            'conditions': [
-              ['asan==1', {
-                'variables': {
-                 'asan_saves_file': 'asan.saves',
-                },
-                'xcode_settings': {
-                  'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)',
-                },
-              }],
-            ],
-            'target_conditions': [
-              ['mac_pie==1 and release_valgrind_build==0', {
-                # Turn on position-independence (ASLR) for executables. When
-                # PIE is on for the Chrome executables, the framework will
-                # also be subject to ASLR.
-                # Don't do this when building for Valgrind, because Valgrind
-                # doesn't understand slide. TODO: Make Valgrind on Mac OS X
-                # understand slide, and get rid of the Valgrind check.
-                'xcode_settings': {
-                  'OTHER_LDFLAGS': [
-                    '-Wl,-pie',  # Position-independent executable (MH_PIE)
-                  ],
-                },
-              }],
-            ],
-          }],
-          ['(_type=="executable" or _type=="shared_library" or \
-             _type=="loadable_module") and mac_strip!=0', {
-            'target_conditions': [
-              ['mac_real_dsym == 1', {
-                # To get a real .dSYM bundle produced by dsymutil, set the
-                # debug information format to dwarf-with-dsym.  Since
-                # strip_from_xcode will not be used, set Xcode to do the
-                # stripping as well.
-                'configurations': {
-                  'Release_Base': {
-                    'xcode_settings': {
-                      'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
-                      'DEPLOYMENT_POSTPROCESSING': 'YES',
-                      'STRIP_INSTALLED_PRODUCT': 'YES',
-                      'target_conditions': [
-                        ['_type=="shared_library" or _type=="loadable_module"', {
-                          # The Xcode default is to strip debugging symbols
-                          # only (-S).  Local symbols should be stripped as
-                          # well, which will be handled by -x.  Xcode will
-                          # continue to insert -S when stripping even when
-                          # additional flags are added with STRIPFLAGS.
-                          'STRIPFLAGS': '-x',
-                        }],  # _type=="shared_library" or _type=="loadable_module"'
-                      ],  # target_conditions
-                    },  # xcode_settings
-                  },  # configuration "Release"
-                },  # configurations
-              }, {  # mac_real_dsym != 1
-                # To get a fast fake .dSYM bundle, use a post-build step to
-                # produce the .dSYM and strip the executable.  strip_from_xcode
-                # only operates in the Release configuration.
-                'postbuilds': [
-                  {
-                    'variables': {
-                      # Define strip_from_xcode in a variable ending in _path
-                      # so that gyp understands it's a path and performs proper
-                      # relativization during dict merging.
-                      'strip_from_xcode_path': 'mac/strip_from_xcode',
-                    },
-                    'postbuild_name': 'Strip If Needed',
-                    'action': ['<(strip_from_xcode_path)'],
-                  },
-                ],  # postbuilds
-              }],  # mac_real_dsym
-            ],  # target_conditions
-          }],  # (_type=="executable" or _type=="shared_library" or
-               #  _type=="loadable_module") and mac_strip!=0
-        ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="mac"
-    ['OS=="ios"', {
-      'target_defaults': {
-        'xcode_settings' : {
-          'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
-
-          # This next block is mostly common with the 'mac' section above,
-          # but keying off (or setting) 'clang' isn't valid for iOS as it
-          # also seems to mean using the custom build of clang.
-
-          # Don't use -Wc++0x-extensions, which Xcode 4 enables by default
-          # when building with clang. This warning is triggered when the
-          # override keyword is used via the OVERRIDE macro from
-          # base/compiler_specific.h.
-          'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
-          # Warn if automatic synthesis is triggered with
-          # the -Wobjc-missing-property-synthesis flag.
-          'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
-          'WARNING_CFLAGS': [
-            '-Wheader-hygiene',
-            # Don't die on dtoa code that uses a char as an array index.
-            # This is required solely for base/third_party/dmg_fp/dtoa.cc.
-            '-Wno-char-subscripts',
-            # Clang spots more unused functions.
-            '-Wno-unused-function',
-            # See comments on this flag higher up in this file.
-            '-Wno-unnamed-type-template-args',
-            # This (rightfully) complains about 'override', which we use
-            # heavily.
-            '-Wno-c++11-extensions',
-          ],
-        },
-        'target_conditions': [
-          ['_type=="executable"', {
-            'configurations': {
-              'Release_Base': {
-                'xcode_settings': {
-                  'DEPLOYMENT_POSTPROCESSING': 'YES',
-                  'STRIP_INSTALLED_PRODUCT': 'YES',
-                },
-              },
-              'Debug_Base': {
-                'xcode_settings': {
-                  # Remove dSYM to reduce build time.
-                  'DEBUG_INFORMATION_FORMAT': 'dwarf',
-                },
-              },
-            },
-            'xcode_settings': {
-              'conditions': [
-                ['chromium_ios_signing', {
-                  # iOS SDK wants everything for device signed.
-                  'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer',
-                }, {
-                  'CODE_SIGNING_REQUIRED': 'NO',
-                  'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
-                }],
-              ],
-            },
-          }],
-        ],  # target_conditions
-      },  # target_defaults
-    }],  # OS=="ios"
-    ['OS=="win"', {
-      'target_defaults': {
-        'defines': [
-          '_WIN32_WINNT=0x0602',
-          'WINVER=0x0602',
-          'WIN32',
-          '_WINDOWS',
-          'NOMINMAX',
-          'PSAPI_VERSION=1',
-          '_CRT_RAND_S',
-          'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
-          'WIN32_LEAN_AND_MEAN',
-          '_ATL_NO_OPENGL',
-        ],
-        'conditions': [
-          ['buildtype=="Official"', {
-              # In official builds, targets can self-select an optimization
-              # level by defining a variable named 'optimize', and setting it
-              # to one of
-              # - "size", optimizes for minimal code size - the default.
-              # - "speed", optimizes for speed over code size.
-              # - "max", whole program optimization and link-time code
-              #   generation. This is very expensive and should be used
-              #   sparingly.
-              'variables': {
-                'optimize%': 'size',
-              },
-              'target_conditions': [
-                ['optimize=="size"', {
-                    'msvs_settings': {
-                      'VCCLCompilerTool': {
-                        # 1, optimizeMinSpace, Minimize Size (/O1)
-                        'Optimization': '1',
-                        # 2, favorSize - Favor small code (/Os)
-                        'FavorSizeOrSpeed': '2',
-                      },
-                    },
-                  },
-                ],
-                ['optimize=="speed"', {
-                    'msvs_settings': {
-                      'VCCLCompilerTool': {
-                        # 2, optimizeMaxSpeed, Maximize Speed (/O2)
-                        'Optimization': '2',
-                        # 1, favorSpeed - Favor fast code (/Ot)
-                        'FavorSizeOrSpeed': '1',
-                      },
-                    },
-                  },
-                ],
-                ['optimize=="max"', {
-                    'msvs_settings': {
-                      'VCCLCompilerTool': {
-                        # 2, optimizeMaxSpeed, Maximize Speed (/O2)
-                        'Optimization': '2',
-                        # 1, favorSpeed - Favor fast code (/Ot)
-                        'FavorSizeOrSpeed': '1',
-                        # This implies link time code generation.
-                        'WholeProgramOptimization': 'true',
-                      },
-                    },
-                  },
-                ],
-              ],
-            },
-          ],
-          ['component=="static_library"', {
-            'defines': [
-              '_HAS_EXCEPTIONS=0',
-            ],
-          }],
-          ['MSVS_VERSION=="2008"', {
-            'defines': [
-              '_HAS_TR1=0',
-            ],
-          }],
-          ['secure_atl', {
-            'defines': [
-              '_SECURE_ATL',
-            ],
-          }],
-          ['msvs_express', {
-            'configurations': {
-              'x86_Base': {
-                'msvs_settings': {
-                  'VCLinkerTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/i386'],
-                  },
-                  'VCLibrarianTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/i386'],
-                  },
-                },
-              },
-              'x64_Base': {
-                'msvs_settings': {
-                  'VCLibrarianTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/amd64'],
-                  },
-                  'VCLinkerTool': {
-                    'AdditionalLibraryDirectories':
-                      ['<(windows_driver_kit_path)/lib/ATL/amd64'],
-                  },
-                },
-              },
-            },
-            'msvs_settings': {
-              'VCLinkerTool': {
-                # Explicitly required when using the ATL with express
-                'AdditionalDependencies': ['atlthunk.lib'],
-
-                # ATL 8.0 included in WDK 7.1 makes the linker to generate
-                # almost eight hundred LNK4254 and LNK4078 warnings:
-                #   - warning LNK4254: section 'ATL' (50000040) merged into
-                #     '.rdata' (40000040) with different attributes
-                #   - warning LNK4078: multiple 'ATL' sections found with
-                #     different attributes
-                'AdditionalOptions': ['/ignore:4254', '/ignore:4078'],
-              },
-            },
-            'msvs_system_include_dirs': [
-              '<(windows_driver_kit_path)/inc/atl71',
-              '<(windows_driver_kit_path)/inc/mfc42',
-            ],
-          }],
-        ],
-        'msvs_system_include_dirs': [
-          '<(windows_sdk_path)/Include/shared',
-          '<(windows_sdk_path)/Include/um',
-          '<(windows_sdk_path)/Include/winrt',
-          '<(directx_sdk_path)/Include',
-          '$(VSInstallDir)/VC/atlmfc/include',
-        ],
-        'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
-        'msvs_disabled_warnings': [4351, 4396, 4503, 4819,
-          # TODO(maruel): These warnings are level 4. They will be slowly
-          # removed as code is fixed.
-          4100, 4121, 4125, 4127, 4130, 4131, 4189, 4201, 4238, 4244, 4245,
-          4310, 4355, 4428, 4481, 4505, 4510, 4512, 4530, 4610, 4611, 4701,
-          4702, 4706,
-        ],
-        'msvs_settings': {
-          'VCCLCompilerTool': {
-            'AdditionalOptions': ['/MP'],
-            'MinimalRebuild': 'false',
-            'BufferSecurityCheck': 'true',
-            'EnableFunctionLevelLinking': 'true',
-            'RuntimeTypeInfo': 'false',
-            'WarningLevel': '4',
-            'WarnAsError': 'true',
-            'DebugInformationFormat': '3',
-            'conditions': [
-              ['component=="shared_library"', {
-                'ExceptionHandling': '1',  # /EHsc
-              }, {
-                'ExceptionHandling': '0',
-              }],
-            ],
-          },
-          'VCLibrarianTool': {
-            'AdditionalOptions': ['/ignore:4221'],
-            'AdditionalLibraryDirectories': [
-              '<(directx_sdk_path)/Lib/x86',
-              '<(windows_sdk_path)/Lib/win8/um/x86',
-            ],
-          },
-          'VCLinkerTool': {
-            'AdditionalDependencies': [
-              'wininet.lib',
-              'dnsapi.lib',
-              'version.lib',
-              'msimg32.lib',
-              'ws2_32.lib',
-              'usp10.lib',
-              'psapi.lib',
-              'dbghelp.lib',
-              'winmm.lib',
-              'shlwapi.lib',
-            ],
-
-            'conditions': [
-              ['MSVS_VERSION=="2005e"', {
-                # Non-express versions link automatically to these
-                'AdditionalDependencies': [
-                  'advapi32.lib',
-                  'comdlg32.lib',
-                  'ole32.lib',
-                  'shell32.lib',
-                  'user32.lib',
-                  'winspool.lib',
-                ],
-              }],
-            ],
-            'AdditionalLibraryDirectories': [
-              '<(directx_sdk_path)/Lib/x86',
-              '<(windows_sdk_path)/Lib/win8/um/x86',
-            ],
-            'GenerateDebugInformation': 'true',
-            'MapFileName': '$(OutDir)\\$(TargetName).map',
-            'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
-            'FixedBaseAddress': '1',
-            # SubSystem values:
-            #   0 == not set
-            #   1 == /SUBSYSTEM:CONSOLE
-            #   2 == /SUBSYSTEM:WINDOWS
-            # Most of the executables we'll ever create are tests
-            # and utilities with console output.
-            'SubSystem': '1',
-          },
-          'VCMIDLTool': {
-            'GenerateStublessProxies': 'true',
-            'TypeLibraryName': '$(InputName).tlb',
-            'OutputDirectory': '$(IntDir)',
-            'HeaderFileName': '$(InputName).h',
-            'DLLDataFileName': '$(InputName).dlldata.c',
-            'InterfaceIdentifierFileName': '$(InputName)_i.c',
-            'ProxyFileName': '$(InputName)_p.c',
-          },
-          'VCResourceCompilerTool': {
-            'Culture' : '1033',
-            'AdditionalIncludeDirectories': [
-              '<(DEPTH)',
-              '<(SHARED_INTERMEDIATE_DIR)',
-            ],
-          },
-        },
-      },
-    }],
-    ['disable_nacl==1', {
-      'target_defaults': {
-        'defines': [
-          'DISABLE_NACL',
-        ],
-      },
-    }],
-    ['OS=="win" and msvs_use_common_linker_extras', {
-      'target_defaults': {
-        'msvs_settings': {
-          'VCLinkerTool': {
-            'DelayLoadDLLs': [
-              'dbghelp.dll',
-              'dwmapi.dll',
-              'shell32.dll',
-              'uxtheme.dll',
-            ],
-          },
-        },
-        'configurations': {
-          'x86_Base': {
-            'msvs_settings': {
-              'VCLinkerTool': {
-                'AdditionalOptions': [
-                  '/safeseh',
-                  '/dynamicbase',
-                  '/ignore:4199',
-                  '/ignore:4221',
-                  '/nxcompat',
-                ],
-              },
-            },
-          },
-          'x64_Base': {
-            'msvs_settings': {
-              'VCLinkerTool': {
-                'AdditionalOptions': [
-                  # safeseh is not compatible with x64
-                  '/dynamicbase',
-                  '/ignore:4199',
-                  '/ignore:4221',
-                  '/nxcompat',
-                ],
-              },
-            },
-          },
-        },
-      },
-    }],
-    ['enable_new_npdevice_api==1', {
-      'target_defaults': {
-        'defines': [
-          'ENABLE_NEW_NPDEVICE_API',
-        ],
-      },
-    }],
     ['clang==1', {
       'conditions': [
         ['OS=="android"', {
@@ -3823,18 +665,6 @@
         }],
       ],
     }],
-    ['OS=="android" and clang==0', {
-      # Hardcode the compiler names in the Makefile so that
-      # it won't depend on the environment at make time.
-      'make_global_settings': [
-        ['CC', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)'],
-        ['CXX', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-g++)'],
-        ['LINK', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)'],
-        ['CC.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which gcc))'],
-        ['CXX.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which g++))'],
-        ['LINK.host', '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <!(which g++))'],
-      ],
-    }],
   ],
   'xcode_settings': {
     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
@@ -3842,39 +672,6 @@
     # file.  It's almost always wrong to put things here.  Specify your
     # custom xcode_settings in target_defaults to add them to targets instead.
 
-    'conditions': [
-      # In an Xcode Project Info window, the "Base SDK for All Configurations"
-      # setting sets the SDK on a project-wide basis. In order to get the
-      # configured SDK to show properly in the Xcode UI, SDKROOT must be set
-      # here at the project level.
-      ['OS=="mac"', {
-        'conditions': [
-          ['mac_sdk_path==""', {
-            'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
-          }, {
-            'SDKROOT': '<(mac_sdk_path)',  # -isysroot
-          }],
-        ],
-      }],
-      ['OS=="ios"', {
-        'conditions': [
-          ['ios_sdk_path==""', {
-            'SDKROOT': 'iphoneos<(ios_sdk)',  # -isysroot
-          }, {
-            'SDKROOT': '<(ios_sdk_path)',  # -isysroot
-          }],
-        ],
-      }],
-      ['OS=="ios"', {
-        'ARCHS': '$(ARCHS_UNIVERSAL_IPHONE_OS)',
-        # Just build armv7, until armv7s is correctly tested.
-        'VALID_ARCHS': 'armv7 i386',
-        'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
-        # Target both iPhone and iPad.
-        'TARGETED_DEVICE_FAMILY': '1,2',
-      }],
-    ],
-
     # The Xcode generator will look for an xcode_settings section at the root
     # of each dict and use it to apply settings on a file-wide basis.  Most
     # settings should not be here, they should be in target-specific
diff --git a/src/build/filename_rules.gypi b/src/build/filename_rules.gypi
index 9fd40db..6ae44dc 100644
--- a/src/build/filename_rules.gypi
+++ b/src/build/filename_rules.gypi
@@ -57,7 +57,7 @@
         ['exclude', '(^|/)posix/'],
       ],
     }],
-    ['<(chromeos)!=1 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_chromeos(_unittest)?\\.(h|cc)$'] ]
     }],
     ['>(nacl_untrusted_build)==0', {
@@ -70,35 +70,35 @@
         ['exclude', '_xdg(_unittest)?\\.(h|cc)$'],
       ],
     }],
-    ['<(use_x11)!=1 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [
         ['exclude', '_(x|x11)(_unittest)?\\.(h|cc)$'],
         ['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],
       ],
     }],
-    ['<(toolkit_uses_gtk)!=1 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [
         ['exclude', '_gtk(_browsertest|_unittest)?\\.(h|cc)$'],
         ['exclude', '(^|/)gtk/'],
         ['exclude', '(^|/)gtk_[^/]*\\.(h|cc)$'],
       ],
     }],
-    ['<(toolkit_views)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
     }],
-    ['<(use_aura)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_aura(_unittest)?\\.(h|cc)$'],
                     ['exclude', '_aura(_browsertest)?\\.(h|cc)$'],
                     ['exclude', '(^|/)aura/'],
       ]
     }],
-    ['<(use_aura)==0 or <(use_x11)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_aurax11\\.(h|cc)$'] ]
     }],
-    ['<(use_aura)==0 or OS!="win" or >(nacl_untrusted_build)==1', {
+    ['OS!="win" or >(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_aurawin\\.(h|cc)$'] ]
     }],
-    ['<(use_ash)==0 or >(nacl_untrusted_build)==1', {
+    ['>(nacl_untrusted_build)==1', {
       'sources/': [ ['exclude', '_ash(_browsertest|_unittest)?\\.(h|cc)$'],
                     ['exclude', '(^|/)ash/'],
       ]
diff --git a/src/cobalt/CHANGELOG.md b/src/cobalt/CHANGELOG.md
index 3deb938..57b1de8 100644
--- a/src/cobalt/CHANGELOG.md
+++ b/src/cobalt/CHANGELOG.md
@@ -76,3 +76,9 @@
    command line option "--fps_stdout".  The frame rate statistics will be
    updated each time an animation ends, or after 60 frames have been processed.
    Both command line flags are available in Gold builds.
+
+ - **Add support for rendering `kSbDecodeTargetFormat1PlaneUYVY` (YUV 422)**
+
+   Decode targets with the format `kSbDecodeTargetFormat1PlaneUYVY` will now
+   be rendered by Cobalt.  This will allow decoders that produce YUV 422 UYVY
+   video frames to now efficiently support 360 video.
\ No newline at end of file
diff --git a/src/cobalt/accessibility/screen_reader_tests.cc b/src/cobalt/accessibility/screen_reader_tests.cc
index 1319c0d..2814b21 100644
--- a/src/cobalt/accessibility/screen_reader_tests.cc
+++ b/src/cobalt/accessibility/screen_reader_tests.cc
@@ -139,6 +139,7 @@
   GURL url(std::string("file:///cobalt/accessibility/testdata/live_region/" +
                        GetParam().html_file_name));
   const math::Size kDefaultViewportSize(1280, 720);
+  const float kDefaultVideoPixelRatio = 1.0f;
   const float kRefreshRate = 60.0f;
 
   network::NetworkModule network_module((network::NetworkModule::Options()));
@@ -167,7 +168,7 @@
       base::Bind(&LiveRegionMutationTest::Quit, base::Unretained(this)),
       base::Closure(), /* window_minimize_callback */
       NULL /* media_module */, &network_module, kDefaultViewportSize,
-      &resource_provider, NULL /* system_window */, kRefreshRate,
+      kDefaultVideoPixelRatio, &resource_provider, kRefreshRate,
       web_module_options);
 
   // Wait for the test to quit.
diff --git a/src/cobalt/system_window/application_event.h b/src/cobalt/base/application_event.h
similarity index 61%
rename from src/cobalt/system_window/application_event.h
rename to src/cobalt/base/application_event.h
index eb0f1dd..a36210c 100644
--- a/src/cobalt/system_window/application_event.h
+++ b/src/cobalt/base/application_event.h
@@ -12,36 +12,25 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef COBALT_SYSTEM_WINDOW_APPLICATION_EVENT_H_
-#define COBALT_SYSTEM_WINDOW_APPLICATION_EVENT_H_
+#ifndef COBALT_BASE_APPLICATION_EVENT_H_
+#define COBALT_BASE_APPLICATION_EVENT_H_
 
 #include "cobalt/base/event.h"
+#include "starboard/event.h"
 
-namespace cobalt {
-namespace system_window {
+namespace base {
 
 class ApplicationEvent : public base::Event {
  public:
-  enum Type {
-    kPause,
-    kPreload,
-    kQuit,
-    kResume,
-    kStart,
-    kSuspend,
-    kUnpause,
-  };
-
-  explicit ApplicationEvent(Type type) : type_(type) {}
-  Type type() const { return type_; }
+  explicit ApplicationEvent(SbEventType type) : type_(type) {}
+  SbEventType type() const { return type_; }
 
   BASE_EVENT_SUBCLASS(ApplicationEvent);
 
  private:
-  Type type_;
+  SbEventType type_;
 };
 
-}  // namespace system_window
-}  // namespace cobalt
+}  // namespace base
 
-#endif  // COBALT_SYSTEM_WINDOW_APPLICATION_EVENT_H_
+#endif  // COBALT_BASE_APPLICATION_EVENT_H_
diff --git a/src/cobalt/base/c_val_collection_entry_stats.h b/src/cobalt/base/c_val_collection_entry_stats.h
index faf7ad1..6f353de 100644
--- a/src/cobalt/base/c_val_collection_entry_stats.h
+++ b/src/cobalt/base/c_val_collection_entry_stats.h
@@ -30,6 +30,41 @@
 namespace base {
 namespace CValDetail {
 
+// This struct contains the data generated by flushes of
+// CValCollectionEntryStats for use with callbacks.
+template <typename EntryType>
+struct CValCollectionEntryStatsFlushResults {
+  typedef base::Callback<void(const CValCollectionEntryStatsFlushResults&)>
+      OnFlushCallback;
+
+  CValCollectionEntryStatsFlushResults(size_t sample_count, EntryType average,
+                                       EntryType minimum, EntryType maximum,
+                                       EntryType standard_deviation,
+                                       EntryType percentile_25th,
+                                       EntryType percentile_50th,
+                                       EntryType percentile_75th,
+                                       EntryType percentile_95th)
+      : sample_count(sample_count),
+        average(average),
+        minimum(minimum),
+        maximum(maximum),
+        standard_deviation(standard_deviation),
+        percentile_25th(percentile_25th),
+        percentile_50th(percentile_50th),
+        percentile_75th(percentile_75th),
+        percentile_95th(percentile_95th) {}
+
+  size_t sample_count;
+  EntryType average;
+  EntryType minimum;
+  EntryType maximum;
+  EntryType standard_deviation;
+  EntryType percentile_25th;
+  EntryType percentile_50th;
+  EntryType percentile_75th;
+  EntryType percentile_95th;
+};
+
 // This class tracks a collection of entries, which it retains in memory. When
 // either the max size of the collection is reached or Flush() is manually
 // called, the count, average, minimum, maximum, 25th, 50th, 75th and 95th
@@ -51,33 +86,8 @@
  public:
   static const size_t kNoMaxSize = 0;
 
-  struct FlushResults {
-    FlushResults(size_t sample_count, EntryType average, EntryType minimum,
-                 EntryType maximum, EntryType standard_deviation,
-                 EntryType percentile_25th, EntryType percentile_50th,
-                 EntryType percentile_75th, EntryType percentile_95th)
-        : sample_count(sample_count),
-          average(average),
-          minimum(minimum),
-          maximum(maximum),
-          standard_deviation(standard_deviation),
-          percentile_25th(percentile_25th),
-          percentile_50th(percentile_50th),
-          percentile_75th(percentile_75th),
-          percentile_95th(percentile_95th) {}
-
-    size_t sample_count;
-    EntryType average;
-    EntryType minimum;
-    EntryType maximum;
-    EntryType standard_deviation;
-    EntryType percentile_25th;
-    EntryType percentile_50th;
-    EntryType percentile_75th;
-    EntryType percentile_95th;
-  };
-
-  typedef base::Callback<void(const FlushResults&)> OnFlushCallback;
+  typedef CValCollectionEntryStatsFlushResults<EntryType> FlushResults;
+  typedef typename FlushResults::OnFlushCallback OnFlushCallback;
 
   CValCollectionEntryStatsImpl(
       const std::string& name, size_t max_size = kNoMaxSize,
@@ -305,14 +315,19 @@
 template <typename EntryType>
 class CValCollectionEntryStatsStub {
  public:
+  typedef CValCollectionEntryStatsFlushResults<EntryType> FlushResults;
+  typedef typename FlushResults::OnFlushCallback OnFlushCallback;
+
   explicit CValCollectionEntryStatsStub(const std::string& name) {
     UNREFERENCED_PARAMETER(name);
   }
-  CValCollectionEntryStatsStub(const std::string& name, size_t max_size,
-                               bool enable_entry_list_c_val) {
+  CValCollectionEntryStatsStub(
+      const std::string& name, size_t max_size, bool enable_entry_list_c_val,
+      const OnFlushCallback& on_flush = OnFlushCallback()) {
     UNREFERENCED_PARAMETER(name);
     UNREFERENCED_PARAMETER(max_size);
     UNREFERENCED_PARAMETER(enable_entry_list_c_val);
+    UNREFERENCED_PARAMETER(on_flush);
   }
 
   void AddEntry(const EntryType& value) { UNREFERENCED_PARAMETER(value); }
diff --git a/src/cobalt/base/c_val_collection_timer_stats.h b/src/cobalt/base/c_val_collection_timer_stats.h
index a40fb20..bee81ee 100644
--- a/src/cobalt/base/c_val_collection_timer_stats.h
+++ b/src/cobalt/base/c_val_collection_timer_stats.h
@@ -21,6 +21,11 @@
 
 namespace base {
 
+typedef CValDetail::CValCollectionEntryStatsFlushResults<TimeDelta>
+    CValCollectionTimerStatsFlushResults;
+typedef typename CValCollectionTimerStatsFlushResults::OnFlushCallback
+    CValCollectionTimerStatsOnFlushCallback;
+
 // This class is a wrapper around |CValCollectionEntryStats|.
 // |CValCollectionTimerStats| calculates the time elapsed between calls to
 // Start() and Stop() and adds it as an entry to |CValCollectionEntryStats|. It
@@ -31,10 +36,7 @@
 template <typename Visibility = CValDebug>
 class CValCollectionTimerStats {
  public:
-  typedef typename base::CValCollectionEntryStats<
-      base::TimeDelta, Visibility>::OnFlushCallback OnFlushCallback;
-  typedef typename base::CValCollectionEntryStats<
-      base::TimeDelta, Visibility>::FlushResults FlushResults;
+  typedef CValCollectionTimerStatsOnFlushCallback OnFlushCallback;
 
   explicit CValCollectionTimerStats(const std::string& name)
       : entry_stats_(name) {}
diff --git a/src/cobalt/base/clock.h b/src/cobalt/base/clock.h
index 01d5442..b3d418b 100644
--- a/src/cobalt/base/clock.h
+++ b/src/cobalt/base/clock.h
@@ -70,6 +70,22 @@
   const base::TimeDelta origin_;
 };
 
+// Simple clock that needs to be manually advanced.
+class ManualAdvanceClock : public base::Clock {
+ public:
+  base::TimeDelta Now() OVERRIDE { return value_; }
+
+  void Advance(const base::TimeDelta& advance_amount) {
+    DCHECK_GE(advance_amount, base::TimeDelta());
+    value_ += advance_amount;
+  }
+
+ private:
+  ~ManualAdvanceClock() OVERRIDE {}
+
+  base::TimeDelta value_;
+};
+
 }  // namespace base
 
 #endif  // COBALT_BASE_CLOCK_H_
diff --git a/src/cobalt/base/wrap_main.h b/src/cobalt/base/wrap_main.h
index 86114e8..35daf04 100644
--- a/src/cobalt/base/wrap_main.h
+++ b/src/cobalt/base/wrap_main.h
@@ -119,6 +119,13 @@
 #define COBALT_WRAP_EVENT_MAIN(start_function, event_function, stop_function) \
   COBALT_WRAP_BASE_MAIN(start_function, stop_function)
 
+// The generic main wrapper that initializes the main MessageLoop and
+// AtExitManager, supports a preload function, start function, event handler,
+// and stop function.
+#define COBALT_WRAP_MAIN(preload_function, start_function, event_function, \
+                         stop_function)                                    \
+  COBALT_WRAP_BASE_MAIN(start_function, stop_function)
+
 }  // namespace wrap_main
 }  // namespace cobalt
 
diff --git a/src/cobalt/base/wrap_main_starboard.h b/src/cobalt/base/wrap_main_starboard.h
index 17d8d40..aa57397 100644
--- a/src/cobalt/base/wrap_main_starboard.h
+++ b/src/cobalt/base/wrap_main_starboard.h
@@ -29,15 +29,18 @@
 namespace wrap_main {
 
 // Starboard implementation of the "Base Main" use case.
-template <StartFunction start_function, EventFunction event_function,
-          StopFunction stop_function>
+template <StartFunction preload_function, StartFunction start_function,
+          EventFunction event_function, StopFunction stop_function>
 void BaseEventHandler(const SbEvent* event) {
   static base::AtExitManager* g_at_exit = NULL;
   static MessageLoopForUI* g_loop = NULL;
+  static bool g_started = false;
   switch (event->type) {
-    case kSbEventTypeStart: {
+#if SB_API_VERSION >= SB_PRELOAD_API_VERSION
+    case kSbEventTypePreload: {
       SbEventStartData* data = static_cast<SbEventStartData*>(event->data);
 
+      DCHECK(!g_started);
       DCHECK(!g_at_exit);
       g_at_exit = new base::AtExitManager();
       InitCobalt(data->argument_count, data->argument_values, data->link);
@@ -47,11 +50,34 @@
       g_loop->set_thread_name("Main");
       g_loop->Start();
 
+      preload_function(data->argument_count, data->argument_values, data->link,
+                       base::Bind(&SbSystemRequestStop, 0));
+      g_started = true;
+      break;
+    }
+#endif  // SB_API_VERSION >= SB_PRELOAD_API_VERSION
+    case kSbEventTypeStart: {
+      SbEventStartData* data = static_cast<SbEventStartData*>(event->data);
+
+      if (!g_started) {
+        DCHECK(!g_at_exit);
+        g_at_exit = new base::AtExitManager();
+
+        InitCobalt(data->argument_count, data->argument_values, data->link);
+
+        DCHECK(!g_loop);
+        g_loop = new MessageLoopForUI();
+        g_loop->set_thread_name("Main");
+        g_loop->Start();
+      }
+
       start_function(data->argument_count, data->argument_values, data->link,
                      base::Bind(&SbSystemRequestStop, 0));
+      g_started = true;
       break;
     }
     case kSbEventTypeStop: {
+      DCHECK(g_started);
       DCHECK(g_at_exit);
       DCHECK(g_loop);
 
@@ -83,25 +109,34 @@
 }  // namespace wrap_main
 }  // namespace cobalt
 
-// Calls |main_function| at startup, creates an AtExitManager and calls
-// InitCobalt, and terminates once it is completed.
-#define COBALT_WRAP_SIMPLE_MAIN(main_function)                          \
-  STARBOARD_WRAP_SIMPLE_MAIN(                                           \
-      ::cobalt::wrap_main::CobaltMainAddOns<main_function>);
+// The generic main wrapper that initializes the main MessageLoop and
+// AtExitManager, supports a preload function, start function, event handler,
+// and stop function.
+#define COBALT_WRAP_MAIN(preload_function, start_function, event_function, \
+                         stop_function)                                    \
+  void SbEventHandle(const SbEvent* event) {                               \
+    return ::cobalt::wrap_main::BaseEventHandler<                          \
+        preload_function, start_function, event_function, stop_function>(  \
+        event);                                                            \
+  }
 
 // Like COBALT_WRAP_BASE_MAIN, but supports an event_function to forward
 // non-application events to.
 #define COBALT_WRAP_EVENT_MAIN(start_function, event_function, stop_function) \
-  void SbEventHandle(const SbEvent* event) {                                  \
-    return ::cobalt::wrap_main::BaseEventHandler<                             \
-        start_function, event_function, stop_function>(event);                \
-  }
+  COBALT_WRAP_MAIN(::cobalt::wrap_main::NoopStartFunction, start_function,    \
+                   event_function, stop_function)
 
 // Creates a MessageLoop and an AtExitManager, calls |start_function|, and
 // terminates once the MessageLoop terminates, calling |stop_function| on the
 // way out.
-#define COBALT_WRAP_BASE_MAIN(start_function, stop_function) \
-  COBALT_WRAP_EVENT_MAIN(                                    \
-      start_function, ::cobalt::wrap_main::NoopEventFunction, stop_function)
+#define COBALT_WRAP_BASE_MAIN(start_function, stop_function)               \
+  COBALT_WRAP_MAIN(::cobalt::wrap_main::NoopStartFunction, start_function, \
+                   ::cobalt::wrap_main::NoopEventFunction, stop_function)
+
+// Calls |main_function| at startup, creates an AtExitManager and calls
+// InitCobalt, and terminates once it is completed.
+#define COBALT_WRAP_SIMPLE_MAIN(main_function) \
+  STARBOARD_WRAP_SIMPLE_MAIN(                  \
+      ::cobalt::wrap_main::CobaltMainAddOns<main_function>);
 
 #endif  // COBALT_BASE_WRAP_MAIN_STARBOARD_H_
diff --git a/src/cobalt/bindings/code_generator_cobalt.py b/src/cobalt/bindings/code_generator_cobalt.py
index 043bad1..7227af8 100644
--- a/src/cobalt/bindings/code_generator_cobalt.py
+++ b/src/cobalt/bindings/code_generator_cobalt.py
@@ -596,6 +596,9 @@
                                             context['named_property_getter'] or
                                             context['named_property_deleter'])
 
+    names = sorted([key for key in interfaces_info])
+    context['unique_id'] = names.index(interface.name)
+
     return context
 
 
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
index b5178c9..eee757a 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/test_dictionary.h"
 
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
index 9740597..9c7df9d 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
@@ -283,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc
index ea95c8f..a810666 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_base_interface.cc
@@ -242,7 +242,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
index e47a9ed..a972552 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
@@ -281,7 +281,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -346,7 +345,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
index 59c48e9..5c0218b 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
@@ -367,7 +367,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -432,7 +431,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -497,7 +495,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -562,7 +559,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -627,7 +623,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
index f52a434..09b1d08 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
@@ -285,7 +285,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -350,7 +349,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
index 90e79e7..fc0d3f4 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
@@ -370,7 +370,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -419,7 +418,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
index 6ba4eeb..ed56d9f 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
@@ -509,7 +509,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -580,7 +579,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -657,7 +655,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
index cc0512e..ca7f7ce 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
@@ -246,7 +246,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
index d9c7928..1b341be 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
@@ -285,7 +285,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -350,7 +349,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
index 5b3a925..c3cbbef 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
@@ -283,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
index e66d97c..17e8569 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
@@ -285,7 +285,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
index 9ec5d55..f4b2722 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
@@ -283,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
index 36681ea..1ff02f5 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
@@ -281,7 +281,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -330,7 +329,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
index 5e4454a..acafd45 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
index d9a2ece..a884585 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
@@ -346,7 +346,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -411,7 +410,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -482,7 +480,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
index cfe8949..07aeddb 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
@@ -201,7 +201,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -254,7 +253,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
index 12df01c..81ab465 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
@@ -306,7 +306,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -371,7 +370,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -442,7 +440,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
index 7b5593e..e242258 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
@@ -505,7 +505,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -576,7 +575,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -653,7 +651,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -724,7 +721,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -801,7 +797,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
index b52697e..b9144d2 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
@@ -531,7 +531,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -596,7 +595,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -649,7 +647,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -714,7 +711,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -767,7 +763,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -832,7 +827,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -885,7 +879,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -950,7 +943,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
index 728b36e..5a27ac4 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
@@ -1675,7 +1675,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1740,7 +1739,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1793,7 +1791,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1858,7 +1855,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1911,7 +1907,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1976,7 +1971,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2041,7 +2035,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2094,7 +2087,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2147,7 +2139,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2212,7 +2203,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2265,7 +2255,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2330,7 +2319,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2383,7 +2371,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2448,7 +2435,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2501,7 +2487,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2566,7 +2551,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2631,7 +2615,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2684,7 +2667,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2737,7 +2719,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -2802,7 +2783,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
index e30f3c5..838dd0b 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
@@ -203,7 +203,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -256,7 +255,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -309,7 +307,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -372,7 +369,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -489,7 +485,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -566,7 +561,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -613,7 +607,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -678,7 +671,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -743,7 +735,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -832,7 +823,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -991,7 +981,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1056,7 +1045,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1155,7 +1143,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1208,7 +1195,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1275,7 +1261,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1380,7 +1365,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1445,7 +1429,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1492,7 +1475,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -1557,7 +1539,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
index 61d37cb..4993d19 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -246,7 +245,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -299,7 +297,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -352,7 +349,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -405,7 +401,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
index 69655e2..e05d81c 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
@@ -205,7 +205,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -258,7 +257,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -311,7 +309,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -364,7 +361,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -417,7 +413,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -470,7 +465,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -523,7 +517,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -576,7 +569,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -641,7 +633,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -706,7 +697,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -771,7 +761,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -836,7 +825,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -901,7 +889,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -966,7 +953,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
index f4ede71..56b185e 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
@@ -29,6 +29,7 @@
 #include "cobalt/script/mozjs/mozjs_callback_interface.h"
 #include "cobalt/script/mozjs/util/exception_helpers.h"
 #include "cobalt/script/mozjs/util/stack_trace_helpers.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/src/jsapi.h"
 #include "third_party/mozjs/js/src/jscntxt.h"
 
@@ -68,7 +69,7 @@
   bool success = false;
   base::optional<int32_t > cobalt_return_value;
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  AutoSaveExceptionState auto_save_exception_state(context_);
   ENABLE_JS_STACK_TRACE_IN_SCOPE(context_);
 
   // This could be set to NULL if it was garbage collected.
@@ -112,7 +113,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return cobalt_return_value;
 }
 
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
index 345a16f..5813a8f 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
@@ -199,15 +199,43 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAnonymousOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAnonymousOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAnonymousOperationInterface* impl =
       wrapper_private->wrappable<StringifierAnonymousOperationInterface>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
index 4afb9bc..8dc7f73 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
@@ -281,15 +281,43 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAttributeInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAttributeInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAttributeInterface* impl =
       wrapper_private->wrappable<StringifierAttributeInterface>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
index bba0eb7..d9fa758 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -252,15 +251,43 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierOperationInterface* impl =
       wrapper_private->wrappable<StringifierOperationInterface>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc
index 50d9053..c509b91 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_target_interface.cc
@@ -199,7 +199,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -246,7 +245,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc
index bba75f7..ea34cc4 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/mozjs_window.cc
@@ -609,7 +609,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -664,7 +663,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
@@ -772,7 +770,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h
index 4c36160..97ffad7 100644
--- a/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h
+++ b/src/cobalt/bindings/generated/mozjs/testing/cobalt/bindings/testing/test_dictionary.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/arbitrary_interface.h"
 
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
index b5178c9..eee757a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/dictionary_with_dictionary_member.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/test_dictionary.h"
 
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
index b06defe..4fedd30 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_indexed_getter_interface.cc
@@ -408,20 +408,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 0;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
index 680c83a..99c1120 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_getter_interface.cc
@@ -361,20 +361,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 1;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
index 52b9f5d..e2bbf8b 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_anonymous_named_indexed_getter_interface.cc
@@ -505,20 +505,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 2;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
index 2051e93..34b1625 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_arbitrary_interface.cc
@@ -276,7 +276,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -420,20 +419,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 3;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
index 278db4a..ae10c81 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_base_interface.cc
@@ -229,7 +229,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -373,20 +372,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 4;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
index 60e62a8..9eef1ad 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_boolean_type_test_interface.cc
@@ -275,7 +275,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -340,7 +339,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -484,20 +482,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 5;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
index 287ca7e..d4dd89a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_function_interface.cc
@@ -369,7 +369,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -434,7 +433,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -499,7 +497,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -564,7 +561,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -629,7 +625,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -800,20 +795,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 6;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
index c8d4f23..19ff19e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_callback_interface_interface.cc
@@ -279,7 +279,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -344,7 +343,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -482,20 +480,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 7;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
index 8aa44f7..7d8ae8d 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_conditional_interface.cc
@@ -372,7 +372,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -421,7 +420,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -578,20 +576,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 8;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
index 9fc7f7f..12749e6 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constants_interface.cc
@@ -321,20 +321,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 9;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
index 12948a7..eb15fb1 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_interface.cc
@@ -274,20 +274,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 10;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
index d7e4244..a309c05 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_constructor_with_arguments_interface.cc
@@ -421,20 +421,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 11;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
index d346835..0574f01 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_getter_setter_interface.cc
@@ -514,7 +514,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -585,7 +584,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -662,7 +660,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -809,20 +806,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 13;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
index 8971ca7..82deddc 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_derived_interface.cc
@@ -233,7 +233,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -377,20 +376,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 14;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
index d2278fb..ac2592b 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dictionary_interface.cc
@@ -279,7 +279,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -344,7 +343,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -500,20 +498,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 15;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
index 59f0f29..dba9f4e 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_disabled_interface.cc
@@ -277,7 +277,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -412,20 +411,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 17;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
index dcece70..f26ffc4 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_dom_string_test_interface.cc
@@ -746,20 +746,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 12;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
index e5b771e..1b4b7c3 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_enumeration_interface.cc
@@ -278,7 +278,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -438,20 +437,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 18;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
index b24c533..f6bb0dd 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exception_object_interface.cc
@@ -366,20 +366,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 19;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
index cd6f023..64559ee 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_exceptions_interface.cc
@@ -276,7 +276,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -420,20 +419,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 20;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
index 82699e1..4789a3a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_extended_idl_attributes_interface.cc
@@ -275,7 +275,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -324,7 +323,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -480,20 +478,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 21;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
index e13c005..f597106 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_garbage_collection_test_interface.cc
@@ -470,20 +470,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 22;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
index cd39673..a9d6b66 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_global_interface_parent.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -314,20 +313,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 23;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
index 77f6e6f..6effd9d 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_indexed_getter_interface.cc
@@ -338,7 +338,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -403,7 +402,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -474,7 +472,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -645,20 +642,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 25;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
index 85578ca..5943475 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_any.cc
@@ -186,7 +186,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -239,7 +238,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -398,20 +396,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 26;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
index bf9a3d0..024a736 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_interface_with_unsupported_properties.cc
@@ -313,20 +313,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 27;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
index a719c77..a013300 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_constructor_interface.cc
@@ -274,20 +274,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 28;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
index 0367daa..e183554 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_getter_interface.cc
@@ -297,7 +297,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -362,7 +361,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -433,7 +431,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -598,20 +595,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 29;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
index 5dea1d5..513dd5a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_named_indexed_getter_interface.cc
@@ -510,7 +510,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -581,7 +580,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -658,7 +656,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -729,7 +726,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -806,7 +802,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -959,20 +954,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 30;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
index 108fc17..243e148 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nested_put_forwards_interface.cc
@@ -386,20 +386,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 31;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
index 35d8aae..5940907 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_constructor_interface.cc
@@ -264,20 +264,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 32;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
index d7bae5a..bafa068 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_no_interface_object_interface.cc
@@ -227,20 +227,15 @@
 
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 33;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
index 7b18b10..8e96f5a 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_nullable_types_test_interface.cc
@@ -549,7 +549,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -614,7 +613,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -667,7 +665,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -732,7 +729,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -785,7 +781,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -850,7 +845,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -903,7 +897,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -968,7 +961,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1148,20 +1140,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 34;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
index 48dd07b..a06e9d8 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_numeric_types_test_interface.cc
@@ -1805,7 +1805,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1870,7 +1869,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1923,7 +1921,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1988,7 +1985,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2041,7 +2037,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2106,7 +2101,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2171,7 +2165,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2224,7 +2217,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2277,7 +2269,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2342,7 +2333,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2395,7 +2385,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2460,7 +2449,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2513,7 +2501,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2578,7 +2565,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2631,7 +2617,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2696,7 +2681,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2761,7 +2745,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2814,7 +2797,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2867,7 +2849,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -2932,7 +2913,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -3232,20 +3212,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 35;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
index 11db14d..d80da47 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_object_type_bindings_interface.cc
@@ -613,20 +613,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 36;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
index 78ee810..213d6bf 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_operations_test_interface.cc
@@ -189,7 +189,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -242,7 +241,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -295,7 +293,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -358,7 +355,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -475,7 +471,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -552,7 +547,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -599,7 +593,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -664,7 +657,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -729,7 +721,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -818,7 +809,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -977,7 +967,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1042,7 +1031,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1141,7 +1129,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1194,7 +1181,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1261,7 +1247,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1366,7 +1351,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1431,7 +1415,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1478,7 +1461,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1543,7 +1525,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1835,20 +1816,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 37;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
index bc07a75..62a9828 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_promise_interface.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -232,7 +231,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -285,7 +283,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -338,7 +335,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -391,7 +387,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -538,20 +533,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 38;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
index b139037..a4bbd60 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_put_forwards_interface.cc
@@ -435,20 +435,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 39;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
index 4473e30..fa79d52 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_sequence_user.cc
@@ -190,7 +190,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -243,7 +242,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -296,7 +294,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -349,7 +346,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -402,7 +398,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -455,7 +450,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -508,7 +502,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -561,7 +554,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -626,7 +618,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -691,7 +682,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -756,7 +746,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -821,7 +810,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -886,7 +874,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -951,7 +938,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -1146,20 +1132,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 40;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
index 3b0c942..bb92da0 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_single_operation_interface.cc
@@ -67,7 +67,7 @@
   bool success = false;
   base::optional<int32_t > cobalt_return_value;
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  JS::AutoSaveExceptionState auto_save_exception_state(context_);
 
   // This could be set to NULL if it was garbage collected.
   JS::RootedObject implementing_object(context_, implementing_object_.GetObject());
@@ -107,7 +107,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
   return cobalt_return_value;
 }
 
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
index d03a770..c51a115 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_static_properties_interface.cc
@@ -570,20 +570,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 42;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
index 0699d67..dfb6793 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_anonymous_operation_interface.cc
@@ -186,15 +186,43 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAnonymousOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAnonymousOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAnonymousOperationInterface* impl =
       wrapper_private->wrappable<StringifierAnonymousOperationInterface>().get();
   if (!impl) {
@@ -297,20 +325,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 43;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
index bd3097d..e861ff7 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_attribute_interface.cc
@@ -276,15 +276,43 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierAttributeInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierAttributeInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierAttributeInterface* impl =
       wrapper_private->wrappable<StringifierAttributeInterface>().get();
   if (!impl) {
@@ -393,20 +421,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 44;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
index da67d25..d0f28bd 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_stringifier_operation_interface.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -239,15 +238,43 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+    const JSClass* proto_class =
+      MozjsStringifierOperationInterface::PrototypeClass(context);
+  if (proto_class == JS_GetClass(object)) {
+    // Simply returns true if the object is this class's prototype object.
+    // There is no need to return any value due to the object is not a platform
+    // object. The execution reaches here when Object.getOwnPropertyDescriptor
+    // gets called on native object prototypes.
+    return true;
+  }
+
+  MozjsGlobalEnvironment* global_environment =
+      static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
+  WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
+  if (!wrapper_factory->DoesObjectImplementInterface(
+        object, base::GetTypeId<StringifierOperationInterface>())) {
+    MozjsExceptionState exception(context);
+    exception.SetSimpleException(script::kDoesNotImplementInterface);
+    return false;
+  }
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   StringifierOperationInterface* impl =
       wrapper_private->wrappable<StringifierOperationInterface>().get();
   if (!impl) {
@@ -353,20 +380,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 45;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
index f0da3bc..92e30b5 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_target_interface.cc
@@ -185,7 +185,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -232,7 +231,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -364,20 +362,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 46;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
index 9d1fe7b..a9026b2 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_union_types_interface.cc
@@ -656,20 +656,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 48;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
index 1414c2c..f0b91a4 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/mozjs_window.cc
@@ -613,7 +613,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -668,7 +667,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -776,7 +774,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
@@ -929,20 +926,15 @@
   DCHECK(success);
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = 50;
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h
index 4c36160..97ffad7 100644
--- a/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h
+++ b/src/cobalt/bindings/generated/mozjs45/testing/cobalt/bindings/testing/test_dictionary.h
@@ -24,6 +24,7 @@
 
 #include <string>
 
+#include "base/optional.h"
 #include "cobalt/script/sequence.h"
 #include "cobalt/bindings/testing/arbitrary_interface.h"
 
diff --git a/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template b/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template
index f3031f9..aee4a88 100644
--- a/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template
+++ b/src/cobalt/bindings/mozjs/templates/callback-interface.cc.template
@@ -24,6 +24,7 @@
 #include "cobalt/script/mozjs/mozjs_callback_interface.h"
 #include "cobalt/script/mozjs/util/exception_helpers.h"
 #include "cobalt/script/mozjs/util/stack_trace_helpers.h"
+#include "third_party/mozjs/js/jsd/jsd.h"
 #include "third_party/mozjs/js/src/jsapi.h"
 #include "third_party/mozjs/js/src/jscntxt.h"
 {% endblock includes %}
@@ -67,7 +68,7 @@
   {{overload.type}} cobalt_return_value;
 {% endif %}
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  AutoSaveExceptionState auto_save_exception_state(context_);
   ENABLE_JS_STACK_TRACE_IN_SCOPE(context_);
 
   // This could be set to NULL if it was garbage collected.
@@ -115,7 +116,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
 {% if overload.type != 'void' %}
   return cobalt_return_value;
 {% endif %}
diff --git a/src/cobalt/bindings/mozjs/templates/interface.cc.template b/src/cobalt/bindings/mozjs/templates/interface.cc.template
index 99ca683..323e665 100644
--- a/src/cobalt/bindings/mozjs/templates/interface.cc.template
+++ b/src/cobalt/bindings/mozjs/templates/interface.cc.template
@@ -497,15 +497,25 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
     NOTREACHED();
     return false;
   }
+
+  {{ check_if_object_implements_interface() }}
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   {{impl_class}}* impl =
       wrapper_private->wrappable<{{impl_class}}>().get();
   if (!impl) {
diff --git a/src/cobalt/bindings/mozjs/templates/macros.cc.template b/src/cobalt/bindings/mozjs/templates/macros.cc.template
index 4436475..8cb1fee 100644
--- a/src/cobalt/bindings/mozjs/templates/macros.cc.template
+++ b/src/cobalt/bindings/mozjs/templates/macros.cc.template
@@ -54,7 +54,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, object.address())) {
diff --git a/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template b/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template
index 04f6ccd..129ff1c 100644
--- a/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template
+++ b/src/cobalt/bindings/mozjs45/templates/callback-interface.cc.template
@@ -66,7 +66,7 @@
   {{overload.type}} cobalt_return_value;
 {% endif %}
   JSAutoRequest auto_request(context_);
-  JSExceptionState* previous_exception_state = JS_SaveExceptionState(context_);
+  JS::AutoSaveExceptionState auto_save_exception_state(context_);
 
   // This could be set to NULL if it was garbage collected.
   JS::RootedObject implementing_object(context_, implementing_object_.GetObject());
@@ -110,7 +110,6 @@
   }
 
   *had_exception = !success;
-  JS_RestoreExceptionState(context_, previous_exception_state);
 {% if overload.type != 'void' %}
   return cobalt_return_value;
 {% endif %}
diff --git a/src/cobalt/bindings/mozjs45/templates/interface.cc.template b/src/cobalt/bindings/mozjs45/templates/interface.cc.template
index abe82f9..00e5080 100644
--- a/src/cobalt/bindings/mozjs45/templates/interface.cc.template
+++ b/src/cobalt/bindings/mozjs45/templates/interface.cc.template
@@ -516,15 +516,25 @@
   JS::RootedObject object(context);
 
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
     NOTREACHED();
     return false;
   }
+
+  {{ check_if_object_implements_interface() }}
+
   WrapperPrivate* wrapper_private =
       WrapperPrivate::GetFromObject(context, object);
+
+  // |WrapperPrivate::GetFromObject| can fail if |object| is not a |Wrapper|
+  // object.
+  if (!wrapper_private) {
+    exception_state.SetSimpleException(cobalt::script::kStringifierProblem);
+    return false;
+  }
+
   {{impl_class}}* impl =
       wrapper_private->wrappable<{{impl_class}}>().get();
   if (!impl) {
@@ -755,20 +765,15 @@
 {% endif %}
 }
 
-InterfaceData* GetInterfaceData(JSContext* context) {
+inline InterfaceData* GetInterfaceData(JSContext* context) {
+  const int kInterfaceUniqueId = {{unique_id}};
   MozjsGlobalEnvironment* global_environment =
       static_cast<MozjsGlobalEnvironment*>(JS_GetContextPrivate(context));
-  // Use the address of the properties definition for this interface as a
-  // unique key for looking up the InterfaceData for this interface.
-  intptr_t key = reinterpret_cast<intptr_t>(&own_properties);
-  InterfaceData* interface_data = global_environment->GetInterfaceData(key);
-  if (!interface_data) {
-    interface_data = new InterfaceData();
-    DCHECK(interface_data);
-    global_environment->CacheInterfaceData(key, interface_data);
-    DCHECK_EQ(interface_data, global_environment->GetInterfaceData(key));
-  }
-  return interface_data;
+  // By convention, the |MozjsGlobalEnvironment| that we are associated with
+  // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked
+  // for it to be there in the first place, and could not have conflicted with
+  // any other interface.
+  return global_environment->GetInterfaceData(kInterfaceUniqueId);
 }
 
 }  // namespace
diff --git a/src/cobalt/bindings/mozjs45/templates/macros.cc.template b/src/cobalt/bindings/mozjs45/templates/macros.cc.template
index 6adbab7..a7ab728 100644
--- a/src/cobalt/bindings/mozjs45/templates/macros.cc.template
+++ b/src/cobalt/bindings/mozjs45/templates/macros.cc.template
@@ -54,7 +54,6 @@
   // 'this' should be an object.
   JS::RootedObject object(context);
   if (JS_TypeOfValue(context, this_value) != JSTYPE_OBJECT) {
-    NOTREACHED();
     return false;
   }
   if (!JS_ValueToObject(context, this_value, &object)) {
diff --git a/src/cobalt/browser/application.cc b/src/cobalt/browser/application.cc
index 02597f5..4948758 100644
--- a/src/cobalt/browser/application.cc
+++ b/src/cobalt/browser/application.cc
@@ -22,11 +22,14 @@
 #include "base/debug/trace_event.h"
 #include "base/lazy_instance.h"
 #include "base/logging.h"
+#include "base/optional.h"
 #include "base/path_service.h"
 #include "base/string_number_conversions.h"
 #include "base/string_split.h"
+#include "base/string_util.h"
 #include "base/time.h"
 #include "build/build_config.h"
+#include "cobalt/base/application_event.h"
 #include "cobalt/base/cobalt_paths.h"
 #include "cobalt/base/deep_link_event.h"
 #include "cobalt/base/init_cobalt.h"
@@ -34,9 +37,7 @@
 #include "cobalt/base/localized_strings.h"
 #include "cobalt/base/startup_timer.h"
 #include "cobalt/base/user_log.h"
-#include "cobalt/browser/memory_settings/auto_mem.h"
-#include "cobalt/browser/memory_settings/checker.h"
-#include "cobalt/browser/memory_settings/pretty_print.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_tracker/tool.h"
 #include "cobalt/browser/switches.h"
 #include "cobalt/loader/image/image_decoder.h"
@@ -46,7 +47,6 @@
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
 #include "cobalt/storage/savegame_fake.h"
 #endif
-#include "cobalt/system_window/application_event.h"
 #include "cobalt/trace_event/scoped_trace_to_file.h"
 #include "googleurl/src/gurl.h"
 #if defined(__LB_SHELL__)
@@ -66,6 +66,10 @@
 
 const char kDefaultURL[] = "https://www.youtube.com/tv";
 
+bool IsStringNone(const std::string& str) {
+  return !base::strcasecmp(str.c_str(), "none");
+}
+
 #if defined(ENABLE_REMOTE_DEBUGGING)
 int GetRemoteDebuggingPort() {
 #if defined(SB_OVERRIDE_DEFAULT_REMOTE_DEBUGGING_PORT)
@@ -140,13 +144,36 @@
     if (url.is_valid()) {
       return url;
     } else {
-      DLOG(INFO) << "URL from parameter is not valid, using default URL.";
+      DLOG(ERROR) << "URL from parameter " << command_line
+                  << " is not valid, using default URL.";
     }
   }
 
   return GURL(kDefaultURL);
 }
 
+base::optional<GURL> GetSplashScreenURL() {
+  CommandLine* command_line = CommandLine::ForCurrentProcess();
+  std::string splash_screen_string;
+  if (command_line->HasSwitch(switches::kFallbackSplashScreenURL)) {
+    splash_screen_string =
+        command_line->GetSwitchValueASCII(switches::kFallbackSplashScreenURL);
+  } else {
+    splash_screen_string = COBALT_FALLBACK_SPLASH_SCREEN_URL;
+  }
+  if (IsStringNone(splash_screen_string)) {
+    return base::optional<GURL>();
+  }
+  base::optional<GURL> splash_screen_url = GURL(splash_screen_string);
+  if (!splash_screen_url->is_valid() ||
+      !(StartsWithASCII(splash_screen_string, "file:///", false) ||
+        StartsWithASCII(splash_screen_string, "h5vcc-embedded://", false))) {
+    LOG(FATAL) << "Ignoring invalid fallback splash screen: "
+               << splash_screen_string;
+  }
+  return splash_screen_url;
+}
+
 base::TimeDelta GetTimedTraceDuration() {
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
   CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -193,6 +220,32 @@
 }
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
+#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
+base::optional<math::Size> GetVideoOutputResolutionOverride(
+    CommandLine* command_line) {
+  DCHECK(command_line);
+  if (command_line->HasSwitch(switches::kVideoContainerSizeOverride)) {
+    std::string size_override = command_line->GetSwitchValueASCII(
+        browser::switches::kVideoContainerSizeOverride);
+    DLOG(INFO) << "Set video container size override from command line to "
+               << size_override;
+    // Override string should be something like "1920x1080".
+    int32 width, height;
+    std::vector<std::string> tokens;
+    base::SplitString(size_override, 'x', &tokens);
+    if (tokens.size() == 2 && base::StringToInt32(tokens[0], &width) &&
+        base::StringToInt32(tokens[1], &height)) {
+      return math::Size(width, height);
+    }
+
+    DLOG(WARNING) << "Invalid size specified for video container: "
+                  << size_override;
+  }
+
+  return base::nullopt;
+}
+#endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
+
 // Represents a parsed int.
 struct ParsedIntValue {
  public:
@@ -202,6 +255,7 @@
   int value_;
   bool error_;  // true if there was a parse error.
 };
+
 // Parses a string like "1234x5678" to vector of parsed int values.
 std::vector<ParsedIntValue> ParseDimensions(const std::string& value_str) {
   std::vector<ParsedIntValue> output;
@@ -217,6 +271,51 @@
   return output;
 }
 
+base::optional<math::Size> GetRequestedViewportSize(CommandLine* command_line) {
+  DCHECK(command_line);
+  if (!command_line->HasSwitch(browser::switches::kViewport)) {
+    return base::nullopt;
+  }
+
+  const std::string switchValue =
+      command_line->GetSwitchValueASCII(browser::switches::kViewport);
+  std::vector<ParsedIntValue> parsed_ints = ParseDimensions(switchValue);
+  if (parsed_ints.size() < 1) {
+    return base::nullopt;
+  }
+
+  const ParsedIntValue parsed_width = parsed_ints[0];
+  if (parsed_width.error_) {
+    DLOG(ERROR) << "Invalid value specified for viewport width: " << switchValue
+                << ". Using default viewport size.";
+    return base::nullopt;
+  }
+
+  const ParsedIntValue* parsed_height_ptr = NULL;
+  if (parsed_ints.size() >= 2) {
+    parsed_height_ptr = &parsed_ints[1];
+  }
+
+  if (!parsed_height_ptr) {
+    // Allow shorthand specification of the viewport by only giving the
+    // width. This calculates the height at 4:3 aspect ratio for smaller
+    // viewport widths, and 16:9 for viewports 1280 pixels wide or larger.
+    if (parsed_width.value_ >= 1280) {
+      return math::Size(parsed_width.value_, 9 * parsed_width.value_ / 16);
+    }
+
+    return math::Size(parsed_width.value_, 3 * parsed_width.value_ / 4);
+  }
+
+  if (parsed_height_ptr->error_) {
+    DLOG(ERROR) << "Invalid value specified for viewport height: "
+                << switchValue << ". Using default viewport size.";
+    return base::nullopt;
+  }
+
+  return math::Size(parsed_width.value_, parsed_height_ptr->value_);
+}
+
 std::string GetMinLogLevelString() {
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
   CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -322,44 +421,7 @@
 int Application::network_connect_count_ = 0;
 int Application::network_disconnect_count_ = 0;
 
-void ApplyAutoMemSettings(const memory_settings::AutoMem& auto_mem,
-                          BrowserModule::Options* options) {
-  std::stringstream ss;
-  const bool enable_color = SbLogIsTty();
-  ss << "\n\n" << auto_mem.ToPrettyPrintString(enable_color) << "\n\n";
-  SB_LOG(INFO) << ss.str();
-
-  options->web_module_options.image_cache_capacity =
-      static_cast<int>(auto_mem.image_cache_size_in_bytes()->value());
-
-  options->renderer_module_options.skia_cache_size_in_bytes =
-      static_cast<int>(auto_mem.skia_cache_size_in_bytes()->value());
-
-  const memory_settings::TextureDimensions skia_glyph_atlas_texture_dimensions =
-      auto_mem.skia_atlas_texture_dimensions()->value();
-
-  // Right now the bytes_per_pixel is assumed in the engine. Any other value
-  // is currently forbidden.
-  if (skia_glyph_atlas_texture_dimensions.bytes_per_pixel() > 0) {
-    DCHECK_EQ(2, skia_glyph_atlas_texture_dimensions.bytes_per_pixel());
-    options->renderer_module_options.skia_glyph_texture_atlas_dimensions =
-        math::Size(skia_glyph_atlas_texture_dimensions.width(),
-                   skia_glyph_atlas_texture_dimensions.height());
-  }
-
-  options->web_module_options.remote_typeface_cache_capacity =
-      static_cast<int>(
-          auto_mem.remote_typeface_cache_size_in_bytes()->value());
-
-  options->web_module_options.javascript_options.gc_threshold_bytes =
-      static_cast<size_t>(auto_mem.javascript_gc_threshold_in_bytes()->value());
-
-  options->renderer_module_options.software_surface_cache_size_in_bytes =
-      static_cast<int>(
-          auto_mem.software_surface_cache_size_in_bytes()->value());
-}
-
-Application::Application(const base::Closure& quit_closure)
+Application::Application(const base::Closure& quit_closure, bool should_preload)
     : message_loop_(MessageLoop::current()),
       quit_closure_(quit_closure),
       stats_update_timer_(true, true) {
@@ -392,12 +454,18 @@
   GURL initial_url = GetInitialURL();
   DLOG(INFO) << "Initial URL: " << initial_url;
 
+  // Get the splash screen URL.
+  base::optional<GURL> splash_screen_url = GetSplashScreenURL();
+  DLOG(INFO) << "Splash screen URL: "
+             << (splash_screen_url ? splash_screen_url->spec() : "none");
+
   // Get the system language and initialize our localized strings.
   std::string language = base::GetSystemLanguage();
   base::LocalizedStrings::GetInstance()->Initialize(language);
 
   CommandLine* command_line = CommandLine::ForCurrentProcess();
-  math::Size window_size = InitSystemWindow(command_line);
+  base::optional<math::Size> requested_viewport_size =
+      GetRequestedViewportSize(command_line);
 
   WebModule::Options web_options;
   // Create the main components of our browser.
@@ -406,6 +474,10 @@
   options.language = language;
   options.initial_deep_link = GetInitialDeepLink();
   options.network_module_options.preferred_language = language;
+  options.command_line_auto_mem_settings =
+      memory_settings::GetSettings(*command_line);
+  options.build_auto_mem_settings = memory_settings::GetDefaultBuildSettings();
+  options.splash_screen_url = splash_screen_url;
 
   if (command_line->HasSwitch(browser::switches::kFPSPrint)) {
     options.renderer_module_options.enable_fps_stdout = true;
@@ -420,14 +492,6 @@
     options.web_module_options.javascript_options.disable_jit = true;
   }
 
-  auto_mem_.reset(
-      new memory_settings::AutoMem(
-          window_size,
-          *command_line,
-          memory_settings::GetDefaultBuildSettings()));
-
-  ApplyAutoMemSettings(*auto_mem_, &options);
-
 #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
   if (command_line->HasSwitch(browser::switches::kNullSavegame)) {
     options.storage_manager_options.savegame_options.factory =
@@ -505,12 +569,18 @@
     DLOG(INFO) << "Use ShellRawVideoDecoderStub";
     options.media_module_options.use_video_decoder_stub = true;
   }
+  options.media_module_options.output_resolution_override =
+      GetVideoOutputResolutionOverride(command_line);
   if (command_line->HasSwitch(switches::kMemoryTracker)) {
     std::string command_arg =
         command_line->GetSwitchValueASCII(switches::kMemoryTracker);
     memory_tracker_tool_ =
         memory_tracker::CreateMemoryTrackerTool(command_arg);
   }
+
+  if (command_line->HasSwitch(switches::kDisableImageAnimations)) {
+    options.web_module_options.enable_image_animations = false;
+  }
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
   if (command_line->HasSwitch(browser::switches::kDisableNavigationWhitelist)) {
@@ -520,13 +590,16 @@
     options.web_module_options.location_policy = "h5vcc-location-src *";
   }
 
+  options.requested_viewport_size = requested_viewport_size;
   account_manager_.reset(new account::AccountManager());
   browser_module_.reset(
-      new BrowserModule(initial_url, base::kApplicationStateStarted,
-                        system_window_.get(), account_manager_.get(), options));
+      new BrowserModule(initial_url,
+                        (should_preload ? base::kApplicationStatePreloading
+                                        : base::kApplicationStateStarted),
+                        &event_dispatcher_, account_manager_.get(), options));
   UpdateAndMaybeRegisterUserAgent();
 
-  app_status_ = kRunningAppStatus;
+  app_status_ = (should_preload ? kPreloadingAppStatus : kRunningAppStatus);
 
   // Register event callbacks.
   network_event_callback_ =
@@ -535,8 +608,9 @@
                                      network_event_callback_);
   application_event_callback_ =
       base::Bind(&Application::OnApplicationEvent, base::Unretained(this));
-  event_dispatcher_.AddEventCallback(system_window::ApplicationEvent::TypeId(),
+  event_dispatcher_.AddEventCallback(base::ApplicationEvent::TypeId(),
                                      application_event_callback_);
+
   deep_link_event_callback_ =
       base::Bind(&Application::OnDeepLinkEvent, base::Unretained(this));
   event_dispatcher_.AddEventCallback(base::DeepLinkEvent::TypeId(),
@@ -592,14 +666,31 @@
   // Unregister event callbacks.
   event_dispatcher_.RemoveEventCallback(network::NetworkEvent::TypeId(),
                                         network_event_callback_);
-  event_dispatcher_.RemoveEventCallback(
-      system_window::ApplicationEvent::TypeId(), application_event_callback_);
+  event_dispatcher_.RemoveEventCallback(base::ApplicationEvent::TypeId(),
+                                        application_event_callback_);
   event_dispatcher_.RemoveEventCallback(
       base::DeepLinkEvent::TypeId(), deep_link_event_callback_);
 
   app_status_ = kShutDownAppStatus;
 }
 
+void Application::Start() {
+  if (MessageLoop::current() != message_loop_) {
+    message_loop_->PostTask(
+        FROM_HERE, base::Bind(&Application::Start, base::Unretained(this)));
+    return;
+  }
+
+  if (app_status_ != kPreloadingAppStatus) {
+    NOTREACHED() << __FUNCTION__ << ": Redundant call.";
+    return;
+  }
+
+  event_dispatcher_.DispatchEvent(make_scoped_ptr<base::Event>(
+      new base::ApplicationEvent(kSbEventTypeStart)));
+  app_status_ = kRunningAppStatus;
+}
+
 void Application::Quit() {
   if (MessageLoop::current() != message_loop_) {
     message_loop_->PostTask(
@@ -639,29 +730,29 @@
 void Application::OnApplicationEvent(const base::Event* event) {
   TRACE_EVENT0("cobalt::browser", "Application::OnApplicationEvent()");
   DCHECK(application_event_thread_checker_.CalledOnValidThread());
-  const system_window::ApplicationEvent* app_event =
-      base::polymorphic_downcast<const system_window::ApplicationEvent*>(event);
-  if (app_event->type() == system_window::ApplicationEvent::kQuit) {
+  const base::ApplicationEvent* app_event =
+      base::polymorphic_downcast<const base::ApplicationEvent*>(event);
+  if (app_event->type() == kSbEventTypeStop) {
     DLOG(INFO) << "Got quit event.";
     app_status_ = kWillQuitAppStatus;
     Quit();
-  } else if (app_event->type() == system_window::ApplicationEvent::kPause) {
+  } else if (app_event->type() == kSbEventTypePause) {
     DLOG(INFO) << "Got pause event.";
     app_status_ = kPausedAppStatus;
     ++app_pause_count_;
     browser_module_->Pause();
-  } else if (app_event->type() == system_window::ApplicationEvent::kUnpause) {
+  } else if (app_event->type() == kSbEventTypeUnpause) {
     DLOG(INFO) << "Got unpause event.";
     app_status_ = kRunningAppStatus;
     ++app_unpause_count_;
     browser_module_->Unpause();
-  } else if (app_event->type() == system_window::ApplicationEvent::kSuspend) {
+  } else if (app_event->type() == kSbEventTypeSuspend) {
     DLOG(INFO) << "Got suspend event.";
     app_status_ = kSuspendedAppStatus;
     ++app_suspend_count_;
     browser_module_->Suspend();
     DLOG(INFO) << "Finished suspending.";
-  } else if (app_event->type() == system_window::ApplicationEvent::kResume) {
+  } else if (app_event->type() == kSbEventTypeResume) {
     DLOG(INFO) << "Got resume event.";
     app_status_ = kPausedAppStatus;
     ++app_resume_count_;
@@ -759,57 +850,6 @@
   }
 }
 
-math::Size Application::InitSystemWindow(CommandLine* command_line) {
-  base::optional<math::Size> viewport_size;
-  if (command_line->HasSwitch(browser::switches::kViewport)) {
-    const std::string switchValue =
-        command_line->GetSwitchValueASCII(browser::switches::kViewport);
-
-    std::vector<ParsedIntValue> parsed_ints = ParseDimensions(switchValue);
-
-    if (parsed_ints.size() >= 1) {
-      const ParsedIntValue parsed_width = parsed_ints[0];
-      if (!parsed_width.error_) {
-        const ParsedIntValue* parsed_height_ptr = NULL;
-        if (parsed_ints.size() >= 2) {
-          parsed_height_ptr = &parsed_ints[1];
-        }
-
-        if (!parsed_height_ptr) {
-          // Allow shorthand specification of the viewport by only giving the
-          // width. This calculates the height at 4:3 aspect ratio for smaller
-          // viewport widths, and 16:9 for viewports 1280 pixels wide or larger.
-          if (parsed_width.value_ >= 1280) {
-            viewport_size.emplace(parsed_width.value_,
-                                  9 * parsed_width.value_ / 16);
-          } else {
-            viewport_size.emplace(parsed_width.value_,
-                                  3 * parsed_width.value_ / 4);
-          }
-        } else if (!parsed_height_ptr->error_) {
-          viewport_size.emplace(parsed_width.value_,
-                                parsed_height_ptr->value_);
-        } else {
-          DLOG(ERROR) << "Invalid value specified for viewport height: "
-                      << switchValue << ". Using default viewport size.";
-        }
-      } else {
-        DLOG(ERROR) << "Invalid value specified for viewport width: "
-                    << switchValue << ". Using default viewport size.";
-      }
-    }
-  }
-
-  system_window_.reset(
-      new system_window::SystemWindow(&event_dispatcher_, viewport_size));
-
-  math::Size window_size = system_window_->GetWindowSize();
-  if (viewport_size) {
-    DCHECK_EQ(viewport_size, window_size);
-  }
-  return window_size;
-}
-
 void Application::UpdatePeriodicStats() {
   TRACE_EVENT0("cobalt::browser", "Application::UpdatePeriodicStats()");
   c_val_stats_.app_lifetime = base::StartupTimer::TimeElapsed();
@@ -834,8 +874,7 @@
   c_val_stats_.js_reserved_memory =
       script::JavaScriptEngine::UpdateMemoryStatsAndReturnReserved();
 
-  memory_settings_checker_.RunChecks(
-      *auto_mem_, used_cpu_memory, used_gpu_memory);
+  browser_module_->CheckMemory(used_cpu_memory, used_gpu_memory);
 }
 
 }  // namespace browser
diff --git a/src/cobalt/browser/application.h b/src/cobalt/browser/application.h
index 6da8a33..a8a5597 100644
--- a/src/cobalt/browser/application.h
+++ b/src/cobalt/browser/application.h
@@ -22,8 +22,6 @@
 #include "cobalt/account/account_manager.h"
 #include "cobalt/base/event_dispatcher.h"
 #include "cobalt/browser/browser_module.h"
-#include "cobalt/browser/memory_settings/auto_mem.h"
-#include "cobalt/browser/memory_settings/checker.h"
 #include "cobalt/browser/memory_tracker/tool.h"
 #include "cobalt/system_window/system_window.h"
 
@@ -46,10 +44,12 @@
  public:
   virtual ~Application();
 
+  // Start from a preloaded state.
+  void Start();
   void Quit();
 
  protected:
-  explicit Application(const base::Closure& quit_closure);
+  Application(const base::Closure& quit_closure, bool should_preload);
 
   MessageLoop* message_loop() { return message_loop_; }
 
@@ -75,11 +75,6 @@
   // A conduit for system events.
   base::EventDispatcher event_dispatcher_;
 
-  // The main system window for our application.
-  // This routes event callbacks, and provides a native window handle
-  // on desktop systems.
-  scoped_ptr<system_window::SystemWindow> system_window_;
-
   // Account manager.
   scoped_ptr<account::AccountManager> account_manager_;
 
@@ -110,6 +105,7 @@
  private:
   enum AppStatus {
     kUninitializedAppStatus,
+    kPreloadingAppStatus,
     kRunningAppStatus,
     kPausedAppStatus,
     kSuspendedAppStatus,
@@ -151,8 +147,6 @@
 
   void UpdatePeriodicStats();
 
-  math::Size InitSystemWindow(CommandLine* command_line);
-
   static ssize_t available_memory_;
   static int64 lifetime_in_ms_;
 
@@ -171,21 +165,18 @@
   base::Timer stats_update_timer_;
 
   scoped_ptr<memory_tracker::Tool> memory_tracker_tool_;
-
-  // Memory configuration tool.
-  scoped_ptr<memory_settings::AutoMem> auto_mem_;
-
-  // Fires memory warning once when memory exceeds specified max cpu/gpu
-  // memory.
-  memory_settings::Checker memory_settings_checker_;
 };
 
-// Factory method for creating an application.  It should be implemented
-// per-platform to allow for platform-specific customization.  The passed
-// in |quit_closure| can be called internally by the application to signal that
-// it would like to quit.
+// Factory method for creating a started application. The passed in
+// |quit_closure| can be called internally by the application to signal that it
+// would like to quit.
 scoped_ptr<Application> CreateApplication(const base::Closure& quit_closure);
 
+// Factory method for creating a preloading application. The passed in
+// |quit_closure| can be called internally by the application to signal that it
+// would like to quit.
+scoped_ptr<Application> PreloadApplication(const base::Closure& quit_closure);
+
 }  // namespace browser
 }  // namespace cobalt
 
diff --git a/src/cobalt/browser/browser.gyp b/src/cobalt/browser/browser.gyp
index 0741ae3..321bc20 100644
--- a/src/cobalt/browser/browser.gyp
+++ b/src/cobalt/browser/browser.gyp
@@ -20,6 +20,9 @@
     {
       'target_name': 'browser',
       'type': 'static_library',
+      'includes': [
+        '../renderer/renderer_parameters_setup.gypi',
+      ],
       'sources': [
         'application.cc',
         'application.h',
@@ -32,8 +35,8 @@
         'lifecycle_observer.h',
         'memory_settings/auto_mem.cc',
         'memory_settings/auto_mem.h',
-        'memory_settings/build_settings.cc',
-        'memory_settings/build_settings.h',
+        'memory_settings/auto_mem_settings.cc',
+        'memory_settings/auto_mem_settings.h',
         'memory_settings/calculations.cc',
         'memory_settings/calculations.h',
         'memory_settings/checker.cc',
@@ -99,12 +102,14 @@
         'web_module_stat_tracker.h',
       ],
       'defines': [
+        'COBALT_FALLBACK_SPLASH_SCREEN_URL="<(fallback_splash_screen_url)"',
         'COBALT_SKIA_CACHE_SIZE_IN_BYTES=<(skia_cache_size_in_bytes)',
         'COBALT_SKIA_GLYPH_ATLAS_WIDTH=<(skia_glyph_atlas_width)',
         'COBALT_SKIA_GLYPH_ATLAS_HEIGHT=<(skia_glyph_atlas_height)',
         'COBALT_IMAGE_CACHE_SIZE_IN_BYTES=<(image_cache_size_in_bytes)',
         'COBALT_REMOTE_TYPEFACE_CACHE_SIZE_IN_BYTES=<(remote_font_cache_size_in_bytes)',
         'COBALT_IMAGE_CACHE_CAPACITY_MULTIPLIER_WHEN_PLAYING_VIDEO=<(image_cache_capacity_multiplier_when_playing_video)',
+        'COBALT_OFFSCREEN_TARGET_CACHE_SIZE_IN_BYTES=<(offscreen_target_cache_size_in_bytes)',
         'COBALT_SOFTWARE_SURFACE_CACHE_SIZE_IN_BYTES=<(software_surface_cache_size_in_bytes)',
         'COBALT_JS_GARBAGE_COLLECTION_THRESHOLD_IN_BYTES=<(mozjs_garbage_collection_threshold_in_bytes)',
         'COBALT_MAX_CPU_USAGE_IN_BYTES=<(max_cobalt_cpu_usage)',
@@ -133,6 +138,7 @@
         '<(DEPTH)/cobalt/renderer/renderer.gyp:renderer',
         '<(DEPTH)/cobalt/script/engine.gyp:engine',
         '<(DEPTH)/cobalt/speech/speech.gyp:speech',
+        '<(DEPTH)/cobalt/sso/sso.gyp:sso',
         '<(DEPTH)/cobalt/system_window/system_window.gyp:system_window',
         '<(DEPTH)/cobalt/trace_event/trace_event.gyp:trace_event',
         '<(DEPTH)/cobalt/webdriver/webdriver.gyp:webdriver',
@@ -225,10 +231,11 @@
       'sources': [
         'storage_upgrade_handler_test.cc',
         'memory_settings/auto_mem_test.cc',
+        'memory_settings/auto_mem_settings_test.cc',
         'memory_settings/calculations_test.cc',
         'memory_settings/constrainer_test.cc',
-        'memory_settings/pretty_print_test.cc',
         'memory_settings/memory_settings_test.cc',
+        'memory_settings/pretty_print_test.cc',
         'memory_settings/table_printer_test.cc',
         'memory_settings/test_common.h',
         'memory_tracker/tool/tool_impl_test.cc',
diff --git a/src/cobalt/browser/browser_bindings_gen.gyp b/src/cobalt/browser/browser_bindings_gen.gyp
index 0ff0e7b..061a5df 100644
--- a/src/cobalt/browser/browser_bindings_gen.gyp
+++ b/src/cobalt/browser/browser_bindings_gen.gyp
@@ -170,6 +170,7 @@
         '../h5vcc/h5vcc_runtime.idl',
         '../h5vcc/h5vcc_runtime_event_target.idl',
         '../h5vcc/h5vcc_settings.idl',
+        '../h5vcc/h5vcc_sso.idl',
         '../h5vcc/h5vcc_storage.idl',
         '../h5vcc/h5vcc_system.idl',
         '../h5vcc/h5vcc_trace_event.idl',
@@ -260,6 +261,7 @@
         '../dom/global_crypto.idl',
         '../dom/global_event_handlers.idl',
         '../dom/html_element_cssom_view.idl',
+        '../dom/mouse_event_cssom_view.idl',
         '../dom/navigator_id.idl',
         '../dom/navigator_language.idl',
         '../dom/navigator_plugins.idl',
diff --git a/src/cobalt/browser/browser_module.cc b/src/cobalt/browser/browser_module.cc
index d5c6719..015dd40 100644
--- a/src/cobalt/browser/browser_module.cc
+++ b/src/cobalt/browser/browser_module.cc
@@ -166,30 +166,6 @@
 
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
-#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
-void GetVideoContainerSizeOverride(math::Size* output_size) {
-  DCHECK(output_size);
-  CommandLine* command_line = CommandLine::ForCurrentProcess();
-  if (command_line->HasSwitch(switches::kVideoContainerSizeOverride)) {
-    std::string size_override = command_line->GetSwitchValueASCII(
-        browser::switches::kVideoContainerSizeOverride);
-    DLOG(INFO) << "Set video container size override from command line to "
-               << size_override;
-    // Override string should be something like "1920x1080".
-    int32 width, height;
-    std::vector<std::string> tokens;
-    base::SplitString(size_override, 'x', &tokens);
-    if (tokens.size() == 2 && base::StringToInt32(tokens[0], &width) &&
-        base::StringToInt32(tokens[1], &height)) {
-      *output_size = math::Size(width, height);
-    } else {
-      DLOG(WARNING) << "Invalid size specified for video container: "
-                    << size_override;
-    }
-  }
-}
-#endif
-
 scoped_refptr<script::Wrappable> CreateH5VCC(
     const h5vcc::H5vcc::Settings& settings,
     const scoped_refptr<dom::Window>& window,
@@ -206,50 +182,73 @@
   return options;  // Copy.
 }
 
+void ApplyAutoMemSettings(const memory_settings::AutoMem& auto_mem,
+                          BrowserModule::Options* options) {
+  SB_LOG(INFO) << "\n\n"
+               << auto_mem.ToPrettyPrintString(SbLogIsTty()) << "\n\n";
+
+  options->web_module_options.image_cache_capacity =
+      static_cast<int>(auto_mem.image_cache_size_in_bytes()->value());
+
+  options->renderer_module_options.skia_cache_size_in_bytes =
+      static_cast<int>(auto_mem.skia_cache_size_in_bytes()->value());
+
+  const memory_settings::TextureDimensions skia_glyph_atlas_texture_dimensions =
+      auto_mem.skia_atlas_texture_dimensions()->value();
+
+  // Right now the bytes_per_pixel is assumed in the engine. Any other value
+  // is currently forbidden.
+  if (skia_glyph_atlas_texture_dimensions.bytes_per_pixel() > 0) {
+    DCHECK_EQ(2, skia_glyph_atlas_texture_dimensions.bytes_per_pixel());
+    options->renderer_module_options.skia_glyph_texture_atlas_dimensions =
+        math::Size(skia_glyph_atlas_texture_dimensions.width(),
+                   skia_glyph_atlas_texture_dimensions.height());
+  }
+
+  options->web_module_options.remote_typeface_cache_capacity =
+      static_cast<int>(auto_mem.remote_typeface_cache_size_in_bytes()->value());
+
+  options->web_module_options.javascript_options.gc_threshold_bytes =
+      static_cast<size_t>(auto_mem.javascript_gc_threshold_in_bytes()->value());
+
+  options->renderer_module_options.software_surface_cache_size_in_bytes =
+      static_cast<int>(
+          auto_mem.software_surface_cache_size_in_bytes()->value());
+  options->renderer_module_options.offscreen_target_cache_size_in_bytes =
+      static_cast<int>(
+          auto_mem.offscreen_target_cache_size_in_bytes()->value());
+}
+
 }  // namespace
 
 BrowserModule::BrowserModule(const GURL& url,
                              base::ApplicationState initial_application_state,
-                             system_window::SystemWindow* system_window,
+                             base::EventDispatcher* event_dispatcher,
                              account::AccountManager* account_manager,
                              const Options& options)
     : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
       ALLOW_THIS_IN_INITIALIZER_LIST(
           weak_this_(weak_ptr_factory_.GetWeakPtr())),
+      options_(options),
       self_message_loop_(MessageLoop::current()),
+      event_dispatcher_(event_dispatcher),
       storage_manager_(
           scoped_ptr<StorageUpgradeHandler>(new StorageUpgradeHandler(url))
               .PassAs<storage::StorageManager::UpgradeHandler>(),
-          options.storage_manager_options),
+          options_.storage_manager_options),
 #if defined(OS_STARBOARD)
       is_rendered_(false),
 #endif  // OS_STARBOARD
-      input_device_manager_(input::InputDeviceManager::CreateFromWindow(
-          base::Bind(&BrowserModule::OnKeyEventProduced,
-                     base::Unretained(this)),
-          base::Bind(&BrowserModule::OnPointerEventProduced,
-                     base::Unretained(this)),
-          base::Bind(&BrowserModule::OnWheelEventProduced,
-                     base::Unretained(this)),
-          system_window)),
-      renderer_module_(system_window, RendererModuleWithCameraOptions(
-                                          options.renderer_module_options,
-                                          input_device_manager_->camera_3d())),
 #if defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
       array_buffer_allocator_(
           new ResourceProviderArrayBufferAllocator(GetResourceProvider())),
       array_buffer_cache_(new dom::ArrayBuffer::Cache(3 * 1024 * 1024)),
 #endif  // defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
-      network_module_(&storage_manager_, system_window->event_dispatcher(),
-                      options.network_module_options),
-      render_tree_combiner_(&renderer_module_,
-                            renderer_module_.render_target()->GetSize()),
-#if defined(ENABLE_SCREENSHOT)
-      screen_shot_writer_(new ScreenShotWriter(renderer_module_.pipeline())),
-#endif  // defined(ENABLE_SCREENSHOT)
+      network_module_(&storage_manager_, event_dispatcher_,
+                      options_.network_module_options),
       web_module_loaded_(true /* manually_reset */,
                          false /* initially_signalled */),
-      web_module_recreated_callback_(options.web_module_recreated_callback),
+      web_module_recreated_callback_(options_.web_module_recreated_callback),
       navigate_time_("Time.Browser.Navigate", 0,
                      "The last time a navigation occurred."),
       on_load_event_time_("Time.Browser.OnLoadEvent", 0,
@@ -270,15 +269,12 @@
           kScreenshotCommandShortHelp, kScreenshotCommandLongHelp)),
 #endif  // defined(ENABLE_SCREENSHOT)
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
-      ALLOW_THIS_IN_INITIALIZER_LIST(h5vcc_url_handler_(this, system_window)),
-      web_module_options_(options.web_module_options),
       has_resumed_(true, false),
 #if defined(COBALT_CHECK_RENDER_TIMEOUT)
       timeout_polling_thread_(kTimeoutPollingThreadName),
       render_timeout_count_(0),
 #endif
       will_quit_(false),
-      system_window_(system_window),
       application_state_(initial_application_state) {
 #if SB_HAS(CORE_DUMP_HANDLER_SUPPORT)
   SbCoreDumpRegisterHandler(BrowserModule::CoreDumpHandler, this);
@@ -297,36 +293,17 @@
       base::TimeDelta::FromSeconds(kRenderTimeOutPollingDelaySeconds));
 #endif
   TRACE_EVENT0("cobalt::browser", "BrowserModule::BrowserModule()");
-  // All allocations for media will be tracked by "Media" memory scope.
-  {
-    TRACK_MEMORY_SCOPE("Media");
-    math::Size output_size = renderer_module_.render_target()->GetSize();
-    if (system_window->GetVideoPixelRatio() != 1.f) {
-      output_size.set_width(
-          static_cast<int>(static_cast<float>(output_size.width()) *
-                           system_window->GetVideoPixelRatio()));
-      output_size.set_height(
-          static_cast<int>(static_cast<float>(output_size.height()) *
-                           system_window->GetVideoPixelRatio()));
-    }
-#if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
-    GetVideoContainerSizeOverride(&output_size);
-#endif
-
-    media_module_ = (media::MediaModule::Create(system_window, output_size,
-                                                GetResourceProvider(),
-                                                options.media_module_options));
-  }
 
   // Setup our main web module to have the H5VCC API injected into it.
-  DCHECK(!ContainsKey(web_module_options_.injected_window_attributes, "h5vcc"));
+  DCHECK(!ContainsKey(options_.web_module_options.injected_window_attributes,
+                      "h5vcc"));
   h5vcc::H5vcc::Settings h5vcc_settings;
   h5vcc_settings.media_module = media_module_.get();
   h5vcc_settings.network_module = &network_module_;
   h5vcc_settings.account_manager = account_manager;
-  h5vcc_settings.event_dispatcher = system_window->event_dispatcher();
-  h5vcc_settings.initial_deep_link = options.initial_deep_link;
-  web_module_options_.injected_window_attributes["h5vcc"] =
+  h5vcc_settings.event_dispatcher = event_dispatcher_;
+  h5vcc_settings.initial_deep_link = options_.initial_deep_link;
+  options_.web_module_options.injected_window_attributes["h5vcc"] =
       base::Bind(&CreateH5VCC, h5vcc_settings);
 
 #if defined(ENABLE_DEBUG_CONSOLE) && defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES)
@@ -341,24 +318,24 @@
   }
 #endif  // ENABLE_DEBUG_CONSOLE && ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
+  if (application_state_ == base::kApplicationStateStarted ||
+      application_state_ == base::kApplicationStatePaused) {
+    InitializeSystemWindow();
+  }
+
 #if defined(ENABLE_DEBUG_CONSOLE)
   debug_console_.reset(new DebugConsole(
       application_state_,
       base::Bind(&BrowserModule::QueueOnDebugConsoleRenderTreeProduced,
                  base::Unretained(this)),
-      media_module_.get(), &network_module_,
-      renderer_module_.render_target()->GetSize(), GetResourceProvider(),
+      &network_module_, GetViewportSize(), GetResourceProvider(),
       kLayoutMaxRefreshFrequencyInHz,
       base::Bind(&BrowserModule::GetDebugServer, base::Unretained(this)),
-      web_module_options_.javascript_options));
+      options_.web_module_options.javascript_options));
   lifecycle_observers_.AddObserver(debug_console_.get());
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
-  // Always render the debug console. It will draw nothing if disabled.
-  // This setting is ignored if ENABLE_DEBUG_CONSOLE is not defined.
-  // TODO: Render tree combiner should probably be refactored.
-  render_tree_combiner_.set_render_debug_console(true);
-
+  splash_screen_url_ = options.splash_screen_url;
   // Synchronously construct our WebModule object.
   NavigateInternal(url);
   DCHECK(web_module_);
@@ -429,22 +406,24 @@
   navigate_time_ = base::TimeTicks::Now().ToInternalValue();
 
   // Show a splash screen while we're waiting for the web page to load.
-  const math::Size& viewport_size = renderer_module_.render_target()->GetSize();
+  const math::Size& viewport_size = GetViewportSize();
   DestroySplashScreen();
-  splash_screen_.reset(
-      new SplashScreen(application_state_,
-                       base::Bind(&BrowserModule::QueueOnRenderTreeProduced,
-                                  base::Unretained(this)),
-                       &network_module_, viewport_size, GetResourceProvider(),
-                       kLayoutMaxRefreshFrequencyInHz));
-  lifecycle_observers_.AddObserver(splash_screen_.get());
+  if (splash_screen_url_) {
+    splash_screen_.reset(
+        new SplashScreen(application_state_,
+                         base::Bind(&BrowserModule::QueueOnRenderTreeProduced,
+                                    base::Unretained(this)),
+                         &network_module_, viewport_size, GetResourceProvider(),
+                         kLayoutMaxRefreshFrequencyInHz, *splash_screen_url_));
+    lifecycle_observers_.AddObserver(splash_screen_.get());
+  }
 
   // Create new WebModule.
 #if !defined(COBALT_FORCE_CSP)
-  web_module_options_.csp_insecure_allowed_token =
+  options_.web_module_options.csp_insecure_allowed_token =
       dom::CspDelegateFactory::GetInsecureAllowedToken();
 #endif
-  WebModule::Options options(web_module_options_);
+  WebModule::Options options(options_.web_module_options);
   options.navigation_callback =
       base::Bind(&BrowserModule::Navigate, base::Unretained(this));
   options.loaded_callbacks.push_back(
@@ -464,7 +443,15 @@
 
   options.image_cache_capacity_multiplier_when_playing_video =
       COBALT_IMAGE_CACHE_CAPACITY_MULTIPLIER_WHEN_PLAYING_VIDEO;
-  options.camera_3d = input_device_manager_->camera_3d();
+  if (input_device_manager_) {
+    options.camera_3d = input_device_manager_->camera_3d();
+  }
+
+  float video_pixel_ratio = 1.0f;
+  if (system_window_) {
+    video_pixel_ratio = system_window_->GetVideoPixelRatio();
+  }
+
   web_module_.reset(new WebModule(
       url, application_state_,
       base::Bind(&BrowserModule::QueueOnRenderTreeProduced,
@@ -472,9 +459,8 @@
       base::Bind(&BrowserModule::OnError, base::Unretained(this)),
       base::Bind(&BrowserModule::OnWindowClose, base::Unretained(this)),
       base::Bind(&BrowserModule::OnWindowMinimize, base::Unretained(this)),
-      media_module_.get(), &network_module_, viewport_size,
-      GetResourceProvider(), system_window_, kLayoutMaxRefreshFrequencyInHz,
-      options));
+      media_module_.get(), &network_module_, viewport_size, video_pixel_ratio,
+      GetResourceProvider(), kLayoutMaxRefreshFrequencyInHz, options));
   lifecycle_observers_.AddObserver(web_module_.get());
   if (!web_module_recreated_callback_.is_null()) {
     web_module_recreated_callback_.Run();
@@ -541,6 +527,9 @@
     const browser::WebModule::LayoutResults& layout_results) {
   TRACE_EVENT0("cobalt::browser", "BrowserModule::OnRenderTreeProduced()");
   DCHECK_EQ(MessageLoop::current(), self_message_loop_);
+  if (!render_tree_combiner_) {
+    return;
+  }
 
   renderer::Submission renderer_submission(layout_results.render_tree,
                                            layout_results.layout_time);
@@ -548,7 +537,7 @@
   renderer_submission.on_rasterized_callback = base::Bind(
       &BrowserModule::OnRendererSubmissionRasterized, base::Unretained(this));
 #endif  // OS_STARBOARD
-  render_tree_combiner_.UpdateMainRenderTree(renderer_submission);
+  render_tree_combiner_->UpdateMainRenderTree(renderer_submission);
 
 #if defined(ENABLE_SCREENSHOT)
   screen_shot_writer_->SetLastPipelineSubmission(renderer::Submission(
@@ -645,13 +634,16 @@
   TRACE_EVENT0("cobalt::browser",
                "BrowserModule::OnDebugConsoleRenderTreeProduced()");
   DCHECK_EQ(MessageLoop::current(), self_message_loop_);
-
-  if (debug_console_->GetMode() == debug::DebugHub::kDebugConsoleOff) {
-    render_tree_combiner_.UpdateDebugConsoleRenderTree(base::nullopt);
+  if (!render_tree_combiner_) {
     return;
   }
 
-  render_tree_combiner_.UpdateDebugConsoleRenderTree(renderer::Submission(
+  if (debug_console_->GetMode() == debug::DebugHub::kDebugConsoleOff) {
+    render_tree_combiner_->UpdateDebugConsoleRenderTree(base::nullopt);
+    return;
+  }
+
+  render_tree_combiner_->UpdateDebugConsoleRenderTree(renderer::Submission(
       layout_results.render_tree, layout_results.layout_time));
 }
 
@@ -918,29 +910,38 @@
   // The screenshot writer may be holding on to a reference to a render tree
   // which could in turn be referencing resources like images, so clear that
   // out.
-  screen_shot_writer_->ClearLastPipelineSubmission();
+  if (screen_shot_writer_) {
+    screen_shot_writer_->ClearLastPipelineSubmission();
+  }
 #endif
 
   // Clear out the render tree combiner so that it doesn't hold on to any
   // render tree resources either.
-  render_tree_combiner_.Reset();
+  if (render_tree_combiner_) {
+    render_tree_combiner_->Reset();
+  }
 
 #if defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
   // Note that the following function call will leak the GPU memory allocated.
-  // This is because after renderer_module_.Suspend() is called it is no longer
+  // This is because after renderer_module_->Suspend() is called it is no longer
   // safe to release the GPU memory allocated.
-  // The following code can call reset() to release the allocated memory but
-  // the memory may still be used by XHR and ArrayBuffer.  As this feature is
-  // only used on platform without Resume() support, it is safer to leak the
-  // memory then to release it.
+  //
+  // The following code can call reset() to release the allocated memory but the
+  // memory may still be used by XHR and ArrayBuffer.  As this feature is only
+  // used on platform without Resume() support, it is safer to leak the memory
+  // then to release it.
   dom::ArrayBuffer::Allocator* allocator = array_buffer_allocator_.release();
 #endif  // defined(ENABLE_GPU_ARRAY_BUFFER_ALLOCATOR)
 
-  media_module_->Suspend();
+  if (media_module_) {
+    media_module_->Suspend();
+  }
 
-  // Place the renderer module into a suspended state where it releases all its
-  // graphical resources.
-  renderer_module_.Suspend();
+  if (renderer_module_) {
+    // Place the renderer module into a suspended state where it releases all
+    // its graphical resources.
+    renderer_module_->Suspend();
+  }
 
   application_state_ = base::kApplicationStateSuspended;
 }
@@ -949,7 +950,7 @@
   TRACE_EVENT0("cobalt::browser", "BrowserModule::Resume()");
   DCHECK(application_state_ == base::kApplicationStateSuspended);
 
-  renderer_module_.Resume();
+  renderer_module_->Resume();
 
   // Note that at this point, it is probable that this resource provider is
   // different than the one that was managed in the associated call to
@@ -970,6 +971,13 @@
   application_state_ = base::kApplicationStatePaused;
 }
 
+void BrowserModule::CheckMemory(
+    const int64_t& used_cpu_memory,
+    const base::optional<int64_t>& used_gpu_memory) {
+  memory_settings_checker_.RunChecks(*auto_mem_, used_cpu_memory,
+                                     used_gpu_memory);
+}
+
 #if defined(OS_STARBOARD)
 void BrowserModule::OnRendererSubmissionRasterized() {
   TRACE_EVENT0("cobalt::browser",
@@ -1030,7 +1038,77 @@
 #endif
 
 render_tree::ResourceProvider* BrowserModule::GetResourceProvider() {
-  return renderer_module_.resource_provider();
+  if (!renderer_module_) {
+    return NULL;
+  }
+
+  return renderer_module_->resource_provider();
+}
+
+void BrowserModule::InitializeSystemWindow() {
+  system_window_.reset(new system_window::SystemWindow(
+      event_dispatcher_, options_.requested_viewport_size));
+
+  auto_mem_.reset(new memory_settings::AutoMem(
+      GetViewportSize(), options_.command_line_auto_mem_settings,
+      options_.build_auto_mem_settings));
+  ApplyAutoMemSettings(*auto_mem_, &options_);
+
+  input_device_manager_ = input::InputDeviceManager::CreateFromWindow(
+                              base::Bind(&BrowserModule::OnKeyEventProduced,
+                                         base::Unretained(this)),
+                              base::Bind(&BrowserModule::OnPointerEventProduced,
+                                         base::Unretained(this)),
+                              base::Bind(&BrowserModule::OnWheelEventProduced,
+                                         base::Unretained(this)),
+                              system_window_.get())
+                              .Pass();
+  renderer_module_.reset(new renderer::RendererModule(
+      system_window_.get(),
+      RendererModuleWithCameraOptions(options_.renderer_module_options,
+                                      input_device_manager_->camera_3d())));
+
+  render_tree_combiner_.reset(
+      new RenderTreeCombiner(renderer_module_.get(), GetViewportSize()));
+
+  // Always render the debug console. It will draw nothing if disabled.
+  // This setting is ignored if ENABLE_DEBUG_CONSOLE is not defined.
+  // TODO: Render tree combiner should probably be refactored.
+  render_tree_combiner_->set_render_debug_console(true);
+
+#if defined(ENABLE_SCREENSHOT)
+  screen_shot_writer_.reset(new ScreenShotWriter(renderer_module_->pipeline()));
+#endif  // defined(ENABLE_SCREENSHOT)
+  // TODO: Pass in dialog closure instead of system window.
+  h5vcc_url_handler_.reset(new H5vccURLHandler(this, system_window_.get()));
+
+  media_module_ =
+      media::MediaModule::Create(system_window_.get(), GetResourceProvider(),
+                                 options_.media_module_options);
+}
+
+math::Size BrowserModule::GetViewportSize() {
+  // We trust the renderer module the most, if it exists.
+  if (renderer_module_) {
+    return renderer_module_->render_target_size();
+  }
+
+  // If the system window exists, that's almost just as good.
+  if (system_window_) {
+    return system_window_->GetWindowSize();
+  }
+
+  // Otherwise, we assume we'll get the viewport size that was requested.
+  if (options_.requested_viewport_size) {
+    return *options_.requested_viewport_size;
+  }
+
+  // TODO: Allow platforms to define the default window size and return that
+  // here.
+
+  // No window and no viewport size was requested, so we return a conservative
+  // default.
+  return math::Size(1280, 720);
 }
 
 }  // namespace browser
diff --git a/src/cobalt/browser/browser_module.h b/src/cobalt/browser/browser_module.h
index 2f12650..066aa04 100644
--- a/src/cobalt/browser/browser_module.h
+++ b/src/cobalt/browser/browser_module.h
@@ -28,6 +28,8 @@
 #include "cobalt/base/message_queue.h"
 #include "cobalt/browser/h5vcc_url_handler.h"
 #include "cobalt/browser/lifecycle_observer.h"
+#include "cobalt/browser/memory_settings/auto_mem.h"
+#include "cobalt/browser/memory_settings/checker.h"
 #include "cobalt/browser/render_tree_combiner.h"
 #include "cobalt/browser/screen_shot_writer.h"
 #include "cobalt/browser/splash_screen.h"
@@ -66,7 +68,11 @@
   // setup reasonable default options.
   struct Options {
     explicit Options(const WebModule::Options& web_options)
-        : web_module_options(web_options) {}
+        : web_module_options(web_options),
+          command_line_auto_mem_settings(
+              memory_settings::AutoMemSettings::kTypeCommandLine),
+          build_auto_mem_settings(
+              memory_settings::AutoMemSettings::kTypeBuild) {}
     network::NetworkModule::Options network_module_options;
     renderer::RendererModule::Options renderer_module_options;
     storage::StorageManager::Options storage_manager_options;
@@ -75,6 +81,10 @@
     std::string language;
     std::string initial_deep_link;
     base::Closure web_module_recreated_callback;
+    memory_settings::AutoMemSettings command_line_auto_mem_settings;
+    memory_settings::AutoMemSettings build_auto_mem_settings;
+    base::optional<GURL> splash_screen_url;
+    base::optional<math::Size> requested_viewport_size;
   };
 
   // Type for a collection of URL handler callbacks that can potentially handle
@@ -83,7 +93,7 @@
 
   BrowserModule(const GURL& url,
                 base::ApplicationState initial_application_state,
-                system_window::SystemWindow* system_window,
+                base::EventDispatcher* event_dispatcher,
                 account::AccountManager* account_manager,
                 const Options& options);
   ~BrowserModule();
@@ -130,6 +140,9 @@
   void Suspend();
   void Resume();
 
+  void CheckMemory(const int64_t& used_cpu_memory,
+                   const base::optional<int64_t>& used_gpu_memory);
+
  private:
 #if SB_HAS(CORE_DUMP_HANDLER_SUPPORT)
   static void CoreDumpHandler(void* browser_module_as_void);
@@ -237,11 +250,9 @@
       scoped_ptr<webdriver::WindowDriver>* out_window_driver);
 #endif
 
-#if defined(OS_STARBOARD)
   // Called when a renderer submission has been rasterized. Used to hide the
   // system splash screen after the first render has completed.
   void OnRendererSubmissionRasterized();
-#endif  // OS_STARBOARD
 
   // Process all messages queued into the |render_tree_submission_queue_|.
   void ProcessRenderTreeSubmissionQueue();
@@ -251,8 +262,19 @@
   void OnPollForRenderTimeout(const GURL& url);
 #endif
 
+  // Gets the current resource provider.
   render_tree::ResourceProvider* GetResourceProvider();
 
+  // Initializes the system window, and all components that require it.
+  void InitializeSystemWindow();
+
+  // Gets a viewport size to use for now. This may change depending on the
+  // current application state. While preloading, this returns the requested
+  // viewport size. If there was no requested viewport size, it returns a
+  // default viewport size of 1280x720 (720p). Once a system window is created,
+  // it returns the confirmed size of the window.
+  math::Size GetViewportSize();
+
   // TODO:
   //     WeakPtr usage here can be avoided if BrowserModule has a thread to
   //     own where it can ensure that its tasks are all resolved when it is
@@ -271,6 +293,12 @@
   // |weak_ptr_factory_.GetWeakPtr() which is not).
   base::WeakPtr<BrowserModule> weak_this_;
 
+  // Memory configuration tool.
+  scoped_ptr<memory_settings::AutoMem> auto_mem_;
+
+  // A copy of the BrowserModule Options passed into the constructor.
+  Options options_;
+
   // The browser module runs on this message loop.
   MessageLoop* const self_message_loop_;
 
@@ -278,13 +306,17 @@
   // using it to initialize a new WebModule.
   URLHandlerCollection url_handlers_;
 
+  base::EventDispatcher* event_dispatcher_;
+
   storage::StorageManager storage_manager_;
 
-#if defined(OS_STARBOARD)
   // Whether the browser module has yet rendered anything. On the very first
   // render, we hide the system splash screen.
   bool is_rendered_;
-#endif  // OS_STARBOARD
+
+  // The main system window for our application. This routes input event
+  // callbacks, and provides a native window handle on desktop systems.
+  scoped_ptr<system_window::SystemWindow> system_window_;
 
   // Wraps input device and produces input events that can be passed into
   // the web module.
@@ -292,7 +324,7 @@
 
   // Sets up everything to do with graphics, from backend objects like the
   // display and graphics context to the rasterizer and rendering pipeline.
-  renderer::RendererModule renderer_module_;
+  scoped_ptr<renderer::RendererModule> renderer_module_;
 
   // Optional memory allocator used by ArrayBuffer.
   scoped_ptr<dom::ArrayBuffer::Allocator> array_buffer_allocator_;
@@ -307,7 +339,7 @@
   network::NetworkModule network_module_;
 
   // Manages the two render trees, combines and renders them.
-  RenderTreeCombiner render_tree_combiner_;
+  scoped_ptr<RenderTreeCombiner> render_tree_combiner_;
 
 #if defined(ENABLE_SCREENSHOT)
   // Helper object to create screen shots of the last layout tree.
@@ -366,10 +398,7 @@
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
   // Handler object for h5vcc URLs.
-  H5vccURLHandler h5vcc_url_handler_;
-
-  // WebModule options.
-  WebModule::Options web_module_options_;
+  scoped_ptr<H5vccURLHandler> h5vcc_url_handler_;
 
   // The splash screen. The pointer wrapped here should be non-NULL iff
   // the splash screen is currently displayed.
@@ -395,13 +424,19 @@
   // ensure synchronous access.
   base::Lock quit_lock_;
 
-  system_window::SystemWindow* system_window_;
-
   // The current application state.
   base::ApplicationState application_state_;
 
   // The list of LifecycleObserver that need to be managed.
   ObserverList<LifecycleObserver> lifecycle_observers_;
+
+  // Fires memory warning once when memory exceeds specified max cpu/gpu
+  // memory.
+  memory_settings::Checker memory_settings_checker_;
+
+  // The URL to the splash screen. If empty (the default), no splash
+  // screen will be displayed.
+  base::optional<GURL> splash_screen_url_;
 };
 
 }  // namespace browser
diff --git a/src/cobalt/browser/debug_console.cc b/src/cobalt/browser/debug_console.cc
index eaa2b2d..0813095 100644
--- a/src/cobalt/browser/debug_console.cc
+++ b/src/cobalt/browser/debug_console.cc
@@ -162,8 +162,7 @@
     base::ApplicationState initial_application_state,
     const WebModule::OnRenderTreeProducedCallback&
         render_tree_produced_callback,
-    media::MediaModule* media_module, network::NetworkModule* network_module,
-    const math::Size& window_dimensions,
+    network::NetworkModule* network_module, const math::Size& window_dimensions,
     render_tree::ResourceProvider* resource_provider, float layout_refresh_rate,
     const debug::Debugger::GetDebugServerCallback& get_debug_server_callback,
     const script::JavaScriptEngine::Options& js_options) {
@@ -187,14 +186,15 @@
       base::Bind(&CreateDebugHub,
                  base::Bind(&DebugConsole::GetMode, base::Unretained(this)),
                  get_debug_server_callback);
-  web_module_.reset(new WebModule(
-      GURL(kInitialDebugConsoleUrl), initial_application_state,
-      render_tree_produced_callback,
-      base::Bind(&DebugConsole::OnError, base::Unretained(this)),
-      base::Closure(), /* window_close_callback */
-      base::Closure(), /* window_minimize_callback */
-      media_module, network_module, window_dimensions, resource_provider,
-      media_module->system_window(), layout_refresh_rate, web_module_options));
+  web_module_.reset(
+      new WebModule(GURL(kInitialDebugConsoleUrl), initial_application_state,
+                    render_tree_produced_callback,
+                    base::Bind(&DebugConsole::OnError, base::Unretained(this)),
+                    base::Closure(), /* window_close_callback */
+                    base::Closure(), /* window_minimize_callback */
+                    &stub_media_module_, network_module, window_dimensions,
+                    1.f /*video_pixel_ratio*/, resource_provider,
+                    layout_refresh_rate, web_module_options));
 }
 
 DebugConsole::~DebugConsole() {}
diff --git a/src/cobalt/browser/debug_console.h b/src/cobalt/browser/debug_console.h
index 0a55b35..3782f40 100644
--- a/src/cobalt/browser/debug_console.h
+++ b/src/cobalt/browser/debug_console.h
@@ -21,11 +21,12 @@
 
 #include "base/callback.h"
 #include "base/logging.h"
-#include "cobalt/browser/lifecycle_observer.h"
 #include "cobalt/base/token.h"
+#include "cobalt/browser/lifecycle_observer.h"
 #include "cobalt/browser/web_module.h"
 #include "cobalt/debug/debug_hub.h"
 #include "cobalt/dom/keyboard_event_init.h"
+#include "cobalt/media/media_module_stub.h"
 #include "googleurl/src/gurl.h"
 
 namespace cobalt {
@@ -39,7 +40,7 @@
       base::ApplicationState initial_application_state,
       const WebModule::OnRenderTreeProducedCallback&
           render_tree_produced_callback,
-      media::MediaModule* media_module, network::NetworkModule* network_module,
+      network::NetworkModule* network_module,
       const math::Size& window_dimensions,
       render_tree::ResourceProvider* resource_provider,
       float layout_refresh_rate,
@@ -78,6 +79,8 @@
     LOG(ERROR) << error;
   }
 
+  media::MediaModuleStub stub_media_module_;
+
   // The current console visibility mode.  The mutex is required since the debug
   // console's visibility mode may be accessed from both the WebModule thread
   // and the DebugConsole's host thread.
diff --git a/src/cobalt/browser/main.cc b/src/cobalt/browser/main.cc
index 69af9ba..f237b47 100644
--- a/src/cobalt/browser/main.cc
+++ b/src/cobalt/browser/main.cc
@@ -24,10 +24,21 @@
 
 cobalt::browser::Application* g_application = NULL;
 
+void PreloadApplication(int /*argc*/, char** /*argv*/, const char* /*link*/,
+                        const base::Closure& quit_closure) {
+  DCHECK(!g_application);
+  g_application = cobalt::browser::PreloadApplication(quit_closure).release();
+  DCHECK(g_application);
+}
+
 void StartApplication(int /*argc*/, char** /*argv*/, const char* /*link*/,
                       const base::Closure& quit_closure) {
-  DCHECK(!g_application);
-  g_application = cobalt::browser::CreateApplication(quit_closure).release();
+  if (!g_application) {
+    g_application = cobalt::browser::CreateApplication(quit_closure).release();
+  } else {
+    g_application->Start();
+  }
+
   DCHECK(g_application);
 }
 
@@ -40,9 +51,8 @@
 }  // namespace
 
 #if defined(OS_STARBOARD)
-COBALT_WRAP_EVENT_MAIN(StartApplication,
-                       cobalt::browser::EventHandler::HandleEvent,
-                       StopApplication);
+COBALT_WRAP_MAIN(PreloadApplication, StartApplication,
+                 cobalt::browser::EventHandler::HandleEvent, StopApplication);
 #else
 COBALT_WRAP_BASE_MAIN(StartApplication, StopApplication);
 #endif
diff --git a/src/cobalt/browser/memory_settings/auto_mem.cc b/src/cobalt/browser/memory_settings/auto_mem.cc
index f17ec05..2d5df3a 100644
--- a/src/cobalt/browser/memory_settings/auto_mem.cc
+++ b/src/cobalt/browser/memory_settings/auto_mem.cc
@@ -26,7 +26,7 @@
 #include "base/string_number_conversions.h"
 #include "base/string_split.h"
 #include "base/stringprintf.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_settings/calculations.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/browser/memory_settings/constrainer.h"
@@ -42,23 +42,22 @@
 namespace memory_settings {
 namespace {
 
-// Determines if the string value signals "autoset".
-bool StringValueSignalsAutoset(const std::string& value) {
-  std::string value_lower_case = value;
-  std::transform(value_lower_case.begin(), value_lower_case.end(),
-                 value_lower_case.begin(), ::tolower);
-  bool is_autoset = (value_lower_case == "auto") ||
-                    (value_lower_case == "autoset") ||
-                    (value_lower_case == "-1");
-  return is_autoset;
+// Determines if the value signals "autoset".
+template <typename ValueType>
+bool SignalsAutoset(const ValueType& value) {
+  return (value < 0);
+}
+
+template <>
+bool SignalsAutoset(const TextureDimensions& value) {
+  return value.IsAutoset();
 }
 
 template <typename MemorySettingType, typename ValueType>
-void SetMemorySetting(
-    const CommandLine& cmd_line,  // Optional.
-    const base::optional<ValueType>& build_setting,
-    const ValueType& autoset_value,
-    MemorySettingType* setting) {
+void SetMemorySetting(const base::optional<ValueType>& command_line_setting,
+                      const base::optional<ValueType>& build_setting,
+                      const ValueType& autoset_value,
+                      MemorySettingType* setting) {
   const std::string setting_name = setting->name();
 
   // True when the command line explicitly requests the variable to be autoset.
@@ -67,13 +66,13 @@
   // The value is set according to importance:
   // 1) Command line switches are the most important, so set those if they
   //    exist.
-  if (cmd_line.HasSwitch(setting_name)) {
-    std::string value = cmd_line.GetSwitchValueNative(setting_name);
-    if (StringValueSignalsAutoset(value)) {
-      force_autoset = true;
-    } else if (setting->TryParseValue(MemorySetting::kCmdLine, value)) {
+  if (command_line_setting) {
+    if (!SignalsAutoset(*command_line_setting)) {
+      setting->set_value(MemorySetting::kCmdLine, *command_line_setting);
       return;
     }
+
+    force_autoset = true;
   }
 
   // 2) Is there a build setting? Then set to build_setting, unless the command
@@ -86,32 +85,30 @@
   }
 }
 
-// Creates the specified memory setting type and binds it to (1) command line
-// or else (2) build setting or else (3) an auto_set value.
+// Creates the specified memory setting type and binds it to (1) command line or
+// else (2) build setting or else (3) an auto_set value.
 template <typename MemorySettingType, typename ValueType>
 scoped_ptr<MemorySettingType> CreateMemorySetting(
     const char* setting_name,
-    const CommandLine& cmd_line,  // Optional.
+    const base::optional<ValueType>& command_line_setting,
     const base::optional<ValueType>& build_setting,
     const ValueType& autoset_value) {
   scoped_ptr<MemorySettingType> output(new MemorySettingType(setting_name));
-  SetMemorySetting(cmd_line, build_setting, autoset_value, output.get());
+  SetMemorySetting(command_line_setting, build_setting, autoset_value,
+                   output.get());
   return output.Pass();
 }
 
 scoped_ptr<IntSetting> CreateSystemMemorySetting(
-    const char* setting_name,
-    MemorySetting::MemoryType memory_type,
-    const CommandLine& command_line,
+    const char* setting_name, MemorySetting::MemoryType memory_type,
+    const base::optional<int64_t>& command_line_setting,
     const base::optional<int64_t>& build_setting,
     const base::optional<int64_t>& starboard_value) {
   scoped_ptr<IntSetting> setting(new IntSetting(setting_name));
   setting->set_memory_type(memory_type);
-  if (command_line.HasSwitch(setting_name)) {
-    const std::string value = command_line.GetSwitchValueNative(setting_name);
-    if (setting->TryParseValue(MemorySetting::kCmdLine, value)) {
-      return setting.Pass();
-    }
+  if (command_line_setting) {
+    setting->set_value(MemorySetting::kCmdLine, *command_line_setting);
+    return setting.Pass();
   }
 
   if (build_setting) {
@@ -178,35 +175,31 @@
 // Creates the GPU setting.
 // This setting is unique because it may not be defined by command line, or
 // build. In this was, it can be unset.
-scoped_ptr<IntSetting> CreateGpuSetting(const CommandLine& command_line,
-                                        const BuildSettings& build_settings) {
+scoped_ptr<IntSetting> CreateGpuSetting(
+    const AutoMemSettings& command_line_settings,
+    const AutoMemSettings& build_settings) {
   // Bind to the starboard api, if applicable.
   base::optional<int64_t> starboard_setting;
   if (SbSystemHasCapability(kSbSystemCapabilityCanQueryGPUMemoryStats)) {
     starboard_setting = SbSystemGetTotalGPUMemory();
   }
 
-  scoped_ptr<IntSetting> gpu_setting =
-      CreateSystemMemorySetting(
-          switches::kMaxCobaltGpuUsage,
-          MemorySetting::kGPU,
-          command_line,
-          build_settings.max_gpu_in_bytes,
-          starboard_setting);
+  scoped_ptr<IntSetting> gpu_setting = CreateSystemMemorySetting(
+      switches::kMaxCobaltGpuUsage, MemorySetting::kGPU,
+      command_line_settings.max_gpu_in_bytes, build_settings.max_gpu_in_bytes,
+      starboard_setting);
 
   EnsureValuePositive(gpu_setting.get());
   return gpu_setting.Pass();
 }
 
-scoped_ptr<IntSetting> CreateCpuSetting(const CommandLine& command_line,
-                                        const BuildSettings& build_settings) {
-  scoped_ptr<IntSetting> cpu_setting =
-      CreateSystemMemorySetting(
-          switches::kMaxCobaltCpuUsage,
-          MemorySetting::kCPU,
-          command_line,
-          build_settings.max_cpu_in_bytes,
-          SbSystemGetTotalCPUMemory());
+scoped_ptr<IntSetting> CreateCpuSetting(
+    const AutoMemSettings& command_line_settings,
+    const AutoMemSettings& build_settings) {
+  scoped_ptr<IntSetting> cpu_setting = CreateSystemMemorySetting(
+      switches::kMaxCobaltCpuUsage, MemorySetting::kCPU,
+      command_line_settings.max_cpu_in_bytes, build_settings.max_cpu_in_bytes,
+      SbSystemGetTotalCPUMemory());
 
   EnsureValuePositive(cpu_setting.get());
   return cpu_setting.Pass();
@@ -275,9 +268,9 @@
 }  // namespace
 
 AutoMem::AutoMem(const math::Size& ui_resolution,
-                 const CommandLine& command_line,
-                 const BuildSettings& build_settings) {
-  ConstructSettings(ui_resolution, command_line, build_settings);
+                 const AutoMemSettings& command_line_settings,
+                 const AutoMemSettings& build_settings) {
+  ConstructSettings(ui_resolution, command_line_settings, build_settings);
 
   const int64_t target_cpu_memory =
       GenerateTargetMemoryBytes(max_cpu_bytes_->value(),
@@ -329,6 +322,10 @@
   return software_surface_cache_size_in_bytes_.get();
 }
 
+const IntSetting* AutoMem::offscreen_target_cache_size_in_bytes() const {
+  return offscreen_target_cache_size_in_bytes_.get();
+}
+
 const IntSetting* AutoMem::max_cpu_bytes() const {
   return max_cpu_bytes_.get();
 }
@@ -356,6 +353,7 @@
   all_settings.push_back(javascript_gc_threshold_in_bytes_.get());
   all_settings.push_back(misc_cobalt_cpu_size_in_bytes_.get());
   all_settings.push_back(misc_cobalt_gpu_size_in_bytes_.get());
+  all_settings.push_back(offscreen_target_cache_size_in_bytes_.get());
   all_settings.push_back(remote_typeface_cache_size_in_bytes_.get());
   all_settings.push_back(skia_atlas_texture_dimensions_.get());
   all_settings.push_back(skia_cache_size_in_bytes_.get());
@@ -419,30 +417,25 @@
   return SumMemoryConsumption(memory_type, AllMemorySettings());
 }
 
-void AutoMem::ConstructSettings(
-    const math::Size& ui_resolution,
-    const CommandLine& command_line,
-    const BuildSettings& build_settings) {
-  max_cpu_bytes_ = CreateCpuSetting(command_line, build_settings);
-  max_gpu_bytes_ = CreateGpuSetting(command_line, build_settings);
+void AutoMem::ConstructSettings(const math::Size& ui_resolution,
+                                const AutoMemSettings& command_line_settings,
+                                const AutoMemSettings& build_settings) {
+  max_cpu_bytes_ = CreateCpuSetting(command_line_settings, build_settings);
+  max_gpu_bytes_ = CreateGpuSetting(command_line_settings, build_settings);
 
   reduced_cpu_bytes_ = CreateSystemMemorySetting(
-      switches::kReduceCpuMemoryBy,
-      MemorySetting::kCPU,
-      command_line,
-      build_settings.reduce_cpu_memory_by,
-      -1);
+      switches::kReduceCpuMemoryBy, MemorySetting::kCPU,
+      command_line_settings.reduce_cpu_memory_by,
+      build_settings.reduce_cpu_memory_by, -1);
   if (reduced_cpu_bytes_->value() == -1) {
     // This effectively disables the value from being used in the constrainer.
     reduced_cpu_bytes_->set_value(MemorySetting::kUnset, 0);
   }
 
   reduced_gpu_bytes_ = CreateSystemMemorySetting(
-      switches::kReduceGpuMemoryBy,
-      MemorySetting::kGPU,
-      command_line,
-      build_settings.reduce_gpu_memory_by,
-      -1);
+      switches::kReduceGpuMemoryBy, MemorySetting::kGPU,
+      command_line_settings.reduce_gpu_memory_by,
+      build_settings.reduce_gpu_memory_by, -1);
   if (reduced_cpu_bytes_->value() == -1) {
     // This effectively disables the value from being used in the constrainer.
     reduced_gpu_bytes_->set_value(MemorySetting::kUnset, 0);
@@ -451,7 +444,7 @@
   // Set the ImageCache
   image_cache_size_in_bytes_ = CreateMemorySetting<IntSetting, int64_t>(
       switches::kImageCacheSizeInBytes,
-      command_line,
+      command_line_settings.cobalt_image_cache_size_in_bytes,
       build_settings.cobalt_image_cache_size_in_bytes,
       CalculateImageCacheSize(ui_resolution));
   EnsureValuePositive(image_cache_size_in_bytes_.get());
@@ -465,10 +458,9 @@
   // Set javascript gc threshold
   JavaScriptGcThresholdSetting* js_setting = new JavaScriptGcThresholdSetting;
   SetMemorySetting<IntSetting, int64_t>(
-      command_line,
+      command_line_settings.javascript_garbage_collection_threshold_in_bytes,
       build_settings.javascript_garbage_collection_threshold_in_bytes,
-      kDefaultJsGarbageCollectionThresholdSize,
-      js_setting);
+      kDefaultJsGarbageCollectionThresholdSize, js_setting);
   EnsureValuePositive(js_setting);
   js_setting->PostInit();
   javascript_gc_threshold_in_bytes_.reset(js_setting);
@@ -489,15 +481,15 @@
   // Set remote_type_face_cache size.
   remote_typeface_cache_size_in_bytes_ =
       CreateMemorySetting<IntSetting, int64_t>(
-        switches::kRemoteTypefaceCacheSizeInBytes,
-        command_line,
-        build_settings.remote_typeface_cache_capacity_in_bytes,
-        kDefaultRemoteTypeFaceCacheSize);
+          switches::kRemoteTypefaceCacheSizeInBytes,
+          command_line_settings.remote_typeface_cache_capacity_in_bytes,
+          build_settings.remote_typeface_cache_capacity_in_bytes,
+          kDefaultRemoteTypeFaceCacheSize);
   EnsureValuePositive(remote_typeface_cache_size_in_bytes_.get());
 
   // Skia atlas texture dimensions.
   skia_atlas_texture_dimensions_.reset(new SkiaGlyphAtlasTextureSetting());
-  SetMemorySetting(command_line,
+  SetMemorySetting(command_line_settings.skia_texture_atlas_dimensions,
                    build_settings.skia_texture_atlas_dimensions,
                    CalculateSkiaGlyphAtlasTextureSize(ui_resolution),
                    skia_atlas_texture_dimensions_.get());
@@ -517,7 +509,7 @@
   // Set skia_cache_size_in_bytes
   skia_cache_size_in_bytes_ = CreateMemorySetting<IntSetting, int64_t>(
       switches::kSkiaCacheSizeInBytes,
-      command_line,
+      command_line_settings.skia_cache_size_in_bytes,
       build_settings.skia_cache_size_in_bytes,
       CalculateSkiaCacheSize(ui_resolution));
   // Not available for blitter platforms.
@@ -533,7 +525,7 @@
   software_surface_cache_size_in_bytes_ =
       CreateMemorySetting<IntSetting, int64_t>(
           switches::kSoftwareSurfaceCacheSizeInBytes,
-          command_line,
+          command_line_settings.software_surface_cache_size_in_bytes,
           build_settings.software_surface_cache_size_in_bytes,
           CalculateSoftwareSurfaceCacheSizeInBytes(ui_resolution));
   // Blitter only feature.
@@ -543,6 +535,24 @@
   }
   EnsureValuePositive(software_surface_cache_size_in_bytes_.get());
 
+  // Set offscreen_target_cache_size_in_bytes (relevant to the direct-gles
+  // rasterizer).
+  offscreen_target_cache_size_in_bytes_ =
+      CreateMemorySetting<IntSetting, int64_t>(
+          switches::kOffscreenTargetCacheSizeInBytes,
+          command_line_settings.offscreen_target_cache_size_in_bytes,
+          build_settings.offscreen_target_cache_size_in_bytes,
+          CalculateOffscreenTargetCacheSizeInBytes(ui_resolution));
+  offscreen_target_cache_size_in_bytes_->set_memory_scaling_function(
+      MakeLinearMemoryScaler(0.25, 1.0));
+#if defined(COBALT_FORCE_DIRECT_GLES_RASTERIZER)
+  offscreen_target_cache_size_in_bytes_->set_memory_type(MemorySetting::kGPU);
+#else
+  offscreen_target_cache_size_in_bytes_->set_memory_type(
+      MemorySetting::kNotApplicable);
+#endif
+  EnsureValuePositive(offscreen_target_cache_size_in_bytes_.get());
+
   // Final stage: Check that all constraining functions are monotonically
   // increasing.
   const std::vector<const MemorySetting*> all_memory_settings =
diff --git a/src/cobalt/browser/memory_settings/auto_mem.h b/src/cobalt/browser/memory_settings/auto_mem.h
index 66101e4..a04a5d9 100644
--- a/src/cobalt/browser/memory_settings/auto_mem.h
+++ b/src/cobalt/browser/memory_settings/auto_mem.h
@@ -17,14 +17,13 @@
 #ifndef COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_H_
 #define COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_H_
 
-#include <map>
 #include <string>
 #include <vector>
 
 #include "base/command_line.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_settings/memory_settings.h"
 #include "cobalt/math/size.h"
 #include "testing/gtest/include/gtest/gtest_prod.h"
@@ -39,8 +38,8 @@
 class AutoMem {
  public:
   explicit AutoMem(const math::Size& ui_resolution,
-                   const CommandLine& command_line,
-                   const BuildSettings& build_settings);
+                   const AutoMemSettings& command_line_settings,
+                   const AutoMemSettings& build_settings);
   ~AutoMem();
 
   const IntSetting* image_cache_size_in_bytes() const;
@@ -53,6 +52,7 @@
   const DimensionSetting* skia_atlas_texture_dimensions() const;
   const IntSetting* skia_cache_size_in_bytes() const;
   const IntSetting* software_surface_cache_size_in_bytes() const;
+  const IntSetting* offscreen_target_cache_size_in_bytes() const;
 
   // max_cpu/gpu_bytes represents the maximum amount of memory that should
   // be consumed by the engine. These values can be set by the command line
@@ -71,8 +71,8 @@
 
  private:
   void ConstructSettings(const math::Size& ui_resolution,
-                         const CommandLine& command_line,
-                         const BuildSettings& build_settings);
+                         const AutoMemSettings& command_line_settings,
+                         const AutoMemSettings& build_settings);
 
   // AllMemorySettings - does not include cpu & gpu max memory.
   std::vector<const MemorySetting*> AllMemorySettings() const;
@@ -87,6 +87,7 @@
   scoped_ptr<DimensionSetting> skia_atlas_texture_dimensions_;
   scoped_ptr<IntSetting> skia_cache_size_in_bytes_;
   scoped_ptr<IntSetting> software_surface_cache_size_in_bytes_;
+  scoped_ptr<IntSetting> offscreen_target_cache_size_in_bytes_;
 
   // These settings are used for constraining the memory and are NOT included
   // in AllMemorySettings().
diff --git a/src/cobalt/browser/memory_settings/auto_mem_settings.cc b/src/cobalt/browser/memory_settings/auto_mem_settings.cc
new file mode 100644
index 0000000..c5ecee4
--- /dev/null
+++ b/src/cobalt/browser/memory_settings/auto_mem_settings.cc
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
+
+#include <algorithm>
+#include <string>
+#include <vector>
+
+#include "base/optional.h"
+#include "base/string_number_conversions.h"
+#include "base/string_split.h"
+#include "cobalt/browser/memory_settings/constants.h"
+#include "cobalt/browser/switches.h"
+#include "nb/lexical_cast.h"
+
+namespace cobalt {
+namespace browser {
+namespace memory_settings {
+namespace {
+bool HasBlitter() {
+#if SB_HAS(BLITTER)
+  const bool has_blitter = true;
+#else
+  const bool has_blitter = false;
+#endif
+  return has_blitter;
+}
+
+base::optional<int64_t> MakeValidIfGreaterThanOrEqualToZero(int64_t value) {
+  base::optional<int64_t> output;
+  if (value >= 0) {
+    output = value;
+  }
+  return output;
+}
+
+base::optional<TextureDimensions> MakeDimensionsIfValid(TextureDimensions td) {
+  base::optional<TextureDimensions> output;
+  if ((td.width() > 0) && (td.height() > 0) && td.bytes_per_pixel() > 0) {
+    output = td;
+  }
+  return output;
+}
+
+char ToLowerCharTypesafe(int c) { return static_cast<char>(::tolower(c)); }
+
+std::string ToLower(const std::string& input) {
+  std::string value_str = input;
+  std::transform(value_str.begin(), value_str.end(), value_str.begin(),
+                 ToLowerCharTypesafe);
+
+  return value_str;
+}
+
+bool StringValueSignalsAutoset(const std::string& value) {
+  std::string value_lower_case = ToLower(value);
+  return ((value_lower_case == "auto") || (value_lower_case == "autoset") ||
+          (value_lower_case == "-1"));
+}
+
+struct ParsedIntValue {
+ public:
+  ParsedIntValue() : value_(0), error_(false) {}
+  ParsedIntValue(const ParsedIntValue& other)
+      : value_(other.value_), error_(other.error_) {}
+  int value_;
+  bool error_;  // true if there was a parse error.
+};
+
+// Parses a string like "1234x5678" to vector of parsed int values.
+std::vector<ParsedIntValue> ParseDimensions(const std::string& input) {
+  std::string value_str = ToLower(input);
+  std::vector<ParsedIntValue> output;
+
+  std::vector<std::string> lengths;
+  base::SplitString(value_str, 'x', &lengths);
+
+  for (size_t i = 0; i < lengths.size(); ++i) {
+    ParsedIntValue parsed_value;
+    parsed_value.error_ = !base::StringToInt(lengths[i], &parsed_value.value_);
+    output.push_back(parsed_value);
+  }
+  return output;
+}
+
+bool StringEndsWith(const std::string& value, const std::string& ending) {
+  if (ending.size() > value.size()) {
+    return false;
+  }
+  // Reverse search through the back of the string.
+  return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
+}
+
+// Handles bytes: "12435"
+// Handles kilobytes: "128KB"
+// Handles megabytes: "64MB"
+// Handles gigabytes: "1GB"
+// Handles fractional units for kilo/mega/gigabytes
+int64_t ParseMemoryValue(const std::string& value, bool* parse_ok) {
+  // nb::lexical_cast<> will parse out the number but it will ignore the
+  // unit part, such as "kb" or "mb".
+  double numerical_value = nb::lexical_cast<double>(value, parse_ok);
+  if (!(*parse_ok)) {
+    return static_cast<int64_t>(numerical_value);
+  }
+
+  // Lowercasing the string makes the units easier to detect.
+  std::string value_lower_case = ToLower(value);
+
+  if (StringEndsWith(value_lower_case, "kb")) {
+    numerical_value *= 1024;  // convert kb -> bytes.
+  } else if (StringEndsWith(value_lower_case, "mb")) {
+    numerical_value *= 1024 * 1024;  // convert mb -> bytes.
+  } else if (StringEndsWith(value_lower_case, "gb")) {
+    numerical_value *= 1024 * 1024 * 1024;  // convert gb -> bytes.
+  }
+  return static_cast<int64_t>(numerical_value);
+}
+
+template <typename ValueType>
+bool TryParseValue(base::optional<ValueType>* destination,
+                   const std::string& string_value);
+
+template <>
+bool TryParseValue<int64_t>(base::optional<int64_t>* destination,
+                            const std::string& string_value) {
+  bool parse_ok = false;
+  int64_t int_value = ParseMemoryValue(string_value, &parse_ok);
+
+  if (parse_ok) {
+    *destination = int_value;
+    return true;
+  }
+
+  LOG(ERROR) << "Invalid value for command line setting: " << string_value;
+  return false;
+}
+
+template <>
+bool TryParseValue<TextureDimensions>(
+    base::optional<TextureDimensions>* destination,
+    const std::string& string_value) {
+  std::vector<ParsedIntValue> int_values = ParseDimensions(string_value);
+
+  if ((int_values.size() < 2) || (int_values.size() > 3)) {
+    LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
+    return false;  // Parse failed.
+  }
+
+  for (size_t i = 0; i < int_values.size(); ++i) {
+    if (int_values[i].error_) {
+      LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
+      return false;  // Parse failed.
+    }
+  }
+
+  const int bytes_per_pixel = int_values.size() == 3
+                                  ? int_values[2].value_
+                                  : kSkiaGlyphAtlasTextureBytesPerPixel;
+
+  TextureDimensions tex_dimensions(int_values[0].value_, int_values[1].value_,
+                                   bytes_per_pixel);
+
+  *destination = tex_dimensions;
+  return true;
+}
+
+template <typename ValueType>
+ValueType GetAutosetValue();
+
+template <>
+int64_t GetAutosetValue() {
+  return -1;
+}
+
+template <>
+TextureDimensions GetAutosetValue() {
+  return TextureDimensions(-1, -1, -1);
+}
+
+template <typename ValueType>
+bool Set(const CommandLine& command_line, base::optional<ValueType>* setting,
+         const char* setting_name) {
+  if (!command_line.HasSwitch(setting_name)) {
+    return true;
+  }
+
+  std::string value = command_line.GetSwitchValueNative(setting_name);
+  if (StringValueSignalsAutoset(value)) {
+    *setting = GetAutosetValue<ValueType>();
+    return true;
+  }
+
+  return TryParseValue(setting, value);
+}
+}  // namespace
+
+AutoMemSettings GetDefaultBuildSettings() {
+  AutoMemSettings settings(AutoMemSettings::kTypeBuild);
+  settings.has_blitter = HasBlitter();
+
+  settings.cobalt_image_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_IMAGE_CACHE_SIZE_IN_BYTES);
+  settings.javascript_garbage_collection_threshold_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_JS_GARBAGE_COLLECTION_THRESHOLD_IN_BYTES);
+  settings.remote_typeface_cache_capacity_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_REMOTE_TYPEFACE_CACHE_SIZE_IN_BYTES);
+  settings.skia_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_SKIA_CACHE_SIZE_IN_BYTES);
+  settings.skia_texture_atlas_dimensions =
+      MakeDimensionsIfValid(TextureDimensions(
+          COBALT_SKIA_GLYPH_ATLAS_WIDTH, COBALT_SKIA_GLYPH_ATLAS_HEIGHT,
+          kSkiaGlyphAtlasTextureBytesPerPixel));
+
+  // Render tree node cache settings for various rasterizers.
+  settings.software_surface_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_SOFTWARE_SURFACE_CACHE_SIZE_IN_BYTES);
+  settings.offscreen_target_cache_size_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(
+          COBALT_OFFSCREEN_TARGET_CACHE_SIZE_IN_BYTES);
+
+  settings.max_cpu_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_CPU_USAGE_IN_BYTES);
+  settings.max_gpu_in_bytes =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_GPU_USAGE_IN_BYTES);
+
+  settings.reduce_cpu_memory_by =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_CPU_MEMORY_BY);
+  settings.reduce_gpu_memory_by =
+      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_GPU_MEMORY_BY);
+
+  return settings;
+}
+
+AutoMemSettings GetSettings(const CommandLine& command_line) {
+  AutoMemSettings settings(AutoMemSettings::kTypeCommandLine);
+  settings.has_blitter = HasBlitter();
+
+  Set(command_line, &settings.cobalt_image_cache_size_in_bytes,
+      switches::kImageCacheSizeInBytes);
+  Set(command_line, &settings.javascript_garbage_collection_threshold_in_bytes,
+      switches::kJavaScriptGcThresholdInBytes);
+  Set(command_line, &settings.remote_typeface_cache_capacity_in_bytes,
+      switches::kRemoteTypefaceCacheSizeInBytes);
+  Set(command_line, &settings.skia_cache_size_in_bytes,
+      switches::kSkiaCacheSizeInBytes);
+  Set(command_line, &settings.skia_texture_atlas_dimensions,
+      switches::kSkiaTextureAtlasDimensions);
+  Set(command_line, &settings.software_surface_cache_size_in_bytes,
+      switches::kSoftwareSurfaceCacheSizeInBytes);
+  Set(command_line, &settings.offscreen_target_cache_size_in_bytes,
+      switches::kOffscreenTargetCacheSizeInBytes);
+  Set(command_line, &settings.max_cpu_in_bytes, switches::kMaxCobaltCpuUsage);
+  Set(command_line, &settings.max_gpu_in_bytes, switches::kMaxCobaltGpuUsage);
+  Set(command_line, &settings.reduce_cpu_memory_by,
+      switches::kReduceCpuMemoryBy);
+  Set(command_line, &settings.reduce_gpu_memory_by,
+      switches::kReduceGpuMemoryBy);
+
+  return settings;
+}
+
+}  // namespace memory_settings
+}  // namespace browser
+}  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/build_settings.h b/src/cobalt/browser/memory_settings/auto_mem_settings.h
similarity index 70%
rename from src/cobalt/browser/memory_settings/build_settings.h
rename to src/cobalt/browser/memory_settings/auto_mem_settings.h
index ea29197..10f5bd8 100644
--- a/src/cobalt/browser/memory_settings/build_settings.h
+++ b/src/cobalt/browser/memory_settings/auto_mem_settings.h
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-#ifndef COBALT_BROWSER_MEMORY_SETTINGS_BUILD_SETTINGS_H_
-#define COBALT_BROWSER_MEMORY_SETTINGS_BUILD_SETTINGS_H_
+#ifndef COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_SETTINGS_H_
+#define COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_SETTINGS_H_
 
+#include "base/command_line.h"
 #include "base/optional.h"
 #include "cobalt/browser/memory_settings/texture_dimensions.h"
 #include "cobalt/math/size.h"
@@ -26,8 +27,19 @@
 namespace browser {
 namespace memory_settings {
 
-struct BuildSettings {
-  BuildSettings() : has_blitter(false), max_cpu_in_bytes(0) {}
+struct AutoMemSettings {
+  enum Type {
+    kTypeBuild,
+    kTypeCommandLine,
+  };
+
+  explicit AutoMemSettings(Type type) : type(type), has_blitter(false) {
+    if (type == kTypeBuild) {
+      max_cpu_in_bytes = 0;
+    }
+  }
+
+  Type type;
   bool has_blitter;
   base::optional<int64_t> cobalt_image_cache_size_in_bytes;
   base::optional<int64_t> javascript_garbage_collection_threshold_in_bytes;
@@ -35,6 +47,7 @@
   base::optional<int64_t> skia_cache_size_in_bytes;
   base::optional<TextureDimensions> skia_texture_atlas_dimensions;
   base::optional<int64_t> software_surface_cache_size_in_bytes;
+  base::optional<int64_t> offscreen_target_cache_size_in_bytes;
 
   base::optional<int64_t> max_cpu_in_bytes;
   base::optional<int64_t> max_gpu_in_bytes;
@@ -42,10 +55,11 @@
   base::optional<int64_t> reduce_gpu_memory_by;
 };
 
-BuildSettings GetDefaultBuildSettings();
+AutoMemSettings GetDefaultBuildSettings();
+AutoMemSettings GetSettings(const CommandLine& command_line);
 
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
 
-#endif  // COBALT_BROWSER_MEMORY_SETTINGS_BUILD_SETTINGS_H_
+#endif  // COBALT_BROWSER_MEMORY_SETTINGS_AUTO_MEM_SETTINGS_H_
diff --git a/src/cobalt/browser/memory_settings/auto_mem_settings_test.cc b/src/cobalt/browser/memory_settings/auto_mem_settings_test.cc
new file mode 100644
index 0000000..06bd7d2
--- /dev/null
+++ b/src/cobalt/browser/memory_settings/auto_mem_settings_test.cc
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
+
+#include <algorithm>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "cobalt/browser/memory_settings/test_common.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace cobalt {
+namespace browser {
+namespace memory_settings {
+namespace {
+CommandLine MakeCommandLine(const std::string& name, const std::string& value) {
+  CommandLine command_line(CommandLine::NO_PROGRAM);
+  command_line.AppendSwitchASCII(name, value);
+  return command_line;
+}
+
+void TestParseInt(const base::optional<int64_t>& expected,
+                  const std::string& value, const std::string& name,
+                  base::optional<int64_t>* setting) {
+#define TEST_EXTRAS                            \
+  "expected=" << expected << ", "              \
+              << "name=\"" << name << "\", "   \
+              << "value=\"" << value << "\", " \
+              << "setting=" << *setting
+
+  if (!expected) {
+    EXPECT_FALSE(*setting) << TEST_EXTRAS;
+    return;
+  }
+
+  EXPECT_TRUE(*setting) << TEST_EXTRAS;
+  if (!*setting) {
+    // Check and quit so we can continue on failure without a crash.
+    return;
+  }
+  EXPECT_EQ(expected, **setting) << TEST_EXTRAS;
+#undef TEST_EXTRAS
+}
+
+void TestAllParseInt(const base::optional<int64_t>& expected,
+                     const std::string& value) {
+#define TEST_PARSE_INT(expected, value, switch_name, field_name)      \
+  {                                                                   \
+    AutoMemSettings settings =                                        \
+        GetSettings(MakeCommandLine(switch_name, value));             \
+    TestParseInt(expected, value, switch_name, &settings.field_name); \
+  }
+
+  TEST_PARSE_INT(expected, value, switches::kImageCacheSizeInBytes,
+                 cobalt_image_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kJavaScriptGcThresholdInBytes,
+                 javascript_garbage_collection_threshold_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kRemoteTypefaceCacheSizeInBytes,
+                 remote_typeface_cache_capacity_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kSkiaCacheSizeInBytes,
+                 skia_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kSoftwareSurfaceCacheSizeInBytes,
+                 software_surface_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kOffscreenTargetCacheSizeInBytes,
+                 offscreen_target_cache_size_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kMaxCobaltCpuUsage,
+                 max_cpu_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kMaxCobaltGpuUsage,
+                 max_gpu_in_bytes);
+  TEST_PARSE_INT(expected, value, switches::kReduceCpuMemoryBy,
+                 reduce_cpu_memory_by);
+  TEST_PARSE_INT(expected, value, switches::kReduceGpuMemoryBy,
+                 reduce_gpu_memory_by);
+#undef TEST_PARSE_INT
+}
+
+void TestParseDimensions(const base::optional<TextureDimensions>& expected,
+                         const std::string& value) {
+  CommandLine command_line(CommandLine::NO_PROGRAM);
+  command_line.AppendSwitchASCII(switches::kSkiaTextureAtlasDimensions, value);
+  AutoMemSettings settings = GetSettings(command_line);
+  if (!expected) {
+    EXPECT_FALSE(settings.skia_texture_atlas_dimensions);
+    return;
+  }
+  EXPECT_TRUE(settings.skia_texture_atlas_dimensions)
+      << " value=\"" << value << "\", expected=" << expected;
+  if (!settings.skia_texture_atlas_dimensions) {
+    return;
+  }
+  EXPECT_EQ(expected->width(), settings.skia_texture_atlas_dimensions->width())
+      << " value=\"" << value << "\", expected=" << expected;
+  EXPECT_EQ(expected->height(),
+            settings.skia_texture_atlas_dimensions->height())
+      << " value=\"" << value << "\", expected=" << expected;
+  EXPECT_EQ(expected->bytes_per_pixel(),
+            settings.skia_texture_atlas_dimensions->bytes_per_pixel())
+      << " value=\"" << value << "\", expected=" << expected;
+}
+}  // namespace
+
+TEST(AutoMemSettingsTest, InitialState) {
+  AutoMemSettings settings(AutoMemSettings::kTypeCommandLine);
+  EXPECT_EQ(AutoMemSettings::kTypeCommandLine, settings.type);
+  EXPECT_FALSE(settings.cobalt_image_cache_size_in_bytes);
+  EXPECT_FALSE(settings.javascript_garbage_collection_threshold_in_bytes);
+  EXPECT_FALSE(settings.remote_typeface_cache_capacity_in_bytes);
+  EXPECT_FALSE(settings.skia_cache_size_in_bytes);
+  EXPECT_FALSE(settings.skia_texture_atlas_dimensions);
+  EXPECT_FALSE(settings.software_surface_cache_size_in_bytes);
+  EXPECT_FALSE(settings.offscreen_target_cache_size_in_bytes);
+  EXPECT_FALSE(settings.max_cpu_in_bytes);
+  EXPECT_FALSE(settings.max_gpu_in_bytes);
+  EXPECT_FALSE(settings.reduce_cpu_memory_by);
+  EXPECT_FALSE(settings.reduce_gpu_memory_by);
+
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  EXPECT_EQ(AutoMemSettings::kTypeBuild, build_settings.type);
+  EXPECT_TRUE(build_settings.max_cpu_in_bytes);
+  EXPECT_EQ(0, *build_settings.max_cpu_in_bytes);
+}
+
+// Tests the expectation that numerous string variations (whole numbers vs
+// fractions vs units) parse correctly.
+TEST(AutoMemSettingsTest, ParseIntegers) {
+  // Autoset
+  TestAllParseInt(-1, "-1");
+  TestAllParseInt(-1, "auto");
+  TestAllParseInt(-1, "Auto");
+  TestAllParseInt(-1, "AUTO");
+  TestAllParseInt(-1, "autoset");
+  TestAllParseInt(-1, "AutoSet");
+  TestAllParseInt(-1, "AUTOSET");
+
+  // Bytes.
+  TestAllParseInt(1, "1");
+  TestAllParseInt(1, "1B");
+  TestAllParseInt(1, "1b");
+  TestAllParseInt(1, "1B");
+  TestAllParseInt(1, "1b");
+
+  // Kilobytes and fractional amounts.
+  TestAllParseInt(1024, "1KB");
+  TestAllParseInt(1024, "1Kb");
+  TestAllParseInt(1024, "1kB");
+  TestAllParseInt(1024, "1kb");
+
+  TestAllParseInt(512, ".5kb");
+  TestAllParseInt(512, "0.5kb");
+  TestAllParseInt(1536, "1.5kb");
+  TestAllParseInt(1536, "1.50kb");
+
+  // Megabytes and fractional amounts.
+  TestAllParseInt(1024 * 1024, "1MB");
+  TestAllParseInt(1024 * 1024, "1Mb");
+  TestAllParseInt(1024 * 1024, "1mB");
+  TestAllParseInt(1024 * 1024, "1mb");
+
+  TestAllParseInt(512 * 1024, ".5mb");
+  TestAllParseInt(512 * 1024, "0.5mb");
+  TestAllParseInt(1536 * 1024, "1.5mb");
+  TestAllParseInt(1536 * 1024, "1.50mb");
+
+  // Gigabytes and fractional amounts.
+  TestAllParseInt(1024 * 1024 * 1024, "1GB");
+  TestAllParseInt(1024 * 1024 * 1024, "1Gb");
+  TestAllParseInt(1024 * 1024 * 1024, "1gB");
+  TestAllParseInt(1024 * 1024 * 1024, "1gb");
+
+  TestAllParseInt(512 * 1024 * 1024, ".5gb");
+  TestAllParseInt(1536 * 1024 * 1024, "1.50gb");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsLower) {
+  TestParseDimensions(TextureDimensions(1234, 5678, 2), "1234x5678");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsOne) {
+  TestParseDimensions(base::nullopt, "1234");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsOneX) {
+  TestParseDimensions(base::nullopt, "1234x");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsTwoX) {
+  TestParseDimensions(base::nullopt, "1234x5678x");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsBadNum1) {
+  TestParseDimensions(base::nullopt, "ABCDx1234");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsBadNum2) {
+  TestParseDimensions(base::nullopt, "1234xABCD");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsUpper) {
+  TestParseDimensions(TextureDimensions(1234, 5678, 2), "1234X5678");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsBpp) {
+  TestParseDimensions(TextureDimensions(1234, 5678, 12), "1234X5678X12");
+  TestParseDimensions(TextureDimensions(1234, 5678, 1), "1234X5678x1");
+  TestParseDimensions(TextureDimensions(1234, 5678, 2), "1234x5678x2");
+  TestParseDimensions(TextureDimensions(1234, 5678, 3), "1234x5678X3");
+}
+
+TEST(AutoMemSettingsTest, ParseDimensionsAuto) {
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "-1");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "auto");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "Auto");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "AUTO");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "autoset");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "AutoSet");
+  TestParseDimensions(TextureDimensions(-1, -1, -1), "AUTOSET");
+}
+
+}  // namespace memory_settings
+}  // namespace browser
+}  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/auto_mem_test.cc b/src/cobalt/browser/memory_settings/auto_mem_test.cc
index 1e289e7..9982a6f 100644
--- a/src/cobalt/browser/memory_settings/auto_mem_test.cc
+++ b/src/cobalt/browser/memory_settings/auto_mem_test.cc
@@ -20,7 +20,7 @@
 #include <vector>
 
 #include "base/optional.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
+#include "cobalt/browser/memory_settings/auto_mem_settings.h"
 #include "cobalt/browser/memory_settings/calculations.h"
 #include "cobalt/browser/memory_settings/test_common.h"
 #include "cobalt/browser/switches.h"
@@ -47,13 +47,17 @@
   EXPECT_EQ(SOURCE, SETTING->source_type()) << " failure for "              \
                                             << SETTING->name();
 
+AutoMemSettings EmptyCommandLine() {
+  return AutoMemSettings(AutoMemSettings::kTypeCommandLine);
+}
+
 scoped_ptr<AutoMem> CreateDefaultAutoMem() {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   scoped_ptr<AutoMem> auto_mem(
-      new AutoMem(kResolution1080p, empty_command_line, build_settings));
+      new AutoMem(kResolution1080p, EmptyCommandLine(), build_settings));
   return auto_mem.Pass();
 }
+
 }  // namespace.
 
 // Tests the expectation that the command-line overrides will be applied.
@@ -61,21 +65,20 @@
 // also tested.
 TEST(AutoMem, CommandLineOverrides) {
   // Load up command line settings of command lines.
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kImageCacheSizeInBytes, "1234");
-  command_line.AppendSwitchASCII(switches::kJavaScriptGcThresholdInBytes,
-                                 "2345");
-  command_line.AppendSwitchASCII(switches::kSkiaCacheSizeInBytes, "3456");
-  command_line.AppendSwitchASCII(switches::kSkiaTextureAtlasDimensions,
-                                 "1234x5678");
-  command_line.AppendSwitchASCII(switches::kSoftwareSurfaceCacheSizeInBytes,
-                                 "4567");
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.cobalt_image_cache_size_in_bytes = 1234;
+  command_line_settings.javascript_garbage_collection_threshold_in_bytes = 2345;
+  command_line_settings.skia_cache_size_in_bytes = 3456;
+  command_line_settings.skia_texture_atlas_dimensions =
+      TextureDimensions(1234, 5678, 2);
+  command_line_settings.software_surface_cache_size_in_bytes = 4567;
+  command_line_settings.offscreen_target_cache_size_in_bytes = 5678;
 
   for (int i = 0; i <= 1; ++i) {
-    BuildSettings build_settings = GetDefaultBuildSettings();
+    AutoMemSettings build_settings = GetDefaultBuildSettings();
     build_settings.has_blitter = (i == 0);
 
-    AutoMem auto_mem(kResolution1080p, command_line, build_settings);
+    AutoMem auto_mem(kResolution1080p, command_line_settings, build_settings);
 
     // image_cache_size_in_bytes and javascript_gc_threshold_in_bytes settings
     // ignore the blitter type.
@@ -85,6 +88,11 @@
     EXPECT_MEMORY_SETTING(auto_mem.javascript_gc_threshold_in_bytes(),
                           MemorySetting::kCmdLine, MemorySetting::kCPU, 2345);
 
+    if (auto_mem.offscreen_target_cache_size_in_bytes()->valid()) {
+      EXPECT_MEMORY_SETTING(auto_mem.offscreen_target_cache_size_in_bytes(),
+                            MemorySetting::kCmdLine, MemorySetting::kGPU, 5678);
+    }
+
     // Certain features are only available for the blitter, and some features
     // are disabled, vice versa.
     if (build_settings.has_blitter) {
@@ -123,12 +131,12 @@
 // Tests the expectation that if the command line specifies that the variable
 // is "autoset" that the builtin setting is overriden.
 TEST(AutoMem, CommandLineSpecifiesAutoset) {
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kImageCacheSizeInBytes, "autoset");
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.cobalt_image_cache_size_in_bytes = -1;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.cobalt_image_cache_size_in_bytes = 1234;
 
-  AutoMem auto_mem(kResolution1080p, command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, command_line_settings, build_settings);
 
   EXPECT_MEMORY_SETTING(auto_mem.image_cache_size_in_bytes(),
                         MemorySetting::kAutoSet, MemorySetting::kGPU,
@@ -138,15 +146,14 @@
 // Tests that skia atlas texture will be bind to the built in value, iff it has
 // been set.
 TEST(AutoMem, SkiaGlyphAtlasTextureSize) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
-  BuildSettings build_settings_with_default;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMemSettings build_settings_with_default(AutoMemSettings::kTypeBuild);
 
   build_settings_with_default.skia_texture_atlas_dimensions =
       TextureDimensions(1234, 5678, 2);
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
-  AutoMem auto_mem_with_default(kResolution1080p, empty_command_line,
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
+  AutoMem auto_mem_with_default(kResolution1080p, EmptyCommandLine(),
                                 build_settings_with_default);
 
   // Expect that when the skia_atlas_texture_dimensions is specified in the
@@ -166,16 +173,15 @@
 // Tests that software surface cache will be bind to the built in value, iff
 // it has been set.
 TEST(AutoMem, SoftwareSurfaceCacheSizeInBytes) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
-  BuildSettings build_settings_with_default;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMemSettings build_settings_with_default(AutoMemSettings::kTypeBuild);
   // Enable the setting by enabling the blitter.
   build_settings.has_blitter = true;
   build_settings_with_default.has_blitter = true;
   build_settings_with_default.software_surface_cache_size_in_bytes = 1234;
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
-  AutoMem auto_mem_with_surface_cache(kResolution1080p, empty_command_line,
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
+  AutoMem auto_mem_with_surface_cache(kResolution1080p, EmptyCommandLine(),
                                       build_settings_with_default);
 
   // Expect that when the software_surface_cache_size_in_bytes is specified in
@@ -194,13 +200,12 @@
 // Tests that skia cache will be bind to the built in value, iff
 // it has been set.
 TEST(AutoMem, SkiaCacheSizeInBytes) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
-  BuildSettings build_settings_with_default;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMemSettings build_settings_with_default(AutoMemSettings::kTypeBuild);
   build_settings_with_default.skia_cache_size_in_bytes = 1234;
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
-  AutoMem auto_mem_with_skia_cache(kResolution1080p, empty_command_line,
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
+  AutoMem auto_mem_with_skia_cache(kResolution1080p, EmptyCommandLine(),
                                    build_settings_with_default);
 
   EXPECT_MEMORY_SETTING(auto_mem.skia_cache_size_in_bytes(),
@@ -213,10 +218,9 @@
 }
 
 TEST(AutoMem, AllMemorySettingsAreOrderedByName) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
 
   std::vector<const MemorySetting*> settings = auto_mem.AllMemorySettings();
 
@@ -228,29 +232,27 @@
 // Tests the expectation that constraining the CPU memory to kSmallEngineSize
 // will result in AutoMem reducing to the expected memory footprint.
 TEST(AutoMem, ConstrainedCPUEnvironment) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.max_cpu_in_bytes = kSmallEngineCpuMemorySize;
 
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
 
   const int64_t cpu_memory_consumption =
       auto_mem.SumAllMemoryOfType(MemorySetting::kCPU);
   EXPECT_LE(cpu_memory_consumption, kSmallEngineCpuMemorySize);
 }
 
-// Tests the expectation that constraining the CPU memory to 40MB will result
+// Tests the expectation that constraining the GPU memory will result
 // in AutoMem reducing the the memory footprint.
 TEST(AutoMem, ConstrainedGPUEnvironment) {
-  CommandLine empty_command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.max_gpu_in_bytes = 57 * 1024 * 1024;
-  AutoMem auto_mem(kResolution1080p, empty_command_line, build_settings);
+  AutoMem auto_mem(kResolution1080p, EmptyCommandLine(), build_settings);
 
   std::vector<const MemorySetting*> settings = auto_mem.AllMemorySettings();
   const int64_t gpu_memory_consumption =
       SumMemoryConsumption(MemorySetting::kGPU, settings);
-  EXPECT_LE(gpu_memory_consumption, 57 * 1024 * 1024);
+  EXPECT_LE(gpu_memory_consumption, *build_settings.max_gpu_in_bytes);
 }
 
 // Tests the expectation that constraining the CPU memory to 40MB will result
@@ -260,13 +262,13 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "5MB");
-  BuildSettings build_settings;
-  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line,
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.reduce_cpu_memory_by = 5 * 1024 * 1024;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line_settings,
                                       build_settings);
 
-  EXPECT_EQ(5*1024*1024,
+  EXPECT_EQ(5 * 1024 * 1024,
             reduced_cpu_memory_auto_mem.reduced_cpu_bytes_->value());
 
   const int64_t original_memory_consumption =
@@ -274,7 +276,7 @@
   const int64_t reduced_memory_consumption =
       reduced_cpu_memory_auto_mem.SumAllMemoryOfType(MemorySetting::kCPU);
 
-  EXPECT_LE(5*1024*1024,
+  EXPECT_LE(5 * 1024 * 1024,
             original_memory_consumption - reduced_memory_consumption);
 }
 
@@ -285,12 +287,12 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kReduceGpuMemoryBy, "5MB");
-  BuildSettings build_settings;
-  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line,
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.reduce_gpu_memory_by = 5 * 1024 * 1024;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
+  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line_settings,
                                       build_settings);
-  EXPECT_EQ(5*1024*1024,
+  EXPECT_EQ(5 * 1024 * 1024,
             reduced_cpu_memory_auto_mem.reduced_gpu_bytes_->value());
 
   const int64_t original_memory_consumption =
@@ -298,7 +300,7 @@
   const int64_t reduced_memory_consumption =
       reduced_cpu_memory_auto_mem.SumAllMemoryOfType(MemorySetting::kGPU);
 
-  EXPECT_LE(5*1024*1024,
+  EXPECT_LE(5 * 1024 * 1024,
             original_memory_consumption - reduced_memory_consumption);
 }
 
@@ -309,14 +311,14 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "5MB");
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  command_line_settings.reduce_cpu_memory_by = 5 * 1024 * 1024;
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
   build_settings.max_cpu_in_bytes = 1;
-  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line,
+  AutoMem reduced_cpu_memory_auto_mem(kResolution1080p, command_line_settings,
                                       build_settings);
 
-  EXPECT_EQ(5*1024*1024,
+  EXPECT_EQ(5 * 1024 * 1024,
             reduced_cpu_memory_auto_mem.reduced_cpu_bytes_->value());
 
   const int64_t original_memory_consumption =
@@ -326,7 +328,7 @@
 
   // Max_cpu_in_bytes specifies one byte of memory, but reduce must override
   // this for this test to pass.
-  EXPECT_LE(5*1024*1024,
+  EXPECT_LE(5 * 1024 * 1024,
             original_memory_consumption - reduced_memory_consumption);
 }
 
@@ -337,15 +339,15 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "0" will
   // override the max_cpu_in_bytes setting.
   build_settings.max_cpu_in_bytes = 1;
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "0");
+  command_line_settings.reduce_cpu_memory_by = 0;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
 
   const int64_t original_memory_consumption =
@@ -365,15 +367,15 @@
   // settings.
   scoped_ptr<AutoMem> default_auto_mem = CreateDefaultAutoMem();
 
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "0" will
   // override the max_cpu_in_bytes setting.
   build_settings.max_gpu_in_bytes = 1;
-  command_line.AppendSwitchASCII(switches::kReduceGpuMemoryBy, "0");
+  command_line_settings.reduce_gpu_memory_by = 0;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
 
   const int64_t original_memory_consumption =
@@ -390,16 +392,16 @@
 // will be effectively disabled and --max_cpu_bytes be used as the memory
 // reduction means.
 TEST(AutoMem, MaxCpuIsEnabledWhenReduceCpuMemoryIsExplicitlyDisabled) {
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "-1"
   // passed to the command line will cause max_cpu_in_bytes to be the
   // dominating memory reduction mechanism.
   build_settings.max_cpu_in_bytes = kSmallEngineGpuMemorySize;
-  command_line.AppendSwitchASCII(switches::kReduceCpuMemoryBy, "-1");
+  command_line_settings.reduce_cpu_memory_by = -1;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
   const int64_t memory_consumption =
       auto_mem_no_reduce_cpu.SumAllMemoryOfType(MemorySetting::kCPU);
@@ -412,16 +414,16 @@
 // will be effectively disabled and --max_gpu_bytes be used as the memory
 // reduction means.
 TEST(AutoMem, MaxGpuIsEnabledWhenReduceCpuMemoryIsExplicitlyDisabled) {
-  CommandLine command_line(CommandLine::NO_PROGRAM);
-  BuildSettings build_settings;
+  AutoMemSettings command_line_settings(AutoMemSettings::kTypeCommandLine);
+  AutoMemSettings build_settings(AutoMemSettings::kTypeBuild);
 
   // Max memory is 1-byte. We expect that the kReduceCpuMemoryBy = "-1"
   // passed to the command line will cause max_cpu_in_bytes to be the
   // dominating memory reduction mechanism.
-  build_settings.max_cpu_in_bytes = kSmallEngineGpuMemorySize;
-  command_line.AppendSwitchASCII(switches::kReduceGpuMemoryBy, "-1");
+  build_settings.max_gpu_in_bytes = kSmallEngineGpuMemorySize;
+  command_line_settings.reduce_gpu_memory_by = -1;
 
-  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line,
+  AutoMem auto_mem_no_reduce_cpu(kResolution1080p, command_line_settings,
                                  build_settings);
   const int64_t memory_consumption =
       auto_mem_no_reduce_cpu.SumAllMemoryOfType(MemorySetting::kGPU);
diff --git a/src/cobalt/browser/memory_settings/build_settings.cc b/src/cobalt/browser/memory_settings/build_settings.cc
deleted file mode 100644
index 1019eab..0000000
--- a/src/cobalt/browser/memory_settings/build_settings.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2017 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "cobalt/browser/memory_settings/build_settings.h"
-
-#include "base/optional.h"
-#include "cobalt/browser/memory_settings/constants.h"
-
-namespace cobalt {
-namespace browser {
-namespace memory_settings {
-namespace {
-bool HasBlitter() {
-#if SB_HAS(BLITTER)
-  const bool has_blitter = true;
-#else
-  const bool has_blitter = false;
-#endif
-  return has_blitter;
-}
-
-base::optional<int64_t> MakeValidIfGreaterThanOrEqualToZero(int64_t value) {
-  base::optional<int64_t> output;
-  if (value >= 0) {
-    output = value;
-  }
-  return output;
-}
-
-base::optional<TextureDimensions> MakeDimensionsIfValid(TextureDimensions td) {
-  base::optional<TextureDimensions> output;
-  if ((td.width() > 0) && (td.height() > 0) && td.bytes_per_pixel() > 0) {
-    output = td;
-  }
-  return output;
-}
-
-}  // namespace
-
-BuildSettings GetDefaultBuildSettings() {
-  BuildSettings settings;
-  settings.has_blitter = HasBlitter();
-
-  settings.cobalt_image_cache_size_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_IMAGE_CACHE_SIZE_IN_BYTES);
-  settings.javascript_garbage_collection_threshold_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(
-          COBALT_JS_GARBAGE_COLLECTION_THRESHOLD_IN_BYTES);
-  settings.remote_typeface_cache_capacity_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(
-          COBALT_REMOTE_TYPEFACE_CACHE_SIZE_IN_BYTES);
-  settings.skia_cache_size_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_SKIA_CACHE_SIZE_IN_BYTES);
-  settings.skia_texture_atlas_dimensions =
-      MakeDimensionsIfValid(
-          TextureDimensions(COBALT_SKIA_GLYPH_ATLAS_WIDTH,
-                            COBALT_SKIA_GLYPH_ATLAS_HEIGHT,
-                            kSkiaGlyphAtlasTextureBytesPerPixel));
-  settings.software_surface_cache_size_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(
-          COBALT_SOFTWARE_SURFACE_CACHE_SIZE_IN_BYTES);
-
-  settings.max_cpu_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_CPU_USAGE_IN_BYTES);
-  settings.max_gpu_in_bytes =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_MAX_GPU_USAGE_IN_BYTES);
-
-  settings.reduce_cpu_memory_by =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_CPU_MEMORY_BY);
-  settings.reduce_gpu_memory_by =
-      MakeValidIfGreaterThanOrEqualToZero(COBALT_REDUCE_GPU_MEMORY_BY);
-
-  return settings;
-}
-
-}  // namespace memory_settings
-}  // namespace browser
-}  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/calculations.cc b/src/cobalt/browser/memory_settings/calculations.cc
index 8474f65..9976132 100644
--- a/src/cobalt/browser/memory_settings/calculations.cc
+++ b/src/cobalt/browser/memory_settings/calculations.cc
@@ -18,7 +18,6 @@
 
 #include <algorithm>
 
-#include "cobalt/browser/memory_settings/build_settings.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/math/clamp.h"
 #include "cobalt/math/size.h"
@@ -28,6 +27,26 @@
 namespace memory_settings {
 namespace {
 
+int32_t NextPowerOf2(int32_t num) {
+  // Return the smallest power of 2 that is greater than or equal to num.
+  // This flips on all bits <= num, then num+1 will be the next power of 2.
+  --num;
+  num |= num >> 1;
+  num |= num >> 2;
+  num |= num >> 4;
+  num |= num >> 8;
+  num |= num >> 16;
+  return num + 1;
+}
+
+int32_t NearestPowerOf2(int32_t num) {
+  int32_t nearest = NextPowerOf2(num);
+  if (static_cast<float>(nearest) / num > 1.5f) {
+    nearest /= 2;
+  }
+  return nearest;
+}
+
 double DisplayScaleTo1080p(const math::Size& dimensions) {
   static const double kNumReferencePixels = 1920. * 1080.;
   const double num_pixels = static_cast<double>(dimensions.width()) *
@@ -137,6 +156,17 @@
   return surface_cache_size_in_bytes;
 }
 
+int64_t CalculateOffscreenTargetCacheSizeInBytes(
+    const math::Size& ui_resolution) {
+  // The offscreen target cache size should be at least half the ui_resolution
+  // rounded to the nearest power of 2.
+  int width = NearestPowerOf2(ui_resolution.width());
+  int height = NearestPowerOf2(ui_resolution.height());
+
+  // The surface cache uses RGBA format so requires 4 bytes per pixel.
+  return (width * height / 2) * 4;
+}
+
 int64_t CalculateSkiaCacheSize(const math::Size& ui_resolution) {
   // This is normalized return 4MB @ 1080p and scales accordingly.
   LinearRemap remap(0, 1920 * 1080, 0, 4 * 1024 * 1024);
diff --git a/src/cobalt/browser/memory_settings/calculations.h b/src/cobalt/browser/memory_settings/calculations.h
index bc4a65a..421313f 100644
--- a/src/cobalt/browser/memory_settings/calculations.h
+++ b/src/cobalt/browser/memory_settings/calculations.h
@@ -49,6 +49,12 @@
 int64_t CalculateSoftwareSurfaceCacheSizeInBytes(
     const math::Size& ui_resolution);
 
+// Calculates the offscreen target cache size from the ui_resolution. This is
+// similar to the software surface cache, but it is specific to the direct-GLES
+// rasterizer.
+int64_t CalculateOffscreenTargetCacheSizeInBytes(
+    const math::Size& ui_resolution);
+
 // Calculates the SkiaCachSize from the ui_resolution. This is normalized
 // to be 4MB @ 1080p and scales accordingly.
 int64_t CalculateSkiaCacheSize(const math::Size& ui_resolution);
diff --git a/src/cobalt/browser/memory_settings/calculations_test.cc b/src/cobalt/browser/memory_settings/calculations_test.cc
index 3b7f62c..c8ce086 100644
--- a/src/cobalt/browser/memory_settings/calculations_test.cc
+++ b/src/cobalt/browser/memory_settings/calculations_test.cc
@@ -16,14 +16,8 @@
 
 #include "cobalt/browser/memory_settings/calculations.h"
 
-#include <algorithm>
-#include <sstream>
-#include <string>
-#include <vector>
-
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/browser/memory_settings/test_common.h"
 #include "cobalt/browser/switches.h"
diff --git a/src/cobalt/browser/memory_settings/constrainer.cc b/src/cobalt/browser/memory_settings/constrainer.cc
index 9e7a985..176463e 100644
--- a/src/cobalt/browser/memory_settings/constrainer.cc
+++ b/src/cobalt/browser/memory_settings/constrainer.cc
@@ -91,6 +91,11 @@
                        int64_t old_memory_consumption,
                        int64_t new_memory_consumption,
                        double constraining_value) {
+  if (old_memory_consumption == 0) {
+    // If the system is already using no memory, then it can't use any less.
+    return;
+  }
+
   // Represents 1% allowed difference.
   static const double kErrorThreshold = 0.01;
 
diff --git a/src/cobalt/browser/memory_settings/memory_settings.cc b/src/cobalt/browser/memory_settings/memory_settings.cc
index caabaf3..51ee2f9 100644
--- a/src/cobalt/browser/memory_settings/memory_settings.cc
+++ b/src/cobalt/browser/memory_settings/memory_settings.cc
@@ -24,91 +24,14 @@
 #include "base/bind.h"
 #include "base/compiler_specific.h"
 #include "base/logging.h"
-#include "base/string_number_conversions.h"
-#include "base/string_split.h"
 #include "base/stringprintf.h"
-#include "cobalt/browser/memory_settings/build_settings.h"
 #include "cobalt/browser/memory_settings/constants.h"
 #include "cobalt/browser/switches.h"
 #include "cobalt/math/linear_interpolator.h"
-#include "nb/lexical_cast.h"
 
 namespace cobalt {
 namespace browser {
 namespace memory_settings {
-namespace {
-
-struct ParsedIntValue {
- public:
-  ParsedIntValue() : value_(0), error_(false) {}
-  ParsedIntValue(const ParsedIntValue& other)
-      : value_(other.value_), error_(other.error_) {}
-  int value_;
-  bool error_;  // true if there was a parse error.
-};
-
-char ToLowerCharTypesafe(int c) {
-  return static_cast<char>(::tolower(c));
-}
-
-std::string ToLower(const std::string& input) {
-  std::string value_str = input;
-  std::transform(value_str.begin(), value_str.end(),
-                 value_str.begin(), ToLowerCharTypesafe);
-
-  return value_str;
-}
-
-// Parses a string like "1234x5678" to vector of parsed int values.
-std::vector<ParsedIntValue> ParseDimensions(const std::string& input) {
-  std::string value_str = ToLower(input);
-  std::vector<ParsedIntValue> output;
-
-  std::vector<std::string> lengths;
-  base::SplitString(value_str, 'x', &lengths);
-
-  for (size_t i = 0; i < lengths.size(); ++i) {
-    ParsedIntValue parsed_value;
-    parsed_value.error_ = !base::StringToInt(lengths[i], &parsed_value.value_);
-    output.push_back(parsed_value);
-  }
-  return output;
-}
-
-bool StringEndsWith(const std::string& value, const std::string& ending) {
-  if (ending.size() > value.size()) {
-    return false;
-  }
-  // Reverse search through the back of the string.
-  return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
-}
-
-// Handles bytes: "12435"
-// Handles kilobytes: "128KB"
-// Handles megabytes: "64MB"
-// Handles gigabytes: "1GB"
-// Handles fractional units for kilo/mega/gigabytes
-int64_t ParseMemoryValue(const std::string& value, bool* parse_ok) {
-  // nb::lexical_cast<> will parse out the number but it will ignore the
-  // unit part, such as "kb" or "mb".
-  double numerical_value = nb::lexical_cast<double>(value, parse_ok);
-  if (!(*parse_ok)) {
-    return static_cast<int64_t>(numerical_value);
-  }
-
-  // Lowercasing the string makes the units easier to detect.
-  std::string value_lower_case = ToLower(value);
-
-  if (StringEndsWith(value_lower_case, "kb")) {
-    numerical_value *= 1024;  // convert kb -> bytes.
-  } else if (StringEndsWith(value_lower_case, "mb")) {
-    numerical_value *= 1024 * 1024;  // convert mb -> bytes.
-  } else if (StringEndsWith(value_lower_case, "gb")) {
-    numerical_value *= 1024 * 1024 * 1024;  // convert gb -> bytes.
-  }
-  return static_cast<int64_t>(numerical_value);
-}
-}  // namespace
 
 void MemorySetting::set_memory_scaling_function(ScalingFunction function) {
   memory_scaling_function_ = function;
@@ -148,20 +71,6 @@
   set_value(MemorySetting::kAutosetConstrained, new_value);
 }
 
-bool IntSetting::TryParseValue(SourceType source_type,
-                               const std::string& string_value) {
-  bool parse_ok = false;
-  int64_t int_value = ParseMemoryValue(string_value, &parse_ok);
-
-  if (parse_ok) {
-    set_value(source_type, int_value);
-    return true;
-  } else {
-    LOG(ERROR) << "Invalid value for command line setting: " << string_value;
-    return false;
-  }
-}
-
 DimensionSetting::DimensionSetting(const std::string& name)
     : MemorySetting(kDimensions, name) {}
 
@@ -177,33 +86,6 @@
   return value().TotalBytes();
 }
 
-bool DimensionSetting::TryParseValue(SourceType source_type,
-                                     const std::string& string_value) {
-  std::vector<ParsedIntValue> int_values = ParseDimensions(string_value);
-
-  if ((int_values.size() < 2) || (int_values.size() > 3)) {
-    LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
-    return false;  // Parse failed.
-  }
-
-  for (size_t i = 0; i < int_values.size(); ++i) {
-    if (int_values[i].error_) {
-      LOG(ERROR) << "Invalid value for parse value setting: " << string_value;
-      return false;  // Parse failed.
-    }
-  }
-
-  const int bytes_per_pixel =
-      int_values.size() == 3 ?
-      int_values[2].value_ : kSkiaGlyphAtlasTextureBytesPerPixel;
-
-  TextureDimensions tex_dimensions(int_values[0].value_, int_values[1].value_,
-                                   bytes_per_pixel);
-
-  set_value(source_type, tex_dimensions);
-  return true;
-}
-
 SkiaGlyphAtlasTextureSetting::SkiaGlyphAtlasTextureSetting()
     : DimensionSetting(switches::kSkiaTextureAtlasDimensions) {
   set_memory_scaling_function(MakeSkiaGlyphAtlasMemoryScaler());
diff --git a/src/cobalt/browser/memory_settings/memory_settings.h b/src/cobalt/browser/memory_settings/memory_settings.h
index 52406e8..d1b3b69 100644
--- a/src/cobalt/browser/memory_settings/memory_settings.h
+++ b/src/cobalt/browser/memory_settings/memory_settings.h
@@ -50,10 +50,6 @@
 
   // Stringify's the value of this memory setting.
   virtual std::string ValueToString() const = 0;
-  // Returns true if the TryParseValue() succeeded when converting the string
-  // into the internal value. If false, then the object should not be changed.
-  virtual bool TryParseValue(SourceType source_type,
-                             const std::string& string_value) = 0;
 
   // Returns the memory consumption (in bytes) that the memory setting will
   // be allocated.
@@ -128,8 +124,7 @@
     source_type_ = source_type;
     value_ = val;
   }
-  bool TryParseValue(SourceType source_type,
-                     const std::string& string_value) OVERRIDE;
+
  private:
   int64_t value_;
 
@@ -158,8 +153,6 @@
     source_type_ = source_type;
     value_ = val;
   }
-  bool TryParseValue(SourceType source_type,
-                     const std::string& string_value) OVERRIDE;
 
  private:
   TextureDimensions value_;
diff --git a/src/cobalt/browser/memory_settings/memory_settings_test.cc b/src/cobalt/browser/memory_settings/memory_settings_test.cc
index 2ca54ea..69ee8e5 100644
--- a/src/cobalt/browser/memory_settings/memory_settings_test.cc
+++ b/src/cobalt/browser/memory_settings/memory_settings_test.cc
@@ -16,10 +16,7 @@
 
 #include "cobalt/browser/memory_settings/memory_settings.h"
 
-#include <algorithm>
-#include <sstream>
 #include <string>
-#include <vector>
 
 #include "base/memory/scoped_ptr.h"
 #include "cobalt/browser/memory_settings/test_common.h"
@@ -28,92 +25,25 @@
 namespace cobalt {
 namespace browser {
 namespace memory_settings {
-namespace {
-int64_t TestIntSettingParse(const std::string& value) {
-  IntSetting int_setting("dummy");
-  EXPECT_TRUE(int_setting.TryParseValue(MemorySetting::kCmdLine, value));
-  return int_setting.value();
-}
-}  // namespace
 
-TEST(IntSetting, ParseFromString) {
+TEST(MemorySettingsTest, IntSetting) {
   scoped_ptr<IntSetting> int_setting(new IntSetting("dummy"));
   EXPECT_EQ(std::string("dummy"), int_setting->name());
-  ASSERT_TRUE(int_setting->TryParseValue(MemorySetting::kCmdLine, "123"));
+  int_setting->set_value(MemorySetting::kCmdLine, 123);
   EXPECT_EQ(123, int_setting->value());
   EXPECT_EQ(MemorySetting::kCmdLine, int_setting->source_type());
   EXPECT_EQ(std::string("123"), int_setting->ValueToString());
 }
 
-// Tests the expectation that numerous string variations (whole numbers vs
-// fractions vs units) parse correctly.
-TEST(IntSetting, ParseFromStrings) {
-  // Bytes.
-  EXPECT_EQ(1, TestIntSettingParse("1"));
-  EXPECT_EQ(1, TestIntSettingParse("1B"));
-  EXPECT_EQ(1, TestIntSettingParse("1b"));
-  EXPECT_EQ(1, TestIntSettingParse("1B"));
-  EXPECT_EQ(1, TestIntSettingParse("1b"));
-
-  // Kilobytes and fractional amounts.
-  EXPECT_EQ(1024, TestIntSettingParse("1KB"));
-  EXPECT_EQ(1024, TestIntSettingParse("1Kb"));
-  EXPECT_EQ(1024, TestIntSettingParse("1kB"));
-  EXPECT_EQ(1024, TestIntSettingParse("1kb"));
-
-  EXPECT_EQ(512, TestIntSettingParse(".5kb"));
-  EXPECT_EQ(512, TestIntSettingParse("0.5kb"));
-  EXPECT_EQ(1536, TestIntSettingParse("1.5kb"));
-  EXPECT_EQ(1536, TestIntSettingParse("1.50kb"));
-
-  // Megabytes and fractional amounts.
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1MB"));
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1Mb"));
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1mB"));
-  EXPECT_EQ(1024*1024, TestIntSettingParse("1mb"));
-
-  EXPECT_EQ(512*1024, TestIntSettingParse(".5mb"));
-  EXPECT_EQ(512*1024, TestIntSettingParse("0.5mb"));
-  EXPECT_EQ(1536*1024, TestIntSettingParse("1.5mb"));
-  EXPECT_EQ(1536*1024, TestIntSettingParse("1.50mb"));
-
-  // Gigabytes and fractional amounts.
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1GB"));
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1Gb"));
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1gB"));
-  EXPECT_EQ(1024*1024*1024, TestIntSettingParse("1gb"));
-
-  EXPECT_EQ(512*1024*1024, TestIntSettingParse(".5gb"));
-  EXPECT_EQ(1536*1024*1024, TestIntSettingParse("1.50gb"));
-}
-
-TEST(DimensionSetting, ParseFromString) {
+TEST(MemorySettingsTest, DimensionSetting) {
   scoped_ptr<DimensionSetting> rect_setting(new TestDimensionSetting("dummy"));
-  ASSERT_TRUE(
-      rect_setting->TryParseValue(MemorySetting::kCmdLine, "1234x5678"));
+  rect_setting->set_value(MemorySetting::kCmdLine,
+                          TextureDimensions(1234, 5678, 2));
   EXPECT_EQ(TextureDimensions(1234, 5678, 2), rect_setting->value());
   EXPECT_EQ(MemorySetting::kCmdLine, rect_setting->source_type());
   EXPECT_EQ(std::string("1234x5678x2"), rect_setting->ValueToString());
 }
 
-TEST(DimensionSetting, ParseFromStringCaseInsensitive) {
-  scoped_ptr<DimensionSetting> rect_setting(new TestDimensionSetting("dummy"));
-  ASSERT_TRUE(
-      rect_setting->TryParseValue(MemorySetting::kCmdLine, "1234X5678"));
-  EXPECT_EQ(TextureDimensions(1234, 5678, 2), rect_setting->value());
-  EXPECT_EQ(MemorySetting::kCmdLine, rect_setting->source_type());
-  EXPECT_EQ(std::string("1234x5678x2"), rect_setting->ValueToString());
-}
-
-TEST(DimensionSetting, ParseFromStringWithBytesPerPixel) {
-  scoped_ptr<DimensionSetting> rect_setting(new TestDimensionSetting("dummy"));
-  ASSERT_TRUE(
-      rect_setting->TryParseValue(MemorySetting::kCmdLine, "1234x5678x12"));
-  EXPECT_EQ(TextureDimensions(1234, 5678, 12), rect_setting->value());
-  EXPECT_EQ(MemorySetting::kCmdLine, rect_setting->source_type());
-  EXPECT_EQ(std::string("1234x5678x12"), rect_setting->ValueToString());
-}
-
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/test_common.h b/src/cobalt/browser/memory_settings/test_common.h
index 9078573..203566c 100644
--- a/src/cobalt/browser/memory_settings/test_common.h
+++ b/src/cobalt/browser/memory_settings/test_common.h
@@ -70,26 +70,21 @@
   TestSettingGroup() {}
 
   void LoadDefault() {
-    MakeSetting(MemorySetting::kInt, MemorySetting::kCmdLine,
-                MemorySetting::kGPU, switches::kImageCacheSizeInBytes,
-                "1234");
+    MakeSetting(MemorySetting::kCmdLine, MemorySetting::kGPU,
+                switches::kImageCacheSizeInBytes, 1234);
 
-    MakeSetting(MemorySetting::kInt, MemorySetting::kAutoSet,
-                MemorySetting::kCPU, switches::kJavaScriptGcThresholdInBytes,
-                "1112");
+    MakeSetting(MemorySetting::kAutoSet, MemorySetting::kCPU,
+                switches::kJavaScriptGcThresholdInBytes, 1112);
 
-    MakeSetting(MemorySetting::kDimensions, MemorySetting::kCmdLine,
-                MemorySetting::kGPU, switches::kSkiaTextureAtlasDimensions,
-                "1234x4567");
+    MakeSetting(MemorySetting::kCmdLine, MemorySetting::kGPU,
+                switches::kSkiaTextureAtlasDimensions,
+                TextureDimensions(1234, 4567, 2));
 
-    MakeSetting(MemorySetting::kInt, MemorySetting::kCmdLine,
-                MemorySetting::kGPU, switches::kSkiaCacheSizeInBytes,
-                "12345678");
+    MakeSetting(MemorySetting::kCmdLine, MemorySetting::kGPU,
+                switches::kSkiaCacheSizeInBytes, 12345678);
 
-    MakeSetting(MemorySetting::kInt, MemorySetting::kBuildSetting,
-                MemorySetting::kNotApplicable,
-                switches::kSoftwareSurfaceCacheSizeInBytes,
-                "8910");
+    MakeSetting(MemorySetting::kBuildSetting, MemorySetting::kNotApplicable,
+                switches::kSoftwareSurfaceCacheSizeInBytes, 8910);
   }
 
   ~TestSettingGroup() {
@@ -99,16 +94,14 @@
   }
 
   // The memory setting is owned internally.
-  void MakeSetting(
-      MemorySetting::ClassType class_type,
-      MemorySetting::SourceType source_type,
-      MemorySetting::MemoryType memory_type,
-      const std::string& name, const std::string& value) {
+  template <typename ValueType>
+  void MakeSetting(MemorySetting::SourceType source_type,
+                   MemorySetting::MemoryType memory_type,
+                   const std::string& name, const ValueType& value) {
     const bool found = (map_.find(name) !=  map_.end());
 
     ASSERT_FALSE(found);
-    map_[name] =
-        CreateMemorySetting(class_type, source_type, memory_type, name, value);
+    map_[name] = CreateMemorySetting(source_type, memory_type, name, value);
   }
 
   std::vector<const MemorySetting*> AsConstVector() const {
@@ -128,29 +121,14 @@
   }
 
  private:
+  template <typename ValueType>
   static MemorySetting* CreateMemorySetting(
-      MemorySetting::ClassType class_type,
       MemorySetting::SourceType source_type,
       MemorySetting::MemoryType memory_type, const std::string& name,
-      const std::string& value) {
-    MemorySetting* memory_setting = NULL;
-    switch (class_type) {
-      case MemorySetting::kInt: {
-        memory_setting = new IntSetting(name);
-        break;
-      }
-      case MemorySetting::kDimensions: {
-        memory_setting = new TestDimensionSetting(name);
-        break;
-      }
-      default: {
-        EXPECT_TRUE(false) << "Unexpected type " << class_type;
-        memory_setting = new IntSetting(name);
-        break;
-      }
-    }
-    EXPECT_TRUE(memory_setting->TryParseValue(source_type, value));
+      const ValueType& value) {
+    IntSetting* memory_setting = new IntSetting(name);
     memory_setting->set_memory_type(memory_type);
+    memory_setting->set_value(source_type, value);
     return memory_setting;
   }
 
@@ -158,6 +136,20 @@
   MemoryMap map_;
 };
 
+// Specialization for TextureDimensions.
+
+// static
+template <>
+inline MemorySetting* TestSettingGroup::CreateMemorySetting(
+    MemorySetting::SourceType source_type,
+    MemorySetting::MemoryType memory_type, const std::string& name,
+    const TextureDimensions& value) {
+  TestDimensionSetting* memory_setting = new TestDimensionSetting(name);
+  memory_setting->set_memory_type(memory_type);
+  memory_setting->set_value(source_type, value);
+  return memory_setting;
+}
+
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
diff --git a/src/cobalt/browser/memory_settings/texture_dimensions.h b/src/cobalt/browser/memory_settings/texture_dimensions.h
index 0e6b9f7..4b73f84 100644
--- a/src/cobalt/browser/memory_settings/texture_dimensions.h
+++ b/src/cobalt/browser/memory_settings/texture_dimensions.h
@@ -17,6 +17,8 @@
 #ifndef COBALT_BROWSER_MEMORY_SETTINGS_TEXTURE_DIMENSIONS_H_
 #define COBALT_BROWSER_MEMORY_SETTINGS_TEXTURE_DIMENSIONS_H_
 
+#include <iosfwd>
+
 #include "starboard/types.h"
 
 namespace cobalt {
@@ -42,6 +44,10 @@
     return !(*this == other);
   }
 
+  // Defining an "autoset" TextureDimensions as one where either component is
+  // negative.
+  bool IsAutoset() const { return width_ < 0 || height_ < 0; }
+
   int width() const { return width_; }
   int height() const { return height_; }
   int bytes_per_pixel() const { return bytes_per_pixel_; }
@@ -63,6 +69,13 @@
   int bytes_per_pixel_;
 };
 
+inline std::ostream& operator<<(std::ostream& stream,
+                                const TextureDimensions& dimensions) {
+  stream << dimensions.width() << "x" << dimensions.height() << "x"
+         << dimensions.bytes_per_pixel();
+  return stream;
+}
+
 }  // namespace memory_settings
 }  // namespace browser
 }  // namespace cobalt
diff --git a/src/cobalt/browser/splash_screen.cc b/src/cobalt/browser/splash_screen.cc
index d2b8e12..531ab13 100644
--- a/src/cobalt/browser/splash_screen.cc
+++ b/src/cobalt/browser/splash_screen.cc
@@ -20,18 +20,13 @@
 namespace cobalt {
 namespace browser {
 
-// Static
-const char SplashScreen::Options::kDefaultSplashScreenURL[] =
-    "h5vcc-embedded://splash_screen.html";
-
 SplashScreen::SplashScreen(base::ApplicationState initial_application_state,
                            const WebModule::OnRenderTreeProducedCallback&
                                render_tree_produced_callback,
                            network::NetworkModule* network_module,
                            const math::Size& window_dimensions,
                            render_tree::ResourceProvider* resource_provider,
-                           float layout_refresh_rate,
-                           const SplashScreen::Options& options)
+                           float layout_refresh_rate, const GURL& url)
     : render_tree_produced_callback_(render_tree_produced_callback),
       is_ready_(true, false) {
   WebModule::Options web_module_options;
@@ -45,13 +40,13 @@
       base::kThreadPriority_High;
 
   web_module_.reset(new WebModule(
-      options.url, initial_application_state,
+      url, initial_application_state,
       base::Bind(&SplashScreen::OnRenderTreeProduced, base::Unretained(this)),
       base::Bind(&SplashScreen::OnError, base::Unretained(this)),
       base::Bind(&SplashScreen::OnWindowClosed, base::Unretained(this)),
       base::Closure(),  // window_minimize_callback
-      &stub_media_module_, network_module, window_dimensions, resource_provider,
-      stub_media_module_.system_window(), layout_refresh_rate,
+      &stub_media_module_, network_module, window_dimensions,
+      1.f /*video_pixel_ratio*/, resource_provider, layout_refresh_rate,
       web_module_options));
 }
 
diff --git a/src/cobalt/browser/splash_screen.h b/src/cobalt/browser/splash_screen.h
index 8ca9ba5..e775e2a 100644
--- a/src/cobalt/browser/splash_screen.h
+++ b/src/cobalt/browser/splash_screen.h
@@ -32,19 +32,13 @@
 //
 class SplashScreen : public LifecycleObserver {
  public:
-  struct Options {
-    Options() : url(kDefaultSplashScreenURL) {}
-    static const char kDefaultSplashScreenURL[];
-    GURL url;
-  };
-
   SplashScreen(base::ApplicationState initial_application_state,
                const WebModule::OnRenderTreeProducedCallback&
                    render_tree_produced_callback,
                network::NetworkModule* network_module,
                const math::Size& window_dimensions,
                render_tree::ResourceProvider* resource_provider,
-               float layout_refresh_rate, const Options& options = Options());
+               float layout_refresh_rate, const GURL& url);
   ~SplashScreen();
 
   // LifecycleObserver implementation.
diff --git a/src/cobalt/browser/starboard/application.cc b/src/cobalt/browser/starboard/application.cc
index 0409a90..1c3e5fe 100644
--- a/src/cobalt/browser/starboard/application.cc
+++ b/src/cobalt/browser/starboard/application.cc
@@ -23,9 +23,9 @@
 
 class ApplicationStarboard : public Application {
  public:
-  explicit ApplicationStarboard(const base::Closure& quit_closure)
-      : Application(quit_closure), event_handler_(&event_dispatcher_) {}
-  ~ApplicationStarboard() OVERRIDE {}
+  ApplicationStarboard(const base::Closure& quit_closure, bool should_preload)
+      : Application(quit_closure, should_preload),
+        event_handler_(&event_dispatcher_) {}
 
  private:
   // Event handler to receive Starboard events, convert to Cobalt events
@@ -34,7 +34,13 @@
 };
 
 scoped_ptr<Application> CreateApplication(const base::Closure& quit_closure) {
-  return scoped_ptr<Application>(new ApplicationStarboard(quit_closure));
+  return scoped_ptr<Application>(
+      new ApplicationStarboard(quit_closure, false /*should_preload*/));
+}
+
+scoped_ptr<Application> PreloadApplication(const base::Closure& quit_closure) {
+  return scoped_ptr<Application>(
+      new ApplicationStarboard(quit_closure, true /*should_preload*/));
 }
 
 }  // namespace browser
diff --git a/src/cobalt/browser/starboard/event_handler.cc b/src/cobalt/browser/starboard/event_handler.cc
index a8ad309..dab7e1b 100644
--- a/src/cobalt/browser/starboard/event_handler.cc
+++ b/src/cobalt/browser/starboard/event_handler.cc
@@ -17,9 +17,9 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "cobalt/base/accessibility_settings_changed_event.h"
+#include "cobalt/base/application_event.h"
 #include "cobalt/base/deep_link_event.h"
 #include "cobalt/network/network_event.h"
-#include "cobalt/system_window/application_event.h"
 #include "cobalt/system_window/input_event.h"
 
 namespace cobalt {
@@ -58,20 +58,11 @@
   // Create a Cobalt event from the Starboard event, if recognized.
   switch (starboard_event->type) {
     case kSbEventTypePause:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kPause));
-      break;
     case kSbEventTypeUnpause:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kUnpause));
-      break;
     case kSbEventTypeSuspend:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kSuspend));
-      break;
     case kSbEventTypeResume:
-      DispatchEventInternal(new system_window::ApplicationEvent(
-          system_window::ApplicationEvent::kResume));
+    case kSbEventTypeStart:
+      DispatchEventInternal(new base::ApplicationEvent(starboard_event->type));
       break;
     case kSbEventTypeNetworkConnect:
       DispatchEventInternal(
diff --git a/src/cobalt/browser/switches.cc b/src/cobalt/browser/switches.cc
index 0232dff..2c107df 100644
--- a/src/cobalt/browser/switches.cc
+++ b/src/cobalt/browser/switches.cc
@@ -115,6 +115,9 @@
 // Enables memory tracking by installing the memory tracker on startup.
 const char kMemoryTracker[] = "memory_tracker";
 
+// Enables/disables animations on animated images (e.g. animated WebP).
+const char kDisableImageAnimations[] = "disable_image_animations";
+
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
 // If toggled, framerate statistics will be printed to stdout after each
@@ -167,12 +170,32 @@
 const char kSoftwareSurfaceCacheSizeInBytes[] =
     "software_surface_cache_size_in_bytes";
 
+// Setting this switch defines the splash screen URL that Cobalt will
+// use in absence of a web cache. The referenced url should be a
+// content file (for example file:///foobar.html) or an embedded file
+// (for example h5vcc-embedded://foobar.html) and all files referenced
+// must be content or embedded files as well. If "none" is passed
+// (case-insensitive), no splash screen will be constructed. If no
+// value is set, the URL in gyp_configuration.gypi or base.gypi will
+// be used.
+const char kFallbackSplashScreenURL[] = "fallback_splash_screen_url";
+
 // Determines the capacity of the surface cache.  The surface cache tracks which
 // render tree nodes are being re-used across frames and stores the nodes that
 // are most CPU-expensive to render into surfaces.  While it depends on the
 // platform, this setting may affect GPU memory usage.
 const char kSurfaceCacheSizeInBytes[] = "surface_cache_size_in_bytes";
 
+// Determines the amount of GPU memory the offscreen target atlases will
+// use. This is specific to the direct-GLES rasterizer and serves a similar
+// purpose as the surface_cache_size_in_bytes, but caches any render tree
+// nodes which require skia for rendering. Two atlases will be allocated
+// from this memory or multiple atlases of the frame size if the limit
+// allows. It is recommended that enough memory be reserved for two RGBA
+// atlases about a quarter of the frame size.
+const char kOffscreenTargetCacheSizeInBytes[] =
+    "offscreen_target_cache_size_in_bytes";
+
 // Specifies the viewport size: width ['x' height]
 const char kViewport[] = "viewport";
 
diff --git a/src/cobalt/browser/switches.h b/src/cobalt/browser/switches.h
index 6f03782..4470c4e 100644
--- a/src/cobalt/browser/switches.h
+++ b/src/cobalt/browser/switches.h
@@ -46,6 +46,7 @@
 extern const char kVideoDecoderStub[];
 extern const char kWebDriverListenIp[];
 extern const char kWebDriverPort[];
+extern const char kDisableImageAnimations[];
 #endif  // ENABLE_DEBUG_COMMAND_LINE_SWITCHES
 
 extern const char kDisableNavigationWhitelist[];
@@ -53,10 +54,12 @@
 extern const char kFPSOverlay[];
 extern const char kImageCacheSizeInBytes[];
 extern const char kInitialURL[];
+extern const char kOffscreenTargetCacheSizeInBytes[];
 extern const char kRemoteTypefaceCacheSizeInBytes[];
 extern const char kScratchSurfaceCacheSizeInBytes[];
 extern const char kSkiaCacheSizeInBytes[];
 extern const char kSoftwareSurfaceCacheSizeInBytes[];
+extern const char kFallbackSplashScreenURL[];
 extern const char kSurfaceCacheSizeInBytes[];
 extern const char kViewport[];
 extern const char kDisableJavaScriptJit[];
diff --git a/src/cobalt/browser/web_module.cc b/src/cobalt/browser/web_module.cc
index 059c85c..48094a9 100644
--- a/src/cobalt/browser/web_module.cc
+++ b/src/cobalt/browser/web_module.cc
@@ -20,6 +20,7 @@
 #include "base/command_line.h"
 #include "base/debug/trace_event.h"
 #include "base/logging.h"
+#include "base/memory/weak_ptr.h"
 #include "base/message_loop_proxy.h"
 #include "base/optional.h"
 #include "base/stringprintf.h"
@@ -51,7 +52,6 @@
 #include "cobalt/page_visibility/visibility_state.h"
 #include "cobalt/script/javascript_engine.h"
 #include "cobalt/storage/storage_manager.h"
-#include "cobalt/system_window/system_window.h"
 #include "starboard/accessibility.h"
 #include "starboard/log.h"
 
@@ -151,6 +151,8 @@
   void CreateDebugServerIfNull();
 #endif  // ENABLE_DEBUG_CONSOLE
 
+  void SetSize(math::Size window_dimensions, float video_pixel_ratio);
+
   // Sets the application state, asserts preconditions to transition to that
   // state, and dispatches any precipitate web events.
   void SetApplicationState(base::ApplicationState state);
@@ -326,7 +328,7 @@
 
   scoped_ptr<media_session::MediaSessionClient> media_session_client_;
 
-  layout::TopmostEventTarget topmost_event_target_;
+  scoped_ptr<layout::TopmostEventTarget> topmost_event_target_;
 };
 
 class WebModule::Impl::DocumentLoadedObserver : public dom::DocumentObserver {
@@ -456,8 +458,8 @@
 
   window_ = new dom::Window(
       data.window_dimensions.width(), data.window_dimensions.height(),
-      data.initial_application_state, css_parser_.get(), dom_parser_.get(),
-      fetcher_factory_.get(), &resource_provider_,
+      data.video_pixel_ratio, data.initial_application_state, css_parser_.get(),
+      dom_parser_.get(), fetcher_factory_.get(), &resource_provider_,
       animated_image_tracker_.get(), image_cache_.get(),
       reduced_image_cache_capacity_manager_.get(), remote_typeface_cache_.get(),
       mesh_cache_.get(), local_storage_database_.get(), data.media_module,
@@ -474,10 +476,17 @@
       base::Bind(&WebModule::Impl::OnRanAnimationFrameCallbacks,
                  base::Unretained(this)),
       data.window_close_callback, data.window_minimize_callback,
-      data.system_window_, data.options.camera_3d,
-      media_session_client_->GetMediaSession(),
+      data.options.camera_3d, media_session_client_->GetMediaSession(),
       data.options.csp_insecure_allowed_token, data.dom_max_element_depth,
-      data.options.video_playback_rate_multiplier);
+      data.options.video_playback_rate_multiplier,
+#if defined(ENABLE_TEST_RUNNER)
+      data.options.layout_trigger == layout::LayoutManager::kTestRunnerMode
+          ? dom::Window::kClockTypeTestRunner
+          : dom::Window::kClockTypeSystemTime
+#else
+      dom::Window::kClockTypeSystemTime
+#endif
+      );  // NOLINT(whitespace/parens)
   DCHECK(window_);
 
   window_weak_ = base::AsWeakPtr(window_.get());
@@ -506,6 +515,7 @@
       base::Bind(&WebModule::Impl::HandlePointerEvents, base::Unretained(this)),
       data.options.layout_trigger, data.dom_max_element_depth,
       data.layout_refresh_rate, data.network_module->preferred_language(),
+      data.options.enable_image_animations,
       web_module_stat_tracker_->layout_stat_tracker()));
   DCHECK(layout_manager_);
 
@@ -557,6 +567,7 @@
   // crash when the callback attempts to access a stale Document pointer.
   DisableCallbacksInResourceCaches();
 
+  topmost_event_target_.reset();
   layout_manager_.reset();
   environment_settings_.reset();
   window_weak_.reset();
@@ -571,8 +582,8 @@
   local_storage_database_.reset();
   mesh_cache_.reset();
   remote_typeface_cache_.reset();
-  animated_image_tracker_.reset();
   image_cache_.reset();
+  animated_image_tracker_.reset();
   fetcher_factory_.reset();
   dom_parser_.reset();
   css_parser_.reset();
@@ -750,6 +761,11 @@
   }
 }
 
+void WebModule::Impl::SetSize(math::Size /*window_dimensions*/,
+                              float /*video_pixel_ratio*/) {
+  NOTIMPLEMENTED();
+}
+
 void WebModule::Impl::SetApplicationState(base::ApplicationState state) {
   window_->SetApplicationState(state);
 }
@@ -791,6 +807,9 @@
   // Clear out the loader factory's resource provider, possibly aborting any
   // in-progress loads.
   loader_factory_->Suspend();
+
+  // Clear out any currently tracked animating images.
+  animated_image_tracker_->Reset();
 }
 
 void WebModule::Impl::FinishSuspend() {
@@ -887,7 +906,8 @@
       thread_priority(base::kThreadPriority_Normal),
       loader_thread_priority(base::kThreadPriority_Low),
       animated_image_decode_thread_priority(base::kThreadPriority_Low),
-      video_playback_rate_multiplier(1.f) {}
+      video_playback_rate_multiplier(1.f),
+      enable_image_animations(true) {}
 
 WebModule::WebModule(
     const GURL& initial_url, base::ApplicationState initial_application_state,
@@ -896,16 +916,15 @@
     const base::Closure& window_close_callback,
     const base::Closure& window_minimize_callback,
     media::MediaModule* media_module, network::NetworkModule* network_module,
-    const math::Size& window_dimensions,
-    render_tree::ResourceProvider* resource_provider,
-    system_window::SystemWindow* system_window, float layout_refresh_rate,
+    const math::Size& window_dimensions, float video_pixel_ratio,
+    render_tree::ResourceProvider* resource_provider, float layout_refresh_rate,
     const Options& options)
     : thread_(options.name.c_str()) {
   ConstructionData construction_data(
       initial_url, initial_application_state, render_tree_produced_callback,
       error_callback, window_close_callback, window_minimize_callback,
-      media_module, network_module, window_dimensions, resource_provider,
-      kDOMMaxElementDepth, system_window, layout_refresh_rate, options);
+      media_module, network_module, window_dimensions, video_pixel_ratio,
+      resource_provider, kDOMMaxElementDepth, layout_refresh_rate, options);
 
   // Start the dedicated thread and create the internal implementation
   // object on that thread.
@@ -1083,6 +1102,14 @@
 }
 #endif  // defined(ENABLE_DEBUG_CONSOLE)
 
+void WebModule::SetSize(const math::Size& window_dimensions,
+                        float video_pixel_ratio) {
+  message_loop()->PostTask(
+      FROM_HERE,
+      base::Bind(&WebModule::Impl::SetSize, base::Unretained(impl_.get()),
+                 window_dimensions, video_pixel_ratio));
+}
+
 void WebModule::Start(render_tree::ResourceProvider* resource_provider) {
   // Must only be called by a thread external from the WebModule thread.
   DCHECK_NE(MessageLoop::current(), message_loop());
@@ -1157,7 +1184,10 @@
           window_ ==
           base::polymorphic_downcast<const dom::UIEvent* const>(event.get())
               ->view());
-      topmost_event_target_.MaybeSendPointerEvents(event, window_);
+      if (!topmost_event_target_) {
+        topmost_event_target_.reset(new layout::TopmostEventTarget());
+      }
+      topmost_event_target_->MaybeSendPointerEvents(event);
     }
   } while (event && !layout_manager_->IsNewRenderTreePending());
 }
diff --git a/src/cobalt/browser/web_module.h b/src/cobalt/browser/web_module.h
index 0cc79ce..47c22ee 100644
--- a/src/cobalt/browser/web_module.h
+++ b/src/cobalt/browser/web_module.h
@@ -54,7 +54,6 @@
 #include "cobalt/script/global_environment.h"
 #include "cobalt/script/javascript_engine.h"
 #include "cobalt/script/script_runner.h"
-#include "cobalt/system_window/system_window.h"
 #include "cobalt/webdriver/session_driver.h"
 #include "googleurl/src/gurl.h"
 
@@ -176,6 +175,10 @@
     // The video playback rate will be multiplied with the following value.  Its
     // default value is 1.0.
     float video_playback_rate_multiplier;
+
+    // Allows image animations to be enabled/disabled.  Its default value
+    // is true to enable them.
+    bool enable_image_animations;
   };
 
   typedef layout::LayoutManager::LayoutResults LayoutResults;
@@ -191,9 +194,8 @@
             const base::Closure& window_minimize_callback,
             media::MediaModule* media_module,
             network::NetworkModule* network_module,
-            const math::Size& window_dimensions,
+            const math::Size& window_dimensions, float video_pixel_ratio,
             render_tree::ResourceProvider* resource_provider,
-            system_window::SystemWindow* system_window,
             float layout_refresh_rate, const Options& options);
   ~WebModule();
 
@@ -232,6 +234,11 @@
   debug::DebugServer* GetDebugServer();
 #endif  // ENABLE_DEBUG_CONSOLE
 
+  // Sets the size and pixel ratio of this web module, possibly causing relayout
+  // and re-render with the new parameters. Does nothing if the parameters are
+  // not different from the current parameters.
+  void SetSize(const math::Size& window_dimensions, float video_pixel_ratio);
+
   // LifecycleObserver implementation
   void Start(render_tree::ResourceProvider* resource_provider) OVERRIDE;
   void Pause() OVERRIDE;
@@ -252,10 +259,10 @@
         const base::Closure& window_minimize_callback,
         media::MediaModule* media_module,
         network::NetworkModule* network_module,
-        const math::Size& window_dimensions,
+        const math::Size& window_dimensions, float video_pixel_ratio,
         render_tree::ResourceProvider* resource_provider,
-        int dom_max_element_depth, system_window::SystemWindow* system_window,
-        float layout_refresh_rate, const Options& options)
+        int dom_max_element_depth, float layout_refresh_rate,
+        const Options& options)
         : initial_url(initial_url),
           initial_application_state(initial_application_state),
           render_tree_produced_callback(render_tree_produced_callback),
@@ -265,9 +272,9 @@
           media_module(media_module),
           network_module(network_module),
           window_dimensions(window_dimensions),
+          video_pixel_ratio(video_pixel_ratio),
           resource_provider(resource_provider),
           dom_max_element_depth(dom_max_element_depth),
-          system_window_(system_window),
           layout_refresh_rate(layout_refresh_rate),
           options(options) {}
 
@@ -280,9 +287,9 @@
     media::MediaModule* media_module;
     network::NetworkModule* network_module;
     math::Size window_dimensions;
+    float video_pixel_ratio;
     render_tree::ResourceProvider* resource_provider;
     int dom_max_element_depth;
-    system_window::SystemWindow* system_window_;
     float layout_refresh_rate;
     Options options;
   };
diff --git a/src/cobalt/build/build.id b/src/cobalt/build/build.id
index 66e3496..d7461cb 100644
--- a/src/cobalt/build/build.id
+++ b/src/cobalt/build/build.id
@@ -1 +1 @@
-71685
\ No newline at end of file
+78263
\ No newline at end of file
diff --git a/src/cobalt/build/config/__init__.py b/src/cobalt/build/config/__init__.py
index 68e992a..e741e5b 100644
--- a/src/cobalt/build/config/__init__.py
+++ b/src/cobalt/build/config/__init__.py
@@ -14,7 +14,6 @@
 # limitations under the License.
 """Initialization for the config package."""
 
-
-from base import LoadPlatformConfig
+from base import GetPlatformConfig
 from base import VALID_BUILD_CONFIGS
 from base import VALID_PLATFORMS
diff --git a/src/cobalt/build/config/base.gypi b/src/cobalt/build/config/base.gypi
index 3133cd6..439781f 100644
--- a/src/cobalt/build/config/base.gypi
+++ b/src/cobalt/build/config/base.gypi
@@ -43,6 +43,12 @@
     'sb_enable_lib%': '<(sb_enable_lib)',
     'cobalt_enable_lib': '<(sb_enable_lib)',
 
+    # Directory path to static contents.
+    'sb_static_contents_output_base_dir%': '<(PRODUCT_DIR)/content',
+
+    # Directory path to static contents' data.
+    'sb_static_contents_output_data_dir%': '<(PRODUCT_DIR)/content/data',
+
     # This variable defines what Cobalt's preferred strategy should be for
     # handling internally triggered application exit requests (e.g. the user
     # chooses to back out of the application).
@@ -146,12 +152,19 @@
     # Defines what kind of rasterizer will be used.  This can be adjusted to
     # force a stub graphics implementation or software graphics implementation.
     # It can be one of the following options:
-    #   'hardware' -- As much hardware acceleration of graphics commands as
-    #                 possible. Required for 360 rendering.
-    #   'software' -- Perform most rasterization using the CPU and only interact
-    #                 with the GPU to send the final image to the output window.
-    #   'stub'     -- Stub graphics rasterization.  A rasterizer object will
-    #                 still be available and valid, but it will do nothing.
+    #   'direct-gles' -- Uses a light wrapper over OpenGL ES to handle most
+    #                    draw elements. This will fall back to the skia hardware
+    #                    rasterizer for some render tree node types, but is
+    #                    generally faster on the CPU and GPU. This can handle
+    #                    360 rendering.
+    #   'hardware'    -- As much hardware acceleration of graphics commands as
+    #                    possible. This uses skia to wrap OpenGL ES commands.
+    #                    Required for 360 rendering.
+    #   'software'    -- Perform most rasterization using the CPU and only
+    #                    interact with the GPU to send the final image to the
+    #                    output window.
+    #   'stub'        -- Stub graphics rasterization.  A rasterizer object will
+    #                    still be available and valid, but it will do nothing.
     'rasterizer_type%': 'hardware',
 
     # If set to 1, will enable support for rendering only the regions of the
@@ -188,8 +201,6 @@
     # native code may require an additional packaging step (ex. Android).
     'gtest_target_type%': 'executable',
     'final_executable_type%': 'executable',
-    'posix_emulation_target_type%': 'static_library',
-    'webkit_target_type%': 'static_library',
 
     # Set to 1 to build with DIAL support.
     'in_app_dial%': 0,
@@ -203,6 +214,9 @@
     # Set to 1 to enable H5vccCrashLog.
     'enable_crash_log%': 0,
 
+    # Set to 1 to enable H5vccSSO (Single Sign On).
+    'enable_sso%': 0,
+
     # Set to 1 to compile with SPDY support.
     'enable_spdy%': 0,
 
@@ -248,6 +262,12 @@
     # Temporary indicator for Tizen - should eventually move to feature defines.
     'tizen_os%': 0,
 
+    # URL of default build time splash screen:
+    # TODO: Point this to cobalt_splash_screen.html and override it in
+    # ports' gyp_configuration.gypi (coordinate transition with
+    # partners).
+    'fallback_splash_screen_url%': 'h5vcc-embedded://splash_screen.html',
+
     # Cache parameters
 
     # The following set of parameters define how much memory is reserved for
@@ -283,6 +303,15 @@
     # nodes that are most CPU-expensive to render into surfaces.
     'surface_cache_size_in_bytes%': 0,
 
+    # Determines the amount of GPU memory the offscreen target atlases will
+    # use. This is specific to the direct-GLES rasterizer and serves a similar
+    # purpose as the surface_cache_size_in_bytes, but caches any render tree
+    # nodes which require skia for rendering. Two atlases will be allocated
+    # from this memory or multiple atlases of the frame size if the limit
+    # allows. It is recommended that enough memory be reserved for two RGBA
+    # atlases about a quarter of the frame size.
+    'offscreen_target_cache_size_in_bytes%': -1,
+
     # Determines the capacity of the image cache, which manages image surfaces
     # downloaded from a web page.  While it depends on the platform, often (and
     # ideally) these images are cached within GPU memory.
@@ -420,17 +449,6 @@
     # implementation is a no-op.
     'cobalt_enable_jit%': 0,
 
-    # Customize variables used by Chromium's build/common.gypi.
-
-    # Disable a check that looks for an official google api key.
-    'use_official_google_api_keys': 0,
-    # Prevents common.gypi from running a bash script which is not required
-    # to compile Cobalt.
-    'clang_use_chrome_plugins': 0,
-    # Disables treat warnings as errors.
-    'werror': '',
-    # Cobalt doesn't currently support tcmalloc.
-    'linux_use_tcmalloc': 0,
     # The event polling mechanism available on this platform to support libevent.
     # Platforms may redefine to 'poll' if necessary.
     # Other mechanisms, e.g. devpoll, kqueue, select, are not yet supported.
@@ -568,16 +586,6 @@
           }],
         ],
       }],
-      ['posix_emulation_target_type == "shared_library"', {
-        'defines': [
-          '__LB_BASE_SHARED__=1',
-        ],
-      }],
-      ['webkit_target_type == "shared_library"', {
-        'defines': [
-          'COBALT_WEBKIT_SHARED=1',
-        ],
-      }],
       ['OS == "lb_shell"', {
         'defines': [
           '__LB_SHELL__',
diff --git a/src/cobalt/build/config/base.py b/src/cobalt/build/config/base.py
index d7cd087..612e547 100644
--- a/src/cobalt/build/config/base.py
+++ b/src/cobalt/build/config/base.py
@@ -18,6 +18,7 @@
 import importlib
 import logging
 import os
+import sys
 
 import gyp_utils
 
@@ -98,7 +99,17 @@
     return {}
 
 
-def LoadPlatformConfig(platform):
+def _ModuleLoaded(module_name, module_path):
+  if module_name not in sys.modules:
+    return False
+  # Sometimes one of these has .pyc and the other has .py, but we don't care.
+  extensionless_loaded_path = os.path.splitext(
+      os.path.abspath(sys.modules['platform_module'].__file__))[0]
+  extensionless_module_path = os.path.splitext(os.path.abspath(module_path))[0]
+  return extensionless_loaded_path == extensionless_module_path
+
+
+def _LoadPlatformConfig(platform):
   """Loads a platform specific configuration.
 
   The function will use the provided platform name to load
@@ -117,7 +128,10 @@
     if platform in platforms.keys():
       platform_path = platforms[platform].path
       module_path = os.path.join(platform_path, 'gyp_configuration.py')
-      platform_module = imp.load_source('platform_module', module_path)
+      if not _ModuleLoaded('platform_module', module_path):
+        platform_module = imp.load_source('platform_module', module_path)
+      else:
+        platform_module = sys.modules['platform_module']
     else:
       module_path = 'config/{}.py'.format(platform)
       platform_module = importlib.import_module('config.{}'.format(platform))
@@ -130,3 +144,28 @@
     return None
 
   return platform_module.CreatePlatformConfig()
+
+
+# Global cache of the platform configurations, so that platform config objects
+# are only created once.
+_PLATFORM_CONFIG_DICT = {}
+
+
+def GetPlatformConfig(platform):
+  """Returns a platform specific configuration.
+
+  This function will return a cached platform configuration object, loading it
+  if it doesn't exist via a call to _LoadPlatformConfig().
+
+  Args:
+    platform: Platform name.
+
+  Returns:
+    Instance of a class derived from PlatformConfigBase.
+  """
+
+  global _PLATFORM_CONFIG_DICT
+  if platform not in _PLATFORM_CONFIG_DICT:
+    _PLATFORM_CONFIG_DICT[platform] = _LoadPlatformConfig(platform)
+
+  return _PLATFORM_CONFIG_DICT[platform]
diff --git a/src/cobalt/build/contents_dir.gypi b/src/cobalt/build/contents_dir.gypi
index 64f7608..b3086c0 100644
--- a/src/cobalt/build/contents_dir.gypi
+++ b/src/cobalt/build/contents_dir.gypi
@@ -16,7 +16,5 @@
 {
   'variables': {
     'static_contents_source_dir': '<(DEPTH)/cobalt/content',
-    'static_contents_output_base_dir': '<(PRODUCT_DIR)/content',
-    'static_contents_output_data_dir': '<(PRODUCT_DIR)/content/data',
   },
 }
diff --git a/src/cobalt/build/copy_icu_data.gypi b/src/cobalt/build/copy_icu_data.gypi
index c2bfac3..2b15d2a 100644
--- a/src/cobalt/build/copy_icu_data.gypi
+++ b/src/cobalt/build/copy_icu_data.gypi
@@ -26,12 +26,12 @@
           'little_endian%': 1,
 
           # A directory with loose data files.should be used instead of a
-	  # single .dat file
+          # single .dat file
           'use_icu_dat_file%': 0,
         },
 
         'conditions': [
-          ['target_arch in ["ps3", "wiiu", "x360"]', {
+          ['target_arch in ["ps3"]', {
             'little_endian%': 0,
           }],
         ],
@@ -47,7 +47,7 @@
 
   'copies': [
     {
-      'destination': '<(static_contents_output_data_dir)/',
+      'destination': '<(sb_static_contents_output_data_dir)/',
       'files': [ '<(inputs_icu)' ],
     },
   ],
diff --git a/src/cobalt/build/copy_test_data.gypi b/src/cobalt/build/copy_test_data.gypi
index 13ac050..e5d8dad 100644
--- a/src/cobalt/build/copy_test_data.gypi
+++ b/src/cobalt/build/copy_test_data.gypi
@@ -49,16 +49,17 @@
 # folder.
 
 {
+  'includes': [ 'contents_dir.gypi' ],
   'inputs': [
     '<!@pymod_do_main(starboard.build.copy_data --inputs <(input_files))',
   ],
   'outputs': [
-    '<!@pymod_do_main(starboard.build.copy_data -o <(PRODUCT_DIR)/content/dir_source_root/<(output_dir) --outputs <(input_files))',
+    '<!@pymod_do_main(starboard.build.copy_data -o <(sb_static_contents_output_base_dir)/dir_source_root/<(output_dir) --outputs <(input_files))',
   ],
   'action': [
     'python',
     '<(DEPTH)/starboard/build/copy_data.py',
-    '-o', '<(PRODUCT_DIR)/content/dir_source_root/<(output_dir)',
+    '-o', '<(sb_static_contents_output_base_dir)/dir_source_root/<(output_dir)',
     '<@(input_files)',
   ],
 }
diff --git a/src/cobalt/build/copy_web_data.gypi b/src/cobalt/build/copy_web_data.gypi
index b4f5c98..672ee45 100644
--- a/src/cobalt/build/copy_web_data.gypi
+++ b/src/cobalt/build/copy_web_data.gypi
@@ -49,16 +49,17 @@
 # folder.
 
 {
+  'includes': [ 'contents_dir.gypi' ],
   'inputs': [
     '<!@pymod_do_main(starboard.build.copy_data --inputs <(input_files))',
   ],
   'outputs': [
-    '<!@pymod_do_main(starboard.build.copy_data -o <(PRODUCT_DIR)/content/data/web/<(output_dir) --outputs <(input_files))',
+    '<!@pymod_do_main(starboard.build.copy_data -o <(sb_static_contents_output_data_dir)/web/<(output_dir) --outputs <(input_files))',
   ],
   'action': [
     'python',
     '<(DEPTH)/starboard/build/copy_data.py',
-    '-o', '<(PRODUCT_DIR)/content/data/web/<(output_dir)',
+    '-o', '<(sb_static_contents_output_data_dir)/web/<(output_dir)',
     '<@(input_files)',
   ],
 }
diff --git a/src/cobalt/build/gyp_cobalt b/src/cobalt/build/gyp_cobalt
index 4444e7e..129e0cf 100755
--- a/src/cobalt/build/gyp_cobalt
+++ b/src/cobalt/build/gyp_cobalt
@@ -144,7 +144,7 @@
   def __init__(self, options):
     self.options = options
     self.common_args = []
-    self.platform_config = config.LoadPlatformConfig(options.platform)
+    self.platform_config = config.GetPlatformConfig(options.platform)
     if not self.platform_config:
       raise RuntimeError('Unable to load platform configuration.')
 
diff --git a/src/cobalt/css_parser/border_shorthand_property_parse_structures.h b/src/cobalt/css_parser/border_shorthand_property_parse_structures.h
index 1b220c8..49889b2 100644
--- a/src/cobalt/css_parser/border_shorthand_property_parse_structures.h
+++ b/src/cobalt/css_parser/border_shorthand_property_parse_structures.h
@@ -22,13 +22,13 @@
 namespace css_parser {
 
 // This helps parsing and verifying syntax of border shorthand property values.
-struct BorderShorthand {
-  BorderShorthand() : error(false) {}
+struct BorderOrOutlineShorthand {
+  BorderOrOutlineShorthand() : error(false) {}
 
   bool error;
-  scoped_refptr<cssom::PropertyValue> border_color;
-  scoped_refptr<cssom::PropertyValue> border_style;
-  scoped_refptr<cssom::PropertyValue> border_width;
+  scoped_refptr<cssom::PropertyValue> color;
+  scoped_refptr<cssom::PropertyValue> style;
+  scoped_refptr<cssom::PropertyValue> width;
 };
 
 // This helps parsing and verifying syntax of border color/style/width shorthand
diff --git a/src/cobalt/css_parser/grammar.y b/src/cobalt/css_parser/grammar.y
index 86a9ca0..6e4d467 100644
--- a/src/cobalt/css_parser/grammar.y
+++ b/src/cobalt/css_parser/grammar.y
@@ -131,6 +131,10 @@
 %token kMinHeightToken                        // min-height
 %token kMinWidthToken                         // min-width
 %token kOpacityToken                          // opacity
+%token kOutlineToken                          // outline
+%token kOutlineColorToken                     // outline-color
+%token kOutlineStyleToken                     // outline-style
+%token kOutlineWidthToken                     // outline-width
 %token kOverflowToken                         // overflow
 %token kOverflowWrapToken                     // overflow-wrap
 %token kPaddingBottomToken                    // padding-bottom
@@ -138,6 +142,7 @@
 %token kPaddingRightToken                     // padding-right
 %token kPaddingToken                          // padding
 %token kPaddingTopToken                       // padding-top
+%token kPointerEventsToken                    // pointer-events
 %token kPositionToken                         // position
 %token kRightToken                            // right
 %token kSrcToken                              // src
@@ -559,6 +564,7 @@
                        overflow_property_value
                        overflow_wrap_property_value
                        padding_side_property_value
+                       pointer_events_property_value
                        position_list_element
                        position_property_value
                        positive_length_percent_property_value
@@ -858,9 +864,10 @@
 %type <position_structure> position_list
 %destructor { delete $$; } <position_structure>
 
-%union { BorderShorthand* border_shorthand; }
-%type <border_shorthand> border_property_value border_property_list
-%destructor { delete $$; } <border_shorthand>
+%union { BorderOrOutlineShorthand* border_or_outline_shorthand; }
+%type <border_or_outline_shorthand> border_or_outline_property_value
+                                    border_or_outline_property_list
+%destructor { delete $$; } <border_or_outline_shorthand>
 
 %union { ShadowPropertyInfo* shadow_info; }
 %type <shadow_info> box_shadow_list text_shadow_list
@@ -1490,6 +1497,22 @@
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kOpacityProperty));
   }
+  | kOutlineToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineProperty));
+  }
+  | kOutlineColorToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineColorProperty));
+  }
+  | kOutlineStyleToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineStyleProperty));
+  }
+  | kOutlineWidthToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kOutlineWidthProperty));
+  }
   | kOverflowToken {
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kOverflowProperty));
@@ -1518,6 +1541,10 @@
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kPaddingTopProperty));
   }
+  | kPointerEventsToken {
+    $$ = TrivialStringPiece::FromCString(
+            cssom::GetPropertyName(cssom::kPointerEventsProperty));
+  }
   | kPositionToken {
     $$ = TrivialStringPiece::FromCString(
             cssom::GetPropertyName(cssom::kPositionProperty));
@@ -3360,53 +3387,54 @@
   }
   ;
 
-// border_property_element represents a component of a single border property.
-// It uses $0 to access its parent's BorderShorthand object and build it, so it
-// should always be used to the right of a border shorthand object.
-// The 'border' property is a shorthand property for setting the same width,
-// color, and style for all four borders of a box. Unlike the shorthand
-// 'margin' and 'padding' properties, the 'border' property cannot set
+// border_or_outline_property_element represents a component of a single border
+// property. It uses $0 to access its parent's BorderOrOutlineShorthand object
+// and build it, so it should always be used to the right of a border shorthand
+// object.
+// The 'border' and 'outline' properties are shorthand properties for setting
+// the same width, color, and style for all four borders of a box. Unlike the
+// shorthand 'margin' and 'padding' properties, the 'border' property cannot set
 // different values on the four borders.
-border_property_element:
+border_or_outline_property_element:
     color {
     scoped_refptr<cssom::PropertyValue> color(MakeScopedRefPtrAndRelease($1));
-    if (!$<border_shorthand>0->border_color) {
-      $<border_shorthand>0->border_color = color;
+    if (!$<border_or_outline_shorthand>0->color) {
+      $<border_or_outline_shorthand>0->color = color;
     } else {
       parser_impl->LogError(
-          @1, "border-color value declared twice in border.");
-      $<border_shorthand>0->error = true;
+          @1, "color value declared twice in border or outline.");
+      $<border_or_outline_shorthand>0->error = true;
     }
   }
   | line_style {
     scoped_refptr<cssom::PropertyValue> line_style =
         MakeScopedRefPtrAndRelease($1);
-    if (!$<border_shorthand>0->border_style) {
-      $<border_shorthand>0->border_style = line_style;
+    if (!$<border_or_outline_shorthand>0->style) {
+      $<border_or_outline_shorthand>0->style = line_style;
     } else {
       parser_impl->LogError(
-          @1, "border-style value declared twice in border.");
-      $<border_shorthand>0->error = true;
+          @1, "style value declared twice in border or outline.");
+      $<border_or_outline_shorthand>0->error = true;
     }
   }
   | positive_length {
     scoped_refptr<cssom::PropertyValue> positive_length =
         MakeScopedRefPtrAndRelease($1);
-    if (!$<border_shorthand>0->border_width) {
-      $<border_shorthand>0->border_width = positive_length;
+    if (!$<border_or_outline_shorthand>0->width) {
+      $<border_or_outline_shorthand>0->width = positive_length;
     } else {
       parser_impl->LogError(
-          @1, "border-width value declared twice in border.");
-      $<border_shorthand>0->error = true;
+          @1, "width value declared twice in border or outline.");
+      $<border_or_outline_shorthand>0->error = true;
     }
   }
   ;
 
-border_property_list:
+border_or_outline_property_list:
     /* empty */ {
-    $$ = new BorderShorthand();
+    $$ = new BorderOrOutlineShorthand();
   }
-  | border_property_list border_property_element {
+  | border_or_outline_property_list border_or_outline_property_element {
     $$ = $1;
   }
   ;
@@ -3417,15 +3445,15 @@
 // various properties define the style ('border-style'), color ('border-color'),
 // and thickness ('border-width') of the border.
 //   https://www.w3.org/TR/css3-background/#borders
-border_property_value:
-    border_property_list
+border_or_outline_property_value:
+    border_or_outline_property_list
   | common_values {
     // Replicate the common value into each of the properties that border is a
     // shorthand for.
-    scoped_ptr<BorderShorthand> border(new BorderShorthand());
-    border->border_color = $1;
-    border->border_style = $1;
-    border->border_width = $1;
+    scoped_ptr<BorderOrOutlineShorthand> border(new BorderOrOutlineShorthand());
+    border->color = $1;
+    border->style = $1;
+    border->width = $1;
     $$ = border.release();
   }
   ;
@@ -4169,6 +4197,23 @@
   }
   ;
 
+// Used to control designation of elements by pointers.
+// While only defined in the SVG spec, the pointer-events property has been
+// proposed an commonly implemented to also apply to HTML elements for
+// values of 'none' (element can not be indicated by a pointer) and 'auto'
+// (element can be indicated by a pointer if the element has 'visibility' set
+// to 'visible').
+//   https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty
+pointer_events_property_value:
+    kAutoToken maybe_whitespace {
+    $$ = AddRef(cssom::KeywordValue::GetAuto().get());
+  }
+  | kNoneToken maybe_whitespace {
+    $$ = AddRef(cssom::KeywordValue::GetNone().get());
+  }
+  | common_values
+  ;
+
 // Determines which of the positioning algorithms is used to calculate
 // the position of a box.
 //   https://www.w3.org/TR/CSS21/visuren.html#choose-position
@@ -5324,8 +5369,17 @@
   | kBackgroundColorToken {
     $$ = cssom::kBackgroundColorProperty;
   }
-  | kBorderRadiusToken {
-    $$ = cssom::kBorderRadiusProperty;
+  | kBorderBottomColorToken {
+    $$ = cssom::kBorderBottomColorProperty;
+  }
+  | kBorderLeftColorToken {
+    $$ = cssom::kBorderLeftColorProperty;
+  }
+  | kBorderRightColorToken {
+    $$ = cssom::kBorderRightColorProperty;
+  }
+  | kBorderTopColorToken {
+    $$ = cssom::kBorderTopColorProperty;
   }
   | kColorToken {
     $$ = cssom::kColorProperty;
@@ -5333,6 +5387,12 @@
   | kOpacityToken {
     $$ = cssom::kOpacityProperty;
   }
+  | kOutlineColorToken {
+    $$ = cssom::kOutlineColorProperty;
+  }
+  | kOutlineWidthToken {
+    $$ = cssom::kOutlineWidthProperty;
+  }
   | kTransformToken {
     $$ = cssom::kTransformProperty;
   }
@@ -5494,9 +5554,9 @@
                                       MakeScopedRefPtrAndRelease($4), $5)
             : NULL;
   }
-  | kBorderToken maybe_whitespace colon border_property_value
+  | kBorderToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5505,44 +5565,44 @@
       // Unpack border color.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopColorProperty, border->border_color));
+              cssom::kBorderTopColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightColorProperty, border->border_color));
+              cssom::kBorderRightColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomColorProperty, border->border_color));
+              cssom::kBorderBottomColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftColorProperty, border->border_color));
+              cssom::kBorderLeftColorProperty, border->color));
 
       // Unpack border style.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopStyleProperty, border->border_style));
+              cssom::kBorderTopStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightStyleProperty, border->border_style));
+              cssom::kBorderRightStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomStyleProperty, border->border_style));
+              cssom::kBorderBottomStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftStyleProperty, border->border_style));
+              cssom::kBorderLeftStyleProperty, border->style));
 
       // Unpack border width.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopWidthProperty, border->border_width));
+              cssom::kBorderTopWidthProperty, border->width));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightWidthProperty, border->border_width));
+              cssom::kBorderRightWidthProperty, border->width));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomWidthProperty, border->border_width));
+              cssom::kBorderBottomWidthProperty, border->width));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftWidthProperty, border->border_width));
+              cssom::kBorderLeftWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5550,9 +5610,9 @@
       $$ = NULL;
     }
   }
-  | kBorderBottomToken maybe_whitespace colon border_property_value
+  | kBorderBottomToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5561,13 +5621,13 @@
       // Unpack border bottom.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomColorProperty, border->border_color));
+              cssom::kBorderBottomColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomStyleProperty, border->border_style));
+              cssom::kBorderBottomStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderBottomWidthProperty, border->border_width));
+              cssom::kBorderBottomWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5628,9 +5688,9 @@
       $$ = NULL;
     }
   }
-  | kBorderLeftToken maybe_whitespace colon border_property_value
+  | kBorderLeftToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5639,13 +5699,13 @@
       // Unpack border left.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftColorProperty, border->border_color));
+              cssom::kBorderLeftColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftStyleProperty, border->border_style));
+              cssom::kBorderLeftStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderLeftWidthProperty, border->border_width));
+              cssom::kBorderLeftWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5677,9 +5737,9 @@
                                       MakeScopedRefPtrAndRelease($4), $5)
             : NULL;
   }
-  | kBorderRightToken maybe_whitespace colon border_property_value
+  | kBorderRightToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5688,13 +5748,13 @@
       // Unpack border right.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightColorProperty, border->border_color));
+              cssom::kBorderRightColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightStyleProperty, border->border_style));
+              cssom::kBorderRightStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderRightWidthProperty, border->border_width));
+              cssom::kBorderRightWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -5755,9 +5815,9 @@
       $$ = NULL;
     }
   }
-  | kBorderTopToken maybe_whitespace colon border_property_value
+  | kBorderTopToken maybe_whitespace colon border_or_outline_property_value
       maybe_important {
-    scoped_ptr<BorderShorthand> border($4);
+    scoped_ptr<BorderOrOutlineShorthand> border($4);
     DCHECK(border);
     if (!border->error) {
       scoped_ptr<PropertyDeclaration> property_declaration(
@@ -5766,13 +5826,13 @@
       // Unpack border top.
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopColorProperty, border->border_color));
+              cssom::kBorderTopColorProperty, border->color));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopStyleProperty, border->border_style));
+              cssom::kBorderTopStyleProperty, border->style));
       property_declaration->property_values.push_back(
           PropertyDeclaration::PropertyKeyValuePair(
-              cssom::kBorderTopWidthProperty, border->border_width));
+              cssom::kBorderTopWidthProperty, border->width));
 
       $$ = property_declaration.release();
     } else {
@@ -6020,6 +6080,53 @@
                                       MakeScopedRefPtrAndRelease($4), $5)
             : NULL;
   }
+  | kOutlineToken maybe_whitespace colon border_or_outline_property_value
+      maybe_important {
+    scoped_ptr<BorderOrOutlineShorthand> outline($4);
+    DCHECK(outline);
+    if (!outline->error) {
+      scoped_ptr<PropertyDeclaration> property_declaration(
+          new PropertyDeclaration($5));
+
+      // Unpack outline color.
+      property_declaration->property_values.push_back(
+          PropertyDeclaration::PropertyKeyValuePair(
+              cssom::kOutlineColorProperty, outline->color));
+
+      // Unpack outline style.
+      property_declaration->property_values.push_back(
+          PropertyDeclaration::PropertyKeyValuePair(
+              cssom::kOutlineStyleProperty, outline->style));
+
+      // Unpack outline width.
+      property_declaration->property_values.push_back(
+          PropertyDeclaration::PropertyKeyValuePair(
+              cssom::kOutlineWidthProperty, outline->width));
+
+      $$ = property_declaration.release();
+    } else {
+      parser_impl->LogWarning(@1, "invalid outline");
+      $$ = NULL;
+    }
+  }
+  | kOutlineColorToken maybe_whitespace colon color_property_value
+      maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kOutlineColorProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
+  | kOutlineStyleToken maybe_whitespace colon line_style_with_common_values
+      maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kOutlineStyleProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
+  | kOutlineWidthToken maybe_whitespace colon
+      border_width_element_with_common_values maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kOutlineWidthProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
   | kOverflowToken maybe_whitespace colon overflow_property_value
       maybe_important {
     $$ = $4 ? new PropertyDeclaration(cssom::kOverflowProperty,
@@ -6081,6 +6188,12 @@
       $$ = NULL;
     }
   }
+  | kPointerEventsToken maybe_whitespace colon pointer_events_property_value
+      maybe_important {
+    $$ = $4 ? new PropertyDeclaration(cssom::kPointerEventsProperty,
+                                      MakeScopedRefPtrAndRelease($4), $5)
+            : NULL;
+  }
   | kPositionToken maybe_whitespace colon position_property_value
       maybe_important {
     $$ = $4 ? new PropertyDeclaration(cssom::kPositionProperty,
diff --git a/src/cobalt/css_parser/parser_test.cc b/src/cobalt/css_parser/parser_test.cc
index e51b2d0..4a7a792 100644
--- a/src/cobalt/css_parser/parser_test.cc
+++ b/src/cobalt/css_parser/parser_test.cc
@@ -3088,7 +3088,7 @@
             style->GetPropertyValue(cssom::kBorderBottomStyleProperty));
 }
 
-TEST_F(ParserTest, ParsesBorderWithInvaildValue) {
+TEST_F(ParserTest, ParsesBorderWithInvalidValue) {
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:9: warning: unsupported value"));
 
@@ -3098,8 +3098,8 @@
 
 TEST_F(ParserTest, InvalidBorderWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:30: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:30: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:1: warning: invalid border"));
 
@@ -3126,8 +3126,8 @@
 
 TEST_F(ParserTest, InvalidBorderBottomWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:37: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:37: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-bottom"));
@@ -3144,8 +3144,8 @@
 
 TEST_F(ParserTest, InvalidBorderLeftWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:35: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:35: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-left"));
@@ -3162,8 +3162,8 @@
 
 TEST_F(ParserTest, InvalidBorderRightWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:36: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:36: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-right"));
@@ -3180,8 +3180,8 @@
 
 TEST_F(ParserTest, InvalidBorderTopWithTwoColors) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:34: error: border-color value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:34: error: color value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(
       parser_observer_,
       OnWarning("[object ParserTest]:1:1: warning: invalid border-right"));
@@ -3198,8 +3198,8 @@
 
 TEST_F(ParserTest, InvalidBorderWithTwoStyles) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:15: error: border-style value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:15: error: style value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:1: warning: invalid border"));
 
@@ -3225,8 +3225,8 @@
 
 TEST_F(ParserTest, InvalidBorderWithTwoWidths) {
   EXPECT_CALL(parser_observer_,
-              OnError("[object ParserTest]:1:7: error: border-width value "
-                      "declared twice in border."));
+              OnError("[object ParserTest]:1:7: error: width value declared "
+                      "twice in border or outline."));
   EXPECT_CALL(parser_observer_,
               OnWarning("[object ParserTest]:1:1: warning: invalid border"));
 
@@ -5111,6 +5111,211 @@
   EXPECT_FLOAT_EQ(1, opaque->value());
 }
 
+TEST_F(ParserTest, ParsesOutlineWithWidthColorAndStyle) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: .5em #fff solid;",
+                                        source_location_);
+
+  scoped_refptr<cssom::LengthValue> outline_width =
+      dynamic_cast<cssom::LengthValue*>(
+          style->GetPropertyValue(cssom::kOutlineWidthProperty).get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_FLOAT_EQ(0.5f, outline_width->value());
+  EXPECT_EQ(cssom::kFontSizesAkaEmUnit, outline_width->unit());
+
+  scoped_refptr<cssom::RGBAColorValue> outline_color =
+      dynamic_cast<cssom::RGBAColorValue*>(
+          style->GetPropertyValue(cssom::kOutlineColorProperty).get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0xffffffff, outline_color->value());
+
+  EXPECT_EQ(cssom::KeywordValue::GetSolid(),
+            style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineWithInvalidValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:10: warning: unsupported value"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: foo, bar;", source_location_);
+}
+
+TEST_F(ParserTest, InvalidOutlineWithTwoColors) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:31: error: color value declared "
+                      "twice in border or outline."));
+  EXPECT_CALL(parser_observer_,
+              OnWarning("[object ParserTest]:1:1: warning: invalid outline"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline: rgba(255,255,255,.1) rgba(255,255,255,.1)",
+          source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, InvalidOutlineWithTwoStyles) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:16: error: style value declared "
+                      "twice in border or outline."));
+  EXPECT_CALL(parser_observer_,
+              OnWarning("[object ParserTest]:1:1: warning: invalid outline"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: solid hidden",
+                                        source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, InvalidOutlineWithTwoWidths) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:8: error: width value declared "
+                      "twice in border or outline."));
+  EXPECT_CALL(parser_observer_,
+              OnWarning("[object ParserTest]:1:1: warning: invalid outline"));
+
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: 10px 20px", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineColorWidth) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline: gray 20px;",
+                                        source_location_);
+
+  scoped_refptr<cssom::LengthValue> outline_width =
+      dynamic_cast<cssom::LengthValue*>(
+          style->GetPropertyValue(cssom::kOutlineWidthProperty).get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_FLOAT_EQ(20.0f, outline_width->value());
+  EXPECT_EQ(cssom::kPixelsUnit, outline_width->unit());
+
+  scoped_refptr<cssom::RGBAColorValue> outline_color =
+      dynamic_cast<cssom::RGBAColorValue*>(
+          style->GetPropertyValue(cssom::kOutlineColorProperty).get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0x808080FF, outline_color->value());
+}
+
+TEST_F(ParserTest, ParsesOutlineColor) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-color: rgba(0, 0, 0, .8);",
+                                        source_location_);
+
+  scoped_refptr<cssom::RGBAColorValue> outline_color =
+      dynamic_cast<cssom::RGBAColorValue*>(
+          style->GetPropertyValue(cssom::kOutlineColorProperty).get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0x000000cc, outline_color->value());
+}
+
+TEST_F(ParserTest, ParsesOutlineWidth) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-width: .8em;",
+                                        source_location_);
+
+  scoped_refptr<cssom::LengthValue> outline_width =
+      dynamic_cast<cssom::LengthValue*>(
+          style->GetPropertyValue(cssom::kOutlineWidthProperty).get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_FLOAT_EQ(0.8f, outline_width->value());
+  EXPECT_EQ(cssom::kFontSizesAkaEmUnit, outline_width->unit());
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleSolid) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-style: solid;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetSolid(),
+            style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleHidden) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-style: hidden;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetHidden(),
+            style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineColorWithInvalidNumberOfValues) {
+  EXPECT_CALL(parser_observer_,
+              OnError("[object ParserTest]:1:23: error: unrecoverable syntax "
+                      "error"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline-color: maroon green transparent #CdC transparent;",
+          source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineColorWithZeroValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:16: warning: unsupported value"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-color: ;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineColorProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleWithInvalidNumberOfValues) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnError("[object ParserTest]:1:22: error: unrecoverable syntax error"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline-style: solid hidden none solid hidden;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineStyleWithZeroValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:16: warning: unsupported value"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-style: ;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineStyleProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineWidthWithInvalidNumberOfValues) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnError("[object ParserTest]:1:22: error: unrecoverable syntax error"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList(
+          "outline-width: 0.2em 12px 0.8em 10px 0.2em 5px;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
+TEST_F(ParserTest, ParsesOutlineWidthWithZeroValue) {
+  EXPECT_CALL(
+      parser_observer_,
+      OnWarning("[object ParserTest]:1:16: warning: unsupported value"));
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("outline-width: ;", source_location_);
+
+  EXPECT_FALSE(style->GetPropertyValue(cssom::kOutlineWidthProperty));
+}
+
 TEST_F(ParserTest, ParsesBreakWordOverflowWrap) {
   scoped_refptr<cssom::CSSDeclaredStyleData> style =
       parser_.ParseStyleDeclarationList("overflow-wrap: break-word;",
@@ -8695,5 +8900,41 @@
   EXPECT_FALSE(style_data->GetPropertyValue(cssom::kDisplayProperty));
 }
 
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordAuto) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: auto;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetAuto(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordInherit) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: inherit;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetInherit(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordInitial) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: initial;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetInitial(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
+TEST_F(ParserTest, ParsesPointerEventsWithKeywordNone) {
+  scoped_refptr<cssom::CSSDeclaredStyleData> style =
+      parser_.ParseStyleDeclarationList("pointer-events: none;",
+                                        source_location_);
+
+  EXPECT_EQ(cssom::KeywordValue::GetNone(),
+            style->GetPropertyValue(cssom::kPointerEventsProperty));
+}
+
 }  // namespace css_parser
 }  // namespace cobalt
diff --git a/src/cobalt/css_parser/scanner.cc b/src/cobalt/css_parser/scanner.cc
index 01beaa3..b03a7d8 100644
--- a/src/cobalt/css_parser/scanner.cc
+++ b/src/cobalt/css_parser/scanner.cc
@@ -1367,6 +1367,11 @@
         return true;
       }
       if (IsEqualToCssIdentifier(
+              name.begin, cssom::GetPropertyName(cssom::kOutlineProperty))) {
+        *property_name_token = kOutlineToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
               name.begin, cssom::GetPropertyName(cssom::kPaddingProperty))) {
         *property_name_token = kPaddingToken;
         return true;
@@ -1586,6 +1591,24 @@
       }
       if (IsEqualToCssIdentifier(
               name.begin,
+              cssom::GetPropertyName(cssom::kOutlineColorProperty))) {
+        *property_name_token = kOutlineColorToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
+              cssom::GetPropertyName(cssom::kOutlineStyleProperty))) {
+        *property_name_token = kOutlineStyleToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
+              cssom::GetPropertyName(cssom::kOutlineWidthProperty))) {
+        *property_name_token = kOutlineWidthToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
               cssom::GetPropertyName(cssom::kOverflowWrapProperty))) {
         *property_name_token = kOverflowWrapToken;
         return true;
@@ -1625,6 +1648,12 @@
       }
       if (IsEqualToCssIdentifier(
               name.begin,
+              cssom::GetPropertyName(cssom::kPointerEventsProperty))) {
+        *property_name_token = kPointerEventsToken;
+        return true;
+      }
+      if (IsEqualToCssIdentifier(
+              name.begin,
               cssom::GetPropertyName(cssom::kTextTransformProperty))) {
         *property_name_token = kTextTransformToken;
         return true;
diff --git a/src/cobalt/cssom/animation_set.cc b/src/cobalt/cssom/animation_set.cc
index 7c999e7..ae3ab51 100644
--- a/src/cobalt/cssom/animation_set.cc
+++ b/src/cobalt/cssom/animation_set.cc
@@ -204,5 +204,12 @@
   return animations_modified;
 }
 
+void AnimationSet::Clear() {
+  for (auto& animation : animations_) {
+    event_handler_->OnAnimationRemoved(animation.second);
+  }
+  animations_.clear();
+}
+
 }  // namespace cssom
 }  // namespace cobalt
diff --git a/src/cobalt/cssom/animation_set.h b/src/cobalt/cssom/animation_set.h
index 73c4718..ce98688 100644
--- a/src/cobalt/cssom/animation_set.h
+++ b/src/cobalt/cssom/animation_set.h
@@ -51,6 +51,12 @@
               const CSSComputedStyleData& style,
               const CSSKeyframesRule::NameMap& keyframes_map);
 
+  // Returns true if there are no animations in this set.
+  bool empty() const { return animations_.empty(); }
+
+  // Clears all animations out of this animation set.
+  void Clear();
+
  private:
   // Our internal collection of animations, mapping 'animation-name' to
   // a Animation object.
diff --git a/src/cobalt/cssom/computed_style.cc b/src/cobalt/cssom/computed_style.cc
index 8cccfe5..c26d8e1 100644
--- a/src/cobalt/cssom/computed_style.cc
+++ b/src/cobalt/cssom/computed_style.cc
@@ -2590,11 +2590,12 @@
 
   // Helper function to return the computed border style for an edge based on
   // border width properties.
-  PropertyValue* GetBorderStyleBasedOnWidth(PropertyKey key);
+  PropertyValue* GetBorderOrOutlineStyleBasedOnWidth(PropertyKey key);
   PropertyValue* GetBorderBottomStyle();
   PropertyValue* GetBorderLeftStyle();
   PropertyValue* GetBorderRightStyle();
   PropertyValue* GetBorderTopStyle();
+  PropertyValue* GetOutlineStyle();
 
   // Helper function to return the computed color.
   RGBAColorValue* GetColor();
@@ -2625,6 +2626,7 @@
   scoped_refptr<PropertyValue> computed_border_top_style_;
   scoped_refptr<PropertyValue> computed_color_;
   scoped_refptr<PropertyValue> computed_font_size_;
+  scoped_refptr<PropertyValue> computed_outline_style_;
   scoped_refptr<PropertyValue> computed_position_;
 };
 
@@ -2671,7 +2673,8 @@
   return viewport_size_;
 }
 
-PropertyValue* CalculateComputedStyleContext::GetBorderStyleBasedOnWidth(
+PropertyValue*
+CalculateComputedStyleContext::GetBorderOrOutlineStyleBasedOnWidth(
     PropertyKey key) {
   if (key == kBorderBottomWidthProperty) {
     return GetBorderBottomStyle();
@@ -2679,9 +2682,11 @@
     return GetBorderLeftStyle();
   } else if (key == kBorderRightWidthProperty) {
     return GetBorderRightStyle();
-  } else {
-    DCHECK_EQ(key, kBorderTopWidthProperty);
+  } else if (key == kBorderTopWidthProperty) {
     return GetBorderTopStyle();
+  } else {
+    DCHECK_EQ(key, kOutlineWidthProperty);
+    return GetOutlineStyle();
   }
 }
 
@@ -2730,6 +2735,15 @@
   return base::polymorphic_downcast<RGBAColorValue*>(computed_color_.get());
 }
 
+PropertyValue* CalculateComputedStyleContext::GetOutlineStyle() {
+  if (!computed_outline_style_) {
+    ComputeValue(kOutlineStyleProperty);
+  }
+
+  DCHECK(computed_outline_style_);
+  return computed_outline_style_.get();
+}
+
 void CalculateComputedStyleContext::ComputeValue(PropertyKey key) {
   if (cascaded_style_->IsDeclared(key)) {
     scoped_refptr<PropertyValue>& cascaded_value =
@@ -2779,6 +2793,7 @@
     case kBorderLeftColorProperty:
     case kBorderRightColorProperty:
     case kBorderTopColorProperty:
+    case kOutlineColorProperty:
     case kTextDecorationColorProperty: {
       if (*value == KeywordValue::GetCurrentColor()) {
         // The computed value of the 'currentColor' keyword is the computed
@@ -2789,10 +2804,11 @@
     case kBorderBottomWidthProperty:
     case kBorderLeftWidthProperty:
     case kBorderRightWidthProperty:
-    case kBorderTopWidthProperty: {
+    case kBorderTopWidthProperty:
+    case kOutlineWidthProperty: {
       ComputedBorderWidthProvider border_width_provider(
           GetFontSize(), GetRootFontSize(), GetViewportSizeOnePercent(),
-          GetBorderStyleBasedOnWidth(key));
+          GetBorderOrOutlineStyleBasedOnWidth(key));
       (*value)->Accept(&border_width_provider);
       *value = border_width_provider.computed_border_width();
     } break;
@@ -2969,8 +2985,10 @@
     case kFontFamilyProperty:
     case kFontStyleProperty:
     case kOpacityProperty:
+    case kOutlineStyleProperty:
     case kOverflowProperty:
     case kOverflowWrapProperty:
+    case kPointerEventsProperty:
     case kPositionProperty:
     case kTextAlignProperty:
     case kTextDecorationLineProperty:
@@ -3001,6 +3019,7 @@
     case kBorderWidthProperty:
     case kFontProperty:
     case kMarginProperty:
+    case kOutlineProperty:
     case kPaddingProperty:
     case kSrcProperty:
     case kTextDecorationProperty:
@@ -3036,6 +3055,9 @@
     case kColorProperty:
       computed_color_ = value;
       break;
+    case kOutlineStyleProperty:
+      computed_outline_style_ = value;
+      break;
 
     case kAllProperty:
     case kAnimationDelayProperty:
@@ -3092,6 +3114,9 @@
     case kMinWidthProperty:
     case kNoneProperty:
     case kOpacityProperty:
+    case kOutlineProperty:
+    case kOutlineColorProperty:
+    case kOutlineWidthProperty:
     case kOverflowProperty:
     case kOverflowWrapProperty:
     case kPaddingBottomProperty:
@@ -3099,6 +3124,7 @@
     case kPaddingProperty:
     case kPaddingRightProperty:
     case kPaddingTopProperty:
+    case kPointerEventsProperty:
     case kRightProperty:
     case kSrcProperty:
     case kTextAlignProperty:
diff --git a/src/cobalt/cssom/computed_style_test.cc b/src/cobalt/cssom/computed_style_test.cc
index 85eb3b3..26e0064 100644
--- a/src/cobalt/cssom/computed_style_test.cc
+++ b/src/cobalt/cssom/computed_style_test.cc
@@ -1105,6 +1105,69 @@
   EXPECT_EQ(KeywordValue::GetNone(), computed_style->box_shadow());
 }
 
+TEST(PromoteToComputedStyle, OutlineColorWithCurrentColorValue) {
+  scoped_refptr<CSSComputedStyleData> computed_style(
+      new CSSComputedStyleData());
+  computed_style->set_outline_color(KeywordValue::GetCurrentColor());
+  computed_style->set_color(RGBAColorValue::GetAqua());
+
+  scoped_refptr<CSSComputedStyleData> parent_computed_style(
+      new CSSComputedStyleData());
+  scoped_refptr<CSSComputedStyleDeclaration> parent_computed_style_declaration(
+      CreateComputedStyleDeclaration(parent_computed_style));
+
+  PromoteToComputedStyle(computed_style, parent_computed_style_declaration,
+                         parent_computed_style, math::Size(), NULL);
+
+  scoped_refptr<RGBAColorValue> outline_color =
+      dynamic_cast<RGBAColorValue*>(computed_style->outline_color().get());
+  ASSERT_TRUE(outline_color);
+  EXPECT_EQ(0x00FFFFFF, outline_color->value());
+}
+
+TEST(PromoteToComputedStyle, OutlineWidthWithOutlineStyleNone) {
+  scoped_refptr<CSSComputedStyleData> computed_style(
+      new CSSComputedStyleData());
+  computed_style->set_outline_style(KeywordValue::GetNone());
+  computed_style->set_outline_width(new LengthValue(2, kFontSizesAkaEmUnit));
+
+  scoped_refptr<CSSComputedStyleData> parent_computed_style(
+      new CSSComputedStyleData());
+  scoped_refptr<CSSComputedStyleDeclaration> parent_computed_style_declaration(
+      CreateComputedStyleDeclaration(parent_computed_style));
+
+  PromoteToComputedStyle(computed_style, parent_computed_style_declaration,
+                         parent_computed_style, math::Size(), NULL);
+
+  scoped_refptr<LengthValue> outline_width =
+      dynamic_cast<LengthValue*>(computed_style->outline_width().get());
+  ASSERT_TRUE(outline_width);
+  EXPECT_EQ(0, outline_width->value());
+  EXPECT_EQ(kPixelsUnit, outline_width->unit());
+}
+
+TEST(PromoteToComputedStyle, OutlineWidthInEmShouldBeComputedAfterFontSize) {
+  scoped_refptr<CSSComputedStyleData> computed_style(
+      new CSSComputedStyleData());
+  computed_style->set_outline_style(KeywordValue::GetSolid());
+  computed_style->set_font_size(new LengthValue(2, kFontSizesAkaEmUnit));
+  computed_style->set_outline_width(new LengthValue(2, kFontSizesAkaEmUnit));
+
+  scoped_refptr<CSSComputedStyleData> parent_computed_style(
+      new CSSComputedStyleData());
+  parent_computed_style->set_font_size(new LengthValue(100, kPixelsUnit));
+  scoped_refptr<CSSComputedStyleDeclaration> parent_computed_style_declaration(
+      CreateComputedStyleDeclaration(parent_computed_style));
+
+  PromoteToComputedStyle(computed_style, parent_computed_style_declaration,
+                         parent_computed_style, math::Size(), NULL);
+
+  scoped_refptr<LengthValue> outline_width =
+      dynamic_cast<LengthValue*>(computed_style->outline_width().get());
+  EXPECT_EQ(400, outline_width->value());
+  EXPECT_EQ(kPixelsUnit, outline_width->unit());
+}
+
 TEST(PromoteToComputedStyle, TextDecorationWithCurrentColor) {
   scoped_refptr<CSSComputedStyleData> computed_style(
       new CSSComputedStyleData());
diff --git a/src/cobalt/cssom/css_computed_style_data.cc b/src/cobalt/cssom/css_computed_style_data.cc
index bdd7115..e0d75a2 100644
--- a/src/cobalt/cssom/css_computed_style_data.cc
+++ b/src/cobalt/cssom/css_computed_style_data.cc
@@ -122,6 +122,7 @@
     case kBorderRightColorProperty:
     case kBorderBottomColorProperty:
     case kBorderLeftColorProperty:
+    case kOutlineColorProperty:
     case kTextDecorationColorProperty:
       // Note that border color and text decoration color are not inherited.
       // The initial value of border color is 'currentColor' which means the
@@ -133,6 +134,7 @@
     case kBorderRightWidthProperty:
     case kBorderBottomWidthProperty:
     case kBorderLeftWidthProperty:
+    case kOutlineWidthProperty:
       // If the border style is 'none' or 'hidden', border width would be 0.
       //   https://www.w3.org/TR/css3-background/#border-width
       if (IsBorderStyleNoneOrHiddenForAnEdge(key)) {
@@ -202,6 +204,8 @@
     case kMinWidthProperty:
     case kNoneProperty:
     case kOpacityProperty:
+    case kOutlineProperty:
+    case kOutlineStyleProperty:
     case kOverflowProperty:
     case kOverflowWrapProperty:
     case kPaddingBottomProperty:
@@ -209,6 +213,7 @@
     case kPaddingProperty:
     case kPaddingRightProperty:
     case kPaddingTopProperty:
+    case kPointerEventsProperty:
     case kPositionProperty:
     case kRightProperty:
     case kSrcProperty:
@@ -243,15 +248,23 @@
 bool CSSComputedStyleData::IsBorderStyleNoneOrHiddenForAnEdge(
     PropertyKey key) const {
   scoped_refptr<PropertyValue> border_style;
-  if (key == kBorderTopWidthProperty) {
-    border_style = border_top_style();
-  } else if (key == kBorderRightWidthProperty) {
-    border_style = border_right_style();
-  } else if (key == kBorderBottomWidthProperty) {
-    border_style = border_bottom_style();
-  } else {
-    DCHECK_EQ(key, kBorderLeftWidthProperty);
-    border_style = border_left_style();
+  switch (key) {
+    case kBorderTopWidthProperty:
+      border_style = border_top_style();
+      break;
+    case kBorderRightWidthProperty:
+      border_style = border_right_style();
+      break;
+    case kBorderBottomWidthProperty:
+      border_style = border_bottom_style();
+      break;
+    case kBorderLeftWidthProperty:
+      border_style = border_left_style();
+      break;
+    default:
+      DCHECK_EQ(key, kOutlineWidthProperty);
+      border_style = outline_style();
+      break;
   }
 
   if (border_style == KeywordValue::GetNone() ||
diff --git a/src/cobalt/cssom/css_computed_style_data.h b/src/cobalt/cssom/css_computed_style_data.h
index 2f86d8f..ab2c0fc 100644
--- a/src/cobalt/cssom/css_computed_style_data.h
+++ b/src/cobalt/cssom/css_computed_style_data.h
@@ -443,6 +443,27 @@
     SetPropertyValue(kOpacityProperty, opacity);
   }
 
+  const scoped_refptr<PropertyValue>& outline_color() const {
+    return GetPropertyValueReference(kOutlineColorProperty);
+  }
+  void set_outline_color(const scoped_refptr<PropertyValue>& outline_color) {
+    SetPropertyValue(kOutlineColorProperty, outline_color);
+  }
+
+  const scoped_refptr<PropertyValue>& outline_style() const {
+    return GetPropertyValueReference(kOutlineStyleProperty);
+  }
+  void set_outline_style(const scoped_refptr<PropertyValue>& outline_style) {
+    SetPropertyValue(kOutlineStyleProperty, outline_style);
+  }
+
+  const scoped_refptr<PropertyValue>& outline_width() const {
+    return GetPropertyValueReference(kOutlineWidthProperty);
+  }
+  void set_outline_width(const scoped_refptr<PropertyValue>& outline_width) {
+    SetPropertyValue(kOutlineWidthProperty, outline_width);
+  }
+
   const scoped_refptr<PropertyValue>& overflow() const {
     return GetPropertyValueReference(kOverflowProperty);
   }
@@ -485,6 +506,13 @@
     SetPropertyValue(kPaddingTopProperty, padding_top);
   }
 
+  const scoped_refptr<PropertyValue>& pointer_events() const {
+    return GetPropertyValueReference(kPointerEventsProperty);
+  }
+  void set_pointer_events(const scoped_refptr<PropertyValue>& pointer_events) {
+    SetPropertyValue(kPointerEventsProperty, pointer_events);
+  }
+
   const scoped_refptr<PropertyValue>& position() const {
     return GetPropertyValueReference(kPositionProperty);