diff --git a/AUTHORS b/AUTHORS
index fe88fc6..66cbb059 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -767,6 +767,7 @@
 Volker Sorge <volker.sorge@gmail.com>
 Waihung Fu <fufranci@amazon.com>
 Wanchang Ryu <wanchang.ryu@lge.com>
+Wang Qing <wangqing-hf@loongson.cn>
 Wesley Lancel <wesleylancel@gmail.com>
 Wesley Wigham <t-weswig@microsoft.com>
 Wesley Wigham <wwigham@gmail.com>
diff --git a/DEPS b/DEPS
index 1312429..6dd7b8c4 100644
--- a/DEPS
+++ b/DEPS
@@ -96,7 +96,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling catapult
   # and whatever else without interference from each other.
-  'catapult_revision': 'e4d806cd4821f1e82d11d9ca1b1e1f500e503c11',
+  'catapult_revision': 'dac0038997b8387868c9e30268bb786d1676c1c9',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
index 9e2aa4c..9325b7a 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -558,13 +558,14 @@
 
                     /**
                      * Starts Safe Browsing initialization. This should only be called once.
-                     * @param context is the activity context the WebView will be used in.
+                     * @param context is the application context the WebView will be used in.
                      * @param callback will be called with the value true if initialization is
                      * successful. The callback will be run on the UI thread.
                      */
                     // TODO(ntfschr): add @Override once next android SDK rolls
                     public void initSafeBrowsing(Context context, ValueCallback<Boolean> callback) {
-                        AwContentsStatics.initSafeBrowsing(context, callback);
+                        AwContentsStatics.initSafeBrowsing(
+                                context.getApplicationContext(), callback);
                     }
 
                     /**
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 3eb20471..2782cad 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1343,7 +1343,7 @@
   cflags = []
   if (is_clang) {
     cflags += [ "-Wno-incompatible-pointer-types" ]
-  } else if (current_cpu == "mipsel") {
+  } else if (current_cpu == "mipsel" || current_cpu == "mips64el") {
     cflags += [ "-w" ]
   } else if (is_chromeos && current_cpu == "arm") {
     cflags += [ "-w" ]
diff --git a/build/config/features.gni b/build/config/features.gni
index 5323602..5095e4c 100644
--- a/build/config/features.gni
+++ b/build/config/features.gni
@@ -25,10 +25,11 @@
   # Temporarily disable nacl on arm64 linux to get rid of compilation errors.
   # TODO(mcgrathr): When mipsel-nacl-clang is available, drop the exclusion.
   enable_nacl = !is_ios && !is_android && !is_fuchsia && !is_chromecast &&
-                current_cpu != "mipsel" && !(is_linux && target_cpu == "arm64")
+                current_cpu != "mipsel" && current_cpu != "mips64el" &&
+                !(is_linux && target_cpu == "arm64")
 
   # Non-SFI is not yet supported on mipsel
-  enable_nacl_nonsfi = current_cpu != "mipsel"
+  enable_nacl_nonsfi = (current_cpu != "mipsel" && current_cpu != "mips64el")
 
   # Enables proprietary codecs and demuxers; e.g. H264, AAC, MP3, and MP4.
   # We always build Google Chrome and Chromecast with proprietary codecs.
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn
index 73e65db..4d00a9f 100644
--- a/build/config/gcc/BUILD.gn
+++ b/build/config/gcc/BUILD.gn
@@ -109,7 +109,7 @@
     if (is_component_build || using_sanitizer) {
       configs = [ ":rpath_for_built_shared_libraries" ]
     }
-    if (current_cpu == "mipsel") {
+    if (current_cpu == "mipsel" || current_cpu == "mips64el") {
       ldflags += [ "-pie" ]
     }
   }
diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn
index f099019..217a0a6 100644
--- a/build/toolchain/linux/BUILD.gn
+++ b/build/toolchain/linux/BUILD.gn
@@ -170,6 +170,14 @@
   }
 }
 
+clang_toolchain("clang_mips64el") {
+  toolchain_args = {
+    current_cpu = "mips64el"
+    current_os = "linux"
+  }
+}
+
+
 gcc_toolchain("mipsel") {
   cc = "mipsel-linux-gnu-gcc"
   cxx = "mipsel-linux-gnu-g++"
@@ -187,6 +195,24 @@
   }
 }
 
+gcc_toolchain("mips64el") {
+  cc = "gcc"
+  cxx = "g++"
+  ar = "ar"
+  ld = cxx
+  readelf = "readelf"
+  nm = "nm"
+
+  toolchain_args = {
+    cc_wrapper = ""
+    current_cpu = "mips64el"
+    current_os = "linux"
+    is_clang = false
+    use_goma = false
+  }
+}
+
+
 gcc_toolchain("s390x") {
   cc = "gcc"
   cxx = "g++"
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
index 066298f..c08c8c41 100644
--- a/build_overrides/build.gni
+++ b/build_overrides/build.gni
@@ -6,7 +6,12 @@
 # as stand-alone projects. If this is ever not the case, these variables
 # can be removed.
 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=5453.
-mac_sdk_min_build_override = "10.10"
+_sdk_min_from_env = getenv("FORCE_MAC_SDK_MIN")
+if (_sdk_min_from_env == "") {
+  mac_sdk_min_build_override = "10.10"
+} else {
+  mac_sdk_min_build_override = _sdk_min_from_env
+}
 
 # Variable that can be used to support multiple build scenarios, like having
 # Chromium specific targets in a client project's GN file etc.
diff --git a/cc/ipc/BUILD.gn b/cc/ipc/BUILD.gn
index c5f2406..67c496e 100644
--- a/cc/ipc/BUILD.gn
+++ b/cc/ipc/BUILD.gn
@@ -21,6 +21,7 @@
   public_deps = [
     "//cc",
     "//cc/surfaces",
+    "//components/viz/common",
     "//skia",
   ]
 
diff --git a/cc/ipc/cc_param_traits.cc b/cc/ipc/cc_param_traits.cc
index 33e2f02f..e0fa899 100644
--- a/cc/ipc/cc_param_traits.cc
+++ b/cc/ipc/cc_param_traits.cc
@@ -720,22 +720,23 @@
   l->append(")");
 }
 
-void ParamTraits<cc::SurfaceInfo>::GetSize(base::PickleSizer* s,
-                                           const param_type& p) {
+void ParamTraits<viz::SurfaceInfo>::GetSize(base::PickleSizer* s,
+                                            const param_type& p) {
   GetParamSize(s, p.id());
   GetParamSize(s, p.device_scale_factor());
   GetParamSize(s, p.size_in_pixels());
 }
 
-void ParamTraits<cc::SurfaceInfo>::Write(base::Pickle* m, const param_type& p) {
+void ParamTraits<viz::SurfaceInfo>::Write(base::Pickle* m,
+                                          const param_type& p) {
   WriteParam(m, p.id());
   WriteParam(m, p.device_scale_factor());
   WriteParam(m, p.size_in_pixels());
 }
 
-bool ParamTraits<cc::SurfaceInfo>::Read(const base::Pickle* m,
-                                        base::PickleIterator* iter,
-                                        param_type* p) {
+bool ParamTraits<viz::SurfaceInfo>::Read(const base::Pickle* m,
+                                         base::PickleIterator* iter,
+                                         param_type* p) {
   viz::SurfaceId surface_id;
   if (!ReadParam(m, iter, &surface_id))
     return false;
@@ -748,12 +749,12 @@
   if (!ReadParam(m, iter, &size_in_pixels))
     return false;
 
-  *p = cc::SurfaceInfo(surface_id, device_scale_factor, size_in_pixels);
+  *p = viz::SurfaceInfo(surface_id, device_scale_factor, size_in_pixels);
   return p->is_valid();
 }
 
-void ParamTraits<cc::SurfaceInfo>::Log(const param_type& p, std::string* l) {
-  l->append("SurfaceInfo(");
+void ParamTraits<viz::SurfaceInfo>::Log(const param_type& p, std::string* l) {
+  l->append("viz::SurfaceInfo(");
   LogParam(p.id(), l);
   l->append(", ");
   LogParam(p.device_scale_factor(), l);
diff --git a/cc/ipc/cc_param_traits.h b/cc/ipc/cc_param_traits.h
index a1fb5f7..ba145268 100644
--- a/cc/ipc/cc_param_traits.h
+++ b/cc/ipc/cc_param_traits.h
@@ -100,8 +100,8 @@
 };
 
 template <>
-struct CC_IPC_EXPORT ParamTraits<cc::SurfaceInfo> {
-  typedef cc::SurfaceInfo param_type;
+struct CC_IPC_EXPORT ParamTraits<viz::SurfaceInfo> {
+  typedef viz::SurfaceInfo param_type;
   static void GetSize(base::PickleSizer* s, const param_type& p);
   static void Write(base::Pickle* m, const param_type& p);
   static bool Read(const base::Pickle* m,
diff --git a/cc/ipc/cc_param_traits_macros.h b/cc/ipc/cc_param_traits_macros.h
index 17326d73..659543fd 100644
--- a/cc/ipc/cc_param_traits_macros.h
+++ b/cc/ipc/cc_param_traits_macros.h
@@ -20,10 +20,10 @@
 #include "cc/quads/yuv_video_draw_quad.h"
 #include "cc/resources/returned_resource.h"
 #include "cc/resources/transferable_resource.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_sequence.h"
 #include "components/viz/common/quads/resource_format.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "ui/gfx/ipc/color/gfx_param_traits.h"
 #include "ui/gfx/ipc/gfx_param_traits.h"
 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
diff --git a/cc/ipc/cc_param_traits_unittest.cc b/cc/ipc/cc_param_traits_unittest.cc
index 8d003a9..895bf02 100644
--- a/cc/ipc/cc_param_traits_unittest.cc
+++ b/cc/ipc/cc_param_traits_unittest.cc
@@ -646,14 +646,14 @@
       viz::LocalSurfaceId(3, base::UnguessableToken::Create()));
   constexpr float kArbitraryDeviceScaleFactor = 0.9f;
   const gfx::Size kArbitrarySize(65, 321);
-  const cc::SurfaceInfo surface_info_in(
+  const viz::SurfaceInfo surface_info_in(
       kArbitrarySurfaceId, kArbitraryDeviceScaleFactor, kArbitrarySize);
-  IPC::ParamTraits<cc::SurfaceInfo>::Write(&msg, surface_info_in);
+  IPC::ParamTraits<viz::SurfaceInfo>::Write(&msg, surface_info_in);
 
-  cc::SurfaceInfo surface_info_out;
+  viz::SurfaceInfo surface_info_out;
   base::PickleIterator iter(msg);
   EXPECT_TRUE(
-      IPC::ParamTraits<cc::SurfaceInfo>::Read(&msg, &iter, &surface_info_out));
+      IPC::ParamTraits<viz::SurfaceInfo>::Read(&msg, &iter, &surface_info_out));
 
   ASSERT_EQ(surface_info_in, surface_info_out);
 }
diff --git a/cc/ipc/surface_info.typemap b/cc/ipc/surface_info.typemap
index 348a28e..87fd3b8 100644
--- a/cc/ipc/surface_info.typemap
+++ b/cc/ipc/surface_info.typemap
@@ -3,6 +3,9 @@
 # found in the LICENSE file.
 
 mojom = "//cc/ipc/surface_info.mojom"
-public_headers = [ "//cc/surfaces/surface_info.h" ]
+public_headers = [ "//components/viz/common/surfaces/surface_info.h" ]
 traits_headers = [ "//cc/ipc/surface_info_struct_traits.h" ]
-type_mappings = [ "cc.mojom.SurfaceInfo=cc::SurfaceInfo" ]
+deps = [
+  "//components/viz/common",
+]
+type_mappings = [ "cc.mojom.SurfaceInfo=viz::SurfaceInfo" ]
diff --git a/cc/ipc/surface_info_struct_traits.h b/cc/ipc/surface_info_struct_traits.h
index 13a2ae6..b326f392 100644
--- a/cc/ipc/surface_info_struct_traits.h
+++ b/cc/ipc/surface_info_struct_traits.h
@@ -6,25 +6,26 @@
 #define CC_IPC_SURFACE_INFO_STRUCT_TRAITS_H_
 
 #include "cc/ipc/surface_info.mojom-shared.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 namespace mojo {
 
 template <>
-struct StructTraits<cc::mojom::SurfaceInfoDataView, cc::SurfaceInfo> {
-  static const viz::SurfaceId& surface_id(const cc::SurfaceInfo& surface_info) {
+struct StructTraits<cc::mojom::SurfaceInfoDataView, viz::SurfaceInfo> {
+  static const viz::SurfaceId& surface_id(
+      const viz::SurfaceInfo& surface_info) {
     return surface_info.id();
   }
 
-  static float device_scale_factor(const cc::SurfaceInfo& surface_info) {
+  static float device_scale_factor(const viz::SurfaceInfo& surface_info) {
     return surface_info.device_scale_factor();
   }
 
-  static const gfx::Size& size_in_pixels(const cc::SurfaceInfo& surface_info) {
+  static const gfx::Size& size_in_pixels(const viz::SurfaceInfo& surface_info) {
     return surface_info.size_in_pixels();
   }
 
-  static bool Read(cc::mojom::SurfaceInfoDataView data, cc::SurfaceInfo* out) {
+  static bool Read(cc::mojom::SurfaceInfoDataView data, viz::SurfaceInfo* out) {
     out->device_scale_factor_ = data.device_scale_factor();
     return data.ReadSurfaceId(&out->id_) &&
            data.ReadSizeInPixels(&out->size_in_pixels_) && out->is_valid();
diff --git a/cc/layers/surface_layer.cc b/cc/layers/surface_layer.cc
index deeaf47..506b3396 100644
--- a/cc/layers/surface_layer.cc
+++ b/cc/layers/surface_layer.cc
@@ -63,13 +63,14 @@
   DCHECK(!layer_tree_host());
 }
 
-void SurfaceLayer::SetPrimarySurfaceInfo(const SurfaceInfo& surface_info) {
+void SurfaceLayer::SetPrimarySurfaceInfo(const viz::SurfaceInfo& surface_info) {
   primary_surface_info_ = surface_info;
   UpdateDrawsContent(HasDrawableContent());
   SetNeedsCommit();
 }
 
-void SurfaceLayer::SetFallbackSurfaceInfo(const SurfaceInfo& surface_info) {
+void SurfaceLayer::SetFallbackSurfaceInfo(
+    const viz::SurfaceInfo& surface_info) {
   RemoveReference(std::move(fallback_reference_returner_));
   if (layer_tree_host())
     layer_tree_host()->RemoveSurfaceLayerId(fallback_surface_info_.id());
diff --git a/cc/layers/surface_layer.h b/cc/layers/surface_layer.h
index d6d3f21..565b712 100644
--- a/cc/layers/surface_layer.h
+++ b/cc/layers/surface_layer.h
@@ -8,8 +8,8 @@
 #include "base/macros.h"
 #include "cc/cc_export.h"
 #include "cc/layers/layer.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_reference_factory.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "ui/gfx/geometry/size.h"
 
 namespace cc {
@@ -21,8 +21,8 @@
   static scoped_refptr<SurfaceLayer> Create(
       scoped_refptr<SurfaceReferenceFactory> ref_factory);
 
-  void SetPrimarySurfaceInfo(const SurfaceInfo& surface_info);
-  void SetFallbackSurfaceInfo(const SurfaceInfo& surface_info);
+  void SetPrimarySurfaceInfo(const viz::SurfaceInfo& surface_info);
+  void SetFallbackSurfaceInfo(const viz::SurfaceInfo& surface_info);
 
   // When stretch_content_to_fill_bounds is true, the scale of the embedded
   // surface is ignored and the content will be stretched to fill the bounds.
@@ -37,11 +37,11 @@
     return ref_factory_;
   }
 
-  const SurfaceInfo& primary_surface_info() const {
+  const viz::SurfaceInfo& primary_surface_info() const {
     return primary_surface_info_;
   }
 
-  const SurfaceInfo& fallback_surface_info() const {
+  const viz::SurfaceInfo& fallback_surface_info() const {
     return fallback_surface_info_;
   }
 
@@ -53,8 +53,8 @@
   ~SurfaceLayer() override;
   void RemoveReference(base::Closure reference_returner);
 
-  SurfaceInfo primary_surface_info_;
-  SurfaceInfo fallback_surface_info_;
+  viz::SurfaceInfo primary_surface_info_;
+  viz::SurfaceInfo fallback_surface_info_;
   base::Closure fallback_reference_returner_;
 
   scoped_refptr<SurfaceReferenceFactory> ref_factory_;
diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc
index 8b23db0..cf007556 100644
--- a/cc/layers/surface_layer_impl.cc
+++ b/cc/layers/surface_layer_impl.cc
@@ -26,7 +26,8 @@
   return SurfaceLayerImpl::Create(tree_impl, id());
 }
 
-void SurfaceLayerImpl::SetPrimarySurfaceInfo(const SurfaceInfo& surface_info) {
+void SurfaceLayerImpl::SetPrimarySurfaceInfo(
+    const viz::SurfaceInfo& surface_info) {
   if (primary_surface_info_ == surface_info)
     return;
 
@@ -34,7 +35,8 @@
   NoteLayerPropertyChanged();
 }
 
-void SurfaceLayerImpl::SetFallbackSurfaceInfo(const SurfaceInfo& surface_info) {
+void SurfaceLayerImpl::SetFallbackSurfaceInfo(
+    const viz::SurfaceInfo& surface_info) {
   if (fallback_surface_info_ == surface_info)
     return;
 
@@ -91,7 +93,7 @@
 SurfaceDrawQuad* SurfaceLayerImpl::CreateSurfaceDrawQuad(
     RenderPass* render_pass,
     SurfaceDrawQuadType surface_draw_quad_type,
-    const SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     SharedQuadState** common_shared_quad_state) {
   DCHECK(surface_info.is_valid());
 
diff --git a/cc/layers/surface_layer_impl.h b/cc/layers/surface_layer_impl.h
index e331a77..afb4ac3e 100644
--- a/cc/layers/surface_layer_impl.h
+++ b/cc/layers/surface_layer_impl.h
@@ -12,8 +12,8 @@
 #include "cc/cc_export.h"
 #include "cc/layers/layer_impl.h"
 #include "cc/quads/surface_draw_quad.h"
-#include "cc/surfaces/surface_info.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 namespace cc {
 
@@ -25,8 +25,8 @@
   }
   ~SurfaceLayerImpl() override;
 
-  void SetPrimarySurfaceInfo(const SurfaceInfo& surface_info);
-  const SurfaceInfo& primary_surface_info() const {
+  void SetPrimarySurfaceInfo(const viz::SurfaceInfo& surface_info);
+  const viz::SurfaceInfo& primary_surface_info() const {
     return primary_surface_info_;
   }
 
@@ -35,8 +35,8 @@
   // compositor will use the fallback if the primary surface is unavailable
   // at the time of surface aggregation. If surface synchronization is not
   // enabled, then a fallback surface will not be specified.
-  void SetFallbackSurfaceInfo(const SurfaceInfo& surface_info);
-  const SurfaceInfo& fallback_surface_info() const {
+  void SetFallbackSurfaceInfo(const viz::SurfaceInfo& surface_info);
+  const viz::SurfaceInfo& fallback_surface_info() const {
     return fallback_surface_info_;
   }
 
@@ -55,7 +55,7 @@
   SurfaceDrawQuad* CreateSurfaceDrawQuad(
       RenderPass* render_pass,
       SurfaceDrawQuadType surface_draw_quad_type,
-      const SurfaceInfo& surface_info,
+      const viz::SurfaceInfo& surface_info,
       SharedQuadState** common_shared_quad_state);
 
   void GetDebugBorderProperties(SkColor* color, float* width) const override;
@@ -63,8 +63,8 @@
   void AsValueInto(base::trace_event::TracedValue* dict) const override;
   const char* LayerTypeAsString() const override;
 
-  SurfaceInfo primary_surface_info_;
-  SurfaceInfo fallback_surface_info_;
+  viz::SurfaceInfo primary_surface_info_;
+  viz::SurfaceInfo fallback_surface_info_;
 
   bool stretch_content_to_fill_bounds_ = false;
 
diff --git a/cc/layers/surface_layer_impl_unittest.cc b/cc/layers/surface_layer_impl_unittest.cc
index 58c4661..b257af8 100644
--- a/cc/layers/surface_layer_impl_unittest.cc
+++ b/cc/layers/surface_layer_impl_unittest.cc
@@ -38,7 +38,7 @@
   surface_layer_impl->SetDrawsContent(true);
   viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId);
   surface_layer_impl->SetPrimarySurfaceInfo(
-      SurfaceInfo(surface_id, device_scale_factor, scaled_surface_size));
+      viz::SurfaceInfo(surface_id, device_scale_factor, scaled_surface_size));
 
   RenderSurfaceList render_surface_list;
   LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -104,7 +104,7 @@
   surface_layer_impl->SetDrawsContent(true);
   viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId);
   surface_layer_impl->SetPrimarySurfaceInfo(
-      SurfaceInfo(surface_id, 1.f, layer_size));
+      viz::SurfaceInfo(surface_id, 1.f, layer_size));
 
   impl.CalcDrawProps(viewport_size);
 
@@ -166,9 +166,9 @@
   viz::SurfaceId surface_id(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId);
   viz::SurfaceId surface_id2(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId2);
   surface_layer_impl->SetPrimarySurfaceInfo(
-      SurfaceInfo(surface_id, surface_scale, surface_size));
+      viz::SurfaceInfo(surface_id, surface_scale, surface_size));
   surface_layer_impl->SetFallbackSurfaceInfo(
-      SurfaceInfo(surface_id2, surface_scale, surface_size));
+      viz::SurfaceInfo(surface_id2, surface_scale, surface_size));
   surface_layer_impl->SetStretchContentToFillBounds(true);
 
   impl.CalcDrawProps(viewport_size);
@@ -208,29 +208,31 @@
 }
 
 // This test verifies that two SurfaceDrawQuads are emitted if a
-// SurfaceLayerImpl holds both a primary and fallback SurfaceInfo.
+// SurfaceLayerImpl holds both a primary and fallback viz::SurfaceInfo.
 TEST(SurfaceLayerImplTest, SurfaceLayerImplEmitsTwoDrawQuadsIfUniqueFallback) {
   LayerTestCommon::LayerImplTest impl;
   SurfaceLayerImpl* surface_layer_impl =
       impl.AddChildToRoot<SurfaceLayerImpl>();
 
-  // Populate the primary SurfaceInfo.
+  // Populate the primary viz::SurfaceInfo.
   const viz::LocalSurfaceId kArbitraryLocalSurfaceId1(
       9, base::UnguessableToken::Create());
   viz::SurfaceId surface_id1(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId1);
   float surface_scale1 = 1.f;
   gfx::Size surface_size1(300, 300);
-  SurfaceInfo primary_surface_info(surface_id1, surface_scale1, surface_size1);
+  viz::SurfaceInfo primary_surface_info(surface_id1, surface_scale1,
+                                        surface_size1);
 
-  // Populate the fallback SurfaceInfo.
+  // Populate the fallback viz::SurfaceInfo.
   const viz::LocalSurfaceId kArbitraryLocalSurfaceId2(
       7, base::UnguessableToken::Create());
   viz::SurfaceId surface_id2(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId2);
   float surface_scale2 = 2.f;
   gfx::Size surface_size2(400, 400);
-  SurfaceInfo fallback_surface_info(surface_id2, surface_scale2, surface_size2);
-  SurfaceInfo fallback_surface_info2(surface_id2, surface_scale1,
-                                     surface_size2);
+  viz::SurfaceInfo fallback_surface_info(surface_id2, surface_scale2,
+                                         surface_size2);
+  viz::SurfaceInfo fallback_surface_info2(surface_id2, surface_scale1,
+                                          surface_size2);
 
   gfx::Size layer_size(400, 100);
 
@@ -248,29 +250,32 @@
   {
     AppendQuadsData data;
     surface_layer_impl->AppendQuads(render_pass.get(), &data);
-    // The the primary SurfaceInfo will be added to activation_dependencies.
-    EXPECT_THAT(data.activation_dependencies,
-                UnorderedElementsAre(surface_id1));
-  }
-
-  // Update the fallback to an invalid SurfaceInfo. The
-  // |activation_dependencies| should still contain the primary SurfaceInfo.
-  {
-    AppendQuadsData data;
-    surface_layer_impl->SetFallbackSurfaceInfo(SurfaceInfo());
-    surface_layer_impl->AppendQuads(render_pass.get(), &data);
-    // The primary SurfaceInfo should not be added to
+    // The the primary viz::SurfaceInfo will be added to
     // activation_dependencies.
     EXPECT_THAT(data.activation_dependencies,
                 UnorderedElementsAre(surface_id1));
   }
 
-  // Update the fallback SurfaceInfo and re-emit DrawQuads.
+  // Update the fallback to an invalid viz::SurfaceInfo. The
+  // |activation_dependencies| should still contain the primary
+  // viz::SurfaceInfo.
+  {
+    AppendQuadsData data;
+    surface_layer_impl->SetFallbackSurfaceInfo(viz::SurfaceInfo());
+    surface_layer_impl->AppendQuads(render_pass.get(), &data);
+    // The primary viz::SurfaceInfo should not be added to
+    // activation_dependencies.
+    EXPECT_THAT(data.activation_dependencies,
+                UnorderedElementsAre(surface_id1));
+  }
+
+  // Update the fallback viz::SurfaceInfo and re-emit DrawQuads.
   {
     AppendQuadsData data;
     surface_layer_impl->SetFallbackSurfaceInfo(fallback_surface_info2);
     surface_layer_impl->AppendQuads(render_pass.get(), &data);
-    // The the primary SurfaceInfo will be added to activation_dependencies.
+    // The the primary viz::SurfaceInfo will be added to
+    // activation_dependencies.
     EXPECT_THAT(data.activation_dependencies,
                 UnorderedElementsAre(surface_id1));
   }
@@ -324,20 +329,21 @@
 
 // This test verifies that one SurfaceDrawQuad is emitted if a
 // SurfaceLayerImpl holds the same surface ID for both the primary
-// and fallback SurfaceInfo.
+// and fallback viz::SurfaceInfo.
 TEST(SurfaceLayerImplTest,
      SurfaceLayerImplEmitsOneDrawQuadsIfPrimaryMatchesFallback) {
   LayerTestCommon::LayerImplTest impl;
   SurfaceLayerImpl* surface_layer_impl =
       impl.AddChildToRoot<SurfaceLayerImpl>();
 
-  // Populate the primary SurfaceInfo.
+  // Populate the primary viz::SurfaceInfo.
   const viz::LocalSurfaceId kArbitraryLocalSurfaceId1(
       9, base::UnguessableToken::Create());
   viz::SurfaceId surface_id1(kArbitraryFrameSinkId, kArbitraryLocalSurfaceId1);
   float surface_scale1 = 1.f;
   gfx::Size surface_size1(300, 300);
-  SurfaceInfo primary_surface_info(surface_id1, surface_scale1, surface_size1);
+  viz::SurfaceInfo primary_surface_info(surface_id1, surface_scale1,
+                                        surface_size1);
 
   gfx::Size layer_size(400, 100);
 
diff --git a/cc/layers/surface_layer_unittest.cc b/cc/layers/surface_layer_unittest.cc
index 9422c9f..6e0d408 100644
--- a/cc/layers/surface_layer_unittest.cc
+++ b/cc/layers/surface_layer_unittest.cc
@@ -17,7 +17,6 @@
 #include "cc/layers/surface_layer_impl.h"
 #include "cc/output/compositor_frame.h"
 #include "cc/surfaces/sequence_surface_reference_factory.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/test/fake_impl_task_runner_provider.h"
 #include "cc/test/fake_layer_tree_host.h"
 #include "cc/test/fake_layer_tree_host_client.h"
@@ -26,6 +25,7 @@
 #include "cc/test/layer_tree_test.h"
 #include "cc/test/test_task_graph_runner.h"
 #include "cc/trees/layer_tree_host.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -96,7 +96,7 @@
 TEST_F(SurfaceLayerTest, MultipleFramesOneSurface) {
   const base::UnguessableToken kArbitraryToken =
       base::UnguessableToken::Create();
-  const SurfaceInfo info(
+  const viz::SurfaceInfo info(
       viz::SurfaceId(kArbitraryFrameSinkId,
                      viz::LocalSurfaceId(1, kArbitraryToken)),
       1.f, gfx::Size(1, 1));
@@ -155,7 +155,7 @@
   testing::Mock::VerifyAndClearExpectations(ref_factory.get());
 }
 
-// This test verifies that the primary and fallback SurfaceInfo are pushed
+// This test verifies that the primary and fallback viz::SurfaceInfo are pushed
 // across from SurfaceLayer to SurfaceLayerImpl.
 TEST_F(SurfaceLayerTest, SurfaceInfoPushProperties) {
   // We use a nice mock here because we are not really interested in calls to
@@ -165,7 +165,7 @@
 
   scoped_refptr<SurfaceLayer> layer = SurfaceLayer::Create(ref_factory);
   layer_tree_host_->SetRootLayer(layer);
-  SurfaceInfo primary_info(
+  viz::SurfaceInfo primary_info(
       viz::SurfaceId(kArbitraryFrameSinkId,
                      viz::LocalSurfaceId(1, base::UnguessableToken::Create())),
       1.f, gfx::Size(1, 1));
@@ -195,7 +195,7 @@
   EXPECT_EQ(primary_info, layer_impl->primary_surface_info());
   EXPECT_EQ(primary_info, layer_impl->fallback_surface_info());
 
-  SurfaceInfo fallback_info(
+  viz::SurfaceInfo fallback_info(
       viz::SurfaceId(kArbitraryFrameSinkId,
                      viz::LocalSurfaceId(2, base::UnguessableToken::Create())),
       2.f, gfx::Size(10, 10));
@@ -210,8 +210,8 @@
 
   EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u);
 
-  // Verify that the primary SurfaceInfo stays the same and the new fallback
-  // SurfaceInfo is pushed through.
+  // Verify that the primary viz::SurfaceInfo stays the same and the new
+  // fallback viz::SurfaceInfo is pushed through.
   EXPECT_EQ(primary_info, layer_impl->primary_surface_info());
   EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info());
 }
@@ -228,7 +228,7 @@
   const viz::SurfaceId old_surface_id(
       kArbitraryFrameSinkId,
       viz::LocalSurfaceId(1, base::UnguessableToken::Create()));
-  const SurfaceInfo old_surface_info(old_surface_id, 1.f, gfx::Size(1, 1));
+  const viz::SurfaceInfo old_surface_info(old_surface_id, 1.f, gfx::Size(1, 1));
 
   // This layer will always contain the old surface id and will be deleted when
   // animation is done.
@@ -259,7 +259,7 @@
   const viz::SurfaceId new_surface_id(
       kArbitraryFrameSinkId,
       viz::LocalSurfaceId(2, base::UnguessableToken::Create()));
-  const SurfaceInfo new_surface_info(new_surface_id, 1.f, gfx::Size(2, 2));
+  const viz::SurfaceInfo new_surface_info(new_surface_id, 1.f, gfx::Size(2, 2));
 
   // Switch the new layer to use |new_surface_id|.
   layer2->SetPrimarySurfaceInfo(new_surface_info);
@@ -295,7 +295,7 @@
   scoped_refptr<SurfaceReferenceFactory> ref_factory =
       new testing::NiceMock<MockSurfaceReferenceFactory>();
 
-  const SurfaceInfo surface_info(
+  const viz::SurfaceInfo surface_info(
       viz::SurfaceId(kArbitraryFrameSinkId,
                      viz::LocalSurfaceId(1, base::UnguessableToken::Create())),
       1.f, gfx::Size(1, 1));
@@ -365,9 +365,10 @@
     EXPECT_CALL(*ref_factory_, SatisfySequence(_)).Times(0);
     EXPECT_CALL(*ref_factory_, RequireSequence(_, _)).Times(0);
     layer_ = SurfaceLayer::Create(ref_factory_);
-    SurfaceInfo info(viz::SurfaceId(kArbitraryFrameSinkId,
-                                    viz::LocalSurfaceId(1, kArbitraryToken)),
-                     1.f, gfx::Size(1, 1));
+    viz::SurfaceInfo info(
+        viz::SurfaceId(kArbitraryFrameSinkId,
+                       viz::LocalSurfaceId(1, kArbitraryToken)),
+        1.f, gfx::Size(1, 1));
     layer_->SetPrimarySurfaceInfo(info);
     layer_->SetFallbackSurfaceInfo(info);
     testing::Mock::VerifyAndClearExpectations(ref_factory_.get());
diff --git a/cc/surfaces/BUILD.gn b/cc/surfaces/BUILD.gn
index 3636bbe..6e6b7ce 100644
--- a/cc/surfaces/BUILD.gn
+++ b/cc/surfaces/BUILD.gn
@@ -6,7 +6,6 @@
 
 cc_source_set("surface_id") {
   sources = [
-    "surface_info.h",
     "surface_reference.cc",
     "surface_reference.h",
     "surface_reference_factory.h",
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index e599478..5cf26f3e 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -24,7 +24,7 @@
 constexpr int kFrameIndexStart = 2;
 }  // namespace
 
-Surface::Surface(const SurfaceInfo& surface_info,
+Surface::Surface(const viz::SurfaceInfo& surface_info,
                  SurfaceManager* surface_manager,
                  base::WeakPtr<SurfaceClient> surface_client,
                  BeginFrameSource* begin_frame_source,
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h
index 3ad6835..4bfd8a0 100644
--- a/cc/surfaces/surface.h
+++ b/cc/surfaces/surface.h
@@ -21,10 +21,10 @@
 #include "cc/output/compositor_frame.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/surfaces/surface_dependency_deadline.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_sequence.h"
 #include "cc/surfaces/surfaces_export.h"
 #include "components/viz/common/surfaces/frame_sink_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "ui/gfx/geometry/size.h"
 
 namespace ui {
@@ -43,7 +43,7 @@
       base::RepeatingCallback<void(const viz::LocalSurfaceId&,
                                    const gfx::Rect&)>;
 
-  Surface(const SurfaceInfo& surface_info,
+  Surface(const viz::SurfaceInfo& surface_info,
           SurfaceManager* surface_manager,
           base::WeakPtr<SurfaceClient> surface_client,
           BeginFrameSource* begin_frame_source,
@@ -204,7 +204,7 @@
       CompositorFrame* frame,
       std::vector<ui::LatencyInfo>* latency_info);
 
-  SurfaceInfo surface_info_;
+  viz::SurfaceInfo surface_info_;
   viz::SurfaceId previous_frame_surface_id_;
   SurfaceManager* const surface_manager_;
   base::WeakPtr<SurfaceClient> surface_client_;
diff --git a/cc/surfaces/surface_dependency_tracker.cc b/cc/surfaces/surface_dependency_tracker.cc
index 12545ce6..4de28b0e 100644
--- a/cc/surfaces/surface_dependency_tracker.cc
+++ b/cc/surfaces/surface_dependency_tracker.cc
@@ -5,8 +5,8 @@
 #include "cc/surfaces/surface_dependency_tracker.h"
 
 #include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_manager.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 namespace cc {
 
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc
index c1d2a72..ee007a04 100644
--- a/cc/surfaces/surface_manager.cc
+++ b/cc/surfaces/surface_manager.cc
@@ -16,8 +16,8 @@
 #include "cc/surfaces/stub_surface_reference_factory.h"
 #include "cc/surfaces/surface.h"
 #include "cc/surfaces/surface_client.h"
-#include "cc/surfaces/surface_info.h"
 #include "components/viz/common/surfaces/local_surface_id_allocator.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 #if DCHECK_IS_ON()
 #include <sstream>
@@ -71,7 +71,7 @@
 
 Surface* SurfaceManager::CreateSurface(
     base::WeakPtr<SurfaceClient> surface_client,
-    const SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     BeginFrameSource* begin_frame_source,
     bool needs_sync_tokens) {
   DCHECK(thread_checker_.CalledOnValidThread());
@@ -430,7 +430,7 @@
   return changed;
 }
 
-void SurfaceManager::SurfaceCreated(const SurfaceInfo& surface_info) {
+void SurfaceManager::SurfaceCreated(const viz::SurfaceInfo& surface_info) {
   CHECK(thread_checker_.CalledOnValidThread());
 
   if (lifetime_type_ == LifetimeType::REFERENCES) {
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index f0acbcc5..75034fd 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -66,7 +66,7 @@
   // destroyed when DestroySurface is called, all of its destruction
   // dependencies are satisfied, and it is not reachable from the root surface.
   Surface* CreateSurface(base::WeakPtr<SurfaceClient> surface_client,
-                         const SurfaceInfo& surface_info,
+                         const viz::SurfaceInfo& surface_info,
                          BeginFrameSource* begin_frame_source,
                          bool needs_sync_tokens);
 
@@ -95,7 +95,7 @@
 
   // Called when a CompositorFrame is submitted to a SurfaceClient
   // for a given |surface_id| for the first time.
-  void SurfaceCreated(const SurfaceInfo& surface_info);
+  void SurfaceCreated(const viz::SurfaceInfo& surface_info);
 
   // Called when a CompositorFrame within |surface| has activated.
   void SurfaceActivated(Surface* surface);
diff --git a/cc/surfaces/surface_observer.h b/cc/surfaces/surface_observer.h
index 388e2b0..83d975b 100644
--- a/cc/surfaces/surface_observer.h
+++ b/cc/surfaces/surface_observer.h
@@ -7,19 +7,19 @@
 
 namespace viz {
 class SurfaceId;
+class SurfaceInfo;
 }
 
 namespace cc {
 
 struct BeginFrameAck;
 struct BeginFrameArgs;
-class SurfaceInfo;
 
 class SurfaceObserver {
  public:
   // Runs when a CompositorFrame is activated for the given SurfaceInfo for the
   // first time.
-  virtual void OnSurfaceCreated(const SurfaceInfo& surface_info) = 0;
+  virtual void OnSurfaceCreated(const viz::SurfaceInfo& surface_info) = 0;
 
   // Runs when a Surface was marked to be destroyed.
   virtual void OnSurfaceDestroyed(const viz::SurfaceId& surface_id) = 0;
diff --git a/cc/test/fake_surface_observer.cc b/cc/test/fake_surface_observer.cc
index 6408037..e34a9d78 100644
--- a/cc/test/fake_surface_observer.cc
+++ b/cc/test/fake_surface_observer.cc
@@ -15,7 +15,7 @@
   last_ack_ = BeginFrameAck();
   damaged_surfaces_.clear();
   will_draw_surfaces_.clear();
-  last_surface_info_ = SurfaceInfo();
+  last_surface_info_ = viz::SurfaceInfo();
   last_created_surface_id_ = viz::SurfaceId();
 }
 
@@ -41,7 +41,8 @@
   will_draw_surfaces_.insert(surface_id);
 }
 
-void FakeSurfaceObserver::OnSurfaceCreated(const SurfaceInfo& surface_info) {
+void FakeSurfaceObserver::OnSurfaceCreated(
+    const viz::SurfaceInfo& surface_info) {
   last_created_surface_id_ = surface_info.id();
   last_surface_info_ = surface_info;
 }
diff --git a/cc/test/fake_surface_observer.h b/cc/test/fake_surface_observer.h
index 157a282ff..011f018 100644
--- a/cc/test/fake_surface_observer.h
+++ b/cc/test/fake_surface_observer.h
@@ -7,9 +7,9 @@
 
 #include "base/containers/flat_set.h"
 #include "cc/output/begin_frame_args.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_observer.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 namespace cc {
 
@@ -30,7 +30,9 @@
     return last_created_surface_id_;
   }
 
-  const SurfaceInfo& last_surface_info() const { return last_surface_info_; }
+  const viz::SurfaceInfo& last_surface_info() const {
+    return last_surface_info_;
+  }
 
   void Reset();
 
@@ -38,7 +40,7 @@
   // SurfaceObserver implementation:
   bool OnSurfaceDamaged(const viz::SurfaceId& surface_id,
                         const BeginFrameAck& ack) override;
-  void OnSurfaceCreated(const SurfaceInfo& surface_info) override;
+  void OnSurfaceCreated(const viz::SurfaceInfo& surface_info) override;
   void OnSurfaceDiscarded(const viz::SurfaceId& surface_id) override {}
   void OnSurfaceDestroyed(const viz::SurfaceId& surface_id) override {}
   void OnSurfaceDamageExpected(const viz::SurfaceId& surface_id,
@@ -50,7 +52,7 @@
   base::flat_set<viz::SurfaceId> damaged_surfaces_;
   base::flat_set<viz::SurfaceId> will_draw_surfaces_;
   viz::SurfaceId last_created_surface_id_;
-  SurfaceInfo last_surface_info_;
+  viz::SurfaceInfo last_surface_info_;
 };
 
 }  // namespace cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 61fba83..3b30806 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3553,11 +3553,11 @@
     child->SetBounds(gfx::Size(1, 1));
     child->SetDrawsContent(true);
     child->SetPrimarySurfaceInfo(
-        SurfaceInfo(primary_surfaces[i], 1.f /* device_scale_factor */,
-                    gfx::Size(10, 10) /* size_in_pixels */));
+        viz::SurfaceInfo(primary_surfaces[i], 1.f /* device_scale_factor */,
+                         gfx::Size(10, 10) /* size_in_pixels */));
     child->SetFallbackSurfaceInfo(
-        SurfaceInfo(fallback_surfaces[i], 1.f /* device_scale_factor */,
-                    gfx::Size(10, 10) /* size_in_pixels */));
+        viz::SurfaceInfo(fallback_surfaces[i], 1.f /* device_scale_factor */,
+                         gfx::Size(10, 10) /* size_in_pixels */));
     root->test_properties()->AddChild(std::move(child));
   }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
index 6d995d7c..bea73b8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
@@ -133,13 +133,6 @@
         Intent intent = new Intent(
                 Intent.ACTION_VIEW, Uri.parse(asyncParams.getLoadUrlParams().getUrl()));
 
-        ComponentName componentName = asyncParams.getComponentName();
-        if (componentName == null) {
-            intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncherActivity.class);
-        } else {
-            intent.setComponent(componentName);
-        }
-
         addAsyncTabExtras(asyncParams, parentId, isChromeUI, assignedTabId, intent);
 
         return intent;
@@ -147,6 +140,13 @@
 
     protected final void addAsyncTabExtras(AsyncTabCreationParams asyncParams, int parentId,
             boolean isChromeUI, int assignedTabId, Intent intent) {
+        ComponentName componentName = asyncParams.getComponentName();
+        if (componentName == null) {
+            intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncherActivity.class);
+        } else {
+            intent.setComponent(componentName);
+        }
+
         Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExtraHeaders();
         if (extraHeaders != null && !extraHeaders.isEmpty()) {
             Bundle bundle = new Bundle();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
index 278044d..9dc5153 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -657,7 +657,7 @@
 
     @Override
     protected TabDelegate createTabDelegate(boolean incognito) {
-        return new WebappTabDelegate(this, incognito);
+        return new WebappTabDelegate(incognito);
     }
 
     // We're temporarily disable CS on webapp since there are some issues. (http://crbug.com/471950)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
index e3e1e9e9..e2831bc 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappTabDelegate.java
@@ -3,9 +3,12 @@
 // found in the LICENSE file.
 package org.chromium.chrome.browser.webapps;
 
+import android.content.Intent;
 import android.net.Uri;
 import android.support.customtabs.CustomTabsIntent;
 
+import org.chromium.chrome.browser.IntentHandler;
+import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
 import org.chromium.chrome.browser.tab.Tab;
 import org.chromium.chrome.browser.tab.TabIdManager;
 import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
@@ -20,11 +23,8 @@
  * {@code _blank} links and {@code window.open(url)} calls instead of creating a new tab in Chrome.
  */
 public class WebappTabDelegate extends TabDelegate {
-    private final WebappActivity mActivity;
-
-    public WebappTabDelegate(WebappActivity activity, boolean incognito) {
+    public WebappTabDelegate(boolean incognito) {
         super(incognito);
-        this.mActivity = activity;
     }
 
     @Override
@@ -32,11 +32,12 @@
         int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
         AsyncTabParamsManager.add(assignedTabId, asyncParams);
 
-        CustomTabsIntent customTabIntent =
-                new CustomTabsIntent.Builder().setShowTitle(true).build();
+        Intent intent = new CustomTabsIntent.Builder().setShowTitle(true).build().intent;
+        intent.setData(Uri.parse(asyncParams.getLoadUrlParams().getUrl()));
+        intent.putExtra(CustomTabIntentDataProvider.EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, true);
+        intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME, true);
+        addAsyncTabExtras(asyncParams, parentId, false /* isChromeUI */, assignedTabId, intent);
 
-        customTabIntent.intent.setPackage(mActivity.getPackageName());
-        addAsyncTabExtras(asyncParams, parentId, true, assignedTabId, customTabIntent.intent);
-        customTabIntent.launchUrl(mActivity, Uri.parse(asyncParams.getLoadUrlParams().getUrl()));
+        IntentHandler.startActivityForTrustedIntent(intent);
     }
 }
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
index ef139210..eac34d4 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -1686,7 +1686,6 @@
   "javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogTest.java",
   "javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenManagerTest.java",
   "javatests/src/org/chromium/chrome/browser/webapps/TestFetchStorageCallback.java",
-  "javatests/src/org/chromium/chrome/browser/webapps/TopActivityListener.java",
   "javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateDataFetcherTest.java",
   "javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java",
   "javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestRule.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/TopActivityListener.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/TopActivityListener.java
deleted file mode 100644
index e746f7ef..0000000
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/TopActivityListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.webapps;
-
-import android.app.Activity;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import org.chromium.base.ActivityState;
-import org.chromium.base.ApplicationStatus;
-import org.chromium.base.ApplicationStatus.ActivityStateListener;
-import org.chromium.content.browser.test.util.Criteria;
-import org.chromium.content.browser.test.util.CriteriaHelper;
-
-import javax.annotation.Nullable;
-
-/**
- * Test rule tracking which Chrome activity is currently at the top of the task.
- */
-public class TopActivityListener implements TestRule {
-    private final ActivityStateListener mListener = new ActivityStateListener() {
-        @Override
-        public void onActivityStateChange(Activity activity, int newState) {
-            if (newState == ActivityState.RESUMED) {
-                mMostRecentActivity = activity;
-            }
-        }
-    };
-
-    private Activity mMostRecentActivity;
-
-    @Override
-    public Statement apply(final Statement base, Description description) {
-        return new Statement() {
-            @Override
-            public void evaluate() throws Throwable {
-                ApplicationStatus.registerStateListenerForAllActivities(mListener);
-                base.evaluate();
-                ApplicationStatus.unregisterActivityStateListener(mListener);
-            }
-        };
-    }
-
-    @Nullable
-    public Activity getMostRecentActivity() {
-        return mMostRecentActivity;
-    }
-
-    @SuppressWarnings("unchecked")
-    public <T extends Activity> T waitFor(final Class<T> expectedActivityClass) {
-        CriteriaHelper.pollUiThread(new Criteria() {
-            @Override
-            public boolean isSatisfied() {
-                return mMostRecentActivity != null
-                        && expectedActivityClass.isAssignableFrom(mMostRecentActivity.getClass());
-            }
-        });
-        return (T) mMostRecentActivity;
-    }
-}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java
index 99595a3..17d4ccd 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java
@@ -4,6 +4,7 @@
 
 package org.chromium.chrome.browser.webapps;
 
+import android.app.Activity;
 import android.content.Intent;
 import android.support.test.InstrumentationRegistry;
 import android.support.test.filters.LargeTest;
@@ -15,11 +16,11 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import org.chromium.base.ApplicationStatus;
 import org.chromium.base.metrics.RecordHistogram;
 import org.chromium.base.test.util.CommandLineFlags;
 import org.chromium.base.test.util.Feature;
 import org.chromium.base.test.util.ScalableTimeout;
-import org.chromium.chrome.browser.ChromeActivity;
 import org.chromium.chrome.browser.ChromeSwitches;
 import org.chromium.chrome.browser.DeferredStartupHandler;
 import org.chromium.chrome.browser.ShortcutHelper;
@@ -45,9 +46,6 @@
     @Rule
     public final NativeLibraryTestRule mNativeLibraryTestRule = new NativeLibraryTestRule();
 
-    @Rule
-    public final TopActivityListener activityListener = new TopActivityListener();
-
     private static final long STARTUP_TIMEOUT = ScalableTimeout.scaleTimeout(10000);
 
     private EmbeddedTestServer mTestServer;
@@ -126,11 +124,14 @@
         CriteriaHelper.pollUiThread(new Criteria() {
             @Override
             public boolean isSatisfied() {
-                ChromeActivity activity = (ChromeActivity) activityListener.getMostRecentActivity();
-                return activity instanceof CustomTabActivity
-                        && activity.getActivityTab() != null
+                Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
+                if (!(activity instanceof CustomTabActivity)) {
+                    return false;
+                }
+                CustomTabActivity customTab = (CustomTabActivity) activity;
+                return customTab.getActivityTab() != null
                         // Dropping the TLD as Google can redirect to a local site.
-                        && activity.getActivityTab().getUrl().startsWith("https://www.google.");
+                        && customTab.getActivityTab().getUrl().startsWith("https://www.google.");
             }
         });
     }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java
index e7e96e3..a8ee4c76e 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappNavigationTest.java
@@ -4,6 +4,11 @@
 
 package org.chromium.chrome.browser.webapps;
 
+import static org.chromium.base.ApplicationState.HAS_DESTROYED_ACTIVITIES;
+import static org.chromium.base.ApplicationState.HAS_PAUSED_ACTIVITIES;
+import static org.chromium.base.ApplicationState.HAS_STOPPED_ACTIVITIES;
+
+import android.app.Activity;
 import android.content.Intent;
 import android.graphics.Color;
 import android.support.test.InstrumentationRegistry;
@@ -17,26 +22,36 @@
 import org.junit.runner.RunWith;
 
 import org.chromium.base.ApiCompatibilityUtils;
+import org.chromium.base.ApplicationStatus;
+import org.chromium.base.ThreadUtils;
 import org.chromium.base.test.util.CommandLineFlags;
 import org.chromium.base.test.util.Feature;
 import org.chromium.chrome.R;
+import org.chromium.chrome.browser.ChromeActivity;
 import org.chromium.chrome.browser.ChromeSwitches;
 import org.chromium.chrome.browser.ChromeTabbedActivity;
 import org.chromium.chrome.browser.ShortcutHelper;
 import org.chromium.chrome.browser.customtabs.CustomTabActivity;
+import org.chromium.chrome.browser.externalnav.ExternalNavigationHandler.OverrideUrlLoadingResult;
 import org.chromium.chrome.browser.firstrun.FirstRunStatus;
+import org.chromium.chrome.browser.tab.InterceptNavigationDelegateImpl;
 import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
 import org.chromium.chrome.test.util.browser.contextmenu.ContextMenuUtils;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
 import org.chromium.content.browser.test.util.DOMUtils;
 import org.chromium.net.test.EmbeddedTestServer;
 import org.chromium.ui.base.PageTransition;
 
+import java.util.concurrent.Callable;
+
 /**
  * Tests web navigations originating from a WebappActivity.
  */
 @RunWith(ChromeJUnit4ClassRunner.class)
 @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE})
 public class WebappNavigationTest {
+    private static final String YOUTUBE_URL = "https://www.youtube.com/watch?v=EYmjoW4vIX8";
     private static final String OFF_ORIGIN_URL = "https://www.google.com/";
     private static final String WEB_APP_PATH = "/chrome/test/data/banners/manifest_test_page.html";
     private static final String IN_SCOPE_PAGE_PATH =
@@ -45,9 +60,6 @@
     @Rule
     public final WebappActivityTestRule mActivityTestRule = new WebappActivityTestRule();
 
-    @Rule
-    public final TopActivityListener activityListener = new TopActivityListener();
-
     private EmbeddedTestServer mTestServer;
 
     @Before
@@ -120,7 +132,7 @@
         addAnchor("testId", mTestServer.getURL(IN_SCOPE_PAGE_PATH), "_blank");
         DOMUtils.clickNode(
                 mActivityTestRule.getActivity().getActivityTab().getContentViewCore(), "testId");
-        CustomTabActivity customTab = activityListener.waitFor(CustomTabActivity.class);
+        CustomTabActivity customTab = waitFor(CustomTabActivity.class);
         mActivityTestRule.waitUntilIdle(customTab);
         Assert.assertTrue(
                 mActivityTestRule.runJavaScriptCodeInCurrentTab("document.body.textContent")
@@ -169,7 +181,7 @@
                 otherPageUrl, mActivityTestRule.getActivity().getActivityTab().getUrl());
 
         Assert.assertSame(
-                mActivityTestRule.getActivity(), activityListener.getMostRecentActivity());
+                mActivityTestRule.getActivity(), ApplicationStatus.getLastTrackedFocusedActivity());
     }
 
     @Test
@@ -187,13 +199,52 @@
                 mActivityTestRule.getActivity().getActivityTab(), "myTestAnchorId",
                 R.id.menu_id_open_in_chrome);
 
-        ChromeTabbedActivity tabbedChrome = activityListener.waitFor(ChromeTabbedActivity.class);
+        ChromeTabbedActivity tabbedChrome = waitFor(ChromeTabbedActivity.class);
 
         mActivityTestRule.waitUntilIdle(tabbedChrome);
         // Dropping the TLD as Google can redirect to a local site, so this could fail outside US.
         Assert.assertTrue(tabbedChrome.getActivityTab().getUrl().startsWith("https://www.google."));
     }
 
+    @Test
+    @SmallTest
+    @Feature({"Webapps"})
+    public void testRegularLinkToExternalApp() throws Exception {
+        runWebappActivityAndWaitForIdle(mActivityTestRule.createIntent());
+
+        InterceptNavigationDelegateImpl navigationDelegate =
+                mActivityTestRule.getActivity().getActivityTab().getInterceptNavigationDelegate();
+
+        addAnchor("testLink", YOUTUBE_URL, "_self");
+        DOMUtils.clickNode(
+                mActivityTestRule.getActivity().getActivityTab().getContentViewCore(), "testLink");
+
+        waitForExternalAppOrIntentPicker();
+        Assert.assertEquals(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT,
+                navigationDelegate.getLastOverrideUrlLoadingResultForTests());
+    }
+
+    @Test
+    @SmallTest
+    @Feature({"Webapps"})
+    public void testNewTabLinkToExternalApp() throws Exception {
+        runWebappActivityAndWaitForIdle(mActivityTestRule.createIntent());
+
+        addAnchor("testLink", YOUTUBE_URL, "_blank");
+        DOMUtils.clickNode(
+                mActivityTestRule.getActivity().getActivityTab().getContentViewCore(), "testLink");
+
+        // For _blank anchors, we open the CustomTab which does the redirecting if necessary.
+        CustomTabActivity customTab = waitFor(CustomTabActivity.class);
+
+        waitForExternalAppOrIntentPicker();
+
+        InterceptNavigationDelegateImpl navigationDelegate =
+                customTab.getActivityTab().getInterceptNavigationDelegate();
+        Assert.assertEquals(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT,
+                navigationDelegate.getLastOverrideUrlLoadingResultForTests());
+    }
+
     private void runWebappActivityAndWaitForIdle(Intent intent) throws Exception {
         mActivityTestRule.startWebappActivity(
                 intent.putExtra(ShortcutHelper.EXTRA_URL, mTestServer.getURL(WEB_APP_PATH)));
@@ -203,7 +254,7 @@
     }
 
     private CustomTabActivity assertCustomTabActivityLaunchedForOffOriginUrl() {
-        CustomTabActivity customTab = activityListener.waitFor(CustomTabActivity.class);
+        CustomTabActivity customTab = waitFor(CustomTabActivity.class);
 
         mActivityTestRule.waitUntilIdle(customTab);
         // Dropping the TLD as Google can redirect to a local site, so this could fail outside US.
@@ -222,4 +273,46 @@
                                 + "document.body.appendChild(aTag);",
                         id, url, target));
     }
+
+    @SuppressWarnings("unchecked")
+    private <T extends Activity> T waitFor(final Class<T> expectedClass) {
+        final Activity[] holder = new Activity[1];
+        CriteriaHelper.pollUiThread(new Criteria() {
+            @Override
+            public boolean isSatisfied() {
+                holder[0] = ApplicationStatus.getLastTrackedFocusedActivity();
+                return holder[0] != null && expectedClass.isAssignableFrom(holder[0].getClass());
+            }
+        });
+        return (T) holder[0];
+    }
+
+    private void waitForExternalAppOrIntentPicker() {
+        final Callable<Boolean> callable = new Callable<Boolean>() {
+            @Override
+            public Boolean call() throws Exception {
+                return ApplicationStatus.getStateForApplication() == HAS_PAUSED_ACTIVITIES
+                        || ApplicationStatus.getStateForApplication() == HAS_STOPPED_ACTIVITIES
+                        || ApplicationStatus.getStateForApplication() == HAS_DESTROYED_ACTIVITIES;
+            }
+        };
+        CriteriaHelper.pollInstrumentationThread(new Criteria() {
+            @Override
+            public boolean isSatisfied() {
+                return ThreadUtils.runOnUiThreadBlockingNoException(callable);
+            }
+
+            @Override
+            public String getFailureReason() {
+                Activity lastFocusedActivity = ApplicationStatus.getLastTrackedFocusedActivity();
+                return String.format(
+                        "Application state is: %d, most recent activity is %s and it is on URL %s",
+                        ApplicationStatus.getStateForApplication(),
+                        lastFocusedActivity.getClass().getSimpleName(),
+                        lastFocusedActivity instanceof ChromeActivity
+                                ? ((ChromeActivity) lastFocusedActivity).getActivityTab().getUrl()
+                                : "[not a ChromeActivity]");
+            }
+        }, CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL * 2, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
+    }
 }
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc
index 7da9f3b7..682acf2 100644
--- a/chrome/browser/devtools/devtools_sanity_browsertest.cc
+++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -1638,22 +1638,6 @@
   RunTest("testPauseWhenScriptIsRunning", kPauseWhenScriptIsRunning);
 }
 
-IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestTempFileIncognito) {
-  GURL url("about:blank");
-  ui_test_utils::BrowserAddedObserver window_observer;
-  chrome::NewEmptyWindow(browser()->profile()->GetOffTheRecordProfile());
-  Browser* new_browser = window_observer.WaitForSingleNewBrowser();
-  ui_test_utils::NavigateToURL(new_browser, url);
-  DevToolsWindow* window = DevToolsWindowTesting::OpenDevToolsWindowSync(
-      new_browser->tab_strip_model()->GetWebContentsAt(0), false);
-  RunTestFunction(window, "testTempFile");
-  DevToolsWindowTesting::CloseDevToolsWindowSync(window);
-}
-
-IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestTempFile) {
-  RunTest("testTempFile", kDebuggerTestPage);
-}
-
 // Tests network timing.
 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestNetworkTiming) {
   RunTest("testNetworkTiming", kSlowTestPage);
@@ -2082,8 +2066,3 @@
   DevToolsWindowTesting::CloseDevToolsWindowSync(window);
   content::WebUIControllerFactory::UnregisterFactoryForTesting(&test_factory);
 }
-
-// Tests scripts panel showing.
-IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestDevToolsSharedWorker) {
-  RunTest("testDevToolsSharedWorker", url::kAboutBlankURL);
-}
diff --git a/chrome/browser/media/webrtc/media_stream_device_permission_context_unittest.cc b/chrome/browser/media/webrtc/media_stream_device_permission_context_unittest.cc
index 5c8682c..6a22aa6 100644
--- a/chrome/browser/media/webrtc/media_stream_device_permission_context_unittest.cc
+++ b/chrome/browser/media/webrtc/media_stream_device_permission_context_unittest.cc
@@ -164,3 +164,17 @@
 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraSecureQueryingUrl) {
   TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
 }
+
+// An embedding origin of about:blank should not be blocked. crbug.com/740540.
+TEST_F(MediaStreamDevicePermissionContextTests, TestAboutBlankNotBlocked) {
+  TestPermissionContext permission_context(
+      profile(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
+  GURL secure_url("https://www.example.com");
+
+  EXPECT_EQ(
+      CONTENT_SETTING_ASK,
+      permission_context
+          .GetPermissionStatus(nullptr /* render_frame_host */, secure_url,
+                               GURL("about:blank").GetOrigin())
+          .content_setting);
+}
diff --git a/chrome/browser/permissions/permission_context_base.cc b/chrome/browser/permissions/permission_context_base.cc
index 8210831..d4dfb8c 100644
--- a/chrome/browser/permissions/permission_context_base.cc
+++ b/chrome/browser/permissions/permission_context_base.cc
@@ -230,21 +230,20 @@
   }
 
   if (IsRestrictedToSecureOrigins()) {
+    // TODO(raymes): The secure origin check here in the browser should match
+    // what we do in blink (i.e. what is described in the secure context spec).
+    // Right now, we can't even check IsOriginSecure(embedding_origin) because
+    // the |embedding_origin| is obtained from the WebContents which does match
+    // the origin of the document in blink in all cases. For example, an
+    // about:blank URL may be a secure context in blink, but it is not treated
+    // as such in the browser at present. The |requesting_origin| is passed from
+    // blink and so is accurate under normal circumstances but may be forged by
+    // a compromised renderer so even this check below is not particularly
+    // secure...
     if (!content::IsOriginSecure(requesting_origin)) {
       return PermissionResult(CONTENT_SETTING_BLOCK,
                               PermissionStatusSource::UNSPECIFIED);
     }
-
-    // TODO(raymes): We should check the entire chain of embedders here whenever
-    // possible as this corresponds to the requirements of the secure contexts
-    // spec and matches what is implemented in blink. Right now we just check
-    // the top level and requesting origins. Note: chrome-extension:// origins
-    // are currently exempt from checking the embedder chain. crbug.com/530507.
-    if (!requesting_origin.SchemeIs(extensions::kExtensionScheme) &&
-        !content::IsOriginSecure(embedding_origin)) {
-      return PermissionResult(CONTENT_SETTING_BLOCK,
-                              PermissionStatusSource::UNSPECIFIED);
-    }
   }
 
   // Check whether the feature is enabled for the frame by feature policy. We
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js
index f3a23a0..cc194f28 100644
--- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js
+++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js
@@ -237,7 +237,7 @@
 
   /** @private */
   onImportantSitesCancelTap_: function() {
-    this.$$('#importantSitesDialog').cancel();
+    /** @type {!CrDialogElement} */ (this.$$('#importantSitesDialog')).cancel();
   },
 
   /**
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/compiled_resources2.gyp b/chrome/browser/resources/settings/clear_browsing_data_dialog/compiled_resources2.gyp
index 1d1c69a..518e48e 100644
--- a/chrome/browser/resources/settings/clear_browsing_data_dialog/compiled_resources2.gyp
+++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/compiled_resources2.gyp
@@ -6,6 +6,7 @@
     {
       'target_name': 'clear_browsing_data_browser_proxy',
       'dependencies': [
+        '<(DEPTH)/ui/webui/resources/cr_elements/cr_dialog/compiled_resources2.gyp:cr_dialog',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
       ],
       'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc b/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc
index 22f5849..a7cada4c 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc
@@ -52,7 +52,7 @@
 // as all fake certificates will contain the same issuer name, it's
 // necessary to ensure the serial number is unique, as otherwise
 // NSS will fail to parse.
-base::StaticAtomicSequenceNumber g_serial_number;
+base::AtomicSequenceNumber g_serial_number;
 
 scoped_refptr<net::X509Certificate> CreateFakeCert() {
   std::unique_ptr<crypto::RSAPrivateKey> unused_key;
diff --git a/chrome/browser/ui/login/login_interstitial_delegate.cc b/chrome/browser/ui/login/login_interstitial_delegate.cc
index fb83fcd5..c33830a 100644
--- a/chrome/browser/ui/login/login_interstitial_delegate.cc
+++ b/chrome/browser/ui/login/login_interstitial_delegate.cc
@@ -55,7 +55,6 @@
   return std::string(
       "<!DOCTYPE html>"
       "<html><body><script>"
-      "window.domAutomationController.setAutomationId(1);"
       "window.domAutomationController.send('1');"
       "</script></body></html>");
 }
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
index c6d37bb..5ff5332f 100644
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -50,7 +50,7 @@
 // as all fake certificates will contain the same issuer name, it's
 // necessary to ensure the serial number is unique, as otherwise
 // NSS will fail to parse.
-base::StaticAtomicSequenceNumber g_serial_number;
+base::AtomicSequenceNumber g_serial_number;
 
 scoped_refptr<net::X509Certificate> CreateFakeCert() {
   std::unique_ptr<crypto::RSAPrivateKey> unused_key;
diff --git a/chrome/common/media_router/issue.cc b/chrome/common/media_router/issue.cc
index 29664f1..7697297 100644
--- a/chrome/common/media_router/issue.cc
+++ b/chrome/common/media_router/issue.cc
@@ -10,7 +10,7 @@
 
 namespace {
 // ID generator for Issue.
-base::StaticAtomicSequenceNumber g_next_issue_id;
+base::AtomicSequenceNumber g_next_issue_id;
 }
 
 IssueInfo::IssueInfo()
diff --git a/chrome/installer/linux/rpm/expected_deps_x86_64 b/chrome/installer/linux/rpm/expected_deps_x86_64
index 4e8ed436..cdb4117 100644
--- a/chrome/installer/linux/rpm/expected_deps_x86_64
+++ b/chrome/installer/linux/rpm/expected_deps_x86_64
@@ -18,6 +18,7 @@
 libc.so.6(GLIBC_2.11)(64bit)
 libc.so.6(GLIBC_2.14)(64bit)
 libc.so.6(GLIBC_2.15)(64bit)
+libc.so.6(GLIBC_2.17)(64bit)
 libc.so.6(GLIBC_2.18)(64bit)
 libc.so.6(GLIBC_2.2.5)(64bit)
 libc.so.6(GLIBC_2.3)(64bit)
diff --git a/components/viz/common/BUILD.gn b/components/viz/common/BUILD.gn
index cdedab7..dc76086 100644
--- a/components/viz/common/BUILD.gn
+++ b/components/viz/common/BUILD.gn
@@ -35,6 +35,7 @@
     "surfaces/local_surface_id_allocator.h",
     "surfaces/surface_id.cc",
     "surfaces/surface_id.h",
+    "surfaces/surface_info.h",
   ]
 
   deps = [
diff --git a/components/viz/common/surfaces/DEPS b/components/viz/common/surfaces/DEPS
index 16764a92..826db9e 100644
--- a/components/viz/common/surfaces/DEPS
+++ b/components/viz/common/surfaces/DEPS
@@ -1,3 +1,4 @@
 include_rules = [
   "+mojo/public/cpp/bindings",
+  "+ui/gfx/geometry",
 ]
diff --git a/cc/surfaces/surface_info.h b/components/viz/common/surfaces/surface_info.h
similarity index 78%
rename from cc/surfaces/surface_info.h
rename to components/viz/common/surfaces/surface_info.h
index 782476f..1e21fda 100644
--- a/cc/surfaces/surface_info.h
+++ b/components/viz/common/surfaces/surface_info.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CC_SURFACES_SURFACE_INFO_H_
-#define CC_SURFACES_SURFACE_INFO_H_
+#ifndef COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_
+#define COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_
 
 #include "components/viz/common/surfaces/surface_id.h"
 #include "ui/gfx/geometry/size.h"
@@ -17,12 +17,15 @@
 namespace mojom {
 class SurfaceInfoDataView;
 }
+}  // namespace cc
+
+namespace viz {
 
 // This class contains information about the surface that is being embedded.
 class SurfaceInfo {
  public:
   SurfaceInfo() = default;
-  SurfaceInfo(const viz::SurfaceId& id,
+  SurfaceInfo(const SurfaceId& id,
               float device_scale_factor,
               const gfx::Size& size_in_pixels)
       : id_(id),
@@ -42,19 +45,19 @@
 
   bool operator!=(const SurfaceInfo& info) const { return !(*this == info); }
 
-  const viz::SurfaceId& id() const { return id_; }
+  const SurfaceId& id() const { return id_; }
   float device_scale_factor() const { return device_scale_factor_; }
   const gfx::Size& size_in_pixels() const { return size_in_pixels_; }
 
  private:
-  friend struct mojo::StructTraits<mojom::SurfaceInfoDataView, SurfaceInfo>;
+  friend struct mojo::StructTraits<cc::mojom::SurfaceInfoDataView, SurfaceInfo>;
   friend struct IPC::ParamTraits<SurfaceInfo>;
 
-  viz::SurfaceId id_;
+  SurfaceId id_;
   float device_scale_factor_ = 1.f;
   gfx::Size size_in_pixels_;
 };
 
-}  // namespace cc
+}  // namespace viz
 
-#endif  // CC_SURFACES_SURFACE_INFO_H_
+#endif  // COMPONENTS_VIZ_COMMON_SURFACES_SURFACE_INFO_H_
diff --git a/components/viz/host/frame_sink_observer.h b/components/viz/host/frame_sink_observer.h
index 4c6de75..eaa0acff 100644
--- a/components/viz/host/frame_sink_observer.h
+++ b/components/viz/host/frame_sink_observer.h
@@ -15,7 +15,7 @@
  public:
   // Runs when a CompositorFrame is received for the given SurfaceInfo for the
   // first time.
-  virtual void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) = 0;
+  virtual void OnSurfaceCreated(const SurfaceInfo& surface_info) = 0;
 
  protected:
   ~FrameSinkObserver() {}
diff --git a/components/viz/host/host_frame_sink_manager.cc b/components/viz/host/host_frame_sink_manager.cc
index 6b73e34..ea1164f 100644
--- a/components/viz/host/host_frame_sink_manager.cc
+++ b/components/viz/host/host_frame_sink_manager.cc
@@ -6,8 +6,8 @@
 
 #include <utility>
 
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_manager.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 namespace viz {
 
@@ -86,8 +86,7 @@
     frame_sink_data_map_.erase(iter);
 }
 
-void HostFrameSinkManager::OnSurfaceCreated(
-    const cc::SurfaceInfo& surface_info) {
+void HostFrameSinkManager::OnSurfaceCreated(const SurfaceInfo& surface_info) {
   for (auto& observer : observers_)
     observer.OnSurfaceCreated(surface_info);
 }
diff --git a/components/viz/host/host_frame_sink_manager.h b/components/viz/host/host_frame_sink_manager.h
index 95a38cd8..256b097a 100644
--- a/components/viz/host/host_frame_sink_manager.h
+++ b/components/viz/host/host_frame_sink_manager.h
@@ -84,7 +84,7 @@
   };
 
   // cc::mojom::FrameSinkManagerClient:
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override;
+  void OnSurfaceCreated(const SurfaceInfo& surface_info) override;
   void OnClientConnectionClosed(const FrameSinkId& frame_sink_id) override;
 
   // Mojo connection to the FrameSinkManager.
diff --git a/components/viz/service/display/display_scheduler.cc b/components/viz/service/display/display_scheduler.cc
index d7a0c9f..6475549 100644
--- a/components/viz/service/display/display_scheduler.cc
+++ b/components/viz/service/display/display_scheduler.cc
@@ -10,7 +10,7 @@
 #include "base/stl_util.h"
 #include "base/trace_event/trace_event.h"
 #include "cc/output/output_surface.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 
 namespace viz {
 
@@ -278,7 +278,7 @@
     NOTIMPLEMENTED();
 }
 
-void DisplayScheduler::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {}
+void DisplayScheduler::OnSurfaceCreated(const SurfaceInfo& surface_info) {}
 
 void DisplayScheduler::OnSurfaceDestroyed(const SurfaceId& surface_id) {
   auto it = surface_states_.find(surface_id);
diff --git a/components/viz/service/display/display_scheduler.h b/components/viz/service/display/display_scheduler.h
index c0e36c5..684bc1c1 100644
--- a/components/viz/service/display/display_scheduler.h
+++ b/components/viz/service/display/display_scheduler.h
@@ -64,7 +64,7 @@
   void OnBeginFrameSourcePausedChanged(bool paused) override;
 
   // SurfaceObserver implementation.
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override;
+  void OnSurfaceCreated(const SurfaceInfo& surface_info) override;
   void OnSurfaceDestroyed(const SurfaceId& surface_id) override;
   bool OnSurfaceDamaged(const SurfaceId& surface_id,
                         const cc::BeginFrameAck& ack) override;
diff --git a/components/viz/service/display/display_scheduler_unittest.cc b/components/viz/service/display/display_scheduler_unittest.cc
index 120a4cd8..a6adbe1d 100644
--- a/components/viz/service/display/display_scheduler_unittest.cc
+++ b/components/viz/service/display/display_scheduler_unittest.cc
@@ -10,9 +10,9 @@
 #include "base/test/simple_test_tick_clock.h"
 #include "base/trace_event/trace_event.h"
 #include "cc/output/begin_frame_args.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/test/fake_external_begin_frame_source.h"
 #include "cc/test/scheduler_test_common.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/service/display/display.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support.cc
index 612a50b..e9587255 100644
--- a/components/viz/service/frame_sinks/compositor_frame_sink_support.cc
+++ b/components/viz/service/frame_sinks/compositor_frame_sink_support.cc
@@ -11,8 +11,8 @@
 #include "cc/scheduler/begin_frame_source.h"
 #include "cc/surfaces/frame_sink_manager.h"
 #include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_reference.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/service/display/display.h"
 #include "components/viz/service/frame_sinks/compositor_frame_sink_support_client.h"
 
@@ -61,7 +61,7 @@
     seen_first_frame_activation_ = true;
 
     gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
-    surface_manager_->SurfaceCreated(cc::SurfaceInfo(
+    surface_manager_->SurfaceCreated(SurfaceInfo(
         surface->surface_id(), frame.metadata.device_scale_factor, frame_size));
   }
   // Fire cc::SurfaceCreated first so that a temporary reference is added before
@@ -180,10 +180,10 @@
     SurfaceId surface_id(frame_sink_id_, local_surface_id);
     gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
     float device_scale_factor = frame.metadata.device_scale_factor;
-    cc::SurfaceInfo surface_info(surface_id, device_scale_factor, frame_size);
+    SurfaceInfo surface_info(surface_id, device_scale_factor, frame_size);
 
     if (!surface_info.is_valid()) {
-      TRACE_EVENT_INSTANT0("cc", "Invalid cc::SurfaceInfo",
+      TRACE_EVENT_INSTANT0("cc", "Invalid SurfaceInfo",
                            TRACE_EVENT_SCOPE_THREAD);
       EvictCurrentSurface();
       std::vector<cc::ReturnedResource> resources =
@@ -347,7 +347,7 @@
 }
 
 cc::Surface* CompositorFrameSinkSupport::CreateSurface(
-    const cc::SurfaceInfo& surface_info) {
+    const SurfaceInfo& surface_info) {
   seen_first_frame_activation_ = false;
   return surface_manager_->CreateSurface(
       weak_factory_.GetWeakPtr(), surface_info,
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support.h b/components/viz/service/frame_sinks/compositor_frame_sink_support.h
index fd5e9a0..0d7dbf978 100644
--- a/components/viz/service/frame_sinks/compositor_frame_sink_support.h
+++ b/components/viz/service/frame_sinks/compositor_frame_sink_support.h
@@ -16,9 +16,9 @@
 #include "cc/surfaces/frame_sink_manager_client.h"
 #include "cc/surfaces/referenced_surface_tracker.h"
 #include "cc/surfaces/surface_client.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_resource_holder.h"
 #include "cc/surfaces/surface_resource_holder_client.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/service/viz_service_export.h"
 
 namespace cc {
@@ -106,7 +106,7 @@
   void OnBeginFrameSourcePausedChanged(bool paused) override;
 
   void UpdateNeedsBeginFramesInternal();
-  cc::Surface* CreateSurface(const cc::SurfaceInfo& surface_info);
+  cc::Surface* CreateSurface(const SurfaceInfo& surface_info);
 
   CompositorFrameSinkSupportClient* const client_;
 
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
index 741c970b..a4e90f0 100644
--- a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
+++ b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
@@ -10,7 +10,6 @@
 #include "cc/output/copy_output_result.h"
 #include "cc/resources/resource_provider.h"
 #include "cc/surfaces/frame_sink_manager.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/test/begin_frame_args_test.h"
 #include "cc/test/compositor_frame_helpers.h"
 #include "cc/test/fake_external_begin_frame_source.h"
@@ -18,6 +17,7 @@
 #include "cc/test/mock_compositor_frame_sink_support_client.h"
 #include "components/viz/common/surfaces/frame_sink_id.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/service/frame_sinks/compositor_frame_sink_support_client.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
index eca2684..5eddbf9 100644
--- a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
+++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
@@ -100,8 +100,7 @@
   compositor_frame_sinks_.erase(sink_id);
 }
 
-void FrameSinkManagerImpl::OnSurfaceCreated(
-    const cc::SurfaceInfo& surface_info) {
+void FrameSinkManagerImpl::OnSurfaceCreated(const SurfaceInfo& surface_info) {
   DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
   DCHECK_GT(surface_info.device_scale_factor(), 0.0f);
 
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.h b/components/viz/service/frame_sinks/frame_sink_manager_impl.h
index 1dc44a0..6610620c 100644
--- a/components/viz/service/frame_sinks/frame_sink_manager_impl.h
+++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.h
@@ -80,7 +80,7 @@
   void DestroyCompositorFrameSink(FrameSinkId frame_sink_id);
 
   // cc::SurfaceObserver implementation.
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override;
+  void OnSurfaceCreated(const SurfaceInfo& surface_info) override;
   bool OnSurfaceDamaged(const SurfaceId& surface_id,
                         const cc::BeginFrameAck& ack) override;
   void OnSurfaceDiscarded(const SurfaceId& surface_id) override;
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 1441c9e9..3c529aa 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -17,7 +17,7 @@
 #include "build/build_config.h"
 #include "cc/surfaces/frame_sink_manager.h"
 #include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
 #include "content/browser/browser_thread_impl.h"
 #include "content/browser/child_process_security_policy_impl.h"
@@ -430,7 +430,7 @@
 }
 
 void BrowserPluginGuest::SetChildFrameSurface(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   has_attached_since_surface_set_ = false;
   SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_SetChildFrameSurface>(
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 7fe0134..f933bf881 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -52,7 +52,6 @@
 #endif
 
 namespace cc {
-class SurfaceInfo;
 struct SurfaceSequence;
 }  // namespace cc
 
@@ -62,6 +61,7 @@
 
 namespace viz {
 class SurfaceId;
+class SurfaceInfo;
 }  // namespace viz
 
 namespace content {
@@ -241,7 +241,7 @@
   void PointerLockPermissionResponse(bool allow);
 
   // The next function is virtual for test purposes.
-  virtual void SetChildFrameSurface(const cc::SurfaceInfo& surface_info,
+  virtual void SetChildFrameSurface(const viz::SurfaceInfo& surface_info,
                                     const cc::SurfaceSequence& sequence);
 
   void ResendEventToEmbedder(const blink::WebInputEvent& event);
diff --git a/content/browser/frame_host/cross_process_frame_connector.cc b/content/browser/frame_host/cross_process_frame_connector.cc
index 21f5dc4..45ae834 100644
--- a/content/browser/frame_host/cross_process_frame_connector.cc
+++ b/content/browser/frame_host/cross_process_frame_connector.cc
@@ -89,7 +89,7 @@
 }
 
 void CrossProcessFrameConnector::SetChildFrameSurface(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   frame_proxy_in_parent_renderer_->Send(new FrameMsg_SetChildFrameSurface(
       frame_proxy_in_parent_renderer_->GetRoutingID(), surface_info, sequence));
diff --git a/content/browser/frame_host/cross_process_frame_connector.h b/content/browser/frame_host/cross_process_frame_connector.h
index a55c098..f01c699 100644
--- a/content/browser/frame_host/cross_process_frame_connector.h
+++ b/content/browser/frame_host/cross_process_frame_connector.h
@@ -18,8 +18,6 @@
 }
 
 namespace cc {
-class SurfaceId;
-class SurfaceInfo;
 struct SurfaceSequence;
 }
 
@@ -27,6 +25,11 @@
 class Message;
 }
 
+namespace viz {
+class SurfaceId;
+class SurfaceInfo;
+}  // namespace viz
+
 namespace content {
 class RenderFrameProxyHost;
 class RenderWidgetHostViewBase;
@@ -85,7 +88,7 @@
 
   void RenderProcessGone();
 
-  virtual void SetChildFrameSurface(const cc::SurfaceInfo& surface_info,
+  virtual void SetChildFrameSurface(const viz::SurfaceInfo& surface_info,
                                     const cc::SurfaceSequence& sequence);
 
   gfx::Rect ChildFrameRect();
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index 6d0da4a6..aa998182 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -484,13 +484,13 @@
   // The renderer process will satisfy this dependency when it creates a
   // SurfaceLayer.
   manager->RequireSequence(surface_id, sequence);
-  cc::SurfaceInfo surface_info(surface_id, current_surface_scale_factor_,
-                               current_surface_size_);
+  viz::SurfaceInfo surface_info(surface_id, current_surface_scale_factor_,
+                                current_surface_size_);
   SendSurfaceInfoToEmbedderImpl(surface_info, sequence);
 }
 
 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedderImpl(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   frame_connector_->SetChildFrameSurface(surface_info, sequence);
 }
@@ -512,7 +512,7 @@
 }
 
 void RenderWidgetHostViewChildFrame::OnSurfaceChanged(
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   cc::SurfaceSequence sequence(frame_sink_id_, next_surface_sequence_++);
   SendSurfaceInfoToEmbedderImpl(surface_info, sequence);
 }
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h
index 89a7967..a4c58cc 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.h
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.h
@@ -18,8 +18,8 @@
 #include "build/build_config.h"
 #include "cc/resources/returned_resource.h"
 #include "cc/scheduler/begin_frame_source.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_sequence.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/service/frame_sinks/compositor_frame_sink_support_client.h"
 #include "content/browser/compositor/image_transport_factory.h"
 #include "content/browser/renderer_host/event_with_latency_info.h"
@@ -120,7 +120,7 @@
   void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id,
                              cc::CompositorFrame frame) override;
   void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) override;
-  void OnSurfaceChanged(const cc::SurfaceInfo& surface_info) override;
+  void OnSurfaceChanged(const viz::SurfaceInfo& surface_info) override;
   // Since the URL of content rendered by this class is not displayed in
   // the URL bar, this method does not need an implementation.
   void ClearCompositorFrame() override {}
@@ -258,7 +258,7 @@
 
  private:
   virtual void SendSurfaceInfoToEmbedderImpl(
-      const cc::SurfaceInfo& surface_info,
+      const viz::SurfaceInfo& surface_info,
       const cc::SurfaceSequence& sequence);
 
   void SubmitSurfaceCopyRequest(const gfx::Rect& src_subrect,
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
index 2028114..f602b8f 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
@@ -64,7 +64,7 @@
   MockCrossProcessFrameConnector() : CrossProcessFrameConnector(nullptr) {}
   ~MockCrossProcessFrameConnector() override {}
 
-  void SetChildFrameSurface(const cc::SurfaceInfo& surface_info,
+  void SetChildFrameSurface(const viz::SurfaceInfo& surface_info,
                             const cc::SurfaceSequence& sequence) override {
     last_surface_info_ = surface_info;
   }
@@ -77,7 +77,7 @@
     return nullptr;
   }
 
-  cc::SurfaceInfo last_surface_info_;
+  viz::SurfaceInfo last_surface_info_;
 };
 
 class RenderWidgetHostViewChildFrameTest : public testing::Test {
@@ -216,7 +216,7 @@
 
     // Surface ID should have been passed to CrossProcessFrameConnector to
     // be sent to the embedding renderer.
-    EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
+    EXPECT_EQ(viz::SurfaceInfo(id, scale_factor, view_size),
               test_frame_connector_->last_surface_info_);
   }
 }
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index df4a82f1..0cec6b5 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -282,7 +282,7 @@
 }
 
 void RenderWidgetHostViewGuest::SendSurfaceInfoToEmbedderImpl(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   if (guest_ && !guest_->is_in_destruction())
     guest_->SetChildFrameSurface(surface_info, sequence);
diff --git a/content/browser/frame_host/render_widget_host_view_guest.h b/content/browser/frame_host/render_widget_host_view_guest.h
index 8d59b040..aaa26f4 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.h
+++ b/content/browser/frame_host/render_widget_host_view_guest.h
@@ -137,7 +137,7 @@
   friend class RenderWidgetHostView;
 
   void SendSurfaceInfoToEmbedderImpl(
-      const cc::SurfaceInfo& surface_info,
+      const viz::SurfaceInfo& surface_info,
       const cc::SurfaceSequence& sequence) override;
 
   RenderWidgetHostViewGuest(
diff --git a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
index 1e0baae..cb86173 100644
--- a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
@@ -122,7 +122,7 @@
 
   ~TestBrowserPluginGuest() override {}
 
-  void ResetTestData() { last_surface_info_ = cc::SurfaceInfo(); }
+  void ResetTestData() { last_surface_info_ = viz::SurfaceInfo(); }
 
   void set_has_attached_since_surface_set(bool has_attached_since_surface_set) {
     BrowserPluginGuest::set_has_attached_since_surface_set_for_test(
@@ -133,12 +133,12 @@
     BrowserPluginGuest::set_attached_for_test(attached);
   }
 
-  void SetChildFrameSurface(const cc::SurfaceInfo& surface_info,
+  void SetChildFrameSurface(const viz::SurfaceInfo& surface_info,
                             const cc::SurfaceSequence& sequence) override {
     last_surface_info_ = surface_info;
   }
 
-  cc::SurfaceInfo last_surface_info_;
+  viz::SurfaceInfo last_surface_info_;
 };
 
 // TODO(wjmaclean): we should restructure RenderWidgetHostViewChildFrameTest to
@@ -274,7 +274,7 @@
 #endif
   // Surface ID should have been passed to BrowserPluginGuest to
   // be sent to the embedding renderer.
-  EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
+  EXPECT_EQ(viz::SurfaceInfo(id, scale_factor, view_size),
             browser_plugin_guest_->last_surface_info_);
 
   browser_plugin_guest_->ResetTestData();
@@ -297,7 +297,7 @@
 #endif
   // Surface ID should have been passed to BrowserPluginGuest to
   // be sent to the embedding renderer.
-  EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
+  EXPECT_EQ(viz::SurfaceInfo(id, scale_factor, view_size),
             browser_plugin_guest_->last_surface_info_);
 
   browser_plugin_guest_->set_attached(false);
diff --git a/content/browser/renderer_host/delegated_frame_host.cc b/content/browser/renderer_host/delegated_frame_host.cc
index 541a797a..4786b99e 100644
--- a/content/browser/renderer_host/delegated_frame_host.cc
+++ b/content/browser/renderer_host/delegated_frame_host.cc
@@ -465,8 +465,8 @@
     if (local_surface_id != local_surface_id_ || !has_frame_) {
       // manager must outlive compositors using it.
       viz::SurfaceId surface_id(frame_sink_id_, local_surface_id);
-      cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor,
-                                   frame_size);
+      viz::SurfaceInfo surface_info(surface_id, frame_device_scale_factor,
+                                    frame_size);
       client_->DelegatedFrameHostGetLayer()->SetShowPrimarySurface(
           surface_info, manager->surface_manager()->reference_factory());
       client_->DelegatedFrameHostGetLayer()->SetFallbackSurface(surface_info);
diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc b/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc
index 048c75e..7764177f 100644
--- a/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc
+++ b/content/browser/renderer_host/offscreen_canvas_provider_impl_unittest.cc
@@ -49,18 +49,18 @@
     return client;
   }
 
-  const cc::SurfaceInfo& GetLastSurfaceInfo() const {
+  const viz::SurfaceInfo& GetLastSurfaceInfo() const {
     return last_surface_info_;
   }
 
  private:
   // blink::mojom::OffscreenCanvasSurfaceClient:
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {
+  void OnSurfaceCreated(const viz::SurfaceInfo& surface_info) override {
     last_surface_info_ = surface_info;
   }
 
   mojo::Binding<blink::mojom::OffscreenCanvasSurfaceClient> binding_;
-  cc::SurfaceInfo last_surface_info_;
+  viz::SurfaceInfo last_surface_info_;
 
   DISALLOW_COPY_AND_ASSIGN(StubOffscreenCanvasSurfaceClient);
 };
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
index b54cdd9..7bef352 100644
--- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
+++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc
@@ -59,7 +59,7 @@
 }
 
 void OffscreenCanvasSurfaceImpl::OnSurfaceCreated(
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   if (surface_info.id().frame_sink_id() != frame_sink_id_)
     return;
 
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.h b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
index 9bfa37e..6ea40cbb 100644
--- a/content/browser/renderer_host/offscreen_canvas_surface_impl.h
+++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.h
@@ -7,8 +7,8 @@
 
 #include "base/callback.h"
 #include "base/compiler_specific.h"
-#include "cc/surfaces/surface_info.h"
 #include "components/viz/common/surfaces/frame_sink_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/host/frame_sink_observer.h"
 #include "components/viz/host/host_frame_sink_manager.h"
 #include "content/common/content_export.h"
@@ -52,7 +52,7 @@
                                  cc::mojom::CompositorFrameSinkRequest request);
 
   // FrameSinkObserver implementation.
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override;
+  void OnSurfaceCreated(const viz::SurfaceInfo& surface_info) override;
 
   // blink::mojom::OffscreenCanvasSurface implementation.
   void Require(const viz::SurfaceId& surface_id,
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index f59f310..9e158628 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1577,7 +1577,7 @@
 }
 
 void RenderWidgetHostViewAura::OnWindowSurfaceChanged(
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   if (!is_guest_view_hack_)
     return;
   host_->GetView()->OnSurfaceChanged(surface_info);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index bff417de..f76bdd6 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -253,7 +253,7 @@
   void OnWindowTargetVisibilityChanged(bool visible) override;
   bool HasHitTestMask() const override;
   void GetHitTestMask(gfx::Path* mask) const override;
-  void OnWindowSurfaceChanged(const cc::SurfaceInfo& surface_info) override;
+  void OnWindowSurfaceChanged(const viz::SurfaceInfo& surface_info) override;
 
   // Overridden from ui::EventHandler:
   void OnKeyEvent(ui::KeyEvent* event) override;
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
index 9bb1d9f..b4297aff 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.h
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -46,7 +46,6 @@
 
 namespace cc {
 struct BeginFrameAck;
-class SurfaceInfo;
 }  // namespace cc
 
 namespace media {
@@ -67,6 +66,10 @@
 struct DidOverscrollParams;
 }
 
+namespace viz {
+class SurfaceInfo;
+}
+
 namespace content {
 
 class BrowserAccessibilityDelegate;
@@ -233,7 +236,7 @@
       cc::CompositorFrame frame) = 0;
 
   virtual void OnDidNotProduceFrame(const cc::BeginFrameAck& ack) {}
-  virtual void OnSurfaceChanged(const cc::SurfaceInfo& surface_info) {}
+  virtual void OnSurfaceChanged(const viz::SurfaceInfo& surface_info) {}
 
   // This method exists to allow removing of displayed graphics, after a new
   // page has been loaded, to prevent the displayed URL from being out of sync
diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h
index 64e0cd4..f7037f9e 100644
--- a/content/common/browser_plugin/browser_plugin_messages.h
+++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -8,7 +8,7 @@
 
 #include "base/process/process.h"
 #include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "content/common/content_export.h"
 #include "content/common/content_param_traits.h"
 #include "content/common/cursors/webcursor.h"
@@ -196,7 +196,7 @@
 
 IPC_MESSAGE_CONTROL3(BrowserPluginMsg_SetChildFrameSurface,
                      int /* browser_plugin_instance_id */,
-                     cc::SurfaceInfo /* surface_info */,
+                     viz::SurfaceInfo /* surface_info */,
                      cc::SurfaceSequence /* sequence */)
 
 // Forwards a PointerLock Unlock request to the BrowserPlugin.
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index c8a637c7..4e408c9 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -14,9 +14,9 @@
 #include <vector>
 
 #include "build/build_config.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_sequence.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "content/common/content_export.h"
 #include "content/common/content_param_traits.h"
 #include "content/common/content_security_policy/csp_context.h"
@@ -699,7 +699,7 @@
 // Messages sent from the browser to the renderer.
 
 IPC_MESSAGE_ROUTED2(FrameMsg_SetChildFrameSurface,
-                    cc::SurfaceInfo /* surface_info */,
+                    viz::SurfaceInfo /* surface_info */,
                     cc::SurfaceSequence /* sequence */)
 
 // Notifies the embedding frame that the process rendering the child frame's
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index a532eff..09231e2 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -18,7 +18,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "content/common/browser_plugin/browser_plugin_constants.h"
 #include "content/common/browser_plugin/browser_plugin_messages.h"
 #include "content/common/view_messages.h"
@@ -126,7 +126,7 @@
 
 void BrowserPlugin::OnSetChildFrameSurface(
     int browser_plugin_instance_id,
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   if (!attached())
     return;
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
index b2223902..5a9f099 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -20,10 +20,13 @@
 #include "third_party/WebKit/public/web/WebNode.h"
 
 namespace cc {
-class SurfaceInfo;
 struct SurfaceSequence;
 }
 
+namespace viz {
+class SurfaceInfo;
+}
+
 namespace content {
 
 class BrowserPluginDelegate;
@@ -157,7 +160,7 @@
   void OnGuestGone(int instance_id);
   void OnGuestReady(int instance_id);
   void OnSetChildFrameSurface(int instance_id,
-                              const cc::SurfaceInfo& surface_info,
+                              const viz::SurfaceInfo& surface_info,
                               const cc::SurfaceSequence& sequence);
   void OnSetContentsOpaque(int instance_id, bool opaque);
   void OnSetCursor(int instance_id, const WebCursor& cursor);
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index d488bd4..aade80d 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -249,7 +249,7 @@
 }
 
 void ChildFrameCompositingHelper::OnSetSurface(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   float scale_factor = surface_info.device_scale_factor();
   surface_id_ = surface_info.id();
@@ -274,8 +274,8 @@
         ->AddPendingSequence(sequence);
   }
 
-  cc::SurfaceInfo modified_surface_info(surface_info.id(), scale_factor,
-                                        surface_info.size_in_pixels());
+  viz::SurfaceInfo modified_surface_info(surface_info.id(), scale_factor,
+                                         surface_info.size_in_pixels());
   surface_layer->SetPrimarySurfaceInfo(modified_surface_info);
   surface_layer->SetFallbackSurfaceInfo(modified_surface_info);
   surface_layer->SetMasksToBounds(true);
diff --git a/content/renderer/child_frame_compositing_helper.h b/content/renderer/child_frame_compositing_helper.h
index 67cb0cb..f324159 100644
--- a/content/renderer/child_frame_compositing_helper.h
+++ b/content/renderer/child_frame_compositing_helper.h
@@ -24,7 +24,6 @@
 struct SurfaceSequence;
 
 class Layer;
-class SurfaceInfo;
 }
 
 namespace blink {
@@ -37,6 +36,10 @@
 class Size;
 }
 
+namespace viz {
+class SurfaceInfo;
+}
+
 namespace content {
 
 class BrowserPlugin;
@@ -51,7 +54,7 @@
       RenderFrameProxy* render_frame_proxy);
 
   void OnContainerDestroy();
-  void OnSetSurface(const cc::SurfaceInfo& surface_info,
+  void OnSetSurface(const viz::SurfaceInfo& surface_info,
                     const cc::SurfaceSequence& sequence);
   void UpdateVisibility(bool);
   void ChildFrameGone();
diff --git a/content/renderer/mus/renderer_window_tree_client.cc b/content/renderer/mus/renderer_window_tree_client.cc
index 8dc45694..ec83c24 100644
--- a/content/renderer/mus/renderer_window_tree_client.cc
+++ b/content/renderer/mus/renderer_window_tree_client.cc
@@ -228,7 +228,7 @@
 
 void RendererWindowTreeClient::OnWindowSurfaceChanged(
     ui::Id window_id,
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   NOTIMPLEMENTED();
 }
 
diff --git a/content/renderer/mus/renderer_window_tree_client.h b/content/renderer/mus/renderer_window_tree_client.h
index 83ef310..63f61e2 100644
--- a/content/renderer/mus/renderer_window_tree_client.h
+++ b/content/renderer/mus/renderer_window_tree_client.h
@@ -128,7 +128,7 @@
   void OnWindowFocused(ui::Id focused_window_id) override;
   void OnWindowCursorChanged(ui::Id window_id, ui::CursorData cursor) override;
   void OnWindowSurfaceChanged(ui::Id window_id,
-                              const cc::SurfaceInfo& surface_info) override;
+                              const viz::SurfaceInfo& surface_info) override;
   void OnDragDropStart(
       const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data)
       override;
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc
index f34ad3f9..a99aea8 100644
--- a/content/renderer/render_frame_proxy.cc
+++ b/content/renderer/render_frame_proxy.cc
@@ -325,7 +325,7 @@
 }
 
 void RenderFrameProxy::OnSetChildFrameSurface(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     const cc::SurfaceSequence& sequence) {
   // If this WebFrame has already been detached, its parent will be null. This
   // can happen when swapping a WebRemoteFrame with a WebLocalFrame, where this
diff --git a/content/renderer/render_frame_proxy.h b/content/renderer/render_frame_proxy.h
index 3dccdb0..bc7ef2a6 100644
--- a/content/renderer/render_frame_proxy.h
+++ b/content/renderer/render_frame_proxy.h
@@ -22,10 +22,13 @@
 }
 
 namespace cc {
-class SurfaceInfo;
 struct SurfaceSequence;
 }
 
+namespace viz {
+class SurfaceInfo;
+}
+
 namespace content {
 
 class ChildFrameCompositingHelper;
@@ -164,7 +167,7 @@
   void OnDeleteProxy();
   void OnChildFrameProcessGone();
   void OnCompositorFrameSwapped(const IPC::Message& message);
-  void OnSetChildFrameSurface(const cc::SurfaceInfo& surface_info,
+  void OnSetChildFrameSurface(const viz::SurfaceInfo& surface_info,
                               const cc::SurfaceSequence& sequence);
   void OnUpdateOpener(int opener_routing_id);
   void OnDidStopLoading();
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc
index 210930d..4cab317e 100644
--- a/extensions/browser/event_router.cc
+++ b/extensions/browser/event_router.cc
@@ -64,7 +64,7 @@
 }
 
 // A global identifier used to distinguish extension events.
-base::StaticAtomicSequenceNumber g_extension_event_id;
+base::AtomicSequenceNumber g_extension_event_id;
 
 }  // namespace
 
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc
index f29a7f9..7fddf33 100644
--- a/extensions/common/user_script.cc
+++ b/extensions/common/user_script.cc
@@ -18,7 +18,7 @@
 
 // This cannot be a plain int or int64_t because we need to generate unique IDs
 // from multiple threads.
-base::StaticAtomicSequenceNumber g_user_script_id_generator;
+base::AtomicSequenceNumber g_user_script_id_generator;
 
 bool UrlMatchesGlobs(const std::vector<std::string>* globs,
                      const GURL& url) {
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 830dcdc..535147c 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -80,7 +80,7 @@
   return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
 }
 
-static base::StaticAtomicSequenceNumber g_flush_id;
+static base::AtomicSequenceNumber g_flush_id;
 
 uint32_t GenerateNextFlushId() {
   return static_cast<uint32_t>(g_flush_id.GetNext());
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index 690713c..d6c7244 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -26,7 +26,7 @@
 
 // Generates process-unique IDs to use for tracing a MappedMemoryManager's
 // chunks.
-base::StaticAtomicSequenceNumber g_next_mapped_memory_manager_tracing_id;
+base::AtomicSequenceNumber g_next_mapped_memory_manager_tracing_id;
 
 }  // namespace
 
diff --git a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
index e4cdd30..27f0bf8c 100644
--- a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
+++ b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc
@@ -272,10 +272,14 @@
         if (method == DIRECT_DRAW && !color_renderable)
           method = DRAW_AND_COPY;
 
-        copier->DoCopySubTexture(
-            decoder, GL_TEXTURE_2D, rgba8_texture_, 0, GL_RGBA8, GL_TEXTURE_2D,
-            source_texture, 0, internal_format, 0, 0, 0, 0, width_, height_,
-            width_, height_, width_, height_, false, false, false, method);
+        // LUMINANCE, LUMINANCE_ALPHA and ALPHA textures aren't
+        // renderable, so we don't need to pass in the luma emulation
+        // blitter to this point.
+        copier->DoCopySubTexture(decoder, GL_TEXTURE_2D, rgba8_texture_, 0,
+                                 GL_RGBA8, GL_TEXTURE_2D, source_texture, 0,
+                                 internal_format, 0, 0, 0, 0, width_, height_,
+                                 width_, height_, width_, height_, false, false,
+                                 false, method, nullptr);
       } else {
         ApplyCMAAEffectTexture(source_texture, source_texture, do_copy);
       }
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
index 08642be..7ad4815 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
+++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
@@ -9,6 +9,7 @@
 #include <algorithm>
 
 #include "gpu/command_buffer/service/gl_utils.h"
+#include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h"
 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
 #include "gpu/command_buffer/service/texture_manager.h"
 #include "ui/gl/gl_version_info.h"
@@ -366,22 +367,20 @@
   // Preamble for texture precision.
   source += kShaderPrecisionPreamble;
 
-  // According to the spec, |dest_format| can be unsigend interger format, float
+  // According to the spec, |dest_format| can be unsigned integer format, float
   // format or unsigned normalized fixed-point format. |source_format| can only
   // be unsigned normalized fixed-point format.
   if (gpu::gles2::GLES2Util::IsUnsignedIntegerFormat(dest_format)) {
     source += "#define TextureType uvec4\n";
     source += "#define ZERO 0u\n";
     source += "#define MAX_COLOR 255u\n";
-    source += "#define InnerScaleValue 255.0\n";
-    source += "#define OuterScaleValue 1u\n";
+    source += "#define ScaleValue 255.0\n";
   } else {
     DCHECK(!gpu::gles2::GLES2Util::IsIntegerFormat(dest_format));
     source += "#define TextureType vec4\n";
     source += "#define ZERO 0.0\n";
     source += "#define MAX_COLOR 1.0\n";
-    source += "#define InnerScaleValue 1.0\n";
-    source += "#define OuterScaleValue 1.0\n";
+    source += "#define ScaleValue 1.0\n";
   }
   if (gl_version_info.is_es2 || gl_version_info.IsLowerThanGL(3, 2) ||
       target == GL_TEXTURE_EXTERNAL_OES) {
@@ -430,26 +429,20 @@
       "void main(void) {\n"
       "  TexCoordPrecision vec4 uv =\n"
       "      u_tex_coord_transform * vec4(v_uv, 0, 1);\n"
-      "  vec4 color = TextureLookup(u_sampler, uv.st);\n"
-      "  FRAGCOLOR = TextureType(color * InnerScaleValue) * OuterScaleValue;\n";
+      "  vec4 color = TextureLookup(u_sampler, uv.st);\n";
 
-  // Post-processing to premultiply or un-premultiply alpha.
-  // Check dest format has alpha channel first.
-  if ((gpu::gles2::GLES2Util::GetChannelsForFormat(dest_format) & 0x0008) !=
-      0) {
-    if (premultiply_alpha) {
-      source += "  FRAGCOLOR.rgb *= FRAGCOLOR.a;\n";
-      source += "  FRAGCOLOR.rgb /= MAX_COLOR;\n";
-    }
-    if (unpremultiply_alpha) {
-      source +=
-          "  if (FRAGCOLOR.a > ZERO) {\n"
-          "    FRAGCOLOR.rgb /= FRAGCOLOR.a;\n"
-          "    FRAGCOLOR.rgb *= MAX_COLOR;\n"
-          "  }\n";
-    }
+  // Premultiply or un-premultiply alpha. Must always do this, even
+  // if the destination format doesn't have an alpha channel.
+  if (premultiply_alpha) {
+    source += "  color.rgb *= color.a;\n";
+  } else if (unpremultiply_alpha) {
+    source += "  if (color.a > 0.0) {\n";
+    source += "    color.rgb /= color.a;\n";
+    source += "  }\n";
   }
 
+  source += "  FRAGCOLOR = TextureType(color * ScaleValue);\n";
+
   // Main function end.
   source += "}\n";
 
@@ -482,14 +475,16 @@
   glShaderSource(shader, 1, &shader_source, 0);
   glCompileShader(shader);
 #if DCHECK_IS_ON()
-  GLint compile_status;
-  glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status);
-  if (GL_TRUE != compile_status) {
-    char buffer[1024];
-    GLsizei length = 0;
-    glGetShaderInfoLog(shader, sizeof(buffer), &length, buffer);
-    std::string log(buffer, length);
-    DLOG(ERROR) << "CopyTextureCHROMIUM: shader compilation failure: " << log;
+  {
+    GLint compile_status;
+    glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status);
+    if (GL_TRUE != compile_status) {
+      char buffer[1024];
+      GLsizei length = 0;
+      glGetShaderInfoLog(shader, sizeof(buffer), &length, buffer);
+      std::string log(buffer, length);
+      DLOG(ERROR) << "CopyTextureCHROMIUM: shader compilation failure: " << log;
+    }
   }
 #endif
 }
@@ -528,17 +523,20 @@
   return true;
 }
 
-void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder,
-                      GLenum source_target,
-                      GLuint source_id,
-                      GLint source_level,
-                      GLenum dest_target,
-                      GLuint dest_id,
-                      GLint dest_level,
-                      GLenum dest_internal_format,
-                      GLsizei width,
-                      GLsizei height,
-                      GLuint framebuffer) {
+void DoCopyTexImage2D(
+    const gpu::gles2::GLES2Decoder* decoder,
+    GLenum source_target,
+    GLuint source_id,
+    GLint source_level,
+    GLenum source_internal_format,
+    GLenum dest_target,
+    GLuint dest_id,
+    GLint dest_level,
+    GLenum dest_internal_format,
+    GLsizei width,
+    GLsizei height,
+    GLuint framebuffer,
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), source_target);
   GLenum dest_binding_target =
       gpu::gles2::GLES2Util::GLFaceTargetToTextureTarget(dest_target);
@@ -552,8 +550,23 @@
     glTexParameterf(dest_binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     glTexParameteri(dest_binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     glTexParameteri(dest_binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    glCopyTexImage2D(dest_target, dest_level, dest_internal_format, 0 /* x */,
-                     0 /* y */, width, height, 0 /* border */);
+
+    // The blitter will only be non-null if we're on the desktop core
+    // profile. Use it only if it's needed.
+    if (luma_emulation_blitter &&
+        gpu::gles2::CopyTexImageResourceManager::CopyTexImageRequiresBlit(
+            decoder->GetFeatureInfo(), dest_internal_format)) {
+      luma_emulation_blitter->DoCopyTexImage2DToLUMACompatibilityTexture(
+          decoder, dest_id, dest_binding_target, dest_target,
+          dest_internal_format,
+          gpu::gles2::TextureManager::ExtractTypeFromStorageFormat(
+              dest_internal_format),
+          dest_level, dest_internal_format, 0 /* x */, 0 /* y */, width, height,
+          framebuffer, source_internal_format);
+    } else {
+      glCopyTexImage2D(dest_target, dest_level, dest_internal_format, 0 /* x */,
+                       0 /* y */, width, height, 0 /* border */);
+    }
   }
 
   decoder->RestoreTextureState(source_id);
@@ -563,20 +576,24 @@
   decoder->RestoreFramebufferBindings();
 }
 
-void DoCopyTexSubImage2D(const gpu::gles2::GLES2Decoder* decoder,
-                         GLenum source_target,
-                         GLuint source_id,
-                         GLint source_level,
-                         GLenum dest_target,
-                         GLuint dest_id,
-                         GLint dest_level,
-                         GLint xoffset,
-                         GLint yoffset,
-                         GLint source_x,
-                         GLint source_y,
-                         GLsizei source_width,
-                         GLsizei source_height,
-                         GLuint framebuffer) {
+void DoCopyTexSubImage2D(
+    const gpu::gles2::GLES2Decoder* decoder,
+    GLenum source_target,
+    GLuint source_id,
+    GLint source_level,
+    GLenum source_internal_format,
+    GLenum dest_target,
+    GLuint dest_id,
+    GLint dest_level,
+    GLenum dest_internal_format,
+    GLint xoffset,
+    GLint yoffset,
+    GLint source_x,
+    GLint source_y,
+    GLsizei source_width,
+    GLsizei source_height,
+    GLuint framebuffer,
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   DCHECK(source_target == GL_TEXTURE_2D ||
          source_target == GL_TEXTURE_RECTANGLE_ARB);
   GLenum dest_binding_target =
@@ -591,8 +608,23 @@
     glTexParameterf(dest_binding_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     glTexParameteri(dest_binding_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     glTexParameteri(dest_binding_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    glCopyTexSubImage2D(dest_target, dest_level, xoffset, yoffset, source_x,
-                        source_y, source_width, source_height);
+
+    // The blitter will only be non-null if we're on the desktop core
+    // profile. Use it only if it's needed.
+    if (luma_emulation_blitter &&
+        gpu::gles2::CopyTexImageResourceManager::CopyTexImageRequiresBlit(
+            decoder->GetFeatureInfo(), dest_internal_format)) {
+      luma_emulation_blitter->DoCopyTexSubImageToLUMACompatibilityTexture(
+          decoder, dest_id, dest_binding_target, dest_target,
+          dest_internal_format,
+          gpu::gles2::TextureManager::ExtractTypeFromStorageFormat(
+              dest_internal_format),
+          dest_level, xoffset, yoffset, 0 /* zoffset */, source_x, source_y,
+          source_width, source_height, framebuffer, source_internal_format);
+    } else {
+      glCopyTexSubImage2D(dest_target, dest_level, xoffset, yoffset, source_x,
+                          source_y, source_width, source_height);
+    }
   }
 
   decoder->RestoreTextureState(source_id);
@@ -896,11 +928,13 @@
     bool flip_y,
     bool premultiply_alpha,
     bool unpremultiply_alpha,
-    CopyTextureMethod method) {
+    CopyTextureMethod method,
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   if (method == DIRECT_COPY) {
     DoCopyTexImage2D(decoder, source_target, source_id, source_level,
-                     dest_target, dest_id, dest_level, dest_internal_format,
-                     width, height, framebuffer_);
+                     source_internal_format, dest_target, dest_id, dest_level,
+                     dest_internal_format, width, height, framebuffer_,
+                     luma_emulation_blitter);
     return;
   }
 
@@ -930,17 +964,19 @@
     dest_internal_format = adjusted_internal_format;
   }
   // Use kIdentityMatrix if no transform passed in.
-  DoCopyTextureWithTransform(
-      decoder, source_target, source_id, source_level, source_internal_format,
-      dest_target, dest_texture, dest_level, dest_internal_format, width,
-      height, flip_y, premultiply_alpha, unpremultiply_alpha, kIdentityMatrix);
+  DoCopyTextureWithTransform(decoder, source_target, source_id, source_level,
+                             source_internal_format, dest_target, dest_texture,
+                             dest_level, dest_internal_format, width, height,
+                             flip_y, premultiply_alpha, unpremultiply_alpha,
+                             kIdentityMatrix, luma_emulation_blitter);
 
   if (method == DRAW_AND_COPY || method == DRAW_AND_READBACK) {
     source_level = 0;
     if (method == DRAW_AND_COPY) {
       DoCopyTexImage2D(decoder, dest_target, intermediate_texture, source_level,
-                       original_dest_target, dest_id, original_dest_level,
-                       original_internal_format, width, height, framebuffer_);
+                       dest_internal_format, original_dest_target, dest_id,
+                       original_dest_level, original_internal_format, width,
+                       height, framebuffer_, luma_emulation_blitter);
     } else if (method == DRAW_AND_READBACK) {
       DoReadbackAndTexImage(
           kTexImage, decoder, dest_target, intermediate_texture, source_level,
@@ -974,11 +1010,13 @@
     bool flip_y,
     bool premultiply_alpha,
     bool unpremultiply_alpha,
-    CopyTextureMethod method) {
+    CopyTextureMethod method,
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   if (method == DIRECT_COPY) {
     DoCopyTexSubImage2D(decoder, source_target, source_id, source_level,
-                        dest_target, dest_id, dest_level, xoffset, yoffset, x,
-                        y, width, height, framebuffer_);
+                        source_internal_format, dest_target, dest_id,
+                        dest_level, dest_internal_format, xoffset, yoffset, x,
+                        y, width, height, framebuffer_, luma_emulation_blitter);
     return;
   }
 
@@ -1019,15 +1057,16 @@
       dest_target, dest_texture, dest_level, dest_internal_format, dest_xoffset,
       dest_yoffset, x, y, width, height, dest_width, dest_height, source_width,
       source_height, flip_y, premultiply_alpha, unpremultiply_alpha,
-      kIdentityMatrix);
+      kIdentityMatrix, luma_emulation_blitter);
 
   if (method == DRAW_AND_COPY || method == DRAW_AND_READBACK) {
     source_level = 0;
     if (method == DRAW_AND_COPY) {
       DoCopyTexSubImage2D(decoder, dest_target, intermediate_texture,
-                          source_level, original_dest_target, dest_id,
-                          original_dest_level, xoffset, yoffset, 0, 0, width,
-                          height, framebuffer_);
+                          source_level, dest_internal_format,
+                          original_dest_target, dest_id, original_dest_level,
+                          original_internal_format, xoffset, yoffset, 0, 0,
+                          width, height, framebuffer_, luma_emulation_blitter);
     } else if (method == DRAW_AND_READBACK) {
       DoReadbackAndTexImage(kTexSubImage, decoder, dest_target,
                             intermediate_texture, source_level,
@@ -1062,12 +1101,14 @@
     bool flip_y,
     bool premultiply_alpha,
     bool unpremultiply_alpha,
-    const GLfloat transform_matrix[16]) {
+    const GLfloat transform_matrix[16],
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   DoCopyTextureInternal(
       decoder, source_target, source_id, source_level, source_internal_format,
       dest_target, dest_id, dest_level, dest_internal_format, xoffset, yoffset,
       x, y, width, height, dest_width, dest_height, source_width, source_height,
-      flip_y, premultiply_alpha, unpremultiply_alpha, transform_matrix);
+      flip_y, premultiply_alpha, unpremultiply_alpha, transform_matrix,
+      luma_emulation_blitter);
 }
 
 void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform(
@@ -1085,14 +1126,15 @@
     bool flip_y,
     bool premultiply_alpha,
     bool unpremultiply_alpha,
-    const GLfloat transform_matrix[16]) {
+    const GLfloat transform_matrix[16],
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   GLsizei dest_width = width;
   GLsizei dest_height = height;
-  DoCopyTextureInternal(decoder, source_target, source_id, source_level,
-                        source_format, dest_target, dest_id, dest_level,
-                        dest_format, 0, 0, 0, 0, width, height, dest_width,
-                        dest_height, width, height, flip_y, premultiply_alpha,
-                        unpremultiply_alpha, transform_matrix);
+  DoCopyTextureInternal(
+      decoder, source_target, source_id, source_level, source_format,
+      dest_target, dest_id, dest_level, dest_format, 0, 0, 0, 0, width, height,
+      dest_width, dest_height, width, height, flip_y, premultiply_alpha,
+      unpremultiply_alpha, transform_matrix, luma_emulation_blitter);
 }
 
 void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal(
@@ -1118,7 +1160,8 @@
     bool flip_y,
     bool premultiply_alpha,
     bool unpremultiply_alpha,
-    const GLfloat transform_matrix[16]) {
+    const GLfloat transform_matrix[16],
+    gpu::gles2::CopyTexImageResourceManager* luma_emulation_blitter) {
   DCHECK(source_target == GL_TEXTURE_2D ||
          source_target == GL_TEXTURE_RECTANGLE_ARB ||
          source_target == GL_TEXTURE_EXTERNAL_OES);
@@ -1185,11 +1228,19 @@
     glAttachShader(info->program, *fragment_shader);
     glBindAttribLocation(info->program, kVertexPositionAttrib, "a_position");
     glLinkProgram(info->program);
-#ifndef NDEBUG
-    GLint linked;
-    glGetProgramiv(info->program, GL_LINK_STATUS, &linked);
-    if (!linked)
-      DLOG(ERROR) << "CopyTextureCHROMIUM: program link failure.";
+
+#if DCHECK_IS_ON()
+    {
+      GLint linked;
+      glGetProgramiv(info->program, GL_LINK_STATUS, &linked);
+      if (!linked) {
+        char buffer[1024];
+        GLsizei length = 0;
+        glGetProgramInfoLog(info->program, sizeof(buffer), &length, buffer);
+        std::string log(buffer, length);
+        DLOG(ERROR) << "CopyTextureCHROMIUM: program link failure: " << log;
+      }
+    }
 #endif
     info->vertex_dest_mult_handle =
         glGetUniformLocation(info->program, "u_vertex_dest_mult");
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h
index 9cad28b..95e5063 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h
+++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h
@@ -17,6 +17,7 @@
 namespace gles2 {
 
 class GLES2Decoder;
+class CopyTexImageResourceManager;
 
 enum CopyTextureMethod {
   // Use CopyTex{Sub}Image2D to copy from the source to the destination.
@@ -66,7 +67,8 @@
                      bool flip_y,
                      bool premultiply_alpha,
                      bool unpremultiply_alpha,
-                     CopyTextureMethod method);
+                     CopyTextureMethod method,
+                     CopyTexImageResourceManager* luma_emulation_blitter);
 
   void DoCopySubTexture(const gles2::GLES2Decoder* decoder,
                         GLenum source_target,
@@ -90,51 +92,56 @@
                         bool flip_y,
                         bool premultiply_alpha,
                         bool unpremultiply_alpha,
-                        CopyTextureMethod method);
+                        CopyTextureMethod method,
+                        CopyTexImageResourceManager* luma_emulation_blitter);
 
-  void DoCopySubTextureWithTransform(const gles2::GLES2Decoder* decoder,
-                                     GLenum source_target,
-                                     GLuint source_id,
-                                     GLint source_level,
-                                     GLenum source_internal_format,
-                                     GLenum dest_target,
-                                     GLuint dest_id,
-                                     GLint dest_level,
-                                     GLenum dest_internal_format,
-                                     GLint xoffset,
-                                     GLint yoffset,
-                                     GLint x,
-                                     GLint y,
-                                     GLsizei width,
-                                     GLsizei height,
-                                     GLsizei dest_width,
-                                     GLsizei dest_height,
-                                     GLsizei source_width,
-                                     GLsizei source_height,
-                                     bool flip_y,
-                                     bool premultiply_alpha,
-                                     bool unpremultiply_alpha,
-                                     const GLfloat transform_matrix[16]);
+  void DoCopySubTextureWithTransform(
+      const gles2::GLES2Decoder* decoder,
+      GLenum source_target,
+      GLuint source_id,
+      GLint source_level,
+      GLenum source_internal_format,
+      GLenum dest_target,
+      GLuint dest_id,
+      GLint dest_level,
+      GLenum dest_internal_format,
+      GLint xoffset,
+      GLint yoffset,
+      GLint x,
+      GLint y,
+      GLsizei width,
+      GLsizei height,
+      GLsizei dest_width,
+      GLsizei dest_height,
+      GLsizei source_width,
+      GLsizei source_height,
+      bool flip_y,
+      bool premultiply_alpha,
+      bool unpremultiply_alpha,
+      const GLfloat transform_matrix[16],
+      CopyTexImageResourceManager* luma_emulation_blitter);
 
   // This will apply a transform on the texture coordinates before sampling
   // the source texture and copying to the destination texture. The transform
   // matrix should be given in column-major form, so it can be passed
   // directly to GL.
-  void DoCopyTextureWithTransform(const gles2::GLES2Decoder* decoder,
-                                  GLenum source_target,
-                                  GLuint source_id,
-                                  GLint source_level,
-                                  GLenum source_format,
-                                  GLenum dest_target,
-                                  GLuint dest_id,
-                                  GLint dest_level,
-                                  GLenum dest_format,
-                                  GLsizei width,
-                                  GLsizei height,
-                                  bool flip_y,
-                                  bool premultiply_alpha,
-                                  bool unpremultiply_alpha,
-                                  const GLfloat transform_matrix[16]);
+  void DoCopyTextureWithTransform(
+      const gles2::GLES2Decoder* decoder,
+      GLenum source_target,
+      GLuint source_id,
+      GLint source_level,
+      GLenum source_format,
+      GLenum dest_target,
+      GLuint dest_id,
+      GLint dest_level,
+      GLenum dest_format,
+      GLsizei width,
+      GLsizei height,
+      bool flip_y,
+      bool premultiply_alpha,
+      bool unpremultiply_alpha,
+      const GLfloat transform_matrix[16],
+      CopyTexImageResourceManager* luma_emulation_blitter);
 
   // The attributes used during invocation of the extension.
   static const GLuint kVertexPositionAttrib = 0;
@@ -166,29 +173,31 @@
     GLuint sampler_handle;
   };
 
-  void DoCopyTextureInternal(const gles2::GLES2Decoder* decoder,
-                             GLenum source_target,
-                             GLuint source_id,
-                             GLint source_level,
-                             GLenum source_format,
-                             GLenum dest_target,
-                             GLuint dest_id,
-                             GLint dest_level,
-                             GLenum dest_format,
-                             GLint xoffset,
-                             GLint yoffset,
-                             GLint x,
-                             GLint y,
-                             GLsizei width,
-                             GLsizei height,
-                             GLsizei dest_width,
-                             GLsizei dest_height,
-                             GLsizei source_width,
-                             GLsizei source_height,
-                             bool flip_y,
-                             bool premultiply_alpha,
-                             bool unpremultiply_alpha,
-                             const GLfloat transform_matrix[16]);
+  void DoCopyTextureInternal(
+      const gles2::GLES2Decoder* decoder,
+      GLenum source_target,
+      GLuint source_id,
+      GLint source_level,
+      GLenum source_format,
+      GLenum dest_target,
+      GLuint dest_id,
+      GLint dest_level,
+      GLenum dest_format,
+      GLint xoffset,
+      GLint yoffset,
+      GLint x,
+      GLint y,
+      GLsizei width,
+      GLsizei height,
+      GLsizei dest_width,
+      GLsizei dest_height,
+      GLsizei source_width,
+      GLsizei source_height,
+      bool flip_y,
+      bool premultiply_alpha,
+      bool unpremultiply_alpha,
+      const GLfloat transform_matrix[16],
+      CopyTexImageResourceManager* luma_emulation_blitter);
 
   bool initialized_;
   bool nv_egl_stream_consumer_external_;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 6f68692..1a74405 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -16660,6 +16660,11 @@
           feature_info_->ext_color_buffer_float_available() ||
           feature_info_->feature_flags().chromium_color_buffer_float_rgba;
       break;
+    case GL_ALPHA:
+    case GL_LUMINANCE:
+    case GL_LUMINANCE_ALPHA:
+      valid_dest_format = true;
+      break;
     default:
       valid_dest_format = false;
       break;
@@ -16997,7 +17002,8 @@
           source_internal_format, dest_target, dest_texture->service_id(),
           dest_level, internal_format, source_width, source_height,
           unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
-          unpack_unmultiply_alpha == GL_TRUE, transform_matrix);
+          unpack_unmultiply_alpha == GL_TRUE, transform_matrix,
+          copy_tex_image_blit_.get());
       return;
     }
   }
@@ -17012,7 +17018,7 @@
       source_internal_format, dest_target, dest_texture->service_id(),
       dest_level, internal_format, source_width, source_height,
       unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
-      unpack_unmultiply_alpha == GL_TRUE, method);
+      unpack_unmultiply_alpha == GL_TRUE, method, copy_tex_image_blit_.get());
 }
 
 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM(
@@ -17210,7 +17216,8 @@
           dest_level, dest_internal_format, xoffset, yoffset, x, y, width,
           height, dest_width, dest_height, source_width, source_height,
           unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
-          unpack_unmultiply_alpha == GL_TRUE, transform_matrix);
+          unpack_unmultiply_alpha == GL_TRUE, transform_matrix,
+          copy_tex_image_blit_.get());
       return;
     }
   }
@@ -17238,7 +17245,7 @@
       dest_level, dest_internal_format, xoffset, yoffset, x, y, width, height,
       dest_width, dest_height, source_width, source_height,
       unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE,
-      unpack_unmultiply_alpha == GL_TRUE, method);
+      unpack_unmultiply_alpha == GL_TRUE, method, copy_tex_image_blit_.get());
 }
 
 bool GLES2DecoderImpl::InitializeCopyTexImageBlitter(
@@ -17264,6 +17271,15 @@
     copy_texture_CHROMIUM_->Initialize(this, features());
     if (LOCAL_PEEK_GL_ERROR(function_name) != GL_NO_ERROR)
       return false;
+
+    // On the desktop core profile this also needs emulation of
+    // CopyTex{Sub}Image2D for luminance, alpha, and luminance_alpha
+    // textures.
+    if (CopyTexImageResourceManager::CopyTexImageRequiresBlit(
+            feature_info_.get(), GL_LUMINANCE)) {
+      if (!InitializeCopyTexImageBlitter(function_name))
+        return false;
+    }
   }
   return true;
 }
@@ -17415,7 +17431,7 @@
       this, source_texture->target(), source_texture->service_id(), 0,
       source_internal_format, dest_texture->target(),
       dest_texture->service_id(), 0, GL_RGBA, source_width, source_height,
-      false, false, false, DIRECT_DRAW);
+      false, false, false, DIRECT_DRAW, copy_tex_image_blit_.get());
 }
 
 void GLES2DecoderImpl::TexStorageImpl(GLenum target,
diff --git a/gpu/ipc/client/gpu_channel_host.cc b/gpu/ipc/client/gpu_channel_host.cc
index 50f9e78..060ce666 100644
--- a/gpu/ipc/client/gpu_channel_host.cc
+++ b/gpu/ipc/client/gpu_channel_host.cc
@@ -25,7 +25,7 @@
 namespace {
 
 // Global atomic to generate unique transfer buffer IDs.
-base::StaticAtomicSequenceNumber g_next_transfer_buffer_id;
+base::AtomicSequenceNumber g_next_transfer_buffer_id;
 
 }  // namespace
 
diff --git a/gpu/ipc/in_process_command_buffer.cc b/gpu/ipc/in_process_command_buffer.cc
index 60e8b22..f5ac52f 100644
--- a/gpu/ipc/in_process_command_buffer.cc
+++ b/gpu/ipc/in_process_command_buffer.cc
@@ -64,7 +64,7 @@
 
 namespace {
 
-base::StaticAtomicSequenceNumber g_next_command_buffer_id;
+base::AtomicSequenceNumber g_next_command_buffer_id;
 
 template <typename T>
 static void RunTaskWithResult(base::Callback<T(void)> task,
diff --git a/ios/chrome/browser/payments/payment_request.h b/ios/chrome/browser/payments/payment_request.h
index a851d44..6def1bae 100644
--- a/ios/chrome/browser/payments/payment_request.h
+++ b/ios/chrome/browser/payments/payment_request.h
@@ -75,6 +75,13 @@
                  id<PaymentRequestUIDelegate> payment_request_ui_delegate);
   ~PaymentRequest() override;
 
+  // Functor used as a simplified comparison function for unique pointers to
+  // PaymentRequest. Only compares |web_payment_request_.payment_request_id|.
+  struct Compare {
+    bool operator()(const std::unique_ptr<PaymentRequest>& lhs,
+                    const std::unique_ptr<PaymentRequest>& rhs) const;
+  };
+
   // PaymentRequestBaseDelegate:
   autofill::PersonalDataManager* GetPersonalDataManager() override;
   const std::string& GetApplicationLocale() const override;
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm
index 785c7f7..d8a40a9 100644
--- a/ios/chrome/browser/payments/payment_request.mm
+++ b/ios/chrome/browser/payments/payment_request.mm
@@ -127,6 +127,13 @@
 
 PaymentRequest::~PaymentRequest() {}
 
+bool PaymentRequest::Compare::operator()(
+    const std::unique_ptr<PaymentRequest>& lhs,
+    const std::unique_ptr<PaymentRequest>& rhs) const {
+  return lhs->web_payment_request().payment_request_id !=
+         rhs->web_payment_request().payment_request_id;
+}
+
 autofill::PersonalDataManager* PaymentRequest::GetPersonalDataManager() {
   return personal_data_manager_;
 }
diff --git a/ios/chrome/browser/ui/payments/payment_request_manager.mm b/ios/chrome/browser/ui/payments/payment_request_manager.mm
index eed9dcc..8faebf7d 100644
--- a/ios/chrome/browser/ui/payments/payment_request_manager.mm
+++ b/ios/chrome/browser/ui/payments/payment_request_manager.mm
@@ -5,9 +5,9 @@
 #import "ios/chrome/browser/ui/payments/payment_request_manager.h"
 
 #include <memory>
+#include <set>
 #include <string>
 #include <unordered_map>
-#include <vector>
 
 #include "base/ios/block_types.h"
 #include "base/ios/ios_util.h"
@@ -97,7 +97,8 @@
   // The of map WebState to the list of payments::PaymentRequest instances
   // maintained for that WebState.
   std::unordered_map<web::WebState*,
-                     std::vector<std::unique_ptr<payments::PaymentRequest>>>
+                     std::set<std::unique_ptr<payments::PaymentRequest>,
+                              payments::PaymentRequest::Compare>>
       _paymentRequests;
 
   // The observer for |_activeWebState|.
@@ -150,6 +151,11 @@
 // Handler for injected JavaScript callbacks.
 - (BOOL)handleScriptCommand:(const base::DictionaryValue&)JSONCommand;
 
+// Handles creation of a PaymentRequest instance. The value of the JavaScript
+// PaymentRequest object should be provided in |message|. Returns YES if the
+// invocation was successful.
+- (BOOL)handleCreatePaymentRequest:(const base::DictionaryValue&)message;
+
 // Handles invocations of PaymentRequest.show(). The value of the JavaScript
 // PaymentRequest object should be provided in |message|. Returns YES if the
 // invocation was successful.
@@ -244,7 +250,8 @@
     _activeWebState = webState;
     if (_paymentRequests.find(webState) == _paymentRequests.end()) {
       _paymentRequests[webState] =
-          std::vector<std::unique_ptr<payments::PaymentRequest>>();
+          std::set<std::unique_ptr<payments::PaymentRequest>,
+                   payments::PaymentRequest::Compare>();
     }
     _activeWebStateObserver =
         base::MakeUnique<web::WebStateObserverBridge>(webState, self);
@@ -351,6 +358,9 @@
     return NO;
   }
 
+  if (command == "paymentRequest.createPaymentRequest") {
+    return [self handleCreatePaymentRequest:JSONCommand];
+  }
   if (command == "paymentRequest.requestShow") {
     return [self handleRequestShow:JSONCommand];
   }
@@ -369,12 +379,11 @@
   return NO;
 }
 
-// Extracts a web::PaymentRequest from |message|. Returns the instance of
-// payments::PaymentRequest that corresponds to the extracted
-// web::PaymentRequest object, if one exists. Otherwise, creates and returns a
-// new one which is initialized with the web::PaymentRequest object. Returns
-// nullptr if it cannot extract a web::PaymentRequest from |message|.
-- (payments::PaymentRequest*)getOrCreatePaymentRequestFromMessage:
+// Extracts a web::PaymentRequest from |message|. Creates and returns an
+// instance of payments::PaymentRequest which is initialized with the
+// web::PaymentRequest object. Returns nullptr if it cannot extract a
+// web::PaymentRequest from |message|.
+- (payments::PaymentRequest*)newPaymentRequestFromMessage:
     (const base::DictionaryValue&)message {
   const base::DictionaryValue* paymentRequestData;
   web::PaymentRequest webPaymentRequest;
@@ -389,20 +398,54 @@
 
   const auto iterator = _paymentRequests.find(_activeWebState);
   DCHECK(iterator != _paymentRequests.end());
-  const auto found = std::find_if(
-      iterator->second.begin(), iterator->second.end(),
-      [webPaymentRequest](
-          const std::unique_ptr<payments::PaymentRequest>& paymentRequest) {
-        return paymentRequest->web_payment_request() == webPaymentRequest;
-      });
-  if (found != iterator->second.end()) {
-    return (*found).get();
+  const auto result =
+      iterator->second.insert(base::MakeUnique<payments::PaymentRequest>(
+          webPaymentRequest, _browserState, _activeWebState,
+          _personalDataManager, self));
+  DCHECK(result.first != iterator->second.end());
+  return result.first->get();
+}
+
+// Extracts a web::PaymentRequest from |message|. Returns the cached instance of
+// payments::PaymentRequest that corresponds to the extracted
+// web::PaymentRequest object, if one exists. Otherwise, creates and returns a
+// new one which is initialized with the web::PaymentRequest object. Returns
+// nullptr if it cannot extract a web::PaymentRequest from |message| or cannot
+// find the payments::PaymentRequest instance.
+- (payments::PaymentRequest*)paymentRequestFromMessage:
+    (const base::DictionaryValue&)message {
+  const base::DictionaryValue* paymentRequestData;
+  web::PaymentRequest webPaymentRequest;
+  if (!message.GetDictionary("payment_request", &paymentRequestData)) {
+    DLOG(ERROR) << "JS message parameter 'payment_request' is missing";
+    return nullptr;
+  }
+  if (!webPaymentRequest.FromDictionaryValue(*paymentRequestData)) {
+    DLOG(ERROR) << "JS message parameter 'payment_request' is invalid";
+    return nullptr;
   }
 
-  iterator->second.push_back(base::MakeUnique<payments::PaymentRequest>(
-      webPaymentRequest, _browserState, _activeWebState, _personalDataManager,
-      self));
-  return iterator->second.back().get();
+  std::unique_ptr<payments::PaymentRequest> temporaryPaymentRequest =
+      base::MakeUnique<payments::PaymentRequest>(webPaymentRequest,
+                                                 _browserState, _activeWebState,
+                                                 _personalDataManager, self);
+  const auto iterator = _paymentRequests.find(_activeWebState);
+  DCHECK(iterator != _paymentRequests.end());
+  const auto found = iterator->second.find(temporaryPaymentRequest);
+  return found != iterator->second.end() ? found->get() : nullptr;
+}
+
+- (BOOL)handleCreatePaymentRequest:(const base::DictionaryValue&)message {
+  payments::PaymentRequest* paymentRequest =
+      [self newPaymentRequestFromMessage:message];
+  if (!paymentRequest) {
+    // TODO(crbug.com/602666): Reject the promise with an error of
+    // "InvalidStateError" type.
+    [_paymentRequestJsManager
+        rejectCanMakePaymentPromiseWithErrorMessage:@"Invalid state error"
+                                  completionHandler:nil];
+  }
+  return YES;
 }
 
 - (BOOL)handleRequestShow:(const base::DictionaryValue&)message {
@@ -412,9 +455,14 @@
   //   if the intersection is empty.
 
   payments::PaymentRequest* paymentRequest =
-      [self getOrCreatePaymentRequestFromMessage:message];
+      [self paymentRequestFromMessage:message];
   if (!paymentRequest) {
-    return NO;
+    // TODO(crbug.com/602666): Reject the promise with an error of
+    // "InvalidStateError" type.
+    [_paymentRequestJsManager
+        rejectCanMakePaymentPromiseWithErrorMessage:@"Invalid state error"
+                                  completionHandler:nil];
+    return YES;
   }
 
   UIImage* pageFavicon = nil;
@@ -472,7 +520,7 @@
 
 - (BOOL)handleCanMakePayment:(const base::DictionaryValue&)message {
   payments::PaymentRequest* paymentRequest =
-      [self getOrCreatePaymentRequestFromMessage:message];
+      [self paymentRequestFromMessage:message];
   if (!paymentRequest) {
     // TODO(crbug.com/602666): Reject the promise with an error of
     // "InvalidStateError" type.
@@ -723,6 +771,9 @@
     (payments::PaymentRequest*)paymentRequest {
   web::PaymentResponse paymentResponse;
 
+  paymentResponse.payment_request_id =
+      paymentRequest->web_payment_request().payment_request_id;
+
   paymentResponse.method_name =
       base::ASCIIToUTF16(_pendingPaymentResponse.methodName);
 
diff --git a/ios/chrome/browser/web/resources/payment_request.js b/ios/chrome/browser/web/resources/payment_request.js
index ed564ad2..e14d867 100644
--- a/ios/chrome/browser/web/resources/payment_request.js
+++ b/ios/chrome/browser/web/resources/payment_request.js
@@ -161,6 +161,24 @@
   // been defined.
   __gCrWeb.paymentRequestManager = {};
 
+  /**
+   * Generates a random string identfier resembling a GUID.
+   * @return {string}
+   */
+  __gCrWeb['paymentRequestManager'].guid = function() {
+    /**
+     * Generates a stringified random 4 digit hexadecimal number.
+     * @return {string}
+     */
+    var s4 = function() {
+      return Math.floor((1 + Math.random()) * 0x10000)
+          .toString(16)
+          .substring(1);
+    };
+    return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() +
+        s4() + s4();
+  };
+
   // Store paymentRequestManager namespace object in a global __gCrWeb object
   // referenced by a string, so it does not get renamed by closure compiler
   // during
@@ -203,8 +221,8 @@
   __gCrWeb['paymentRequestManager'].parsePaymentResponseData = function(
       paymentResponseData) {
     var response = new window.PaymentResponse(
-        paymentResponseData['paymentRequestID'],
-        paymentResponseData['methodName'], paymentResponseData['details']);
+        paymentResponseData['requestId'], paymentResponseData['methodName'],
+        paymentResponseData['details']);
     if (paymentResponseData['shippingAddress'])
       response.shippingAddress = paymentResponseData['shippingAddress'];
     if (paymentResponseData['shippingOption'])
@@ -377,6 +395,7 @@
   __gCrWeb['paymentRequestManager'].serializePaymentRequest = function(
       paymentRequest) {
     var serialized = {
+      'id': paymentRequest.id,
       'methodData': paymentRequest.methodData,
       'details': paymentRequest.details,
     };
@@ -551,10 +570,9 @@
 
   /**
    * A provided or generated ID for the this Payment Request instance.
-   * TODO(crbug.com/602666): Generate an ID if one is not provided.
-   * @type {?string}
+   * @type {string}
    */
-  this.paymentRequestID = null;
+  this.id = details.id ? details.id : __gCrWeb['paymentRequestManager'].guid();
 
   /**
    * Shipping address selected by the user.
@@ -582,6 +600,13 @@
       this.shippingType = PaymentShippingType.SHIPPING;
     }
   }
+
+  var message = {
+    'command': 'paymentRequest.createPaymentRequest',
+    'payment_request':
+        __gCrWeb['paymentRequestManager'].serializePaymentRequest(this),
+  };
+  __gCrWeb.message.invokeOnHost(message);
 };
 
 window.PaymentRequest.prototype = {
@@ -675,6 +700,7 @@
 
 /**
  * @typedef {{
+ *   id: (string|undefined),
  *   total: (window.PaymentItem|undefined),
  *   displayItems: (!Array<!window.PaymentItem>|undefined),
  *   shippingOptions: (!Array<!window.PaymentShippingOption>|undefined),
@@ -761,12 +787,12 @@
  * @constructor
  * @private
  */
-window.PaymentResponse = function(paymentRequestID, methodName, details) {
+window.PaymentResponse = function(requestId, methodName, details) {
   /**
-   * The same paymentRequestID present in the original window.PaymentRequest.
+   * The same identifier present in the original window.PaymentRequest.
    * @type {string}
    */
-  this.paymentRequestID = paymentRequestID;
+  this.requestId = requestId;
 
   /**
    * The payment method identifier for the payment method that the user selected
@@ -789,7 +815,7 @@
    * final shipping address chosen by the user.
    * @type {?window.PaymentAddress}
    */
-   this.shippingAddress = null;
+  this.shippingAddress = null;
 
   /**
    * If the requestShipping flag was set to true in the window.PaymentOptions
@@ -797,7 +823,7 @@
    * attribute of the selected shipping option.
    * @type {?string}
    */
-   this.shippingOption = null;
+  this.shippingOption = null;
 
   /**
    * If the requestPayerName flag was set to true in the window.PaymentOptions
@@ -805,7 +831,7 @@
    * provided by the user.
    * @type {?string}
    */
-   this.payerName = null;
+  this.payerName = null;
 
   /**
    * If the requestPayerEmail flag was set to true in the window.PaymentOptions
@@ -813,7 +839,7 @@
    * address chosen by the user.
    * @type {?string}
    */
-   this.payerEmail = null;
+  this.payerEmail = null;
 
   /**
    * If the requestPayerPhone flag was set to true in the window.PaymentOptions
@@ -821,7 +847,7 @@
    * number chosen by the user.
    * @type {?string}
    */
-   this.payerPhone = null;
+  this.payerPhone = null;
 };
 
 /**
diff --git a/ios/web/payments/payment_request.cc b/ios/web/payments/payment_request.cc
index 73657d0..52867d08 100644
--- a/ios/web/payments/payment_request.cc
+++ b/ios/web/payments/payment_request.cc
@@ -18,6 +18,7 @@
 static const char kPaymentCurrencyAmountCurrencySystem[] = "currencySystem";
 static const char kPaymentCurrencyAmountCurrency[] = "currency";
 static const char kPaymentCurrencyAmountValue[] = "value";
+static const char kPaymentDetailsId[] = "id";
 static const char kPaymentDetailsDisplayItems[] = "displayItems";
 static const char kPaymentDetailsError[] = "error";
 static const char kPaymentDetailsShippingOptions[] = "shippingOptions";
@@ -33,9 +34,10 @@
 static const char kPaymentOptionsShippingTypePickup[] = "pickup";
 static const char kPaymentOptionsShippingType[] = "shippingType";
 static const char kPaymentRequestDetails[] = "details";
-static const char kPaymentRequestId[] = "paymentRequestID";
+static const char kPaymentRequestId[] = "id";
 static const char kPaymentRequestMethodData[] = "methodData";
 static const char kPaymentRequestOptions[] = "options";
+static const char kPaymentResponseId[] = "requestId";
 static const char kPaymentResponseDetails[] = "details";
 static const char kPaymentResponseMethodName[] = "methodName";
 static const char kPaymentResponsePayerEmail[] = "payerEmail";
@@ -179,7 +181,7 @@
 PaymentDetails::~PaymentDetails() = default;
 
 bool PaymentDetails::operator==(const PaymentDetails& other) const {
-  return this->total == other.total &&
+  return this->id == other.id && this->total == other.total &&
          this->display_items == other.display_items &&
          this->shipping_options == other.shipping_options &&
          this->modifiers == other.modifiers && this->error == other.error;
@@ -195,6 +197,9 @@
   this->shipping_options.clear();
   this->modifiers.clear();
 
+  // ID is optional.
+  value.GetString(kPaymentDetailsId, &this->id);
+
   const base::DictionaryValue* total_dict = nullptr;
   if (!value.GetDictionary(kPaymentDetailsTotal, &total_dict) &&
       requires_total) {
@@ -305,6 +310,10 @@
 bool PaymentRequest::FromDictionaryValue(const base::DictionaryValue& value) {
   this->method_data.clear();
 
+  if (!value.GetString(kPaymentRequestId, &this->payment_request_id)) {
+    return false;
+  }
+
   // Parse the payment method data.
   const base::ListValue* method_data_list = nullptr;
   // At least one method is required.
@@ -364,7 +373,7 @@
     const {
   std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
 
-  result->SetString(kPaymentRequestId, this->payment_request_id);
+  result->SetString(kPaymentResponseId, this->payment_request_id);
   result->SetString(kPaymentResponseMethodName, this->method_name);
   // |this.details| is a json-serialized string. Parse it to a base::Value so
   // that when |this| is converted to a JSON string, |this.details| won't get
diff --git a/ios/web/payments/payment_request_unittest.cc b/ios/web/payments/payment_request_unittest.cc
index 45e3131..1e2fee0e 100644
--- a/ios/web/payments/payment_request_unittest.cc
+++ b/ios/web/payments/payment_request_unittest.cc
@@ -252,6 +252,8 @@
   base::DictionaryValue request_dict;
 
   // Add the expected values to expected_request.
+  expected_request.payment_request_id = "123456789";
+  expected_request.details.id = "12345";
   expected_request.details.total.label = base::ASCIIToUTF16("TOTAL");
   expected_request.details.total.amount.currency = base::ASCIIToUTF16("GBP");
   expected_request.details.total.amount.value = base::ASCIIToUTF16("6.66");
@@ -273,6 +275,7 @@
   amount_dict->SetString("value", "6.66");
   total_dict->Set("amount", std::move(amount_dict));
   details_dict->Set("total", std::move(total_dict));
+  details_dict->SetString("id", "12345");
   details_dict->SetString("error", "Error in details");
   request_dict.Set("details", std::move(details_dict));
 
@@ -284,6 +287,7 @@
   method_data_dict->Set("supportedMethods", std::move(supported_methods_list));
   method_data_list->Append(std::move(method_data_dict));
   request_dict.Set("methodData", std::move(method_data_list));
+  request_dict.SetString("id", "123456789");
 
   // With the required values present, parsing should succeed.
   EXPECT_TRUE(output_request.FromDictionaryValue(request_dict));
@@ -313,7 +317,7 @@
 TEST(PaymentRequestTest, EmptyResponseDictionary) {
   base::DictionaryValue expected_value;
 
-  expected_value.SetString("paymentRequestID", "");
+  expected_value.SetString("requestId", "");
   expected_value.SetString("methodName", "");
 
   PaymentResponse payment_response;
@@ -337,7 +341,7 @@
   billing_address->SetString("postalCode", "90210");
   details->Set("billingAddress", std::move(billing_address));
   expected_value.Set("details", std::move(details));
-  expected_value.SetString("paymentRequestID", "12345");
+  expected_value.SetString("requestId", "12345");
   expected_value.SetString("methodName", "American Express");
   std::unique_ptr<base::DictionaryValue> shipping_address(
       new base::DictionaryValue);
@@ -349,7 +353,7 @@
   expected_value.SetString("payerPhone", "1234-567-890");
 
   PaymentResponse payment_response;
-  payment_response.payment_request_id = base::ASCIIToUTF16("12345");
+  payment_response.payment_request_id = "12345";
   payment_response.method_name = base::ASCIIToUTF16("American Express");
 
   payments::BasicCardResponse payment_response_details;
@@ -518,6 +522,13 @@
   PaymentDetails details2;
   EXPECT_EQ(details1, details2);
 
+  details1.id = "12345";
+  EXPECT_NE(details1, details2);
+  details2.id = "54321";
+  EXPECT_NE(details1, details2);
+  details2.id = details1.id;
+  EXPECT_EQ(details1, details2);
+
   details1.total.label = base::ASCIIToUTF16("Total");
   EXPECT_NE(details1, details2);
   details2.total.label = base::ASCIIToUTF16("Shipping");
@@ -619,6 +630,13 @@
   PaymentRequest request2;
   EXPECT_EQ(request1, request2);
 
+  request1.payment_request_id = "12345";
+  EXPECT_NE(request1, request2);
+  request2.payment_request_id = "54321";
+  EXPECT_NE(request1, request2);
+  request2.payment_request_id = request1.payment_request_id;
+  EXPECT_EQ(request1, request2);
+
   payments::PaymentAddress address1;
   address1.recipient = base::ASCIIToUTF16("Jessica Jones");
   request1.shipping_address = address1;
diff --git a/ios/web/public/payments/payment_request.h b/ios/web/public/payments/payment_request.h
index 5eee723..22ea8baa 100644
--- a/ios/web/public/payments/payment_request.h
+++ b/ios/web/public/payments/payment_request.h
@@ -6,6 +6,7 @@
 #define IOS_WEB_PUBLIC_PAYMENTS_PAYMENT_REQUEST_H_
 
 #include <memory>
+#include <string>
 #include <vector>
 
 #include "base/strings/string16.h"
@@ -152,6 +153,9 @@
   bool FromDictionaryValue(const base::DictionaryValue& value,
                            bool requires_total);
 
+  // The unique free-form identifier for this payment request.
+  std::string id;
+
   // The total amount of the payment request.
   PaymentItem total;
 
@@ -230,7 +234,7 @@
 
   // The unique ID for this PaymentRequest. If it is not provided during
   // construction, one is generated.
-  base::string16 payment_request_id;
+  std::string payment_request_id;
 
   // Properties set in order to communicate user choices back to the page.
   payments::PaymentAddress shipping_address;
@@ -257,8 +261,8 @@
   // Populates |value| with the properties of this PaymentResponse.
   std::unique_ptr<base::DictionaryValue> ToDictionaryValue() const;
 
-  // The same paymentRequestID present in the original PaymentRequest.
-  base::string16 payment_request_id;
+  // The same ID present in the original PaymentRequest.
+  std::string payment_request_id;
 
   // The payment method identifier for the payment method that the user selected
   // to fulfil the transaction.
diff --git a/ipc/ipc_channel.cc b/ipc/ipc_channel.cc
index 2d51047..177b9676 100644
--- a/ipc/ipc_channel.cc
+++ b/ipc/ipc_channel.cc
@@ -17,7 +17,7 @@
 namespace {
 
 // Global atomic used to guarantee channel IDs are unique.
-base::StaticAtomicSequenceNumber g_last_id;
+base::AtomicSequenceNumber g_last_id;
 
 }  // namespace
 
diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
index f66b4fe8..8f408ea 100644
--- a/ipc/ipc_message.cc
+++ b/ipc/ipc_message.cc
@@ -21,7 +21,7 @@
 
 namespace {
 
-base::StaticAtomicSequenceNumber g_ref_num;
+base::AtomicSequenceNumber g_ref_num;
 
 // Create a reference number for identifying IPC messages in traces. The return
 // values has the reference number stored in the upper 24 bits, leaving the low
diff --git a/ipc/ipc_sync_message.cc b/ipc/ipc_sync_message.cc
index ba87de8..34cb875 100644
--- a/ipc/ipc_sync_message.cc
+++ b/ipc/ipc_sync_message.cc
@@ -14,7 +14,7 @@
 
 namespace {
 
-base::StaticAtomicSequenceNumber g_next_id;
+base::AtomicSequenceNumber g_next_id;
 
 }  // namespace
 
diff --git a/media/base/media_log.cc b/media/base/media_log.cc
index df26788f..d58fccd 100644
--- a/media/base/media_log.cc
+++ b/media/base/media_log.cc
@@ -15,7 +15,7 @@
 
 // A count of all MediaLogs created in the current process. Used to generate
 // unique IDs.
-static base::StaticAtomicSequenceNumber g_media_log_count;
+static base::AtomicSequenceNumber g_media_log_count;
 
 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) {
   switch (level) {
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 388a879..126f496 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -33,8 +33,8 @@
 
 }  // namespace
 
-// Static POD class for generating unique identifiers for each VideoFrame.
-static base::StaticAtomicSequenceNumber g_unique_id_generator;
+// Static constexpr class for generating unique identifiers for each VideoFrame.
+static base::AtomicSequenceNumber g_unique_id_generator;
 
 static bool IsPowerOfTwo(size_t x) {
   return x != 0 && (x & (x - 1)) == 0;
diff --git a/media/gpu/vt_video_decode_accelerator_mac.cc b/media/gpu/vt_video_decode_accelerator_mac.cc
index 1be78db..d077589 100644
--- a/media/gpu/vt_video_decode_accelerator_mac.cc
+++ b/media/gpu/vt_video_decode_accelerator_mac.cc
@@ -44,10 +44,10 @@
 namespace {
 
 // A sequence of ids for memory tracing.
-base::StaticAtomicSequenceNumber g_memory_dump_ids;
+base::AtomicSequenceNumber g_memory_dump_ids;
 
 // A sequence of shared memory ids for CVPixelBufferRefs.
-base::StaticAtomicSequenceNumber g_cv_pixel_buffer_ids;
+base::AtomicSequenceNumber g_cv_pixel_buffer_ids;
 
 // Only H.264 with 4:2:0 chroma sampling is supported.
 const VideoCodecProfile kSupportedProfiles[] = {
diff --git a/services/identity/identity_manager_unittest.cc b/services/identity/identity_manager_unittest.cc
index 6a3e7a5d..bd2bbda 100644
--- a/services/identity/identity_manager_unittest.cc
+++ b/services/identity/identity_manager_unittest.cc
@@ -148,10 +148,24 @@
   }
 
  protected:
-  void SetUp() override {
-    ServiceTest::SetUp();
+  void SetUp() override { ServiceTest::SetUp(); }
 
-    connector()->BindInterface(mojom::kServiceName, &identity_manager_);
+  mojom::IdentityManager* GetIdentityManager() {
+    if (!identity_manager_)
+      connector()->BindInterface(mojom::kServiceName, &identity_manager_);
+    return identity_manager_.get();
+  }
+
+  void ResetIdentityManager() { identity_manager_.reset(); }
+
+  void FlushIdentityManagerForTesting() {
+    GetIdentityManager();
+    identity_manager_.FlushForTesting();
+  }
+
+  void SetIdentityManagerConnectionErrorHandler(base::Closure handler) {
+    GetIdentityManager();
+    identity_manager_.set_connection_error_handler(handler);
   }
 
   // service_manager::test::ServiceTest:
@@ -182,15 +196,46 @@
   DISALLOW_COPY_AND_ASSIGN(IdentityManagerTest);
 };
 
-// Tests that the Identity Manager destroys itself on SigninManager shutdown.
-TEST_F(IdentityManagerTest, SigninManagerShutdown) {
+// Tests that it is not possible to connect to the Identity Manager if
+// initiated after SigninManager shutdown.
+TEST_F(IdentityManagerTest, SigninManagerShutdownBeforeConnection) {
+  AccountInfo sentinel;
+  sentinel.account_id = "sentinel";
+  primary_account_info_ = sentinel;
+
+  // Ensure that the Identity Service has actually been created before
+  // invoking SigninManagerBase::Shutdown(), since otherwise this test will
+  // spin forever. Then reset the Identity Manager so that the next request
+  // makes a fresh connection.
+  FlushIdentityManagerForTesting();
+  ResetIdentityManager();
+
+  // Make a call to connect to the IdentityManager *after* SigninManager
+  // shutdown; it should get notified of an error when the Identity Service
+  // drops the connection.
+  signin_manager()->Shutdown();
   base::RunLoop run_loop;
-  identity_manager_.set_connection_error_handler(run_loop.QuitClosure());
+  SetIdentityManagerConnectionErrorHandler(run_loop.QuitClosure());
+
+  GetIdentityManager()->GetPrimaryAccountInfo(
+      base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
+                 base::Unretained(this), run_loop.QuitClosure()));
+  run_loop.Run();
+
+  // Verify that the callback to GetPrimaryAccountInfo() was not invoked.
+  EXPECT_TRUE(primary_account_info_);
+  EXPECT_EQ("sentinel", primary_account_info_->account_id);
+}
+
+// Tests that the Identity Manager destroys itself on SigninManager shutdown.
+TEST_F(IdentityManagerTest, SigninManagerShutdownAfterConnection) {
+  base::RunLoop run_loop;
+  SetIdentityManagerConnectionErrorHandler(run_loop.QuitClosure());
 
   // Ensure that the IdentityManager instance has actually been created before
   // invoking SigninManagerBase::Shutdown(), since otherwise this test will
   // spin forever.
-  identity_manager_.FlushForTesting();
+  FlushIdentityManagerForTesting();
   signin_manager()->Shutdown();
   run_loop.Run();
 }
@@ -198,7 +243,7 @@
 // Check that the primary account info is null if not signed in.
 TEST_F(IdentityManagerTest, GetPrimaryAccountInfoNotSignedIn) {
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountInfo(
+  GetIdentityManager()->GetPrimaryAccountInfo(
       base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
                  base::Unretained(this), run_loop.QuitClosure()));
   run_loop.Run();
@@ -210,7 +255,7 @@
 TEST_F(IdentityManagerTest, GetPrimaryAccountInfoSignedInNoRefreshToken) {
   signin_manager()->SetAuthenticatedAccountInfo(kTestGaiaId, kTestEmail);
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountInfo(
+  GetIdentityManager()->GetPrimaryAccountInfo(
       base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
                  base::Unretained(this), run_loop.QuitClosure()));
   run_loop.Run();
@@ -230,7 +275,7 @@
   token_service()->UpdateCredentials(
       signin_manager()->GetAuthenticatedAccountId(), kTestRefreshToken);
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountInfo(
+  GetIdentityManager()->GetPrimaryAccountInfo(
       base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
                  base::Unretained(this), run_loop.QuitClosure()));
   run_loop.Run();
@@ -253,7 +298,7 @@
   AccountInfo account_info;
   AccountState account_state;
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountWhenAvailable(base::Bind(
+  GetIdentityManager()->GetPrimaryAccountWhenAvailable(base::Bind(
       &IdentityManagerTest::OnPrimaryAccountAvailable, base::Unretained(this),
       run_loop.QuitClosure(), base::Unretained(&account_info),
       base::Unretained(&account_state)));
@@ -275,7 +320,7 @@
   AccountState account_state;
 
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountWhenAvailable(base::Bind(
+  GetIdentityManager()->GetPrimaryAccountWhenAvailable(base::Bind(
       &IdentityManagerTest::OnPrimaryAccountAvailable, base::Unretained(this),
       run_loop.QuitClosure(), base::Unretained(&account_info),
       base::Unretained(&account_state)));
@@ -284,7 +329,7 @@
   // serves to ensure that the preceding call has been received by the Identity
   // Manager before proceeding).
   base::RunLoop run_loop2;
-  identity_manager_->GetPrimaryAccountInfo(
+  GetIdentityManager()->GetPrimaryAccountInfo(
       base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
                  base::Unretained(this), run_loop2.QuitClosure()));
   run_loop2.Run();
@@ -315,7 +360,7 @@
   // Sign in, but don't set the refresh token yet.
   signin_manager()->SetAuthenticatedAccountInfo(kTestGaiaId, kTestEmail);
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountWhenAvailable(base::Bind(
+  GetIdentityManager()->GetPrimaryAccountWhenAvailable(base::Bind(
       &IdentityManagerTest::OnPrimaryAccountAvailable, base::Unretained(this),
       run_loop.QuitClosure(), base::Unretained(&account_info),
       base::Unretained(&account_state)));
@@ -325,7 +370,7 @@
   // serves to ensure that the preceding call has been received by the Identity
   // Manager before proceeding).
   base::RunLoop run_loop2;
-  identity_manager_->GetPrimaryAccountInfo(
+  GetIdentityManager()->GetPrimaryAccountInfo(
       base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
                  base::Unretained(this), run_loop2.QuitClosure()));
   run_loop2.Run();
@@ -365,7 +410,7 @@
       account_tracker()->SeedAccountInfo(kTestGaiaId, kTestEmail);
   token_service()->UpdateCredentials(account_id_to_use, kTestRefreshToken);
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountWhenAvailable(base::Bind(
+  GetIdentityManager()->GetPrimaryAccountWhenAvailable(base::Bind(
       &IdentityManagerTest::OnPrimaryAccountAvailable, base::Unretained(this),
       run_loop.QuitClosure(), base::Unretained(&account_info),
       base::Unretained(&account_state)));
@@ -375,7 +420,7 @@
   // that the preceding call has been received by the Identity Manager before
   // proceeding).
   base::RunLoop run_loop2;
-  identity_manager_->GetAccountInfoFromGaiaId(
+  GetIdentityManager()->GetAccountInfoFromGaiaId(
       kTestGaiaId,
       base::Bind(&IdentityManagerTest::OnReceivedAccountInfoFromGaiaId,
                  base::Unretained(this), run_loop2.QuitClosure()));
@@ -415,7 +460,7 @@
   AccountInfo account_info1;
   AccountState account_state1;
   base::RunLoop run_loop;
-  identity_manager_->GetPrimaryAccountWhenAvailable(base::Bind(
+  GetIdentityManager()->GetPrimaryAccountWhenAvailable(base::Bind(
       &IdentityManagerTest::OnPrimaryAccountAvailable, base::Unretained(this),
       run_loop.QuitClosure(), base::Unretained(&account_info1),
       base::Unretained(&account_state1)));
@@ -423,7 +468,7 @@
   AccountInfo account_info2;
   AccountState account_state2;
   base::RunLoop run_loop2;
-  identity_manager_->GetPrimaryAccountWhenAvailable(base::Bind(
+  GetIdentityManager()->GetPrimaryAccountWhenAvailable(base::Bind(
       &IdentityManagerTest::OnPrimaryAccountAvailable, base::Unretained(this),
       run_loop2.QuitClosure(), base::Unretained(&account_info2),
       base::Unretained(&account_state2)));
@@ -432,7 +477,7 @@
   // serves to ensure that the preceding call has been received by the Identity
   // Manager before proceeding).
   base::RunLoop run_loop3;
-  identity_manager_->GetPrimaryAccountInfo(
+  GetIdentityManager()->GetPrimaryAccountInfo(
       base::Bind(&IdentityManagerTest::OnReceivedPrimaryAccountInfo,
                  base::Unretained(this), run_loop3.QuitClosure()));
   run_loop3.Run();
@@ -465,7 +510,7 @@
 // unknown.
 TEST_F(IdentityManagerTest, GetAccountInfoForUnknownGaiaID) {
   base::RunLoop run_loop;
-  identity_manager_->GetAccountInfoFromGaiaId(
+  GetIdentityManager()->GetAccountInfoFromGaiaId(
       kTestGaiaId,
       base::Bind(&IdentityManagerTest::OnReceivedAccountInfoFromGaiaId,
                  base::Unretained(this), run_loop.QuitClosure()));
@@ -479,7 +524,7 @@
   std::string account_id =
       account_tracker()->SeedAccountInfo(kTestGaiaId, kTestEmail);
   base::RunLoop run_loop;
-  identity_manager_->GetAccountInfoFromGaiaId(
+  GetIdentityManager()->GetAccountInfoFromGaiaId(
       kTestGaiaId,
       base::Bind(&IdentityManagerTest::OnReceivedAccountInfoFromGaiaId,
                  base::Unretained(this), run_loop.QuitClosure()));
@@ -499,7 +544,7 @@
       account_tracker()->SeedAccountInfo(kTestGaiaId, kTestEmail);
   token_service()->UpdateCredentials(account_id, kTestRefreshToken);
   base::RunLoop run_loop;
-  identity_manager_->GetAccountInfoFromGaiaId(
+  GetIdentityManager()->GetAccountInfoFromGaiaId(
       kTestGaiaId,
       base::Bind(&IdentityManagerTest::OnReceivedAccountInfoFromGaiaId,
                  base::Unretained(this), run_loop.QuitClosure()));
@@ -516,7 +561,7 @@
 // not signed in.
 TEST_F(IdentityManagerTest, GetAccessTokenNotSignedIn) {
   base::RunLoop run_loop;
-  identity_manager_->GetAccessToken(
+  GetIdentityManager()->GetAccessToken(
       kTestGaiaId, ScopeSet(), "dummy_consumer",
       base::Bind(&IdentityManagerTest::OnReceivedAccessToken,
                  base::Unretained(this), run_loop.QuitClosure()));
@@ -535,7 +580,7 @@
   token_service()->set_auto_post_fetch_response_on_message_loop(true);
   base::RunLoop run_loop;
 
-  identity_manager_->GetAccessToken(
+  GetIdentityManager()->GetAccessToken(
       account_id, ScopeSet(), "dummy_consumer",
       base::Bind(&IdentityManagerTest::OnReceivedAccessToken,
                  base::Unretained(this), run_loop.QuitClosure()));
diff --git a/services/identity/identity_service.cc b/services/identity/identity_service.cc
index 4043f538..f1de9573 100644
--- a/services/identity/identity_service.cc
+++ b/services/identity/identity_service.cc
@@ -17,9 +17,14 @@
       token_service_(token_service) {
   registry_.AddInterface<mojom::IdentityManager>(
       base::Bind(&IdentityService::Create, base::Unretained(this)));
+  signin_manager_shutdown_subscription_ =
+      signin_manager_->RegisterOnShutdownCallback(
+          base::Bind(&IdentityService::ShutDown, base::Unretained(this)));
 }
 
-IdentityService::~IdentityService() {}
+IdentityService::~IdentityService() {
+  ShutDown();
+}
 
 void IdentityService::OnStart() {}
 
@@ -31,8 +36,26 @@
                           std::move(interface_pipe));
 }
 
+void IdentityService::ShutDown() {
+  if (IsShutDown())
+    return;
+
+  signin_manager_ = nullptr;
+  signin_manager_shutdown_subscription_.reset();
+  token_service_ = nullptr;
+  account_tracker_ = nullptr;
+}
+
+bool IdentityService::IsShutDown() {
+  return (signin_manager_ == nullptr);
+}
+
 void IdentityService::Create(const service_manager::BindSourceInfo& source_info,
                              mojom::IdentityManagerRequest request) {
+  // This instance cannot service requests if it has already been shut down.
+  if (IsShutDown())
+    return;
+
   IdentityManager::Create(std::move(request), account_tracker_, signin_manager_,
                           token_service_);
 }
diff --git a/services/identity/identity_service.h b/services/identity/identity_service.h
index 1aa513d..fc6c268 100644
--- a/services/identity/identity_service.h
+++ b/services/identity/identity_service.h
@@ -5,12 +5,12 @@
 #ifndef SERVICES_IDENTITY_IDENTITY_SERVICE_H_
 #define SERVICES_IDENTITY_IDENTITY_SERVICE_H_
 
+#include "components/signin/core/browser/signin_manager_base.h"
 #include "services/identity/public/interfaces/identity_manager.mojom.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
 #include "services/service_manager/public/cpp/service.h"
 
 class AccountTrackerService;
-class SigninManagerBase;
 class ProfileOAuth2TokenService;
 
 namespace identity {
@@ -23,7 +23,7 @@
   ~IdentityService() override;
 
  private:
-  // |Service| override:
+  // service_manager::Service:
   void OnStart() override;
   void OnBindInterface(const service_manager::BindSourceInfo& source_info,
                        const std::string& interface_name,
@@ -32,10 +32,19 @@
   void Create(const service_manager::BindSourceInfo& source_info,
               mojom::IdentityManagerRequest request);
 
+  // Shuts down this instance, blocking it from serving any pending or future
+  // requests. Safe to call multiple times; will be a no-op after the first
+  // call.
+  void ShutDown();
+  bool IsShutDown();
+
   AccountTrackerService* account_tracker_;
   SigninManagerBase* signin_manager_;
   ProfileOAuth2TokenService* token_service_;
 
+  std::unique_ptr<base::CallbackList<void()>::Subscription>
+      signin_manager_shutdown_subscription_;
+
   service_manager::BinderRegistry registry_;
 
   DISALLOW_COPY_AND_ASSIGN(IdentityService);
diff --git a/services/metrics/public/cpp/ukm_recorder.cc b/services/metrics/public/cpp/ukm_recorder.cc
index 551c0128..0e8b2f6 100644
--- a/services/metrics/public/cpp/ukm_recorder.cc
+++ b/services/metrics/public/cpp/ukm_recorder.cc
@@ -33,7 +33,7 @@
 
 // static
 ukm::SourceId UkmRecorder::GetNewSourceID() {
-  static base::StaticAtomicSequenceNumber seq;
+  static base::AtomicSequenceNumber seq;
   return static_cast<ukm::SourceId>(seq.GetNext());
 }
 
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc
index 637260b..6747daa 100644
--- a/services/ui/ws/frame_generator.cc
+++ b/services/ui/ws/frame_generator.cc
@@ -36,7 +36,7 @@
   SetNeedsBeginFrame(true);
 }
 
-void FrameGenerator::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
+void FrameGenerator::OnSurfaceCreated(const viz::SurfaceInfo& surface_info) {
   DCHECK(surface_info.is_valid());
 
   // Only handle embedded surfaces changing here. The display root surface
diff --git a/services/ui/ws/frame_generator.h b/services/ui/ws/frame_generator.h
index eeea07d..a228e55 100644
--- a/services/ui/ws/frame_generator.h
+++ b/services/ui/ws/frame_generator.h
@@ -10,9 +10,9 @@
 #include "base/macros.h"
 #include "cc/ipc/compositor_frame_sink.mojom.h"
 #include "cc/scheduler/begin_frame_source.h"
-#include "cc/surfaces/surface_info.h"
 #include "components/viz/common/surfaces/local_surface_id_allocator.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "services/ui/ws/compositor_frame_sink_client_binding.h"
 #include "ui/gfx/geometry/rect.h"
 
@@ -34,7 +34,7 @@
   void SetHighContrastMode(bool enabled);
 
   // Updates the WindowManager's SurfaceInfo.
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
+  void OnSurfaceCreated(const viz::SurfaceInfo& surface_info);
 
   void OnWindowDamaged();
   void OnWindowSizeChanged(const gfx::Size& pixel_size);
@@ -70,7 +70,7 @@
   viz::LocalSurfaceIdAllocator id_allocator_;
   float last_device_scale_factor_ = 0.0f;
 
-  cc::SurfaceInfo window_manager_surface_info_;
+  viz::SurfaceInfo window_manager_surface_info_;
 
   DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
 };
diff --git a/services/ui/ws/frame_generator_unittest.cc b/services/ui/ws/frame_generator_unittest.cc
index 9cba8f1d..aa882a7c 100644
--- a/services/ui/ws/frame_generator_unittest.cc
+++ b/services/ui/ws/frame_generator_unittest.cc
@@ -26,9 +26,9 @@
 const viz::SurfaceId kArbitrarySurfaceId(
     viz::FrameSinkId(1, 1),
     viz::LocalSurfaceId(1, base::UnguessableToken::Create()));
-const cc::SurfaceInfo kArbitrarySurfaceInfo(kArbitrarySurfaceId,
-                                            1.0f,
-                                            gfx::Size(100, 100));
+const viz::SurfaceInfo kArbitrarySurfaceInfo(kArbitrarySurfaceId,
+                                             1.0f,
+                                             gfx::Size(100, 100));
 }
 
 // TestClientBinding Observes a BeginFrame and accepts CompositorFrame submitted
diff --git a/services/ui/ws/test_change_tracker.cc b/services/ui/ws/test_change_tracker.cc
index 4371e5cf..626c1bb 100644
--- a/services/ui/ws/test_change_tracker.cc
+++ b/services/ui/ws/test_change_tracker.cc
@@ -457,7 +457,7 @@
 
 void TestChangeTracker::OnWindowSurfaceChanged(
     Id window_id,
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   Change change;
   change.type = CHANGE_TYPE_SURFACE_CHANGED;
   change.window_id = window_id;
diff --git a/services/ui/ws/test_change_tracker.h b/services/ui/ws/test_change_tracker.h
index ef10ede..4b64275 100644
--- a/services/ui/ws/test_change_tracker.h
+++ b/services/ui/ws/test_change_tracker.h
@@ -187,7 +187,7 @@
                          mojom::WindowDataPtr window_data,
                          bool drawn);
   void OnWindowSurfaceChanged(Id window_id,
-                              const cc::SurfaceInfo& surface_info);
+                              const viz::SurfaceInfo& surface_info);
 
  private:
   void AddChange(const Change& change);
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc
index 8d9bafa9..6a7f622 100644
--- a/services/ui/ws/test_utils.cc
+++ b/services/ui/ws/test_utils.cc
@@ -439,7 +439,7 @@
 
 void TestWindowTreeClient::OnWindowSurfaceChanged(
     Id window_id,
-    const cc::SurfaceInfo& surface_info) {}
+    const viz::SurfaceInfo& surface_info) {}
 
 void TestWindowTreeClient::OnDragDropStart(
     const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) {}
diff --git a/services/ui/ws/test_utils.h b/services/ui/ws/test_utils.h
index 633fefb..fee76599 100644
--- a/services/ui/ws/test_utils.h
+++ b/services/ui/ws/test_utils.h
@@ -497,7 +497,7 @@
   void OnWindowCursorChanged(uint32_t window_id,
                              ui::CursorData cursor) override;
   void OnWindowSurfaceChanged(Id window_id,
-                              const cc::SurfaceInfo& surface_info) override;
+                              const viz::SurfaceInfo& surface_info) override;
   void OnDragDropStart(
       const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data)
       override;
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index cb26903..5e802ac6 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -860,7 +860,7 @@
   delegate_->StartDisplayInit();
 }
 
-void WindowServer::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
+void WindowServer::OnSurfaceCreated(const viz::SurfaceInfo& surface_info) {
   WindowId window_id(
       WindowIdFromTransportId(surface_info.id().frame_sink_id().client_id()));
   ServerWindow* window = GetWindow(window_id);
diff --git a/services/ui/ws/window_server.h b/services/ui/ws/window_server.h
index 090948a..bdac6fd 100644
--- a/services/ui/ws/window_server.h
+++ b/services/ui/ws/window_server.h
@@ -358,7 +358,7 @@
   void OnGpuServiceInitialized() override;
 
   // cc::mojom::FrameSinkManagerClient:
-  void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override;
+  void OnSurfaceCreated(const viz::SurfaceInfo& surface_info) override;
   void OnClientConnectionClosed(const viz::FrameSinkId& frame_sink_id) override;
 
   // UserIdTrackerObserver:
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 319fbee..92bbfdf 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -970,7 +970,7 @@
 
 void WindowTree::ProcessWindowSurfaceChanged(
     ServerWindow* window,
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   ClientWindowId client_window_id;
   if (!IsWindowKnown(window, &client_window_id))
     return;
diff --git a/services/ui/ws/window_tree.h b/services/ui/ws/window_tree.h
index f63970f..a6a128c 100644
--- a/services/ui/ws/window_tree.h
+++ b/services/ui/ws/window_tree.h
@@ -279,7 +279,7 @@
                                      const ServerWindow* transient_window,
                                      bool originated_change);
   void ProcessWindowSurfaceChanged(ServerWindow* window,
-                                   const cc::SurfaceInfo& surface_info);
+                                   const viz::SurfaceInfo& surface_info);
 
   // Sends this event to the client if it matches an active pointer watcher.
   // |target_window| is the target of the event, and may be null or not known
diff --git a/services/ui/ws/window_tree_client_unittest.cc b/services/ui/ws/window_tree_client_unittest.cc
index ff7d0f7..9ca22f5 100644
--- a/services/ui/ws/window_tree_client_unittest.cc
+++ b/services/ui/ws/window_tree_client_unittest.cc
@@ -399,7 +399,7 @@
   }
 
   void OnWindowSurfaceChanged(Id window_id,
-                              const cc::SurfaceInfo& surface_info) override {
+                              const viz::SurfaceInfo& surface_info) override {
     tracker_.OnWindowSurfaceChanged(window_id, surface_info);
   }
 
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index e9bf392..9c54e65 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -4207,7 +4207,7 @@
       },
       {
         "swarming": {
-          "can_use_on_swarming_builders": true
+          "can_use_on_swarming_builders": false
         },
         "test": "traffic_annotation_auditor_unittests"
       },
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
index 34e47cfe..24cfcd2d 100644
--- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
+++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -4319,7 +4319,6 @@
 crbug.com/591099 external/wpt/css/CSS2/text/text-decoration-applies-to-014.xht [ Failure ]
 crbug.com/591099 external/wpt/css/CSS2/text/text-decoration-applies-to-015.xht [ Failure ]
 crbug.com/591099 external/wpt/css/CSS2/text/text-indent-012.xht [ Failure ]
-crbug.com/591099 external/wpt/css/CSS2/text/text-indent-percent-001.xht [ Failure ]
 crbug.com/591099 external/wpt/css/CSS2/text/text-transform-capitalize-003.xht [ Failure ]
 crbug.com/591099 external/wpt/css/CSS2/text/white-space-mixed-002.xht [ Failure ]
 crbug.com/591099 external/wpt/css/CSS2/text/white-space-normal-001.xht [ Failure ]
@@ -16896,7 +16895,6 @@
 crbug.com/591099 inspector/profiler/heap-snapshot-summary-sorting.html [ Crash Failure ]
 crbug.com/591099 inspector/profiler/heap-snapshot-weak-dominator.html [ Crash Pass ]
 crbug.com/591099 inspector/profiler/heap-snapshot.html [ Crash Failure ]
-crbug.com/591099 inspector/profiler/temp-storage-cleaner.html [ Crash Failure ]
 crbug.com/591099 inspector/quick-open/command-menu.html [ Crash Failure ]
 crbug.com/591099 inspector/remote-object.html [ Failure ]
 crbug.com/591099 inspector/report-API-errors.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/animations/font-size-using-ems-expected.txt b/third_party/WebKit/LayoutTests/animations/font-size-using-ems-expected.txt
deleted file mode 100644
index 9946f7c..0000000
--- a/third_party/WebKit/LayoutTests/animations/font-size-using-ems-expected.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This test performs an animation of the font-size property using 'em' units. It tests whether or not we are properly getting the default font-size. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text.
-PASS
diff --git a/third_party/WebKit/LayoutTests/animations/font-size-using-ems.html b/third_party/WebKit/LayoutTests/animations/font-size-using-ems.html
new file mode 100644
index 0000000..730e974
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/animations/font-size-using-ems.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id="box"></div>
+<style>
+    body {
+        font-size: 30px;
+    }
+    #box {
+        animation-duration: 3s;
+        animation-timing-function: linear;
+        animation-delay: -1s;
+        animation-play-state: paused;
+        animation-name: anim;
+    }
+    @keyframes anim {
+        from { font-size: 1em; }
+        to   { font-size: 2em; }
+    }
+</style>
+<script>
+test(() => {
+    assert_equals(getComputedStyle(box).fontSize, '40px');
+}, 'font-size animation using em units gets the default font size');
+</script>
diff --git a/third_party/WebKit/LayoutTests/animations/font-size-using-ems.html-disabled b/third_party/WebKit/LayoutTests/animations/font-size-using-ems.html-disabled
deleted file mode 100644
index 8daee271..0000000
--- a/third_party/WebKit/LayoutTests/animations/font-size-using-ems.html-disabled
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
-<html lang="en">
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Test of font-size Animation Using em Units</title>
-  <style type="text/css" media="screen">
-    body {
-        font-family: "arial";
-        font-size: 10px;    
-    }
-    
-    #box {
-        position: absolute;
-        left: 0;
-        top: 100px;
-        height: 250px;
-        width: 400px;
-        border: 1px solid black;
-        animation-duration: 1s;
-        animation-timing-function: linear;
-        animation-name: anim;
-    }
-    @keyframes anim {
-        from { font-size: 1em; }
-        to   { font-size: 2em; }
-    }
-    </style>
-    <script type="text/javascript" charset="utf-8">
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-    }
-    
-    result = "PASS";
-    const defaultTolerance = 1;
-    
-    function isEqual(actual, desired, tolerance)
-    {
-        if (tolerance == undefined || tolerance == 0)
-            tolerance = defaultTolerance;
-        var diff = Math.abs(actual - desired);
-        return diff < tolerance;
-    }
-    
-    function snapshot(expected)
-    {
-        if (result != "PASS")
-            return;
-            
-        var fontSize = parseInt(window.getComputedStyle(document.getElementById('box')).fontSize);
-        if (!isEqual(fontSize, expected)) {
-            result = "FAIL(was:"+fontSize+", expected:"+expected+")";
-        }
-    }
-
-    function start()
-    {
-        setTimeout("snapshot(13)", 333);
-        
-        window.setTimeout(function() {
-            document.getElementById('result').innerHTML = result;
-            if (window.testRunner)
-                testRunner.notifyDone();
-        }, 400);
-    }
-    
-    document.addEventListener('animationstart', start, false);
-    
-  </script>
-</head>
-<body>
-This test performs an animation of the font-size property using 'em' units. It tests whether or not we are properly 
-getting the default font-size.
-<div id="box">
-Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. 
-Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. Here is some text. 
-</div>
-<div id="result">
-</div>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt
new file mode 100644
index 0000000..4ed287e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https-expected.txt
@@ -0,0 +1,4 @@
+This is a testharness.js-based test.
+FAIL Service Worker responds to fetch event with the referrer policy assert_unreached: unexpected rejection: assert_equals: Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present expected "Referrer: https://web-platform.test:8444/service-workers/service-worker/fake-referrer\nReferrerPolicy: no-referrer-when-downgrade" but got "Referrer: https://web-platform.test:8444/service-workers/service-worker/resources/fake-referrer\nReferrerPolicy: no-referrer-when-downgrade" Reached unreachable code
+Harness: the test ran to completion.
+
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html
new file mode 100644
index 0000000..9b67facc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-referrer-policy.https.html
@@ -0,0 +1,266 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+var worker = 'resources/fetch-event-test-worker.js';
+
+function run_referrer_policy_tests(frame, referrer, href, origin) {
+    return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                     {method: "GET", referrer: referrer})
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {method: "GET", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with the referrer with ""');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with no referrer with ""');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + origin + '/' + '\n' +
+            'ReferrerPolicy: origin',
+            'Service Worker should respond to fetch with the referrer origin with "origin" and a same origin request');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + origin + '/' + '\n' +
+            'ReferrerPolicy: origin',
+            'Service Worker should respond to fetch with the referrer origin with "origin" and a cross origin request');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "origin-when-cross-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: origin-when-cross-origin',
+            'Service Worker should respond to fetch with the referrer URL with "origin-when-cross-origin" and a same origin request');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "origin-when-cross-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + origin + '/' + '\n' +
+            'ReferrerPolicy: origin-when-cross-origin',
+            'Service Worker should respond to fetch with the referrer origin with "origin-when-cross-origin" and a cross origin request');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "no-referrer-when-downgrade", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and a same origin request');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "no-referrer-when-downgrade", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url, {referrerPolicy: "unsafe-url", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: unsafe-url',
+            'Service Worker should respond to fetch with no referrer with "unsafe-url"');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "no-referrer", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: no-referrer',
+            'Service Worker should respond to fetch with no referrer URL with "no-referrer"');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "same-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: same-origin',
+            'Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request');
+          var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "same-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: same-origin',
+            'Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request');
+          var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "strict-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + origin + '/' + '\n' +
+            'ReferrerPolicy: strict-origin',
+            'Service Worker should respond to fetch with the referrer origin  with "strict-origin" and a HTTPS cross origin request');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "strict-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + origin + '/' + '\n' +
+            'ReferrerPolicy: strict-origin',
+            'Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "strict-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: strict-origin',
+            'Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request');
+          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
+                                           {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + href + '\n' +
+            'ReferrerPolicy: strict-origin-when-cross-origin',
+            'Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request');
+          var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: ' + origin + '/' + '\n' +
+            'ReferrerPolicy: strict-origin-when-cross-origin',
+            'Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request');
+          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
+                         '/resources/simple.html?referrerFull';
+          return frame.contentWindow.fetch(http_url,
+                                           {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
+        })
+      .then(function(response) { return response.text(); })
+      .then(function(response_text) {
+          assert_equals(
+            response_text,
+            'Referrer: \n' +
+            'ReferrerPolicy: strict-origin-when-cross-origin',
+            'Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request');
+        });
+}
+
+async_test(function(t) {
+    var scope = 'resources/simple.html?referrerPolicy';
+    var frame;
+    service_worker_unregister_and_register(t, worker, scope)
+      .then(function(reg) {
+          return wait_for_state(t, reg.installing, 'activated');
+        })
+      .then(function() { return with_iframe(scope); })
+      .then(function(f) {
+          frame = f;
+          assert_equals(
+            frame.contentDocument.body.textContent,
+            'ReferrerPolicy: no-referrer-when-downgrade',
+            'Service Worker should respond to fetch with the default referrer policy');
+          // First, run the referrer policy tests without passing a referrer in RequestInit.
+          return run_referrer_policy_tests(frame, undefined, frame.contentDocument.location.href,
+                                           frame.contentDocument.location.origin);
+        })
+      .then(function() {
+          // Now, run the referrer policy tests while passing a referrer in RequestInit.
+          var referrer = get_host_info()['HTTPS_ORIGIN'] + base_path() + 'fake-referrer';
+          return run_referrer_policy_tests(frame, 'fake-referrer', referrer,
+                                           frame.contentDocument.location.origin);
+        })
+      .then(function() {
+          frame.remove();
+          return service_worker_unregister_and_done(t, scope);
+        })
+      .catch(unreached_rejection(t));
+  }, 'Service Worker responds to fetch event with the referrer policy');
+
+</script>
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https-expected.txt
index 10c40ef1..0e0dfe1 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https-expected.txt
@@ -3,7 +3,6 @@
 PASS Service Worker responds to fetch event with string 
 PASS Service Worker responds to fetch event with blob body 
 PASS Service Worker responds to fetch event with the referrer URL 
-FAIL Service Worker responds to fetch event with the referrer policy assert_unreached: unexpected rejection: Failed to fetch Reached unreachable code
 PASS Service Worker responds to fetch event with an existing client id 
 PASS Service Worker does not respond to fetch event 
 PASS Service Worker responds to fetch event with null response body 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https.html
index ba313c5..51446cae 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event.https.html
@@ -98,261 +98,6 @@
       .catch(unreached_rejection(t));
   }, 'Service Worker responds to fetch event with the referrer URL');
 
-function run_referrer_policy_tests(frame, referrer, href, origin) {
-    return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                     {method: "GET", referrer: referrer})
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with the referrer URL when a member of RequestInit is present');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {method: "GET", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with no referrer when a member of RequestInit is present with an HTTP request');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with the referrer with ""');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with no referrer with ""');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + origin + '/' + '\n' +
-            'ReferrerPolicy: origin',
-            'Service Worker should respond to fetch with the referrer origin with "origin" and a same origin request');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + origin + '/' + '\n' +
-            'ReferrerPolicy: origin',
-            'Service Worker should respond to fetch with the referrer origin with "origin" and a cross origin request');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "origin-when-cross-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: origin-when-cross-origin',
-            'Service Worker should respond to fetch with the referrer URL with "origin-when-cross-origin" and a same origin request');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "origin-when-cross-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + origin + '/' + '\n' +
-            'ReferrerPolicy: origin-when-cross-origin',
-            'Service Worker should respond to fetch with the referrer origin with "origin-when-cross-origin" and a cross origin request');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "no-referrer-when-downgrade", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and a same origin request');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "no-referrer-when-downgrade", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with no referrer with "no-referrer-when-downgrade" and an HTTP request');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url, {referrerPolicy: "unsafe-url", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: unsafe-url',
-            'Service Worker should respond to fetch with no referrer with "unsafe-url"');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "no-referrer", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: no-referrer',
-            'Service Worker should respond to fetch with no referrer URL with "no-referrer"');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "same-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: same-origin',
-            'Service Worker should respond to fetch with referrer URL with "same-origin" and a same origin request');
-          var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "same-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: same-origin',
-            'Service Worker should respond to fetch with no referrer with "same-origin" and cross origin request');
-          var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "strict-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + origin + '/' + '\n' +
-            'ReferrerPolicy: strict-origin',
-            'Service Worker should respond to fetch with the referrer origin  with "strict-origin" and a HTTPS cross origin request');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "strict-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + origin + '/' + '\n' +
-            'ReferrerPolicy: strict-origin',
-            'Service Worker should respond to fetch with the referrer origin with "strict-origin" and a same origin request');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "strict-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: strict-origin',
-            'Service Worker should respond to fetch with no referrer with "strict-origin" and a HTTP request');
-          return frame.contentWindow.fetch('resources/simple.html?referrerFull',
-                                           {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + href + '\n' +
-            'ReferrerPolicy: strict-origin-when-cross-origin',
-            'Service Worker should respond to fetch with the referrer URL with "strict-origin-when-cross-origin" and a same origin request');
-          var http_url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: ' + origin + '/' + '\n' +
-            'ReferrerPolicy: strict-origin-when-cross-origin',
-            'Service Worker should respond to fetch with the referrer origin with "strict-origin-when-cross-origin" and a HTTPS cross origin request');
-          var http_url = get_host_info()['HTTP_ORIGIN'] + base_path() +
-                         '/resources/simple.html?referrerFull';
-          return frame.contentWindow.fetch(http_url,
-                                           {referrerPolicy: "strict-origin-when-cross-origin", referrer: referrer});
-        })
-      .then(function(response) { return response.text(); })
-      .then(function(response_text) {
-          assert_equals(
-            response_text,
-            'Referrer: \n' +
-            'ReferrerPolicy: strict-origin-when-cross-origin',
-            'Service Worker should respond to fetch with no referrer with "strict-origin-when-cross-origin" and a HTTP request');
-        });
-}
-
-async_test(function(t) {
-    var scope = 'resources/simple.html?referrerPolicy';
-    var frame;
-    service_worker_unregister_and_register(t, worker, scope)
-      .then(function(reg) {
-          return wait_for_state(t, reg.installing, 'activated');
-        })
-      .then(function() { return with_iframe(scope); })
-      .then(function(f) {
-          frame = f;
-          assert_equals(
-            frame.contentDocument.body.textContent,
-            'ReferrerPolicy: no-referrer-when-downgrade',
-            'Service Worker should respond to fetch with the default referrer policy');
-          // First, run the referrer policy tests without passing a referrer in RequestInit.
-          return run_referrer_policy_tests(frame, undefined, frame.contentDocument.location.href,
-                                           frame.contentDocument.location.origin);
-        })
-      .then(function() {
-          // Now, run the referrer policy tests while passing a referrer in RequestInit.
-          var referrer = get_host_info()['HTTPS_ORIGIN'] + base_path() + 'fake-referrer';
-          return run_referrer_policy_tests(frame, 'fake-referrer', referrer,
-                                           frame.contentDocument.location.origin);
-        })
-      .then(function() {
-          frame.remove();
-          return service_worker_unregister_and_done(t, scope);
-        })
-      .catch(unreached_rejection(t));
-  }, 'Service Worker responds to fetch event with the referrer policy');
-
 async_test(function(t) {
     var scope = 'resources/simple.html?clientId';
     var frame;
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
index 935d93e6..df56d36 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/inspector-test.js
@@ -851,100 +851,6 @@
     }
 };
 
-
-/**
- * @constructor
- * @param {!string} dirPath
- * @param {!string} name
- */
-InspectorTest.TempFileMock = function(dirPath, name)
-{
-    this._chunks = [];
-    this._name = name;
-}
-
-InspectorTest.TempFileMock.prototype = {
-    /**
-     * @param {!Array.<string>} chunks
-     * @return {!Promise<boolean>}
-     */
-    write: async function(chunks)
-    {
-        var size = chunks.reduce((total, chunk) => total + chunk.length, 0);
-        this._chunks.push.apply(this._chunks, chunks);
-        await new Promise(resolve => setTimeout(resolve, 1));
-        return size;
-    },
-
-    finishWriting: function() { },
-
-    /**
-     * @return {!Promise<?string>}
-     */
-    read: function()
-    {
-        return this.readRange();
-    },
-
-    /**
-     * @param {number=} startOffset
-     * @param {number=} endOffset
-     * @return {!Promise<?string>}
-     */
-    readRange: function(startOffset, endOffset)
-    {
-        return new Promise(resolve => {
-            var blob = new Blob(this._chunks);
-            blob = blob.slice(startOffset || 0, endOffset || blob.size);
-            reader = new FileReader();
-            reader.onloadend = () => resolve(reader.result);
-            reader.readAsText(blob);
-        });
-    },
-
-    /**
-     * @param {!Common.OutputStream} outputStream
-     * @param {function(*)=} progress
-     * @return {!Promise<boolean>}
-     */
-    copyToOutputStream: function(outputStream, progress)
-    {
-        var name = this._name;
-        var text = this._chunks.join("");
-        var chunkedReaderMock = {
-            loadedSize: function()
-            {
-                return text.length;
-            },
-
-            fileSize: function()
-            {
-                return text.length;
-            },
-
-            fileName: function()
-            {
-                return name;
-            },
-
-            cancel: function() { }
-        }
-        outputStream.write(text);
-        if (progress)
-          progress(chunkedReaderMock);
-        outputStream.close();
-        return Promise.resolve(true);
-    },
-
-    remove: function() { }
-}
-
-InspectorTest.TempFileMock.create = function(dirPath, name)
-{
-    var tempFile = new InspectorTest.TempFileMock(dirPath, name);
-    return Promise.resolve(tempFile);
-}
-
 InspectorTest.loadedModules = function()
 {
     return self.runtime._modules.filter(module => module._loadedForTest);
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js
index 3cae88d..5ad1ff5 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js
@@ -8,7 +8,6 @@
 var initialize_Timeline = function() {
 
 InspectorTest.preloadPanel("timeline");
-Bindings.TempFile = InspectorTest.TempFileMock;
 
 // Scrub values when printing out these properties in the record or data field.
 InspectorTest.timelinePropertyFormatters = {
@@ -299,59 +298,6 @@
     return null;
 }
 
-InspectorTest.FakeFileReader = class {
-    constructor(input, chunkSize, chunkTransferredCallback)
-    {
-        this._input = input;
-        this._loadedSize = 0;
-        this._fileSize = input.length;
-        this._chunkTransferredCallback = chunkTransferredCallback;
-    }
-
-    read(output)
-    {
-        var length = this._input.length;
-        var half = (length + 1) >> 1;
-
-        var chunk = this._input.substring(0, half);
-        this._loadedSize += chunk.length;
-        output.write(chunk);
-        if (this._chunkTransferredCallback)
-            this._chunkTransferredCallback(this);
-
-        chunk = this._input.substring(half);
-        this._loadedSize += chunk.length;
-        output.write(chunk);
-        if (this._chunkTransferredCallback)
-            this._chunkTransferredCallback(this);
-
-        output.close();
-        return Promise.resolve(true);
-    }
-
-    cancel() { }
-
-    loadedSize()
-    {
-        return this._loadedSize;
-    }
-
-    fileSize()
-    {
-        return this._fileSize;
-    }
-
-    fileName()
-    {
-        return "fakeFile";
-    }
-
-    error()
-    {
-        return null;
-    }
-};
-
 InspectorTest.dumpFrame = function(frame)
 {
     var fieldsToDump = ["cpuTime", "duration", "startTime", "endTime", "id", "mainThreadFrameId", "timeByCategory", "other", "scripting", "painting", "rendering", "committedFrom", "idle"];
@@ -415,9 +361,8 @@
 
 InspectorTest.loadTimeline = function(timelineData)
 {
-    Bindings.ChunkedFileReader = InspectorTest.FakeFileReader;
     var promise = new Promise(fulfill => InspectorTest.runWhenTimelineIsReady(fulfill));
-    UI.panels.timeline._loadFromFile(timelineData);
+    UI.panels.timeline._loadFromFile(new Blob([timelineData], {type: 'text/plain'}));
     return promise;
 }
 
diff --git a/third_party/WebKit/LayoutTests/inspector/profiler/cpu-profiler-save-load.html b/third_party/WebKit/LayoutTests/inspector/profiler/cpu-profiler-save-load.html
index c13248d7..db660d70 100644
--- a/third_party/WebKit/LayoutTests/inspector/profiler/cpu-profiler-save-load.html
+++ b/third_party/WebKit/LayoutTests/inspector/profiler/cpu-profiler-save-load.html
@@ -42,10 +42,6 @@
     InspectorTest.runProfilerTestSuite([
         function testSave(next)
         {
-            function waitForTempFile(view)
-            {
-                InspectorTest.addSniffer(view._profileHeader, "_writeToTempFile", saveProfileToFile.bind(this, view._profileHeader));
-            }
             function saveProfileToFile(profile)
             {
                 Bindings.FileOutputStream = function() { }
@@ -86,7 +82,7 @@
                 profile.saveToFile();
             }
             InspectorTest.showProfileWhenAdded("manual");
-            InspectorTest.waitUntilProfileViewIsShown("manual", waitForTempFile.bind(this));
+            InspectorTest.waitUntilProfileViewIsShown("manual", view => saveProfileToFile(view._profileHeader));
             InspectorTest.evaluateInPage("pageFunction()", function done() {});
         },
 
diff --git a/third_party/WebKit/LayoutTests/inspector/profiler/heap-snapshot-summary-expand-collapse-expected.txt b/third_party/WebKit/LayoutTests/inspector/profiler/heap-snapshot-summary-expand-collapse-expected.txt
new file mode 100644
index 0000000..4b9a904
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/profiler/heap-snapshot-summary-expand-collapse-expected.txt
@@ -0,0 +1,20 @@
+https://crbug.com/738932 Tests the snapshot view is not empty on repeatitive expand-collapse.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShowAll
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+A data-grid-data-grid-node parent revealed
+undefined data-grid-data-grid-node revealed
+
+Profiler was disabled.
+
diff --git a/third_party/WebKit/LayoutTests/inspector/profiler/heap-snapshot-summary-expand-collapse.html b/third_party/WebKit/LayoutTests/inspector/profiler/heap-snapshot-summary-expand-collapse.html
new file mode 100644
index 0000000..42c16aa
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/profiler/heap-snapshot-summary-expand-collapse.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="heap-snapshot-test.js"></script>
+<script>
+
+function test()
+{
+    var instanceCount = 25;
+    function createHeapSnapshot()
+    {
+        return InspectorTest.createHeapSnapshot(instanceCount);
+    }
+
+    InspectorTest.runHeapSnapshotTestSuite([
+        function testShowAll(next)
+        {
+            InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
+
+            function step1()
+            {
+                InspectorTest.switchToView("Summary", step2);
+            }
+
+            function step2()
+            {
+                InspectorTest.findAndExpandRow("A", step3);
+            }
+
+            function step3(row)
+            {
+                row.collapse();
+                row.expand();
+                for (var child of row.children)
+                    InspectorTest.addResult(child._name + " " + child._element.classList.value);
+                next();
+            }
+        }
+    ]);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>
+https://crbug.com/738932
+Tests the snapshot view is not empty on repeatitive expand-collapse.
+</p>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/inspector/profiler/profiler-test.js b/third_party/WebKit/LayoutTests/inspector/profiler/profiler-test.js
index 79e0808..1857d890 100644
--- a/third_party/WebKit/LayoutTests/inspector/profiler/profiler-test.js
+++ b/third_party/WebKit/LayoutTests/inspector/profiler/profiler-test.js
@@ -1,7 +1,6 @@
 var initialize_ProfilerTest = function() {
 
 InspectorTest.preloadPanel("js_profiler");
-Bindings.TempFile = InspectorTest.TempFileMock;
 
 InspectorTest.startProfilerTest = function(callback)
 {
diff --git a/third_party/WebKit/LayoutTests/inspector/profiler/temp-storage-cleaner-expected.txt b/third_party/WebKit/LayoutTests/inspector/profiler/temp-storage-cleaner-expected.txt
deleted file mode 100644
index 9aaa4eb..0000000
--- a/third_party/WebKit/LayoutTests/inspector/profiler/temp-storage-cleaner-expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This test checks TempStorageCleaner which is used in HeapProfiler.
-
-PASSED: we got a call from TempStorageCleaner that it had done the job.
-
diff --git a/third_party/WebKit/LayoutTests/inspector/profiler/temp-storage-cleaner.html b/third_party/WebKit/LayoutTests/inspector/profiler/temp-storage-cleaner.html
deleted file mode 100644
index 5ca5996..0000000
--- a/third_party/WebKit/LayoutTests/inspector/profiler/temp-storage-cleaner.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<html>
-<head>
-<script src="../../http/tests/inspector/inspector-test.js"></script>
-<script>
-
-function test()
-{
-    Bindings.TempFile.ensureTempStorageCleared()
-        .then(function finish() {
-                InspectorTest.addResult("PASSED: we got a call from TempStorageCleaner that it had done the job.");
-            }, function(e) {
-                InspectorTest.addResult("FAILED: we got a rejection: " + e);
-            })
-        .then(InspectorTest.completeTest);
-}
-
-</script>
-</head>
-
-<body onload="runTest()">
-<p>
-This test checks TempStorageCleaner which is used in HeapProfiler.
-</p>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load-expected.txt
index 9c6fa1d..a72c13b 100644
--- a/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load-expected.txt
@@ -3,28 +3,24 @@
 
 Running: testNormal
 TimelineLoaderClient.loadingStarted()
-TimelineLoaderClient.loadingProgress()
 TimelineLoaderClient.processingStarted()
 TimelineLoaderClient.loadingComplete(true)
 Saved data is equal to restored data: true
 
 Running: testJSONObjectFormat
 TimelineLoaderClient.loadingStarted()
-TimelineLoaderClient.loadingProgress()
 TimelineLoaderClient.processingStarted()
 TimelineLoaderClient.loadingComplete(true)
 Saved data is equal to restored data: true
 
 Running: testJSONObjectFormatWithMetadata
 TimelineLoaderClient.loadingStarted()
-TimelineLoaderClient.loadingProgress()
 TimelineLoaderClient.processingStarted()
 TimelineLoaderClient.loadingComplete(true)
 Saved data is equal to restored data: true
 
 Running: testBroken
 TimelineLoaderClient.loadingStarted()
-TimelineLoaderClient.loadingProgress()
 TimelineLoaderClient.processingStarted()
 TimelineLoaderClient.loadingComplete(true)
 Model is empty: true
diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load.html b/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load.html
index b707015..88413594 100644
--- a/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load.html
+++ b/third_party/WebKit/LayoutTests/inspector/tracing/tracing-timeline-load.html
@@ -19,7 +19,6 @@
 
         loadingProgress: function()
         {
-            InspectorTest.addResult("TimelineLoaderClient.loadingProgress()");
         },
 
         processingStarted: function()
@@ -48,9 +47,9 @@
             callback();
         }
 
-        Bindings.ChunkedFileReader = InspectorTest.FakeFileReader;
         var client = new InspectorTest.TestTimelineLoaderClient();
-        var loader = Timeline.TimelineLoader.loadFromFile(input, client);
+        var blob = new Blob([input], {type: 'text/pain'});
+        var loader = Timeline.TimelineLoader.loadFromFile(blob, client);
         var stream = new InspectorTest.StringOutputStream(InspectorTest.safeWrap(checkSaveData));
         var model = await client.modelPromise();
         var storage = model.backingStorage();
@@ -60,9 +59,9 @@
 
     async function runTestOnMalformedInput(input, callback)
     {
-        Bindings.ChunkedFileReader = InspectorTest.FakeFileReader;
         var client = new InspectorTest.TestTimelineLoaderClient();
-        var loader = Timeline.TimelineLoader.loadFromFile(input, client);
+        var blob = new Blob([input], {type: 'text/pain'});
+        var loader = Timeline.TimelineLoader.loadFromFile(blob, client);
         var model = await client.modelPromise();
         InspectorTest.addResult("Model is empty: " + (!model || (!model.minimumRecordTime() && !model.maximumRecordTime())));
         callback();
diff --git a/third_party/WebKit/LayoutTests/resources/testharnessreport.js b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
index 72ddacd0..7a31e662 100644
--- a/third_party/WebKit/LayoutTests/resources/testharnessreport.js
+++ b/third_party/WebKit/LayoutTests/resources/testharnessreport.js
@@ -23,6 +23,14 @@
         testRunner.setCanOpenWindows();
         testRunner.setCloseRemainingWindowsWhenComplete(true);
         testRunner.setDumpJavaScriptDialogs(false);
+
+        // fetch-event-referrer-policy.https.html intentiontially loads mixed
+        // content in order to test the referrer policy, so
+        // WebKitAllowRunningInsecureContent must be set to true or else the
+        // load would be blocked.
+        if (document.URL.indexOf("service-workers/service-worker/fetch-event-referrer-policy.https.html") >= 0) {
+            testRunner.overridePreference('WebKitAllowRunningInsecureContent', true);
+        }
     }
 
     // Disable the default output of testharness.js.  The default output formats
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp b/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp
index a33c9df..4d7d90e 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp
@@ -17,9 +17,9 @@
 #include "bindings/core/v8/V8Element.h"
 #include "core/animation/ElementAnimation.h"
 #include "core/dom/ChildNode.h"
-#include "core/dom/ElementFullscreen.h"
 #include "core/dom/NonDocumentTypeChildNode.h"
 #include "core/dom/ParentNode.h"
+#include "core/fullscreen/ElementFullscreen.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp b/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
index d51b16f..77f720c6 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp
@@ -18,9 +18,9 @@
 #include "bindings/core/v8/V8Element.h"
 #include "core/animation/ElementAnimation.h"
 #include "core/dom/ChildNode.h"
-#include "core/dom/ElementFullscreen.h"
 #include "core/dom/NonDocumentTypeChildNode.h"
 #include "core/dom/ParentNode.h"
+#include "core/fullscreen/ElementFullscreen.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp
index 3ad6a050a2..515a81c 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp
@@ -15,8 +15,8 @@
 #include "bindings/core/v8/V8DOMConfiguration.h"
 #include "bindings/core/v8/V8Location.h"
 #include "core/animation/DocumentAnimation.h"
-#include "core/dom/DocumentFullscreen.h"
 #include "core/dom/ExecutionContext.h"
+#include "core/fullscreen/DocumentFullscreen.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/xml/DocumentXPathEvaluator.h"
 #include "platform/bindings/V8ObjectConstructor.h"
diff --git a/third_party/WebKit/Source/build/scripts/css_properties.py b/third_party/WebKit/Source/build/scripts/css_properties.py
index 32d1378..ce3f280 100755
--- a/third_party/WebKit/Source/build/scripts/css_properties.py
+++ b/third_party/WebKit/Source/build/scripts/css_properties.py
@@ -33,6 +33,13 @@
     def __init__(self, file_paths):
         json5_generator.Writer.__init__(self, file_paths)
 
+        # StylePropertyMetadata assumes that there are at most 1024 properties + aliases.
+        self._alias_offset = 512
+        # 0: CSSPropertyInvalid
+        # 1: CSSPropertyApplyAtRule
+        # 2: CSSPropertyVariable
+        self._first_enum_value = 3
+
         properties = self.json5_file.name_dictionaries
 
         # Sort properties by priority, then alphabetically.
@@ -56,13 +63,8 @@
         self._aliases = [property for property in properties if property['alias_for']]
         properties = [property for property in properties if not property['alias_for']]
 
-        # 0: CSSPropertyInvalid
-        # 1: CSSPropertyApplyAtRule
-        # 2: CSSPropertyVariable
-        self._first_enum_value = 3
-
-        # StylePropertyMetadata additionally assumes there are under 1024 properties.
-        assert self._first_enum_value + len(properties) < 512, 'Property aliasing expects there are under 512 properties.'
+        assert (self._first_enum_value + len(properties) < self._alias_offset), (
+            'Property aliasing expects there are under %d properties.' % self._alias_offset)
 
         for property in properties:
             assert property['is_descriptor'] or property['is_property'], \
@@ -96,7 +98,7 @@
             updated_alias['name'] = alias['name']
             updated_alias['alias_for'] = alias['alias_for']
             updated_alias['property_id'] = enum_for_css_property_alias(alias['name'])
-            updated_alias['enum_value'] = aliased_property['enum_value'] + 512
+            updated_alias['enum_value'] = aliased_property['enum_value'] + self._alias_offset
             updated_alias['upper_camel_name'] = upper_camel_case(alias['name'])
             updated_alias['lower_camel_name'] = lower_camel_case(alias['name'])
             self._aliases[i] = updated_alias
diff --git a/third_party/WebKit/Source/build/scripts/make_css_property_names.py b/third_party/WebKit/Source/build/scripts/make_css_property_names.py
index b239019..eb2430b0 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_property_names.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_names.py
@@ -5,83 +5,10 @@
 
 import css_properties
 import json5_generator
+import template_expander
 import license
 
 
-HEADER_TEMPLATE = """
-%(license)s
-
-#ifndef %(class_name)s_h
-#define %(class_name)s_h
-
-#include "core/CoreExport.h"
-#include "platform/wtf/Assertions.h"
-#include <stddef.h>
-
-namespace WTF {
-class AtomicString;
-class String;
-}
-
-namespace blink {
-
-enum CSSPropertyID {
-    CSSPropertyInvalid = 0,
-    // This isn't a property, but we need to know the position of @apply rules in style rules
-    CSSPropertyApplyAtRule = 1,
-    CSSPropertyVariable = 2,
-%(property_enums)s
-};
-
-const CSSPropertyID kCSSPropertyAliasList[] = {
-%(property_aliases)s
-};
-
-const int firstCSSProperty = %(first_property_id)s;
-const int numCSSProperties = %(properties_count)s;
-const int lastCSSProperty = %(last_property_id)d;
-const int lastUnresolvedCSSProperty = %(last_unresolved_property_id)d;
-const int numCSSPropertyIDs = lastUnresolvedCSSProperty + 1;
-const size_t maxCSSPropertyNameLength = %(max_name_length)d;
-
-const char* getPropertyName(CSSPropertyID);
-const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID);
-WTF::String CORE_EXPORT getPropertyNameString(CSSPropertyID);
-WTF::String getJSPropertyName(CSSPropertyID);
-
-inline bool isCSSPropertyIDWithName(int id)
-{
-    return id >= firstCSSProperty && id <= lastUnresolvedCSSProperty;
-}
-
-inline bool isValidCSSPropertyID(CSSPropertyID id)
-{
-    return id != CSSPropertyInvalid;
-}
-
-inline CSSPropertyID convertToCSSPropertyID(int value)
-{
-    DCHECK_GE(value, CSSPropertyInvalid);
-    DCHECK_LE(value, lastCSSProperty);
-    return static_cast<CSSPropertyID>(value);
-}
-
-inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id)
-{
-    return convertToCSSPropertyID(id & ~512);
-}
-
-inline bool isPropertyAlias(CSSPropertyID id) { return id & 512; }
-
-CSSPropertyID unresolvedCSSPropertyID(const WTF::String&);
-
-CSSPropertyID CORE_EXPORT cssPropertyID(const WTF::String&);
-
-} // namespace blink
-
-#endif // %(class_name)s_h
-"""
-
 GPERF_TEMPLATE = """
 %%{
 %(license)s
@@ -212,9 +139,10 @@
     def _array_item(self, property_):
         return "    static_cast<CSSPropertyID>(%(enum_value)s), // %(property_id)s" % property_
 
+    @template_expander.use_jinja('templates/CSSPropertyNames.h.tmpl')
     def generate_header(self):
-        return HEADER_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
+        return {
+            'alias_offset': self._alias_offset,
             'class_name': self.class_name,
             'property_enums': "\n".join(map(self._enum_declaration, self._properties_including_aliases)),
             'property_aliases': "\n".join(map(self._array_item, self._aliases)),
diff --git a/third_party/WebKit/Source/build/scripts/templates/CSSPropertyNames.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/CSSPropertyNames.h.tmpl
new file mode 100644
index 0000000..785bb580
--- /dev/null
+++ b/third_party/WebKit/Source/build/scripts/templates/CSSPropertyNames.h.tmpl
@@ -0,0 +1,72 @@
+{% from 'templates/macros.tmpl' import license %}
+{{license()}}
+
+#ifndef CSSPropertyNames_h
+#define CSSPropertyNames_h
+
+#include "core/CoreExport.h"
+#include "platform/wtf/Assertions.h"
+#include <stddef.h>
+
+namespace WTF {
+class AtomicString;
+class String;
+}
+
+namespace blink {
+
+enum CSSPropertyID {
+    CSSPropertyInvalid = 0,
+    // This isn't a property, but we need to know the position of @apply rules in style rules
+    CSSPropertyApplyAtRule = 1,
+    CSSPropertyVariable = 2,
+{{property_enums}}
+};
+
+const CSSPropertyID kCSSPropertyAliasList[] = {
+{{property_aliases}}
+};
+
+const int firstCSSProperty = {{first_property_id}};
+const int numCSSProperties = {{properties_count}};
+const int lastCSSProperty = {{last_property_id}};
+const int lastUnresolvedCSSProperty = {{last_unresolved_property_id}};
+const int numCSSPropertyIDs = lastUnresolvedCSSProperty + 1;
+const size_t maxCSSPropertyNameLength = {{max_name_length}};
+
+const char* getPropertyName(CSSPropertyID);
+const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID);
+WTF::String CORE_EXPORT getPropertyNameString(CSSPropertyID);
+WTF::String getJSPropertyName(CSSPropertyID);
+
+inline bool isCSSPropertyIDWithName(int id)
+{
+    return id >= firstCSSProperty && id <= lastUnresolvedCSSProperty;
+}
+
+inline bool isValidCSSPropertyID(CSSPropertyID id)
+{
+    return id != CSSPropertyInvalid;
+}
+
+inline CSSPropertyID convertToCSSPropertyID(int value)
+{
+    DCHECK_GE(value, CSSPropertyInvalid);
+    DCHECK_LE(value, lastCSSProperty);
+    return static_cast<CSSPropertyID>(value);
+}
+
+inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id)
+{
+    return convertToCSSPropertyID(id & ~{{alias_offset}});
+}
+
+inline bool isPropertyAlias(CSSPropertyID id) { return id & {{alias_offset}}; }
+
+CSSPropertyID unresolvedCSSPropertyID(const WTF::String&);
+
+CSSPropertyID CORE_EXPORT cssPropertyID(const WTF::String&);
+
+} // namespace blink
+
+#endif // CSSPropertyNames_h
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn
index e6d33c5..52d08ea2 100644
--- a/third_party/WebKit/Source/core/BUILD.gn
+++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -182,6 +182,7 @@
     "//third_party/WebKit/Source/core/exported",
     "//third_party/WebKit/Source/core/fileapi",
     "//third_party/WebKit/Source/core/frame",
+    "//third_party/WebKit/Source/core/fullscreen",
     "//third_party/WebKit/Source/core/geometry",
     "//third_party/WebKit/Source/core/html",
     "//third_party/WebKit/Source/core/imagebitmap",
@@ -612,6 +613,7 @@
 
 css_properties("make_core_generated_css_property_names") {
   script = "../build/scripts/make_css_property_names.py"
+  other_inputs = [ "../build/scripts/templates/CSSPropertyNames.h.tmpl" ]
   outputs = [
     "$blink_core_output_dir/CSSPropertyNames.cpp",
     "$blink_core_output_dir/CSSPropertyNames.h",
diff --git a/third_party/WebKit/Source/core/core_idl_files.gni b/third_party/WebKit/Source/core/core_idl_files.gni
index c56edc2..ccfc5a1 100644
--- a/third_party/WebKit/Source/core/core_idl_files.gni
+++ b/third_party/WebKit/Source/core/core_idl_files.gni
@@ -458,9 +458,7 @@
                     "css/cssom/CSSUnitValues.idl",
                     "css/cssom/WindowGetComputedStyle.idl",
                     "dom/ChildNode.idl",
-                    "dom/DocumentFullscreen.idl",
                     "dom/DocumentOrShadowRoot.idl",
-                    "dom/ElementFullscreen.idl",
                     "dom/GlobalEventHandlers.idl",
                     "dom/NoncedElement.idl",
                     "dom/NonDocumentTypeChildNode.idl",
@@ -479,6 +477,8 @@
                     "frame/WindowBase64.idl",
                     "frame/WindowEventHandlers.idl",
                     "frame/WindowTimers.idl",
+                    "fullscreen/DocumentFullscreen.idl",
+                    "fullscreen/ElementFullscreen.idl",
                     "html/HTMLHyperlinkElementUtils.idl",
                     "imagebitmap/ImageBitmapFactories.idl",
                     "svg/SVGDocument.idl",
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
index 24a9e94c..f036cbf 100644
--- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp
+++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -35,7 +35,6 @@
 #include "core/dom/Element.h"
 #include "core/dom/ElementTraversal.h"
 #include "core/dom/FlatTreeTraversal.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/NodeComputedStyle.h"
 #include "core/dom/NthIndexCache.h"
 #include "core/dom/ShadowRoot.h"
@@ -44,6 +43,7 @@
 #include "core/dom/V0InsertionPoint.h"
 #include "core/editing/FrameSelection.h"
 #include "core/frame/LocalFrame.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLFrameElementBase.h"
 #include "core/html/HTMLInputElement.h"
diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/Source/core/dom/BUILD.gn
index cc2f9b1..26b4d11a 100644
--- a/third_party/WebKit/Source/core/dom/BUILD.gn
+++ b/third_party/WebKit/Source/core/dom/BUILD.gn
@@ -101,8 +101,6 @@
     "DocumentEncodingData.h",
     "DocumentFragment.cpp",
     "DocumentFragment.h",
-    "DocumentFullscreen.cpp",
-    "DocumentFullscreen.h",
     "DocumentInit.cpp",
     "DocumentInit.h",
     "DocumentLifecycle.cpp",
@@ -135,8 +133,6 @@
     "ElementData.h",
     "ElementDataCache.cpp",
     "ElementDataCache.h",
-    "ElementFullscreen.cpp",
-    "ElementFullscreen.h",
     "ElementIntersectionObserverData.cpp",
     "ElementIntersectionObserverData.h",
     "ElementRareData.cpp",
@@ -161,8 +157,6 @@
     "FrameRequestCallback.h",
     "FrameRequestCallbackCollection.cpp",
     "FrameRequestCallbackCollection.h",
-    "Fullscreen.cpp",
-    "Fullscreen.h",
     "GlobalEventHandlers.h",
     "IconURL.cpp",
     "IconURL.h",
diff --git a/third_party/WebKit/Source/core/dom/DocumentOrShadowRoot.h b/third_party/WebKit/Source/core/dom/DocumentOrShadowRoot.h
index b3731c0a..4692958 100644
--- a/third_party/WebKit/Source/core/dom/DocumentOrShadowRoot.h
+++ b/third_party/WebKit/Source/core/dom/DocumentOrShadowRoot.h
@@ -6,9 +6,9 @@
 #define DocumentOrShadowRoot_h
 
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/ShadowRoot.h"
 #include "core/frame/UseCounter.h"
+#include "core/fullscreen/Fullscreen.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 7a10a0f..8e968903 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -61,7 +61,6 @@
 #include "core/dom/ElementTraversal.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/FirstLetterPseudoElement.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/LayoutTreeBuilder.h"
 #include "core/dom/MutationObserverInterestGroup.h"
 #include "core/dom/MutationRecord.h"
@@ -96,6 +95,7 @@
 #include "core/frame/UseCounter.h"
 #include "core/frame/VisualViewport.h"
 #include "core/frame/csp/ContentSecurityPolicy.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/geometry/DOMRect.h"
 #include "core/geometry/DOMRectList.h"
 #include "core/html/HTMLCanvasElement.h"
diff --git a/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp b/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp
index 934a6baff..3815025 100644
--- a/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp
@@ -31,11 +31,11 @@
 #include "core/SVGNames.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/FirstLetterPseudoElement.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/Node.h"
 #include "core/dom/PseudoElement.h"
 #include "core/dom/Text.h"
 #include "core/dom/V0InsertionPoint.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/layout/LayoutFullScreen.h"
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutText.h"
diff --git a/third_party/WebKit/Source/core/dom/RangeTest.cpp b/third_party/WebKit/Source/core/dom/RangeTest.cpp
index 09092bc0..a861974 100644
--- a/third_party/WebKit/Source/core/dom/RangeTest.cpp
+++ b/third_party/WebKit/Source/core/dom/RangeTest.cpp
@@ -5,11 +5,15 @@
 #include "core/dom/Range.h"
 
 #include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/StringOrArrayBufferOrArrayBufferView.h"
 #include "bindings/core/v8/V8BindingForTesting.h"
+#include "core/css/FontFaceDescriptors.h"
+#include "core/css/FontFaceSet.h"
 #include "core/dom/Element.h"
 #include "core/dom/NodeList.h"
 #include "core/dom/Text.h"
 #include "core/editing/EditingTestBase.h"
+#include "core/editing/FrameSelection.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/frame/Settings.h"
 #include "core/html/HTMLBodyElement.h"
@@ -19,6 +23,7 @@
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLTextAreaElement.h"
 #include "platform/heap/Handle.h"
+#include "platform/testing/UnitTestHelpers.h"
 #include "platform/wtf/Compiler.h"
 #include "platform/wtf/RefPtr.h"
 #include "platform/wtf/text/AtomicString.h"
@@ -254,4 +259,41 @@
   EXPECT_EQ(position, range.EndPosition());
 }
 
+static void LoadAhem(DummyPageHolder& page_holder, Document& document) {
+  RefPtr<SharedBuffer> shared_buffer =
+      testing::ReadFromFile(testing::CoreTestDataPath("Ahem.ttf"));
+  StringOrArrayBufferOrArrayBufferView buffer =
+      StringOrArrayBufferOrArrayBufferView::fromArrayBuffer(
+          DOMArrayBuffer::Create(shared_buffer));
+  FontFace* ahem =
+      FontFace::Create(&document, "Ahem", buffer, FontFaceDescriptors());
+
+  ScriptState* script_state =
+      ToScriptStateForMainWorld(&page_holder.GetFrame());
+  DummyExceptionStateForTesting exception_state;
+  FontFaceSet::From(document)->addForBinding(script_state, ahem,
+                                             exception_state);
+}
+
+TEST_F(RangeTest, BoundingRectMustIndependentFromSelection) {
+  LoadAhem(GetDummyPageHolder(), GetDocument());
+  GetDocument().body()->setInnerHTML(
+      "<div style='font: Ahem; width: 2em;letter-spacing: 5px;'>xx xx </div>");
+  Node* const div = GetDocument().QuerySelector("div");
+  // "x^x
+  //  x|x "
+  Range* const range =
+      Range::Create(GetDocument(), div->firstChild(), 1, div->firstChild(), 4);
+  const FloatRect rect_before = range->BoundingRect();
+  EXPECT_GT(rect_before.Width(), 0);
+  EXPECT_GT(rect_before.Height(), 0);
+  Selection().SetSelection(SelectionInDOMTree::Builder()
+                               .SetBaseAndExtent(EphemeralRange(range))
+                               .Build());
+  GetDocument().View()->UpdateAllLifecyclePhases();
+  EXPECT_EQ(Selection().SelectedText(), "x x");
+  const FloatRect rect_after = range->BoundingRect();
+  EXPECT_EQ(rect_before, rect_after);
+}
+
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
index 70eb6c2..12b2592 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -293,7 +293,7 @@
 }
 
 std::pair<int, int> LayoutSelection::SelectionStartEnd() {
-  Commit();
+  DCHECK(!HasPendingSelection());
   if (paint_range_.IsNull())
     return std::make_pair(-1, -1);
   return std::make_pair(paint_range_.StartOffset(), paint_range_.EndOffset());
@@ -348,6 +348,10 @@
                              end_layout_object, end_pos.ComputeEditingOffset());
 }
 
+void LayoutSelection::SetHasPendingSelection() {
+  has_pending_selection_ = true;
+}
+
 void LayoutSelection::Commit() {
   if (!HasPendingSelection())
     return;
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.h b/third_party/WebKit/Source/core/editing/LayoutSelection.h
index 3e7686f..84b27263 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.h
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.h
@@ -93,7 +93,7 @@
   }
 
   bool HasPendingSelection() const { return has_pending_selection_; }
-  void SetHasPendingSelection() { has_pending_selection_ = true; }
+  void SetHasPendingSelection();
   void Commit();
 
   IntRect SelectionBounds();
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
index b69b161..ea537d8 100644
--- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -718,130 +718,125 @@
 
   frame->GetSpellChecker().UpdateMarkersForWordsAffectedByEditing(false);
 
-  switch (EndingSelection().GetSelectionType()) {
-    case kRangeSelection:
-      DeleteKeyPressedInternal(EndingSelection(), EndingSelection(), kill_ring,
-                               editing_state);
+  if (EndingSelection().IsRange()) {
+    DeleteKeyPressedInternal(EndingSelection(), EndingSelection(), kill_ring,
+                             editing_state);
+    return;
+  }
+
+  if (!EndingSelection().IsCaret()) {
+    NOTREACHED();
+    return;
+  }
+
+  // After breaking out of an empty mail blockquote, we still want continue
+  // with the deletion so actual content will get deleted, and not just the
+  // quote style.
+  const bool break_out_result =
+      BreakOutOfEmptyMailBlockquotedParagraph(editing_state);
+  if (editing_state->IsAborted())
+    return;
+  if (break_out_result)
+    TypingAddedToOpenCommand(kDeleteKey);
+
+  smart_delete_ = false;
+  GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
+
+  SelectionModifier selection_modifier(*frame, EndingSelection());
+  selection_modifier.Modify(FrameSelection::kAlterationExtend,
+                            kDirectionBackward, granularity);
+  if (kill_ring && selection_modifier.Selection().IsCaret() &&
+      granularity != TextGranularity::kCharacter) {
+    selection_modifier.Modify(FrameSelection::kAlterationExtend,
+                              kDirectionBackward, TextGranularity::kCharacter);
+  }
+
+  const VisiblePosition& visible_start(EndingSelection().VisibleStart());
+  const VisiblePosition& previous_position =
+      PreviousPositionOf(visible_start, kCannotCrossEditingBoundary);
+  const Node* enclosing_table_cell =
+      EnclosingNodeOfType(visible_start.DeepEquivalent(), &IsTableCell);
+  const Node* enclosing_table_cell_for_previous_position =
+      EnclosingNodeOfType(previous_position.DeepEquivalent(), &IsTableCell);
+  if (previous_position.IsNull() ||
+      enclosing_table_cell != enclosing_table_cell_for_previous_position) {
+    // When the caret is at the start of the editable area, or cell, in an
+    // empty list item, break out of the list item.
+    const bool break_out_of_empty_list_item_result =
+        BreakOutOfEmptyListItem(editing_state);
+    if (editing_state->IsAborted())
       return;
-    case kCaretSelection: {
-      // After breaking out of an empty mail blockquote, we still want continue
-      // with the deletion so actual content will get deleted, and not just the
-      // quote style.
-      bool break_out_result =
-          BreakOutOfEmptyMailBlockquotedParagraph(editing_state);
-      if (editing_state->IsAborted())
-        return;
-      if (break_out_result)
-        TypingAddedToOpenCommand(kDeleteKey);
-
-      smart_delete_ = false;
-      GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
-
-      SelectionModifier selection_modifier(*frame, EndingSelection());
-      selection_modifier.Modify(FrameSelection::kAlterationExtend,
-                                kDirectionBackward, granularity);
-      if (kill_ring && selection_modifier.Selection().IsCaret() &&
-          granularity != TextGranularity::kCharacter) {
-        selection_modifier.Modify(FrameSelection::kAlterationExtend,
-                                  kDirectionBackward,
-                                  TextGranularity::kCharacter);
-      }
-
-      const VisiblePosition& visible_start(EndingSelection().VisibleStart());
-      const VisiblePosition& previous_position =
-          PreviousPositionOf(visible_start, kCannotCrossEditingBoundary);
-      const Node* enclosing_table_cell =
-          EnclosingNodeOfType(visible_start.DeepEquivalent(), &IsTableCell);
-      const Node* enclosing_table_cell_for_previous_position =
-          EnclosingNodeOfType(previous_position.DeepEquivalent(), &IsTableCell);
-      if (previous_position.IsNull() ||
-          enclosing_table_cell != enclosing_table_cell_for_previous_position) {
-        // When the caret is at the start of the editable area, or cell, in an
-        // empty list item, break out of the list item.
-        bool break_out_of_empty_list_item_result =
-            BreakOutOfEmptyListItem(editing_state);
-        if (editing_state->IsAborted())
-          return;
-        if (break_out_of_empty_list_item_result) {
-          TypingAddedToOpenCommand(kDeleteKey);
-          return;
-        }
-      }
-      if (previous_position.IsNull()) {
-        // When there are no visible positions in the editing root, delete its
-        // entire contents.
-        if (NextPositionOf(visible_start, kCannotCrossEditingBoundary)
-                .IsNull() &&
-            MakeEditableRootEmpty(editing_state)) {
-          TypingAddedToOpenCommand(kDeleteKey);
-          return;
-        }
-        if (editing_state->IsAborted())
-          return;
-      }
-
-      // If we have a caret selection at the beginning of a cell, we have
-      // nothing to do.
-      if (enclosing_table_cell &&
-          visible_start.DeepEquivalent() ==
-              VisiblePosition::FirstPositionInNode(
-                  *const_cast<Node*>(enclosing_table_cell))
-                  .DeepEquivalent())
-        return;
-
-      // If the caret is at the start of a paragraph after a table, move content
-      // into the last table cell.
-      if (IsStartOfParagraph(visible_start) &&
-          TableElementJustBefore(
-              PreviousPositionOf(visible_start, kCannotCrossEditingBoundary))) {
-        // Unless the caret is just before a table.  We don't want to move a
-        // table into the last table cell.
-        if (TableElementJustAfter(visible_start))
-          return;
-        // Extend the selection backward into the last cell, then deletion will
-        // handle the move.
-        selection_modifier.Modify(FrameSelection::kAlterationExtend,
-                                  kDirectionBackward, granularity);
-        // If the caret is just after a table, select the table and don't delete
-        // anything.
-      } else if (Element* table = TableElementJustBefore(visible_start)) {
-        SetEndingSelection(
-            SelectionInDOMTree::Builder()
-                .Collapse(Position::BeforeNode(*table))
-                .Extend(EndingSelection().Start())
-                .SetIsDirectional(EndingSelection().IsDirectional())
-                .Build());
-        TypingAddedToOpenCommand(kDeleteKey);
-        return;
-      }
-
-      const VisibleSelection& selection_to_delete =
-          granularity == TextGranularity::kCharacter
-              ? AdjustSelectionForBackwardDelete(selection_modifier.Selection())
-              : selection_modifier.Selection();
-
-      if (!StartingSelection().IsRange() ||
-          selection_to_delete.Base() != StartingSelection().Start()) {
-        DeleteKeyPressedInternal(selection_to_delete, selection_to_delete,
-                                 kill_ring, editing_state);
-        return;
-      }
-      // It's a little tricky to compute what the starting selection would
-      // have been in the original document. We can't let the VisibleSelection
-      // class's validation kick in or it'll adjust for us based on the
-      // current state of the document and we'll get the wrong result.
-      const VisibleSelection& selection_after_undo =
-          VisibleSelection::CreateWithoutValidationDeprecated(
-              StartingSelection().End(), selection_to_delete.Extent(),
-              selection_to_delete.Affinity());
-      DeleteKeyPressedInternal(selection_to_delete, selection_after_undo,
-                               kill_ring, editing_state);
+    if (break_out_of_empty_list_item_result) {
+      TypingAddedToOpenCommand(kDeleteKey);
       return;
     }
-    case kNoSelection:
-      NOTREACHED();
-      break;
   }
+  if (previous_position.IsNull()) {
+    // When there are no visible positions in the editing root, delete its
+    // entire contents.
+    if (NextPositionOf(visible_start, kCannotCrossEditingBoundary).IsNull() &&
+        MakeEditableRootEmpty(editing_state)) {
+      TypingAddedToOpenCommand(kDeleteKey);
+      return;
+    }
+    if (editing_state->IsAborted())
+      return;
+  }
+
+  // If we have a caret selection at the beginning of a cell, we have
+  // nothing to do.
+  if (enclosing_table_cell && visible_start.DeepEquivalent() ==
+                                  VisiblePosition::FirstPositionInNode(
+                                      *const_cast<Node*>(enclosing_table_cell))
+                                      .DeepEquivalent())
+    return;
+
+  // If the caret is at the start of a paragraph after a table, move content
+  // into the last table cell.
+  if (IsStartOfParagraph(visible_start) &&
+      TableElementJustBefore(
+          PreviousPositionOf(visible_start, kCannotCrossEditingBoundary))) {
+    // Unless the caret is just before a table.  We don't want to move a
+    // table into the last table cell.
+    if (TableElementJustAfter(visible_start))
+      return;
+    // Extend the selection backward into the last cell, then deletion will
+    // handle the move.
+    selection_modifier.Modify(FrameSelection::kAlterationExtend,
+                              kDirectionBackward, granularity);
+    // If the caret is just after a table, select the table and don't delete
+    // anything.
+  } else if (Element* table = TableElementJustBefore(visible_start)) {
+    SetEndingSelection(SelectionInDOMTree::Builder()
+                           .Collapse(Position::BeforeNode(*table))
+                           .Extend(EndingSelection().Start())
+                           .SetIsDirectional(EndingSelection().IsDirectional())
+                           .Build());
+    TypingAddedToOpenCommand(kDeleteKey);
+    return;
+  }
+
+  const VisibleSelection& selection_to_delete =
+      granularity == TextGranularity::kCharacter
+          ? AdjustSelectionForBackwardDelete(selection_modifier.Selection())
+          : selection_modifier.Selection();
+
+  if (!StartingSelection().IsRange() ||
+      selection_to_delete.Base() != StartingSelection().Start()) {
+    DeleteKeyPressedInternal(selection_to_delete, selection_to_delete,
+                             kill_ring, editing_state);
+    return;
+  }
+  // It's a little tricky to compute what the starting selection would
+  // have been in the original document. We can't let the VisibleSelection
+  // class's validation kick in or it'll adjust for us based on the
+  // current state of the document and we'll get the wrong result.
+  const VisibleSelection& selection_after_undo =
+      VisibleSelection::CreateWithoutValidationDeprecated(
+          StartingSelection().End(), selection_to_delete.Extent(),
+          selection_to_delete.Affinity());
+  DeleteKeyPressedInternal(selection_to_delete, selection_after_undo, kill_ring,
+                           editing_state);
 }
 
 void TypingCommand::DeleteKeyPressedInternal(
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
index 403a8f2..5f0af96 100644
--- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
@@ -40,7 +40,6 @@
 #include "core/clipboard/DataObject.h"
 #include "core/clipboard/DataTransfer.h"
 #include "core/dom/ExecutionContext.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/events/DragEvent.h"
 #include "core/events/EventQueue.h"
@@ -59,6 +58,7 @@
 #include "core/frame/LocalFrameView.h"
 #include "core/frame/WebLocalFrameBase.h"
 #include "core/frame/csp/ContentSecurityPolicy.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLPlugInElement.h"
 #include "core/input/EventHandler.h"
diff --git a/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp b/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp
index 4cc9915..474a061 100644
--- a/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp
@@ -5,7 +5,6 @@
 #include "core/exported/WebRemoteFrameImpl.h"
 
 #include "bindings/core/v8/WindowProxy.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/RemoteSecurityContext.h"
 #include "core/dom/SecurityContext.h"
 #include "core/exported/WebFactory.h"
@@ -16,6 +15,7 @@
 #include "core/frame/Settings.h"
 #include "core/frame/WebLocalFrameBase.h"
 #include "core/frame/csp/ContentSecurityPolicy.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/layout/LayoutObject.h"
 #include "core/page/ChromeClient.h"
diff --git a/third_party/WebKit/Source/core/exported/WebViewTest.cpp b/third_party/WebKit/Source/core/exported/WebViewTest.cpp
index b02e3b2..9d9f792 100644
--- a/third_party/WebKit/Source/core/exported/WebViewTest.cpp
+++ b/third_party/WebKit/Source/core/exported/WebViewTest.cpp
@@ -38,7 +38,6 @@
 #include "build/build_config.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/NodeComputedStyle.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/editing/FrameSelection.h"
@@ -53,6 +52,7 @@
 #include "core/frame/Settings.h"
 #include "core/frame/VisualViewport.h"
 #include "core/frame/WebLocalFrameBase.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLIFrameElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLTextAreaElement.h"
diff --git a/third_party/WebKit/Source/core/frame/FullscreenController.cpp b/third_party/WebKit/Source/core/frame/FullscreenController.cpp
index ce21bdb1..958252a 100644
--- a/third_party/WebKit/Source/core/frame/FullscreenController.cpp
+++ b/third_party/WebKit/Source/core/frame/FullscreenController.cpp
@@ -31,12 +31,12 @@
 #include "core/frame/FullscreenController.h"
 
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/exported/WebViewBase.h"
 #include "core/frame/LocalFrame.h"
 #include "core/frame/LocalFrameView.h"
 #include "core/frame/PageScaleConstraintsSet.h"
 #include "core/frame/WebLocalFrameBase.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/layout/LayoutFullScreen.h"
 #include "core/page/Page.h"
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
index 87d4fc5..b935336 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
@@ -35,7 +35,6 @@
 #include "core/dom/AXObjectCache.h"
 #include "core/dom/DOMNodeIds.h"
 #include "core/dom/ElementVisibilityObserver.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/IntersectionObserverCallback.h"
 #include "core/dom/IntersectionObserverController.h"
 #include "core/dom/IntersectionObserverInit.h"
@@ -58,6 +57,7 @@
 #include "core/frame/RemoteFrameView.h"
 #include "core/frame/Settings.h"
 #include "core/frame/VisualViewport.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLFrameElement.h"
 #include "core/html/HTMLPlugInElement.h"
 #include "core/html/TextControlElement.h"
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
index 6548714f..6b62059f 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -32,7 +32,6 @@
 
 #include <memory>
 #include "core/dom/DOMNodeIds.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/TaskRunnerHelper.h"
 #include "core/frame/LocalFrame.h"
 #include "core/frame/LocalFrameClient.h"
@@ -41,6 +40,7 @@
 #include "core/frame/PageScaleConstraintsSet.h"
 #include "core/frame/RootFrameViewport.h"
 #include "core/frame/Settings.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/layout/TextAutosizer.h"
 #include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/ChromeClient.h"
diff --git a/third_party/WebKit/Source/core/fullscreen/BUILD.gn b/third_party/WebKit/Source/core/fullscreen/BUILD.gn
new file mode 100644
index 0000000..41a8d83
--- /dev/null
+++ b/third_party/WebKit/Source/core/fullscreen/BUILD.gn
@@ -0,0 +1,21 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//third_party/WebKit/Source/core/core.gni")
+
+blink_core_sources("fullscreen") {
+  sources = [
+    "DocumentFullscreen.cpp",
+    "DocumentFullscreen.h",
+    "ElementFullscreen.cpp",
+    "ElementFullscreen.h",
+    "Fullscreen.cpp",
+    "Fullscreen.h",
+  ]
+
+  configs += [
+    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+    "//build/config/compiler:no_size_t_to_int_warning",
+  ]
+}
diff --git a/third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp b/third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.cpp
similarity index 94%
rename from third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp
rename to third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.cpp
index 2cbf370..50146cdd 100644
--- a/third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp
+++ b/third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.cpp
@@ -23,9 +23,9 @@
  * DAMAGE.
  */
 
-#include "core/dom/DocumentFullscreen.h"
+#include "core/fullscreen/DocumentFullscreen.h"
 
-#include "core/dom/Fullscreen.h"
+#include "core/fullscreen/Fullscreen.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/DocumentFullscreen.h b/third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.h
similarity index 100%
rename from third_party/WebKit/Source/core/dom/DocumentFullscreen.h
rename to third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.h
diff --git a/third_party/WebKit/Source/core/dom/DocumentFullscreen.idl b/third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.idl
similarity index 100%
rename from third_party/WebKit/Source/core/dom/DocumentFullscreen.idl
rename to third_party/WebKit/Source/core/fullscreen/DocumentFullscreen.idl
diff --git a/third_party/WebKit/Source/core/dom/ElementFullscreen.cpp b/third_party/WebKit/Source/core/fullscreen/ElementFullscreen.cpp
similarity index 88%
rename from third_party/WebKit/Source/core/dom/ElementFullscreen.cpp
rename to third_party/WebKit/Source/core/fullscreen/ElementFullscreen.cpp
index cbf182c..e6cb4e9c 100644
--- a/third_party/WebKit/Source/core/dom/ElementFullscreen.cpp
+++ b/third_party/WebKit/Source/core/fullscreen/ElementFullscreen.cpp
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "core/dom/ElementFullscreen.h"
+#include "core/fullscreen/ElementFullscreen.h"
 
-#include "core/dom/Fullscreen.h"
 #include "core/frame/UseCounter.h"
+#include "core/fullscreen/Fullscreen.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/dom/ElementFullscreen.h b/third_party/WebKit/Source/core/fullscreen/ElementFullscreen.h
similarity index 100%
rename from third_party/WebKit/Source/core/dom/ElementFullscreen.h
rename to third_party/WebKit/Source/core/fullscreen/ElementFullscreen.h
diff --git a/third_party/WebKit/Source/core/dom/ElementFullscreen.idl b/third_party/WebKit/Source/core/fullscreen/ElementFullscreen.idl
similarity index 100%
rename from third_party/WebKit/Source/core/dom/ElementFullscreen.idl
rename to third_party/WebKit/Source/core/fullscreen/ElementFullscreen.idl
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/fullscreen/Fullscreen.cpp
similarity index 99%
rename from third_party/WebKit/Source/core/dom/Fullscreen.cpp
rename to third_party/WebKit/Source/core/fullscreen/Fullscreen.cpp
index ce5ad71..8ff8c60 100644
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp
+++ b/third_party/WebKit/Source/core/fullscreen/Fullscreen.cpp
@@ -27,7 +27,7 @@
  *
  */
 
-#include "core/dom/Fullscreen.h"
+#include "core/fullscreen/Fullscreen.h"
 
 #include "core/HTMLElementTypeHelpers.h"
 #include "core/dom/Document.h"
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.h b/third_party/WebKit/Source/core/fullscreen/Fullscreen.h
similarity index 100%
rename from third_party/WebKit/Source/core/dom/Fullscreen.h
rename to third_party/WebKit/Source/core/fullscreen/Fullscreen.h
diff --git a/third_party/WebKit/Source/core/fullscreen/OWNERS b/third_party/WebKit/Source/core/fullscreen/OWNERS
new file mode 100644
index 0000000..ae781ae
--- /dev/null
+++ b/third_party/WebKit/Source/core/fullscreen/OWNERS
@@ -0,0 +1,3 @@
+foolip@chromium.org
+
+# COMPONENT: Blink>Fullscreen
diff --git a/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp b/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
index 1fad4a3..0f29096 100644
--- a/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
@@ -29,10 +29,10 @@
 #include "core/dom/AXObjectCache.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/FlatTreeTraversal.h"
-#include "core/dom/Fullscreen.h"
 #include "core/events/Event.h"
 #include "core/frame/LocalFrameView.h"
 #include "core/frame/UseCounter.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLFormControlElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 989a9583..a9fbb3f 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -36,7 +36,6 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/DOMException.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/ShadowRoot.h"
 #include "core/dom/TaskRunnerHelper.h"
 #include "core/events/Event.h"
@@ -46,6 +45,7 @@
 #include "core/frame/Settings.h"
 #include "core/frame/UseCounter.h"
 #include "core/frame/csp/ContentSecurityPolicy.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLSourceElement.h"
 #include "core/html/HTMLTrackElement.h"
 #include "core/html/TimeRanges.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp
index f81b2c0..16ad73d 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElementEventListenersTest.cpp
@@ -4,8 +4,8 @@
 
 #include "core/html/HTMLMediaElement.h"
 
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/html/media/MediaControls.h"
 #include "core/html/media/MediaCustomControlsFullscreenDetector.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
index cb5bd7d..fed741d 100644
--- a/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp
@@ -32,11 +32,11 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/ShadowRoot.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/frame/LocalDOMWindow.h"
 #include "core/frame/Settings.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/media/MediaCustomControlsFullscreenDetector.h"
 #include "core/html/media/MediaRemotingInterstitial.h"
 #include "core/html/parser/HTMLParserIdioms.h"
diff --git a/third_party/WebKit/Source/core/html/HTMLVideoElementPersistentTest.cpp b/third_party/WebKit/Source/core/html/HTMLVideoElementPersistentTest.cpp
index 478cb9d..d8a04a4 100644
--- a/third_party/WebKit/Source/core/html/HTMLVideoElementPersistentTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLVideoElementPersistentTest.cpp
@@ -6,8 +6,8 @@
 
 #include <memory>
 
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/layout/LayoutFullScreen.h"
 #include "core/loader/EmptyClients.h"
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.cpp b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.cpp
index e04c8af5b..47b69713 100644
--- a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.cpp
+++ b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.cpp
@@ -17,7 +17,7 @@
 
 HTMLImportTreeRoot::HTMLImportTreeRoot(Document* document)
     : HTMLImport(HTMLImport::kSync),
-      document_(document),
+      document_(this, document),
       recalc_timer_(
           TaskRunnerHelper::Get(TaskType::kUnspecedTimer, document->GetFrame()),
           this,
@@ -87,4 +87,8 @@
   HTMLImport::Trace(visitor);
 }
 
+DEFINE_TRACE_WRAPPERS(HTMLImportTreeRoot) {
+  visitor->TraceWrappers(document_);
+}
+
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h
index 3a7a2eb6..83e4c73 100644
--- a/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h
+++ b/third_party/WebKit/Source/core/html/imports/HTMLImportTreeRoot.h
@@ -8,13 +8,15 @@
 #include "core/dom/TaskRunnerHelper.h"
 #include "core/html/imports/HTMLImport.h"
 #include "platform/Timer.h"
+#include "platform/bindings/ScriptWrappable.h"
+#include "platform/bindings/TraceWrapperMember.h"
 
 namespace blink {
 
 class HTMLImportChild;
 class KURL;
 
-class HTMLImportTreeRoot final : public HTMLImport {
+class HTMLImportTreeRoot final : public HTMLImport, public TraceWrapperBase {
  public:
   static HTMLImportTreeRoot* Create(Document*);
 
@@ -33,13 +35,14 @@
   HTMLImportChild* Find(const KURL&) const;
 
   DECLARE_VIRTUAL_TRACE();
+  DECLARE_VIRTUAL_TRACE_WRAPPERS();
 
  private:
   explicit HTMLImportTreeRoot(Document*);
 
   void RecalcTimerFired(TimerBase*);
 
-  Member<Document> document_;
+  TraceWrapperMember<Document> document_;
   TaskRunnerTimer<HTMLImportTreeRoot> recalc_timer_;
 
   // List of import which has been loaded or being loaded.
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportsController.cpp b/third_party/WebKit/Source/core/html/imports/HTMLImportsController.cpp
index 55ec2db..d528e36 100644
--- a/third_party/WebKit/Source/core/html/imports/HTMLImportsController.cpp
+++ b/third_party/WebKit/Source/core/html/imports/HTMLImportsController.cpp
@@ -42,7 +42,7 @@
 namespace blink {
 
 HTMLImportsController::HTMLImportsController(Document& master)
-    : root_(HTMLImportTreeRoot::Create(&master)) {
+    : root_(this, HTMLImportTreeRoot::Create(&master)) {
   UseCounter::Count(master, WebFeature::kHTMLImports);
 }
 
@@ -153,7 +153,7 @@
 }
 
 DEFINE_TRACE_WRAPPERS(HTMLImportsController) {
-  visitor->TraceWrappers(Master());
+  visitor->TraceWrappers(root_);
 }
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportsController.h b/third_party/WebKit/Source/core/html/imports/HTMLImportsController.h
index 6992902c..2940fe9b 100644
--- a/third_party/WebKit/Source/core/html/imports/HTMLImportsController.h
+++ b/third_party/WebKit/Source/core/html/imports/HTMLImportsController.h
@@ -84,7 +84,7 @@
                                HTMLImport* parent,
                                HTMLImportChildClient*);
 
-  Member<HTMLImportTreeRoot> root_;
+  TraceWrapperMember<HTMLImportTreeRoot> root_;
   using LoaderList = HeapVector<Member<HTMLImportLoader>>;
   LoaderList loaders_;
 };
diff --git a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetector.cpp b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetector.cpp
index 5abe2d1..79ca82b 100644
--- a/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetector.cpp
+++ b/third_party/WebKit/Source/core/html/media/MediaCustomControlsFullscreenDetector.cpp
@@ -4,9 +4,9 @@
 
 #include "core/html/media/MediaCustomControlsFullscreenDetector.h"
 
-#include "core/dom/Fullscreen.h"
 #include "core/dom/TaskRunnerHelper.h"
 #include "core/events/Event.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/layout/IntersectionGeometry.h"
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp b/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp
index b2d2956..682d513 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp
@@ -25,8 +25,8 @@
 
 #include "core/layout/LayoutFullScreen.h"
 
-#include "core/dom/Fullscreen.h"
 #include "core/frame/VisualViewport.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/layout/LayoutBlockFlow.h"
 #include "core/page/Page.h"
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index e053cf9..b8053c9df 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -23,8 +23,8 @@
 
 #include "core/layout/LayoutInline.h"
 
-#include "core/dom/Fullscreen.h"
 #include "core/dom/StyleEngine.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/layout/HitTestResult.h"
 #include "core/layout/LayoutBlock.h"
 #include "core/layout/LayoutFullScreen.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index a029beee..4a91a268 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -331,7 +331,9 @@
                                      unsigned start,
                                      unsigned end) {
   unsigned real_end = std::min(box->end() + 1, end);
-  LayoutRect r = box->LocalSelectionRect(start, real_end);
+  const bool include_newline_space_width = false;
+  LayoutRect r =
+      box->LocalSelectionRect(start, real_end, include_newline_space_width);
   if (r.Height()) {
     // Change the height and y position (or width and x for vertical text)
     // because selectionRect uses selection-specific values.
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
index f8c35b1..dc0ae22 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -29,13 +29,13 @@
 #include "core/animation/DocumentTimeline.h"
 #include "core/animation/ElementAnimations.h"
 #include "core/dom/DOMNodeIds.h"
-#include "core/dom/Fullscreen.h"
 #include "core/editing/FrameSelection.h"
 #include "core/frame/LocalFrame.h"
 #include "core/frame/LocalFrameClient.h"
 #include "core/frame/LocalFrameView.h"
 #include "core/frame/Settings.h"
 #include "core/frame/VisualViewport.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLIFrameElement.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/layout/LayoutEmbeddedContent.h"
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
index 4115ba6..3f0620d 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -269,7 +269,10 @@
   return style_to_use.GetFont().SpaceWidth();
 }
 
-LayoutRect InlineTextBox::LocalSelectionRect(int start_pos, int end_pos) const {
+LayoutRect InlineTextBox::LocalSelectionRect(
+    int start_pos,
+    int end_pos,
+    bool consider_current_selection) const {
   int s_pos = std::max(start_pos - start_, 0);
   int e_pos = std::min(end_pos - start_, (int)len_);
 
@@ -315,7 +318,7 @@
     top_point = LayoutPoint(r.X(), sel_top);
     width = logical_width;
     height = sel_height;
-    if (HasWrappedSelectionNewline()) {
+    if (consider_current_selection && HasWrappedSelectionNewline()) {
       if (!IsLeftToRightDirection())
         top_point.SetX(LayoutUnit(top_point.X() - NewlineSpaceWidth()));
       width += NewlineSpaceWidth();
@@ -326,7 +329,7 @@
     height = logical_width;
     // TODO(wkorman): RTL text embedded in top-to-bottom text can create
     // bottom-to-top situations. Add tests and ensure we handle correctly.
-    if (HasWrappedSelectionNewline())
+    if (consider_current_selection && HasWrappedSelectionNewline())
       height += NewlineSpaceWidth();
   }
 
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.h b/third_party/WebKit/Source/core/layout/line/InlineTextBox.h
index 239e809..44be8d0 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.h
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.h
@@ -137,7 +137,10 @@
     return LayoutRect(X(), Y(), Width(), Height());
   }
 
-  virtual LayoutRect LocalSelectionRect(int start_pos, int end_pos) const;
+  virtual LayoutRect LocalSelectionRect(
+      int start_pos,
+      int end_pos,
+      bool include_newline_space_width = true) const;
   bool IsSelected(int start_pos, int end_pos) const;
   void SelectionStartEnd(int& s_pos, int& e_pos) const;
 
diff --git a/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_size.h b/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_size.h
index af0e5e9..9d19045 100644
--- a/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_size.h
+++ b/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_size.h
@@ -31,6 +31,8 @@
   bool IsEmpty() const {
     return inline_size == LayoutUnit() || block_size == LayoutUnit();
   }
+
+  void Flip() { std::swap(inline_size, block_size); }
 };
 
 inline NGLogicalSize& operator-=(NGLogicalSize& a, const NGBoxStrut& b) {
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc
index 1323845..16b822db 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item_result.cc
@@ -31,9 +31,19 @@
   line_style_ = layout_object->Style(use_first_line_style_);
 
   if (line_style_->ShouldUseTextIndent(is_first_line, is_after_forced_break)) {
-    text_indent_ =
-        MinimumValueForLength(line_style_->TextIndent(),
-                              constraint_space.AvailableSize().inline_size);
+    // 'text-indent' applies to block container, and percentage is of its
+    // containing block.
+    // https://drafts.csswg.org/css-text-3/#valdef-text-indent-percentage
+    // In our constraint space tree, parent constraint space is of its
+    // containing block.
+    // TODO(kojii): ComputeMinMaxContentSize does not know parent constraint
+    // space that we cannot compute percent for text-indent.
+    const Length& length = line_style_->TextIndent();
+    LayoutUnit maximum_value;
+    if (length.IsPercentOrCalc() &&
+        constraint_space.ParentPercentageResolutionInlineSize().has_value())
+      maximum_value = *constraint_space.ParentPercentageResolutionInlineSize();
+    text_indent_ = MinimumValueForLength(length, maximum_value);
   } else {
     text_indent_ = LayoutUnit();
   }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
index 5f3f92b..c87ac32 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -15,6 +15,7 @@
     TextDirection direction,
     NGLogicalSize available_size,
     NGLogicalSize percentage_resolution_size,
+    Optional<LayoutUnit> parent_percentage_resolution_inline_size,
     NGPhysicalSize initial_containing_block_size,
     LayoutUnit fragmentainer_space_available,
     bool is_fixed_size_inline,
@@ -34,6 +35,8 @@
     Vector<NGBaselineRequest>& baseline_requests)
     : available_size_(available_size),
       percentage_resolution_size_(percentage_resolution_size),
+      parent_percentage_resolution_inline_size_(
+          parent_percentage_resolution_inline_size),
       initial_containing_block_size_(initial_containing_block_size),
       fragmentainer_space_available_(fragmentainer_space_available),
       is_fixed_size_inline_(is_fixed_size_inline),
@@ -137,6 +140,16 @@
       .ToConstraintSpace(writing_mode);
 }
 
+Optional<LayoutUnit> NGConstraintSpace::ParentPercentageResolutionInlineSize()
+    const {
+  if (!parent_percentage_resolution_inline_size_.has_value())
+    return {};
+  if (*parent_percentage_resolution_inline_size_ != NGSizeIndefinite)
+    return *parent_percentage_resolution_inline_size_;
+  return initial_containing_block_size_.ConvertToLogical(WritingMode())
+      .inline_size;
+}
+
 void NGConstraintSpace::AddExclusion(const NGExclusion& exclusion) {
   exclusions_->Add(exclusion);
 }
@@ -157,6 +170,8 @@
 
   return available_size_ == other.available_size_ &&
          percentage_resolution_size_ == other.percentage_resolution_size_ &&
+         parent_percentage_resolution_inline_size_ ==
+             other.parent_percentage_resolution_inline_size_ &&
          initial_containing_block_size_ ==
              other.initial_containing_block_size_ &&
          fragmentainer_space_available_ ==
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
index 991f2ff..6ed914c 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
@@ -60,6 +60,10 @@
     return percentage_resolution_size_;
   }
 
+  // Parent's PercentageResolutionInlineSize().
+  // This is not always available.
+  Optional<LayoutUnit> ParentPercentageResolutionInlineSize() const;
+
   // The available space size.
   // See: https://drafts.csswg.org/css-sizing/#available
   NGLogicalSize AvailableSize() const { return available_size_; }
@@ -168,27 +172,29 @@
  private:
   friend class NGConstraintSpaceBuilder;
   // Default constructor.
-  NGConstraintSpace(NGWritingMode,
-                    TextDirection,
-                    NGLogicalSize available_size,
-                    NGLogicalSize percentage_resolution_size,
-                    NGPhysicalSize initial_containing_block_size,
-                    LayoutUnit fragmentainer_space_available,
-                    bool is_fixed_size_inline,
-                    bool is_fixed_size_block,
-                    bool is_shrink_to_fit,
-                    bool is_inline_direction_triggers_scrollbar,
-                    bool is_block_direction_triggers_scrollbar,
-                    NGFragmentationType block_direction_fragmentation_type,
-                    bool is_new_fc,
-                    bool is_anonymous,
-                    const NGMarginStrut& margin_strut,
-                    const NGLogicalOffset& bfc_offset,
-                    const WTF::Optional<NGLogicalOffset>& floats_bfc_offset,
-                    const std::shared_ptr<NGExclusions>& exclusions,
-                    Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats,
-                    const WTF::Optional<LayoutUnit>& clearance_offset,
-                    Vector<NGBaselineRequest>& baseline_requests);
+  NGConstraintSpace(
+      NGWritingMode,
+      TextDirection,
+      NGLogicalSize available_size,
+      NGLogicalSize percentage_resolution_size,
+      Optional<LayoutUnit> parent_percentage_resolution_inline_size,
+      NGPhysicalSize initial_containing_block_size,
+      LayoutUnit fragmentainer_space_available,
+      bool is_fixed_size_inline,
+      bool is_fixed_size_block,
+      bool is_shrink_to_fit,
+      bool is_inline_direction_triggers_scrollbar,
+      bool is_block_direction_triggers_scrollbar,
+      NGFragmentationType block_direction_fragmentation_type,
+      bool is_new_fc,
+      bool is_anonymous,
+      const NGMarginStrut& margin_strut,
+      const NGLogicalOffset& bfc_offset,
+      const WTF::Optional<NGLogicalOffset>& floats_bfc_offset,
+      const std::shared_ptr<NGExclusions>& exclusions,
+      Vector<RefPtr<NGUnpositionedFloat>>& unpositioned_floats,
+      const WTF::Optional<LayoutUnit>& clearance_offset,
+      Vector<NGBaselineRequest>& baseline_requests);
 
   NGPhysicalSize InitialContainingBlockSize() const {
     return initial_containing_block_size_;
@@ -196,6 +202,7 @@
 
   NGLogicalSize available_size_;
   NGLogicalSize percentage_resolution_size_;
+  Optional<LayoutUnit> parent_percentage_resolution_inline_size_;
   NGPhysicalSize initial_containing_block_size_;
 
   LayoutUnit fragmentainer_space_available_;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
index 39b0537..49bad41 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.cc
@@ -12,6 +12,8 @@
     const NGConstraintSpace* parent_space)
     : available_size_(parent_space->AvailableSize()),
       percentage_resolution_size_(parent_space->PercentageResolutionSize()),
+      parent_percentage_resolution_size_(
+          parent_space->PercentageResolutionSize()),
       initial_containing_block_size_(
           parent_space->InitialContainingBlockSize()),
       fragmentainer_space_available_(NGSizeIndefinite),
@@ -171,10 +173,13 @@
 
   NGLogicalSize available_size = available_size_;
   NGLogicalSize percentage_resolution_size = percentage_resolution_size_;
+  Optional<NGLogicalSize> parent_percentage_resolution_size =
+      parent_percentage_resolution_size_;
   if (!is_in_parallel_flow) {
-    std::swap(available_size.inline_size, available_size.block_size);
-    std::swap(percentage_resolution_size.inline_size,
-              percentage_resolution_size.block_size);
+    available_size.Flip();
+    percentage_resolution_size.Flip();
+    if (parent_percentage_resolution_size.has_value())
+      parent_percentage_resolution_size->Flip();
   }
 
   // If inline size is indefinite, use size of initial containing block.
@@ -197,6 +202,12 @@
           initial_containing_block_size_.height;
     }
   }
+  // parent_percentage_resolution_size is so rarely used that compute indefinite
+  // fallback in NGConstraintSpace when it is used.
+  Optional<LayoutUnit> parent_percentage_resolution_inline_size =
+      parent_percentage_resolution_size.has_value()
+          ? parent_percentage_resolution_size->inline_size
+          : Optional<LayoutUnit>();
 
   // Reset things that do not pass the Formatting Context boundary.
   std::shared_ptr<NGExclusions> exclusions(
@@ -219,9 +230,9 @@
     return AdoptRef(new NGConstraintSpace(
         static_cast<NGWritingMode>(out_writing_mode),
         static_cast<TextDirection>(text_direction_), available_size,
-        percentage_resolution_size, initial_containing_block_size_,
-        fragmentainer_space_available_, is_fixed_size_inline_,
-        is_fixed_size_block_, is_shrink_to_fit_,
+        percentage_resolution_size, parent_percentage_resolution_inline_size,
+        initial_containing_block_size_, fragmentainer_space_available_,
+        is_fixed_size_inline_, is_fixed_size_block_, is_shrink_to_fit_,
         is_inline_direction_triggers_scrollbar_,
         is_block_direction_triggers_scrollbar_,
         static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
@@ -231,8 +242,9 @@
   return AdoptRef(new NGConstraintSpace(
       out_writing_mode, static_cast<TextDirection>(text_direction_),
       available_size, percentage_resolution_size,
-      initial_containing_block_size_, fragmentainer_space_available_,
-      is_fixed_size_block_, is_fixed_size_inline_, is_shrink_to_fit_,
+      parent_percentage_resolution_inline_size, initial_containing_block_size_,
+      fragmentainer_space_available_, is_fixed_size_block_,
+      is_fixed_size_inline_, is_shrink_to_fit_,
       is_block_direction_triggers_scrollbar_,
       is_inline_direction_triggers_scrollbar_,
       static_cast<NGFragmentationType>(fragmentation_type_), is_new_fc_,
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
index 6dd79da1..9577646 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_builder.h
@@ -79,6 +79,7 @@
   NGLogicalSize available_size_;
   // Relative to parent_writing_mode_.
   NGLogicalSize percentage_resolution_size_;
+  Optional<NGLogicalSize> parent_percentage_resolution_size_;
   NGPhysicalSize initial_containing_block_size_;
   LayoutUnit fragmentainer_space_available_;
 
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
index 6ebccb6..4d21b45 100644
--- a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
@@ -134,8 +134,10 @@
   return selection_rect;
 }
 
-LayoutRect SVGInlineTextBox::LocalSelectionRect(int start_position,
-                                                int end_position) const {
+LayoutRect SVGInlineTextBox::LocalSelectionRect(
+    int start_position,
+    int end_position,
+    bool consider_current_selection) const {
   int box_start = Start();
   start_position = std::max(start_position - box_start, 0);
   end_position = std::min(end_position - box_start, static_cast<int>(Len()));
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.h b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.h
index d1fc236..b22e4ff 100644
--- a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.h
+++ b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.h
@@ -47,7 +47,8 @@
              LayoutUnit line_top,
              LayoutUnit line_bottom) const override;
   LayoutRect LocalSelectionRect(int start_position,
-                                int end_position) const override;
+                                int end_position,
+                                bool = true) const override;
 
   bool MapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&,
                                                    int& start_position,
diff --git a/third_party/WebKit/Source/core/loader/PingLoaderTest.cpp b/third_party/WebKit/Source/core/loader/PingLoaderTest.cpp
index ced63815..e1c904d 100644
--- a/third_party/WebKit/Source/core/loader/PingLoaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoaderTest.cpp
@@ -23,7 +23,7 @@
 class PingLocalFrameClient : public EmptyLocalFrameClient {
  public:
   void DispatchWillSendRequest(ResourceRequest& request) override {
-    if (request.HttpContentType() == "text/ping")
+    if (request.GetKeepalive())
       ping_request_ = request;
   }
 
@@ -71,7 +71,7 @@
     return ping_request;
   }
 
- private:
+ protected:
   Persistent<PingLocalFrameClient> client_;
   std::unique_ptr<DummyPageHolder> page_holder_;
 };
@@ -103,6 +103,52 @@
   ASSERT_TRUE(ping_request.IsNull());
 }
 
+TEST_F(PingLoaderTest, LoadImagePriority) {
+  SetDocumentURL(KURL(kParsedURLString, "http://localhost/foo.html"));
+
+  KURL ping_url(kParsedURLString, "https://localhost/bar.html");
+  URLTestHelpers::RegisterMockedURLLoad(
+      ping_url, testing::CoreTestDataPath("bar.html"), "text/html");
+  PingLoader::LoadImage(&page_holder_->GetFrame(), ping_url);
+  Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests();
+  const ResourceRequest& request = client_->PingRequest();
+  ASSERT_FALSE(request.IsNull());
+  ASSERT_EQ(request.Url(), ping_url);
+  EXPECT_EQ(kResourceLoadPriorityVeryLow, request.Priority());
+}
+
+TEST_F(PingLoaderTest, LinkAuditPingPriority) {
+  KURL destination_url(kParsedURLString, "http://navigation.destination");
+  SetDocumentURL(KURL(kParsedURLString, "http://localhost/foo.html"));
+
+  KURL ping_url(kParsedURLString, "https://localhost/bar.html");
+  URLTestHelpers::RegisterMockedURLLoad(
+      ping_url, testing::CoreTestDataPath("bar.html"), "text/html");
+  PingLoader::SendLinkAuditPing(&page_holder_->GetFrame(), ping_url,
+                                destination_url);
+  Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests();
+  const ResourceRequest& request = client_->PingRequest();
+  ASSERT_FALSE(request.IsNull());
+  ASSERT_EQ(request.Url(), ping_url);
+  EXPECT_EQ(kResourceLoadPriorityVeryLow, request.Priority());
+}
+
+TEST_F(PingLoaderTest, BeaconPriority) {
+  SetDocumentURL(KURL(kParsedURLString, "https://localhost/foo.html"));
+
+  KURL ping_url(kParsedURLString, "https://localhost/bar.html");
+  URLTestHelpers::RegisterMockedURLLoad(
+      ping_url, testing::CoreTestDataPath("bar.html"), "text/html");
+  size_t size = 0;
+  PingLoader::SendBeacon(&page_holder_->GetFrame(), 123, ping_url, "hello",
+                         size);
+  Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests();
+  const ResourceRequest& request = client_->PingRequest();
+  ASSERT_FALSE(request.IsNull());
+  ASSERT_EQ(request.Url(), ping_url);
+  EXPECT_EQ(kResourceLoadPriorityVeryLow, request.Priority());
+}
+
 }  // namespace
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp
index bfac232..3433bd5c 100644
--- a/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp
+++ b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp
@@ -21,18 +21,25 @@
 class ValidationMessageChromeClient : public EmptyChromeClient {
  public:
   explicit ValidationMessageChromeClient(ChromeClient& main_chrome_client,
+                                         LocalFrameView* anchor_view,
                                          PageOverlay& overlay)
-      : main_chrome_client_(main_chrome_client), overlay_(overlay) {}
+      : main_chrome_client_(main_chrome_client),
+        anchor_view_(anchor_view),
+        overlay_(overlay) {}
 
   DEFINE_INLINE_TRACE() {
     visitor->Trace(main_chrome_client_);
+    visitor->Trace(anchor_view_);
     EmptyChromeClient::Trace(visitor);
   }
 
   void InvalidateRect(const IntRect&) override { overlay_.Update(); }
 
   void ScheduleAnimation(const PlatformFrameView* frame_view) override {
-    main_chrome_client_->ScheduleAnimation(frame_view);
+    // Need to pass LocalFrameView for the anchor element because the Frame for
+    // this overlay doesn't have an associated WebFrameWidget, which schedules
+    // animation.
+    main_chrome_client_->ScheduleAnimation(anchor_view_);
   }
 
   float WindowToViewportScalar(const float scalar_value) const override {
@@ -41,6 +48,7 @@
 
  private:
   Member<ChromeClient> main_chrome_client_;
+  Member<LocalFrameView> anchor_view_;
   PageOverlay& overlay_;
 };
 
@@ -116,7 +124,8 @@
   Page::PageClients page_clients;
   FillWithEmptyClients(page_clients);
   chrome_client_ = new ValidationMessageChromeClient(
-      main_page_->GetChromeClient(), const_cast<PageOverlay&>(overlay));
+      main_page_->GetChromeClient(), anchor_->GetDocument().View(),
+      const_cast<PageOverlay&>(overlay));
   page_clients.chrome_client = chrome_client_;
   Settings& main_settings = main_page_->GetSettings();
   page_ = Page::Create(page_clients);
diff --git a/third_party/WebKit/Source/core/paint/BoxPainter.cpp b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
index 58995ce5..14d84d2 100644
--- a/third_party/WebKit/Source/core/paint/BoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
@@ -106,14 +106,12 @@
   bool painting_overflow_contents =
       IsPaintingBackgroundOfPaintContainerIntoScrollingContentsLayer(
           &layout_box_, paint_info);
-  const ComputedStyle& style = layout_box_.StyleRef();
-
   Optional<DisplayItemCacheSkipper> cache_skipper;
   // Disable cache in under-invalidation checking mode for MediaSliderPart
   // because we always paint using the latest data (buffered ranges, current
   // time and duration) which may be different from the cached data.
   if ((RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() &&
-       style.Appearance() == kMediaSliderPart)
+       layout_box_.StyleRef().Appearance() == kMediaSliderPart)
       // We may paint a delayed-invalidation object before it's actually
       // invalidated. Note this would be handled for us by
       // LayoutObjectDrawingRecorder but we have to use DrawingRecorder as we
@@ -145,11 +143,12 @@
     // FIXME: Should eventually give the theme control over whether the box
     // shadow should paint, since controls could have custom shadows of their
     // own.
-    PaintNormalBoxShadow(paint_info, paint_rect, style);
+    PaintNormalBoxShadow(paint_info, paint_rect, layout_box_.StyleRef());
 
     if (BleedAvoidanceIsClipping(box_decoration_data.bleed_avoidance)) {
       state_saver.Save();
-      FloatRoundedRect border = style.GetRoundedBorderFor(paint_rect);
+      FloatRoundedRect border =
+          layout_box_.StyleRef().GetRoundedBorderFor(paint_rect);
       paint_info.context.ClipRoundedRect(border);
 
       if (box_decoration_data.bleed_avoidance == kBackgroundBleedClipLayer)
@@ -179,7 +178,7 @@
   }
 
   if (!painting_overflow_contents) {
-    PaintInsetBoxShadow(paint_info, paint_rect, style);
+    PaintInsetBoxShadow(paint_info, paint_rect, layout_box_.StyleRef());
 
     // The theme will tell us whether or not we should also paint the CSS
     // border.
@@ -191,7 +190,8 @@
         !(layout_box_.IsTable() &&
           ToLayoutTable(&layout_box_)->ShouldCollapseBorders())) {
       PaintBorder(layout_box_, layout_box_.GetDocument(), GetNode(), paint_info,
-                  paint_rect, style, box_decoration_data.bleed_avoidance);
+                  paint_rect, layout_box_.StyleRef(),
+                  box_decoration_data.bleed_avoidance);
     }
   }
 
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index ab812bf..05c7008 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -47,7 +47,6 @@
 #include "core/css/PseudoStyleRequest.h"
 #include "core/dom/AXObjectCache.h"
 #include "core/dom/DOMNodeIds.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/Node.h"
 #include "core/dom/ShadowRoot.h"
 #include "core/dom/TaskRunnerHelper.h"
@@ -59,6 +58,7 @@
 #include "core/frame/RootFrameViewport.h"
 #include "core/frame/Settings.h"
 #include "core/frame/VisualViewport.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLSelectElement.h"
 #include "core/input/EventHandler.h"
diff --git a/third_party/WebKit/Source/devtools/BUILD.gn b/third_party/WebKit/Source/devtools/BUILD.gn
index 1aee815..eb3bdaf 100644
--- a/third_party/WebKit/Source/devtools/BUILD.gn
+++ b/third_party/WebKit/Source/devtools/BUILD.gn
@@ -750,10 +750,6 @@
   "front_end/ui/ZoomManager.js",
   "front_end/unit_test_runner.js",
   "front_end/unit_test_runner.json",
-  "front_end/utility_shared_worker.js",
-  "front_end/utility_shared_worker.json",
-  "front_end/utility_shared_worker/module.json",
-  "front_end/utility_shared_worker/TempStorage.js",
   "front_end/worker_service/ServiceDispatcher.js",
   "front_end/workspace/FileManager.js",
   "front_end/workspace/module.json",
@@ -888,7 +884,6 @@
   "$resources_out_dir/audits2_worker.js",
   "$resources_out_dir/formatter_worker.js",
   "$resources_out_dir/heap_snapshot_worker.js",
-  "$resources_out_dir/utility_shared_worker.js",
 ]
 
 generated_non_autostart_non_remote_modules = [
@@ -951,7 +946,6 @@
   "formatter_worker",
   "audits2_worker",
   "heap_snapshot_worker",
-  "utility_shared_worker",
 ]
 
 #-------------------------------------------------------------------------------
diff --git a/third_party/WebKit/Source/devtools/front_end/Runtime.js b/third_party/WebKit/Source/devtools/front_end/Runtime.js
index e1ce991..32b192d 100644
--- a/third_party/WebKit/Source/devtools/front_end/Runtime.js
+++ b/third_party/WebKit/Source/devtools/front_end/Runtime.js
@@ -285,40 +285,6 @@
   }
 
   /**
-   * @param {string} appName
-   */
-  static startSharedWorker(appName) {
-    var startPromise = Runtime.startApplication(appName);
-
-    /**
-     * @param {!MessageEvent} event
-     */
-    self.onconnect = function(event) {
-      var newPort = /** @type {!MessagePort} */ (event.ports[0]);
-      startPromise.then(sendWorkerReadyAndContinue);
-
-      function sendWorkerReadyAndContinue() {
-        newPort.postMessage('workerReady');
-        if (Runtime._sharedWorkerNewPortCallback)
-          Runtime._sharedWorkerNewPortCallback.call(null, newPort);
-        else
-          Runtime._sharedWorkerConnectedPorts.push(newPort);
-      }
-    };
-  }
-
-  /**
-   * @param {function(!MessagePort)} callback
-   */
-  static setSharedWorkerNewPortCallback(callback) {
-    Runtime._sharedWorkerNewPortCallback = callback;
-    while (Runtime._sharedWorkerConnectedPorts.length) {
-      var port = Runtime._sharedWorkerConnectedPorts.shift();
-      callback.call(null, port);
-    }
-  }
-
-  /**
    * @param {string} name
    * @return {?string}
    */
@@ -593,12 +559,6 @@
 };
 
 
-/** @type {?function(!MessagePort)} */
-Runtime._sharedWorkerNewPortCallback = null;
-/** @type {!Array<!MessagePort>} */
-Runtime._sharedWorkerConnectedPorts = [];
-
-
 Runtime._console = console;
 Runtime._originalAssert = console.assert;
 
diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js
index 837870dd..b77fdf3 100644
--- a/third_party/WebKit/Source/devtools/front_end/Tests.js
+++ b/third_party/WebKit/Source/devtools/front_end/Tests.js
@@ -857,16 +857,6 @@
     }
   };
 
-  TestSuite.prototype.testDevToolsSharedWorker = function() {
-    this.takeControl();
-    Bindings.TempFile.ensureTempStorageCleared().then(() => this.releaseControl());
-  };
-
-  TestSuite.prototype.testTempFile = function() {
-    this.takeControl();
-    Bindings.TempFile.create('test-file', 'test').then(() => this.releaseControl(), error => this.fail(String(error)));
-  };
-
   TestSuite.prototype.waitForTestResultsInConsole = function() {
     var messages = ConsoleModel.consoleModel.messages();
     for (var i = 0; i < messages.length; ++i) {
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
index 48fb287..d7dce91e0 100644
--- a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
+++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
@@ -581,7 +581,7 @@
 
   _initWorker() {
     this._backendPromise =
-        Services.serviceManager.createAppService('audits2_worker', 'Audits2Service', false).then(backend => {
+        Services.serviceManager.createAppService('audits2_worker', 'Audits2Service').then(backend => {
           if (this._backend)
             return;
           this._backend = backend;
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/FileUtils.js b/third_party/WebKit/Source/devtools/front_end/bindings/FileUtils.js
index 69b9524..cf4c917e 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/FileUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/FileUtils.js
@@ -63,13 +63,13 @@
  */
 Bindings.ChunkedFileReader = class {
   /**
-   * @param {!File} file
+   * @param {!Blob} blob
    * @param {number} chunkSize
    * @param {function(!Bindings.ChunkedReader)=} chunkTransferredCallback
    */
-  constructor(file, chunkSize, chunkTransferredCallback) {
-    this._file = file;
-    this._fileSize = file.size;
+  constructor(blob, chunkSize, chunkTransferredCallback) {
+    this._file = blob;
+    this._fileSize = blob.size;
     this._loadedSize = 0;
     this._chunkSize = chunkSize;
     this._chunkTransferredCallback = chunkTransferredCallback;
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js b/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js
index 1ab0e33..22d455e 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js
@@ -28,79 +28,19 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
-
 Bindings.TempFile = class {
   constructor() {
-    /** @type {?FileEntry} */
-    this._fileEntry = null;
-    /** @type {?FileWriter} */
-    this._writer = null;
+    /** @type {?Blob} */
+    this._lastBlob = null;
   }
 
   /**
-   * @param {string} dirPath
-   * @param {string} name
-   * @return {!Promise<!Bindings.TempFile>}
+   * @param {!Array<string|!Blob>} pieces
    */
-  static async create(dirPath, name) {
-    var file = new Bindings.TempFile();
-
-    await Bindings.TempFile.ensureTempStorageCleared();
-    var fs = await new Promise(window.requestFileSystem.bind(window, window.TEMPORARY, 10));
-    var dir = await new Promise(fs.root.getDirectory.bind(fs.root, dirPath, {create: true}));
-    file._fileEntry = await new Promise(dir.getFile.bind(dir, name, {create: true}));
-    var writer = await new Promise(file._fileEntry.createWriter.bind(file._fileEntry));
-
-    if (writer.length) {
-      try {
-        await new Promise((resolve, reject) => {
-          writer.onwriteend = resolve;
-          writer.onerror = reject;
-          writer.truncate(0);
-        });
-      } finally {
-        writer.onwriteend = null;
-        writer.onerror = null;
-      }
-    }
-
-    file._writer = writer;
-    return file;
-  }
-
-  /**
-   * @return {!Promise}
-   */
-  static ensureTempStorageCleared() {
-    if (!Bindings.TempFile._storageCleanerPromise) {
-      Bindings.TempFile._storageCleanerPromise =
-          Services.serviceManager.createAppService('utility_shared_worker', 'TempStorage', true).then(service => {
-            if (service)
-              return service.send('clear');
-          });
-    }
-    return Bindings.TempFile._storageCleanerPromise;
-  }
-
-  /**
-   * @param {!Array<string>} strings
-   * @return {!Promise<number>}
-   */
-  write(strings) {
-    var blob = new Blob(strings, {type: 'text/plain'});
-    return new Promise(resolve => {
-      this._writer.onerror = function(e) {
-        Common.console.error('Failed to write into a temp file: ' + e.target.error.message);
-        resolve(-1);
-      };
-      this._writer.onwriteend = e => resolve(e.target.length);
-      this._writer.write(blob);
-    });
-  }
-
-  finishWriting() {
-    this._writer = null;
+  write(pieces) {
+    if (this._lastBlob)
+      pieces.unshift(this._lastBlob);
+    this._lastBlob = new Blob(pieces, {type: 'text/plain'});
   }
 
   /**
@@ -111,28 +51,32 @@
   }
 
   /**
+   * @return {number}
+   */
+  size() {
+    return this._lastBlob ? this._lastBlob.size : 0;
+  }
+
+  /**
    * @param {number=} startOffset
    * @param {number=} endOffset
    * @return {!Promise<?string>}
    */
   async readRange(startOffset, endOffset) {
-    var file;
-    try {
-      file = await new Promise(this._fileEntry.file.bind(this._fileEntry));
-    } catch (error) {
-      Common.console.error('Failed to load temp file: ' + error.message);
-      return null;
+    if (!this._lastBlob) {
+      Common.console.error('Attempt to read a temp file that was never written');
+      return Promise.resolve('');
     }
-
-    if (typeof startOffset === 'number' || typeof endOffset === 'number')
-      file = file.slice(/** @type {number} */ (startOffset), /** @type {number} */ (endOffset));
+    var blob = typeof startOffset === 'number' || typeof endOffset === 'number' ?
+        this._lastBlob.slice(/** @type {number} */ (startOffset), /** @type {number} */ (endOffset)) :
+        this._lastBlob;
 
     var reader = new FileReader();
     try {
       await new Promise((resolve, reject) => {
         reader.onloadend = resolve;
         reader.onerror = reject;
-        reader.readAsText(file);
+        reader.readAsText(blob);
       });
     } catch (error) {
       Common.console.error('Failed to read from temp file: ' + error.message);
@@ -147,112 +91,16 @@
    * @return {!Promise<?FileError>}
    */
   copyToOutputStream(outputStream, progress) {
-    return new Promise(resolve => {
-      this._fileEntry.file(didGetFile, didFailToGetFile);
-
-      /**
-       * @param {!File} file
-       */
-      async function didGetFile(file) {
-        var reader = new Bindings.ChunkedFileReader(file, 10 * 1000 * 1000, progress);
-        var success = await reader.read(outputStream);
-        resolve(success ? null : reader.error());
-      }
-
-      /**
-       * @param {!FileError} error
-       */
-      function didFailToGetFile(error) {
-        Common.console.error('Failed to load temp file: ' + error.message);
-        outputStream.close();
-        resolve(error);
-      }
-    });
+    if (!this._lastBlob) {
+      outputStream.close();
+      return Promise.resolve(/** @type {?FileError} */ (null));
+    }
+    var reader = new Bindings.ChunkedFileReader(/** @type {!Blob} */ (this._lastBlob), 10 * 1000 * 1000, progress);
+    return reader.read(outputStream).then(success => success ? null : reader.error());
   }
 
   remove() {
-    if (this._fileEntry)
-      this._fileEntry.remove(() => {});
-  }
-};
-
-Bindings.DeferredTempFile = class {
-  /**
-   * @param {string} dirPath
-   * @param {string} name
-   */
-  constructor(dirPath, name) {
-    /** @type {?Bindings.TempFile} */
-    this._tempFile = null;
-    this._writeFinished = false;
-    /** @type {function(?Bindings.TempFile)} */
-    this._writeFinishedResolve;
-    this._writeFinishedPromise = new Promise(resolve => this._writeFinishedResolve = resolve);
-
-    this._lastActionPromise =
-        Bindings.TempFile.create(dirPath, name)
-            .then(
-                tempFile => this._tempFile = tempFile,
-                error => Common.console.error(`Failed to create temp file ${error.code} : ${error.message}`));
-  }
-
-  /**
-   * @param {!Array<string>} strings
-   * @return {!Promise<number>}
-   */
-  write(strings) {
-    if (this._writeFinished)
-      throw new Error('No writes are allowed after close.');
-
-    this._lastActionPromise = this._lastActionPromise.then(async () => {
-      if (!this._tempFile)
-        return -1;
-      var size = await this._tempFile.write(strings);
-      if (size === -1) {
-        this._tempFile.remove();
-        this._tempFile = null;
-      }
-      return size;
-    });
-
-    return this._lastActionPromise;
-  }
-
-  /**
-   * @return {!Promise<?Bindings.TempFile>}
-   */
-  async finishWriting() {
-    this._writeFinished = true;
-    await this._lastActionPromise;
-    this._writeFinishedResolve(this._tempFile);
-    return this._writeFinishedPromise;
-  }
-
-  /**
-   * @param {number|undefined} startOffset
-   * @param {number|undefined} endOffset
-   * @return {!Promise<?string>}
-   */
-  async readRange(startOffset, endOffset) {
-    await this._writeFinishedPromise;
-    return this._tempFile ? this._tempFile.readRange(startOffset, endOffset) : null;
-  }
-
-  /**
-   * @param {!Common.OutputStream} outputStream
-   * @param {function()=} progress
-   * @return {!Promise<?FileError>}
-   */
-  async copyToOutputStream(outputStream, progress) {
-    await this._writeFinishedPromise;
-    return this._tempFile ? await this._tempFile.copyToOutputStream(outputStream, progress) : null;
-  }
-
-  async remove() {
-    await this._lastActionPromise;
-    if (this._tempFile)
-      this._tempFile.remove();
-    this._tempFile = null;
+    this._lastBlob = null;
   }
 };
 
@@ -260,19 +108,13 @@
  * @implements {SDK.BackingStorage}
  */
 Bindings.TempFileBackingStorage = class {
-  /**
-   * @param {string} dirName
-   */
-  constructor(dirName) {
-    this._dirName = dirName;
-    /** @type {?Bindings.DeferredTempFile} */
+  constructor() {
+    /** @type {?Bindings.TempFile} */
     this._file = null;
     /** @type {!Array<string>} */
     this._strings;
     /** @type {number} */
     this._stringsLength;
-    /** @type {number} */
-    this._fileSize;
     this.reset();
   }
 
@@ -285,7 +127,7 @@
     this._stringsLength += string.length;
     var flushStringLength = 10 * 1024 * 1024;
     if (this._stringsLength > flushStringLength)
-      this._flush(false);
+      this._flush();
   }
 
   /**
@@ -294,67 +136,27 @@
    * @return {function():!Promise<?string>}
    */
   appendAccessibleString(string) {
-    this._flush(false);
+    this._flush();
+    var startOffset = this._file.size();
     this._strings.push(string);
-    var chunk = /** @type {!Bindings.TempFileBackingStorage.Chunk} */ (this._flush(true));
-
-    /**
-     * @param {!Bindings.TempFileBackingStorage.Chunk} chunk
-     * @param {!Bindings.DeferredTempFile} file
-     * @return {!Promise<?string>}
-     */
-    function readString(chunk, file) {
-      if (chunk.string)
-        return /** @type {!Promise<?string>} */ (Promise.resolve(chunk.string));
-
-      console.assert(chunk.endOffset);
-      if (!chunk.endOffset)
-        return Promise.reject('Neither string nor offset to the string in the file were found.');
-
-      return file.readRange(chunk.startOffset, chunk.endOffset);
-    }
-
-    return readString.bind(null, chunk, /** @type {!Bindings.DeferredTempFile} */ (this._file));
+    this._flush();
+    return this._file.readRange.bind(this._file, startOffset, this._file.size());
   }
 
-  /**
-   * @param {boolean} createChunk
-   * @return {?Bindings.TempFileBackingStorage.Chunk}
-   */
-  _flush(createChunk) {
+  _flush() {
     if (!this._strings.length)
-      return null;
-
-    var chunk = null;
-    if (createChunk) {
-      console.assert(this._strings.length === 1);
-      chunk = {string: this._strings[0], startOffset: 0, endOffset: 0};
-    }
-
+      return;
     if (!this._file)
-      this._file = new Bindings.DeferredTempFile(this._dirName, String(Date.now()));
-
+      this._file = new Bindings.TempFile();
     this._stringsLength = 0;
-    this._file.write(this._strings.splice(0)).then(fileSize => {
-      if (fileSize === -1)
-        return;
-      if (chunk) {
-        chunk.startOffset = this._fileSize;
-        chunk.endOffset = fileSize;
-        chunk.string = null;
-      }
-      this._fileSize = fileSize;
-    });
-
-    return chunk;
+    this._file.write(this._strings.splice(0));
   }
 
   /**
    * @override
    */
   finishWriting() {
-    this._flush(false);
-    this._file.finishWriting();
+    this._flush();
   }
 
   /**
@@ -367,7 +169,6 @@
     /** @type {!Array<string>} */
     this._strings = [];
     this._stringsLength = 0;
-    this._fileSize = 0;
   }
 
   /**
@@ -381,7 +182,6 @@
 
 /**
  * @typedef {{
- *      string: ?string,
  *      startOffset: number,
  *      endOffset: number
  * }}
diff --git a/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js b/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
index 3e5c12c..b891fc2 100644
--- a/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
+++ b/third_party/WebKit/Source/devtools/front_end/data_grid/DataGrid.js
@@ -1374,7 +1374,7 @@
       currentAncestor = currentAncestor.parent;
     }
 
-    this._revealed = true;
+    this.revealed = true;
     return true;
   }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js
index f490923..ccecb2c 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js
@@ -694,7 +694,7 @@
     this._resourceTreeModel = this._tracingManager.target().model(SDK.ResourceTreeModel);
     if (this._tracingModel)
       this._tracingModel.dispose();
-    this._tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStorage('tracing'));
+    this._tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStorage());
     this._tracingManager.start(this, '-*,disabled-by-default-devtools.screenshot', '');
   }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js b/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js
index c99673d..b182f6b6 100644
--- a/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js
+++ b/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js
@@ -168,6 +168,8 @@
   highlightEntry(entryIndex) {
     if (this._highlightedEntryIndex === entryIndex)
       return;
+    if (!this._dataProvider.entryColor(entryIndex))
+      return;
     this._highlightedEntryIndex = entryIndex;
     this._updateElementPosition(this._highlightElement, this._highlightedEntryIndex);
     this.dispatchEventToListeners(PerfUI.FlameChart.Events.EntryHighlighted, entryIndex);
@@ -692,7 +694,6 @@
       var color = colors[c];
       var indexes = colorBuckets.get(color);
       context.beginPath();
-      context.fillStyle = color;
       for (var i = 0; i < indexes.length; ++i) {
         var entryIndex = indexes[i];
         var entryStartTime = entryStartTimes[entryIndex];
@@ -709,14 +710,17 @@
         }
         var barRight = this._timeToPositionClipped(entryStartTime + duration);
         var barWidth = Math.max(barRight - barX, 1);
-        context.rect(barX, barY, barWidth - 0.4, barHeight - 1);
+        if (color)
+          context.rect(barX, barY, barWidth - 0.4, barHeight - 1);
         if (barWidth > minTextWidth || this._dataProvider.forceDecoration(entryIndex))
           titleIndices.push(entryIndex);
       }
+      if (!color)
+        continue;
+      context.fillStyle = color;
       context.fill();
     }
 
-    context.strokeStyle = 'rgba(0, 0, 0, 0.2)';
     context.beginPath();
     for (var m = 0; m < markerIndices.length; ++m) {
       var entryIndex = markerIndices[m];
@@ -727,6 +731,7 @@
       context.moveTo(barX + this._markerRadius, y);
       context.arc(barX, y, this._markerRadius, 0, Math.PI * 2);
     }
+    context.strokeStyle = 'rgba(0, 0, 0, 0.2)';
     context.stroke();
 
     context.textBaseline = 'alphabetic';
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotDataGrids.js b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotDataGrids.js
index e13d1b9f..eca2bd4 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotDataGrids.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotDataGrids.js
@@ -389,7 +389,6 @@
       var hasChildren = child.hasChildren();
       child.removeChildren();
       child.setHasChildren(hasChildren);
-      child.revealed = true;
       parentNode.appendChild(child);
       position += child.nodeSelfHeight();
       position += this._addVisibleNodes(child, topBound - position, bottomBound - position);
@@ -414,8 +413,6 @@
    * @return {number}
    */
   _nodeHeight(node) {
-    if (!node.revealed)
-      return 0;
     var result = node.nodeSelfHeight();
     if (!node.expanded)
       return result;
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
index aa2011b..afc66cc 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
@@ -1358,14 +1358,12 @@
     this.updateStatus(Common.UIString('Loading\u2026'), true);
   }
 
-  async _finishLoad() {
+  _finishLoad() {
     if (!this._wasDisposed)
       this._receiver.close();
     if (!this._bufferedWriter)
       return;
-    var file = await this._bufferedWriter.finishWriting();
-    this._bufferedWriter = null;
-    this._didWriteToTempFile(file);
+    this._didWriteToTempFile(this._bufferedWriter);
   }
 
   /**
@@ -1437,7 +1435,7 @@
    */
   transferChunk(chunk) {
     if (!this._bufferedWriter)
-      this._bufferedWriter = new Bindings.DeferredTempFile('heap-profiler', String(this.uid));
+      this._bufferedWriter = new Bindings.TempFile();
     this._bufferedWriter.write([chunk]);
 
     ++this._totalNumberOfChunks;
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
index 66840ef..1873901 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
@@ -453,31 +453,17 @@
   /**
    * @override
    */
-  saveToFile() {
+  async saveToFile() {
     var fileOutputStream = new Bindings.FileOutputStream();
     this._fileName = this._fileName ||
         `${this.profileType().typeName()}-${new Date().toISO8601Compact()}${this.profileType().fileExtension()}`;
-    fileOutputStream.open(this._fileName).then(onOpenForSave.bind(this));
-
-    /**
-     * @param {boolean} accepted
-     * @this {Profiler.WritableProfileHeader}
-     */
-    async function onOpenForSave(accepted) {
-      if (!accepted)
-        return;
-      if (this._failedToCreateTempFile) {
-        Common.console.error('Failed to open temp file with heap snapshot');
-        fileOutputStream.close();
-      } else if (this._tempFile) {
-        var data = await this._tempFile.read();
-        if (data)
-          await fileOutputStream.write(data);
-        fileOutputStream.close();
-      } else {
-        this._onTempFileReady = onOpenForSave.bind(this, accepted);
-      }
-    }
+    var accepted = await fileOutputStream.open(this._fileName);
+    if (!accepted || !this._tempFile)
+      return;
+    var data = await this._tempFile.read();
+    if (data)
+      await fileOutputStream.write(data);
+    fileOutputStream.close();
   }
 
   /**
@@ -509,50 +495,9 @@
    */
   setProtocolProfile(profile) {
     this._protocolProfile = profile;
-    this._saveProfileDataToTempFile(profile);
+    this._tempFile = new Bindings.TempFile();
+    this._tempFile.write([JSON.stringify(profile)]);
     if (this.canSaveToFile())
       this.dispatchEventToListeners(Profiler.ProfileHeader.Events.ProfileReceived);
   }
-
-  /**
-   * @param {*} data
-   */
-  _saveProfileDataToTempFile(data) {
-    var serializedData = JSON.stringify(data);
-
-    /**
-     * @this {Profiler.WritableProfileHeader}
-     */
-    function didCreateTempFile(tempFile) {
-      this._writeToTempFile(tempFile, serializedData);
-    }
-    Bindings.TempFile.create('cpu-profiler', String(this.uid)).then(didCreateTempFile.bind(this));
-  }
-
-  /**
-   * @param {?Bindings.TempFile} tempFile
-   * @param {string} serializedData
-   */
-  async _writeToTempFile(tempFile, serializedData) {
-    this._tempFile = tempFile;
-    if (!tempFile) {
-      this._failedToCreateTempFile = true;
-      this._notifyTempFileReady();
-      return;
-    }
-
-    var fileSize = await tempFile.write([serializedData]);
-
-    if (!fileSize)
-      this._failedToCreateTempFile = true;
-    tempFile.finishWriting();
-    this._notifyTempFileReady();
-  }
-
-  _notifyTempFileReady() {
-    if (this._onTempFileReady) {
-      this._onTempFileReady();
-      this._onTempFileReady = null;
-    }
-  }
 };
diff --git a/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js b/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js
index ab708375..ed74db5 100644
--- a/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js
@@ -25,21 +25,18 @@
   /**
    * @param {string} appName
    * @param {string} serviceName
-   * @param {boolean} isSharedWorker
    * @return {!Promise<?Services.ServiceManager.Service>}
    */
-  createAppService(appName, serviceName, isSharedWorker) {
+  createAppService(appName, serviceName) {
     var url = appName + '.js';
     var remoteBase = Runtime.queryParam('remoteBase');
     var debugFrontend = Runtime.queryParam('debugFrontend');
-    // Do not pass additional query parameters to shared worker to avoid URLMismatchError
-    // in case another instance of DevTools with different query parameters creates same shared worker.
-    if (remoteBase && !isSharedWorker)
+    if (remoteBase)
       url += '?remoteBase=' + remoteBase;
-    if (debugFrontend && !isSharedWorker)
+    if (debugFrontend)
       url += '?debugFrontend=' + debugFrontend;
 
-    var worker = isSharedWorker ? new SharedWorker(url, appName) : new Worker(url);
+    var worker = new Worker(url);
     var connection = new Services.ServiceManager.Connection(new Services.ServiceManager.WorkerServicePort(worker));
     return connection._createService(serviceName);
   }
@@ -323,22 +320,16 @@
  */
 Services.ServiceManager.WorkerServicePort = class {
   /**
-   * @param {!Worker|!SharedWorker} worker
+   * @param {!Worker} worker
    */
   constructor(worker) {
     this._worker = worker;
 
     var fulfill;
     this._workerPromise = new Promise(resolve => fulfill = resolve);
-    this._isSharedWorker = worker instanceof SharedWorker;
 
-    if (this._isSharedWorker) {
-      this._worker.port.onmessage = onMessage.bind(this);
-      this._worker.port.onclose = this._closeHandler;
-    } else {
-      this._worker.onmessage = onMessage.bind(this);
-      this._worker.onclose = this._closeHandler;
-    }
+    this._worker.onmessage = onMessage.bind(this);
+    this._worker.onclose = this._closeHandler;
 
     /**
      * @param {!Event} event
@@ -371,10 +362,7 @@
   send(message) {
     return this._workerPromise.then(() => {
       try {
-        if (this._isSharedWorker)
-          this._worker.port.postMessage(message);
-        else
-          this._worker.postMessage(message);
+        this._worker.postMessage(message);
         return true;
       } catch (e) {
         return false;
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js
index 2984dcb3..09e59a0 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js
@@ -18,7 +18,7 @@
     this._performanceModel = performanceModel;
     this._client = client;
 
-    var backingStorage = new Bindings.TempFileBackingStorage('tracing');
+    var backingStorage = new Bindings.TempFileBackingStorage();
     this._tracingModel = new SDK.TracingModel(backingStorage);
 
     this._performanceModel.setMainTarget(tracingManager.target());
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartDataProvider.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartDataProvider.js
index 40eed87..411d6a7 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartDataProvider.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartDataProvider.js
@@ -487,16 +487,15 @@
     this._entryTypeByLevel[this._currentLevel] = Timeline.TimelineFlameChartDataProvider.EntryType.Screenshot;
     var prevTimestamp;
     for (var screenshot of screenshots) {
-      var index = this._entryData.length;
       this._entryData.push(screenshot);
-      this._timelineData.entryLevels[index] = this._currentLevel;
-      this._timelineData.entryStartTimes[index] = screenshot.timestamp;
+      this._timelineData.entryLevels.push(this._currentLevel);
+      this._timelineData.entryStartTimes.push(screenshot.timestamp);
       if (prevTimestamp)
-        this._timelineData.entryTotalTimes[index - 1] = screenshot.timestamp - prevTimestamp;
+        this._timelineData.entryTotalTimes.push(screenshot.timestamp - prevTimestamp);
       prevTimestamp = screenshot.timestamp;
     }
-    this._timelineData.entryTotalTimes[this._timelineData.entryTotalTimes.length - 1] =
-        this._model.maximumRecordTime() - prevTimestamp;
+    if (screenshots.length)
+      this._timelineData.entryTotalTimes.push(this._model.maximumRecordTime() - prevTimestamp);
     ++this._currentLevel;
   }
 
@@ -644,8 +643,7 @@
       this.dispatchEventToListeners(Timeline.TimelineFlameChartDataProvider.Events.DataChanged);
       return;
     }
-    context.fillStyle = '#eee';
-    context.fillRect(barX, barY, barWidth, barHeight);
+
     var image = this._screenshotImageCache.get(screenshot);
     if (!image)
       return;
@@ -653,12 +651,14 @@
     var imageY = barY + 1;
     var imageHeight = barHeight - 2;
     var scale = imageHeight / image.naturalHeight;
-    var imageWidth = image.naturalWidth * scale;
+    var imageWidth = Math.floor(image.naturalWidth * scale);
     context.save();
     context.beginPath();
-    context.rect(imageX, imageY, barWidth - 2, imageHeight);
+    context.rect(barX, barY, barWidth, barHeight);
     context.clip();
     context.drawImage(image, imageX, imageY, imageWidth, imageHeight);
+    context.strokeStyle = '#ccc';
+    context.strokeRect(imageX - 0.5, imageY - 0.5, Math.min(barWidth - 1, imageWidth + 1), imageHeight);
     context.restore();
   }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
index 2c4ae84..342a114a 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLoader.js
@@ -13,7 +13,7 @@
   constructor(client) {
     this._client = client;
 
-    this._backingStorage = new Bindings.TempFileBackingStorage('tracing');
+    this._backingStorage = new Bindings.TempFileBackingStorage();
     this._tracingModel = new SDK.TracingModel(this._backingStorage);
 
     /** @type {?function()} */
diff --git a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker.js b/third_party/WebKit/Source/devtools/front_end/utility_shared_worker.js
deleted file mode 100644
index 58d29c8..0000000
--- a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-// Release build has Runtime.js bundled.
-if (!self.Runtime)
-  self.importScripts('Runtime.js');
-Runtime.startSharedWorker('utility_shared_worker');
diff --git a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker.json b/third_party/WebKit/Source/devtools/front_end/utility_shared_worker.json
deleted file mode 100644
index c654c349..0000000
--- a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-    "modules": [
-        { "name": "worker_service", "type": "autostart" },
-        { "name": "utility_shared_worker", "type": "autostart" }
-    ],
-
-    "has_html": false
-}
diff --git a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker/TempStorage.js b/third_party/WebKit/Source/devtools/front_end/utility_shared_worker/TempStorage.js
deleted file mode 100644
index bcfaaec2..0000000
--- a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker/TempStorage.js
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-/**
- * @implements {Service}
- * @unrestricted
- */
-var TempStorage = class {
-  /**
-   * @override
-   * @param {function(string)} notify
-   */
-  setNotify(notify) {
-  }
-
-  /**
-   * @override
-   */
-  dispose() {
-  }
-
-  /**
-   * @return {!Promise}
-   */
-  clear() {
-    if (!TempStorage._clearPromise)
-      TempStorage._clearPromise = new Promise(this._innerClear.bind(this));
-    return TempStorage._clearPromise;
-  }
-
-  /**
-   * @param {function()} resolve
-   */
-  _innerClear(resolve) {
-    self.webkitRequestFileSystem(self.TEMPORARY, 10, didGetFS, didFail);
-
-    /**
-     * @param {!FileSystem} fs
-     */
-    function didGetFS(fs) {
-      fs.root.createReader().readEntries(didReadEntries, didFail);
-    }
-
-    /**
-     * @param {!Array.<!Entry>} entries
-     */
-    function didReadEntries(entries) {
-      var remainingEntries = entries.length;
-      if (!remainingEntries) {
-        resolve();
-        return;
-      }
-
-      function didDeleteEntry() {
-        if (!--remainingEntries)
-          resolve();
-      }
-
-      function failedToDeleteEntry(e) {
-        var tempStorageError = 'Failed to delete entry: ' + e.message + ' ' + e.name;
-        console.error(tempStorageError);
-        didDeleteEntry();
-      }
-
-      for (var i = 0; i < entries.length; i++) {
-        var entry = entries[i];
-        if (entry.isFile)
-          entry.remove(didDeleteEntry, failedToDeleteEntry);
-        else
-          entry.removeRecursively(didDeleteEntry, failedToDeleteEntry);
-      }
-    }
-
-    function didFail(e) {
-      var tempStorageError = 'Failed to clear temp storage: ' + e.message + ' ' + e.name;
-      console.error(tempStorageError);
-      resolve();
-    }
-  }
-};
diff --git a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker/module.json b/third_party/WebKit/Source/devtools/front_end/utility_shared_worker/module.json
deleted file mode 100644
index c978bc9..0000000
--- a/third_party/WebKit/Source/devtools/front_end/utility_shared_worker/module.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "dependencies": [
-        "worker_service"
-    ],
-    "extensions": [
-        {
-            "type": "@Service",
-            "className": "TempStorage",
-            "name": "TempStorage"
-        }
-    ],
-    "scripts": [
-        "TempStorage.js"
-    ]
-}
diff --git a/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js b/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js
index aa1cb39..e92f2c0 100644
--- a/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js
+++ b/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js
@@ -187,14 +187,6 @@
 
 var dispatchers = [];
 
-if (self.SharedWorkerGlobalScope) {
-  function onNewPort(port) {
-    var dispatcher = new ServiceDispatcher(new WorkerServicePort(port));
-    dispatchers.push(dispatcher);
-  }
-  Runtime.setSharedWorkerNewPortCallback(onNewPort);
-} else {
-  var worker = /** @type {!Object} */ (self);
-  var servicePort = new WorkerServicePort(/** @type {!Worker} */ (worker));
-  dispatchers.push(new ServiceDispatcher(servicePort));
-}
+var worker = /** @type {!Object} */ (self);
+var servicePort = new WorkerServicePort(/** @type {!Worker} */ (worker));
+dispatchers.push(new ServiceDispatcher(servicePort));
diff --git a/third_party/WebKit/Source/devtools/scripts/compile_frontend.py b/third_party/WebKit/Source/devtools/scripts/compile_frontend.py
index cb9a26df..5a783d4 100755
--- a/third_party/WebKit/Source/devtools/scripts/compile_frontend.py
+++ b/third_party/WebKit/Source/devtools/scripts/compile_frontend.py
@@ -114,7 +114,6 @@
     'unit_test_runner.json',
     'formatter_worker.json',
     'heap_snapshot_worker.json',
-    'utility_shared_worker.json',
 ]
 
 skipped_namespaces = {
diff --git a/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js b/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
index d7ac2f59..fc38bf3 100644
--- a/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
+++ b/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
@@ -24,7 +24,6 @@
   'unit_test_runner.json',
   'formatter_worker.json',
   'heap_snapshot_worker.json',
-  'utility_shared_worker.json',
 ];
 
 /*
diff --git a/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js b/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js
index 0cd9630..5bd65d9 100644
--- a/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js
+++ b/third_party/WebKit/Source/devtools/scripts/gulp/gulpfile.js
@@ -38,7 +38,6 @@
     'toolbox',
     'formatter_worker',
     'heap_snapshot_worker',
-    'utility_shared_worker',
     '--input_path',
     frontendPath,
     '--output_path',
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
index 9dda656..9702f39 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -27,7 +27,6 @@
 #include "modules/media_controls/MediaControlsImpl.h"
 
 #include "bindings/core/v8/ExceptionState.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/MutationCallback.h"
 #include "core/dom/MutationObserver.h"
 #include "core/dom/MutationObserverInit.h"
@@ -39,6 +38,7 @@
 #include "core/events/MouseEvent.h"
 #include "core/frame/Settings.h"
 #include "core/frame/UseCounter.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/geometry/DOMRect.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/HTMLVideoElement.h"
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
index 56baff26..9cc4397 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
@@ -6,10 +6,10 @@
 
 #include "core/HTMLNames.h"
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/frame/FrameView.h"
 #include "core/frame/ScreenOrientationController.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLAudioElement.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/loader/EmptyClients.h"
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegate.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegate.cpp
index 1e0a6f9..21468ac 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegate.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegate.cpp
@@ -5,10 +5,10 @@
 #include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h"
 
 #include "core/dom/ElementVisibilityObserver.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/events/Event.h"
 #include "core/frame/LocalDOMWindow.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/page/ChromeClient.h"
 #include "modules/media_controls/MediaControlsImpl.h"
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp
index 20ac52e..4fce7de 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp
@@ -7,11 +7,11 @@
 #include "core/HTMLNames.h"
 #include "core/css/CSSStyleDeclaration.h"
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/frame/LocalDOMWindow.h"
 #include "core/frame/LocalFrameView.h"
 #include "core/frame/Settings.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLAudioElement.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/loader/EmptyClients.h"
diff --git a/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp b/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp
index f6baae6e..c966856 100644
--- a/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp
+++ b/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp
@@ -9,7 +9,6 @@
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/ExecutionContext.h"
-#include "core/dom/Fullscreen.h"
 #include "core/frame/LocalDOMWindow.h"
 #include "core/frame/LocalFrame.h"
 #include "core/frame/Navigator.h"
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index d8c6de50..c29ce69 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -7732,7 +7732,7 @@
     visitor->TraceWrappers(unit.texture3d_binding_);
     visitor->TraceWrappers(unit.texture2d_array_binding_);
   }
-  for (ExtensionTracker* tracker : extensions_) {
+  for (auto tracker : extensions_) {
     visitor->TraceWrappers(tracker);
   }
   CanvasRenderingContext::TraceWrappers(visitor);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
index 919d126..16243349 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -863,6 +863,7 @@
 
     DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() {
       visitor->TraceWrappers(extension_);
+      ExtensionTracker::TraceWrappers(visitor);
     }
 
    private:
diff --git a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp
index 77ac2bf..73e4d80 100644
--- a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.cpp
@@ -8,9 +8,9 @@
 #include "cc/layers/solid_color_layer.h"
 #include "cc/layers/surface_layer.h"
 #include "cc/surfaces/sequence_surface_reference_factory.h"
-#include "cc/surfaces/surface_info.h"
 #include "cc/surfaces/surface_sequence.h"
 #include "components/viz/common/surfaces/surface_id.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/mojo/MojoHelper.h"
 #include "platform/wtf/Functional.h"
@@ -103,7 +103,8 @@
   GraphicsLayer::RegisterContentsLayer(web_layer_.get());
 }
 
-void SurfaceLayerBridge::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
+void SurfaceLayerBridge::OnSurfaceCreated(
+    const viz::SurfaceInfo& surface_info) {
   if (!current_surface_id_.is_valid() && surface_info.is_valid()) {
     // First time a SurfaceId is received
     current_surface_id_ = surface_info.id();
diff --git a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h
index 4111090..6c2757b 100644
--- a/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h
+++ b/third_party/WebKit/Source/platform/graphics/SurfaceLayerBridge.h
@@ -17,9 +17,12 @@
 
 namespace cc {
 class Layer;
-class SurfaceInfo;
 }  // namespace cc
 
+namespace viz {
+class SurfaceInfo;
+}  // namespace viz
+
 namespace blink {
 
 class WebLayer;
@@ -44,7 +47,7 @@
   void CreateSolidColorLayer();
 
   // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient
-  void OnSurfaceCreated(const cc::SurfaceInfo&) override;
+  void OnSurfaceCreated(const viz::SurfaceInfo&) override;
   void SatisfyCallback(const cc::SurfaceSequence&);
   void RequireCallback(const viz::SurfaceId&, const cc::SurfaceSequence&);
 
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index 57ae8de..c95b85d 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -215,6 +215,13 @@
     }
   } else if (FetchParameters::kLazyLoad == defer_option) {
     priority = kResourceLoadPriorityVeryLow;
+  } else if (resource_request.GetRequestContext() ==
+                 WebURLRequest::kRequestContextBeacon ||
+             resource_request.GetRequestContext() ==
+                 WebURLRequest::kRequestContextPing ||
+             resource_request.GetRequestContext() ==
+                 WebURLRequest::kRequestContextCSPReport) {
+    priority = kResourceLoadPriorityVeryLow;
   }
 
   // A manually set priority acts as a floor. This is used to ensure that
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
index f093c74..6e196cd 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -37,7 +37,6 @@
 #include "build/build_config.h"
 #include "core/HTMLNames.h"
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/Node.h"
 #include "core/events/WebInputEventConversion.h"
 #include "core/exported/WebFileChooserCompletionImpl.h"
@@ -49,6 +48,7 @@
 #include "core/frame/Settings.h"
 #include "core/frame/UseCounter.h"
 #include "core/frame/VisualViewport.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/ColorChooser.h"
 #include "core/html/forms/ColorChooserClient.h"
diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
index 7c68e8d..4392549 100644
--- a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
+++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
@@ -36,7 +36,6 @@
 #include "bindings/core/v8/ScriptController.h"
 #include "core/HTMLNames.h"
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/UserGestureIndicator.h"
 #include "core/events/MessageEvent.h"
 #include "core/events/MouseEvent.h"
@@ -49,6 +48,7 @@
 #include "core/frame/LocalFrameView.h"
 #include "core/frame/Settings.h"
 #include "core/frame/WebLocalFrameBase.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLFrameElementBase.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/HTMLPlugInElement.h"
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 101c6de..b241cb32 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -39,7 +39,6 @@
 #include "core/clipboard/DataObject.h"
 #include "core/dom/ContextFeaturesClientImpl.h"
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/LayoutTreeBuilderTraversal.h"
 #include "core/dom/Text.h"
 #include "core/dom/UserGestureIndicator.h"
@@ -72,6 +71,7 @@
 #include "core/frame/UseCounter.h"
 #include "core/frame/VisualViewport.h"
 #include "core/frame/WebLocalFrameBase.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/HTMLPlugInElement.h"
 #include "core/html/HTMLTextAreaElement.h"
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index a33f94d..769d51c8 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -49,7 +49,6 @@
 #include "core/css/resolver/StyleResolver.h"
 #include "core/css/resolver/ViewportStyleResolver.h"
 #include "core/dom/Document.h"
-#include "core/dom/Fullscreen.h"
 #include "core/dom/NodeComputedStyle.h"
 #include "core/dom/Range.h"
 #include "core/dom/UserGestureIndicator.h"
@@ -71,6 +70,7 @@
 #include "core/frame/Settings.h"
 #include "core/frame/VisualViewport.h"
 #include "core/frame/WebLocalFrameBase.h"
+#include "core/fullscreen/Fullscreen.h"
 #include "core/html/HTMLBodyElement.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLIFrameElement.h"
diff --git a/third_party/closure_compiler/README.chromium b/third_party/closure_compiler/README.chromium
index 1272225..9e306ec 100644
--- a/third_party/closure_compiler/README.chromium
+++ b/third_party/closure_compiler/README.chromium
@@ -3,7 +3,7 @@
 URL: http://github.com/google/closure-compiler
 Version: v20150729-236-gad656a1
 Date: 2015/08/26 08:46
-Revision: a13d0ba6d2b02b2188137b36cb699415bd8784c5
+Revision: 71ab0eecc33e2d8db1ce9ee251cbf174bddc493b
 License: Apache 2.0
 License File: LICENSE
 Security Critical: no
diff --git a/third_party/closure_compiler/compiler/compiler.jar b/third_party/closure_compiler/compiler/compiler.jar
index 80be348..8d92d49 100644
--- a/third_party/closure_compiler/compiler/compiler.jar
+++ b/third_party/closure_compiler/compiler/compiler.jar
Binary files differ
diff --git a/third_party/closure_compiler/externs/chrome_extensions.js b/third_party/closure_compiler/externs/chrome_extensions.js
index 9b3ec6df..e9bafac 100644
--- a/third_party/closure_compiler/externs/chrome_extensions.js
+++ b/third_party/closure_compiler/externs/chrome_extensions.js
@@ -1474,6 +1474,25 @@
 
 /**
  * @constructor
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#type-Request
+ */
+chrome.bluetoothLowEnergy.Request = function() {};
+
+
+/** @type {number} */
+chrome.bluetoothLowEnergy.Request.prototype.requestId;
+
+
+/** @type {!Object} */
+chrome.bluetoothLowEnergy.Request.prototype.device;
+
+
+/** @type {!ArrayBuffer|undefined} */
+chrome.bluetoothLowEnergy.Request.prototype.value;
+
+
+/**
+ * @constructor
  * @see https://developer.chrome.com/apps/bluetoothLowEnergy#type-Characteristic
  */
 chrome.bluetoothLowEnergy.Characteristic = function() {};
@@ -1513,6 +1532,10 @@
 chrome.bluetoothLowEnergy.Descriptor.prototype.characteristic;
 
 
+/** @type {!Array<string>} */
+chrome.bluetoothLowEnergy.Descriptor.prototype.permissions;
+
+
 /** @type {string|undefined} */
 chrome.bluetoothLowEnergy.Descriptor.prototype.instanceId;
 
@@ -1559,6 +1582,15 @@
 
 
 /**
+ * @param {!chrome.bluetoothLowEnergy.Service} service
+ * @param {function(string)} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-createService
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.createService = function(service, callback) {};
+
+
+/**
  * @param {string} deviceAddress
  * @param {function(!Array<!chrome.bluetoothLowEnergy.Service>)} callback
  * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-getServices
@@ -1578,6 +1610,17 @@
 
 
 /**
+ * @param {!chrome.bluetoothLowEnergy.Characteristic} characteristic
+ * @param {string} serviceId
+ * @param {function(string)} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-createCharacteristic
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.createCharacteristic = function(
+    characteristic, serviceId, callback) {};
+
+
+/**
  * @param {string} serviceId
  * @param {function(!Array<!chrome.bluetoothLowEnergy.Characteristic>)}
  * callback
@@ -1608,6 +1651,17 @@
 
 
 /**
+ * @param {!chrome.bluetoothLowEnergy.Descriptor} descriptor
+ * @param {string} characteristicId
+ * @param {function(string)} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-createDescriptor
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.createDescriptor = function(
+    descriptor, characteristicId, callback) {};
+
+
+/**
  * @param {string} characteristicId
  * @param {function(!Array<!chrome.bluetoothLowEnergy.Descriptor>)} callback
  * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-getDescriptors
@@ -1668,6 +1722,26 @@
 
 
 /**
+ * @typedef{?{
+ *   value: !ArrayBuffer,
+ *   shouldIndicate: (boolean|undefined)
+ * }}
+ */
+chrome.bluetoothLowEnergy.NotificationIndication;
+
+
+/**
+ * @param {string} characteristicId
+ * @param {!chrome.bluetoothLowEnergy.NotificationIndication} notification
+ * @param {function()} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-notifyCharacteristicValueChanged
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.notifyCharacteristicValueChanged = function(
+    characteristicId, notification, callback) {};
+
+
+/**
  * @param {string} descriptorId
  * @param {function(!chrome.bluetoothLowEnergy.Descriptor)} callback
  * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-readDescriptorValue
@@ -1689,6 +1763,87 @@
 
 
 /**
+ * @param {string} serviceId
+ * @param {function()} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-registerService
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.registerService = function(serviceId, callback) {};
+
+
+/**
+ * @param {string} serviceId
+ * @param {function()} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-unregisterService
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.unregisterService = function(serviceId, callback) {};
+
+
+/**
+ * @param {string} serviceId
+ * @param {function()=} opt_callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-removeService
+ * @return {undefined}
+ */
+chrome.bluetoothLowEnergy.removeService = function(serviceId, opt_callback) {};
+
+
+/**
+ * @typedef {?{
+ *   type: string,
+ *   serviceUuids: (!Array<string>|undefined),
+ *   manufacturerData: (!Array<{id: number, data: !Array<number>}>|undefined),
+ *   solicitUuids: (!Array<string>|undefined),
+ *   serviceData: (!Array<{uuid: string, data: !Array<number>}>|undefined)
+ * }}
+ */
+chrome.bluetoothLowEnergy.Advertisement;
+
+
+/**
+ * @param {!chrome.bluetoothLowEnergy.Advertisement} advertisement
+ * @param {function(number)} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-registerAdvertisement
+ */
+chrome.bluetoothLowEnergy.registerAdvertisement =
+    function(advertisement, callback) {};
+
+
+/**
+ * @param {number} advertisementId
+ * @param {function()} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-unregisterAdvertisement
+ */
+chrome.bluetoothLowEnergy.unregisterAdvertisement =
+    function(advertisementId, callback) {};
+
+
+/**
+ * @param {number} minInterval
+ * @param {number} maxInterval
+ * @param {function()} callback
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-setAdvertisingInterval
+ */
+chrome.bluetoothLowEnergy.setAdvertisingInterval = function(
+    minInterval, maxInterval, callback) {};
+
+
+/**
+ * @typedef {?{
+ *   requestId: number,
+ *   isError: boolean,
+ *   value: (!ArrayBuffer|undefined)
+ * }}
+ */
+chrome.bluetoothLowEnergy.RequestResponse;
+
+
+/** @param {!chrome.bluetoothLowEnergy.RequestResponse} response */
+chrome.bluetoothLowEnergy.sendRequestResponse = function(response) {};
+
+
+/**
  * Event whose listeners take a Service parameter.
  * @constructor
  */
@@ -1790,7 +1945,7 @@
 
 
 /**
- * Event whose listeners take a Characteristic parameter.
+ * Event whose listeners take a Descriptor parameter.
  * @constructor
  */
 chrome.bluetoothLowEnergy.DescriptorEvent = function() {};
@@ -1835,33 +1990,69 @@
 
 
 /**
- * @typedef {?{
- *   type: string,
- *   serviceUuids: (!Array<string>|undefined),
- *   manufacturerData: (!Array<{id: number, data: !Array<number>}>|undefined),
- *   solicitUuids: (!Array<string>|undefined),
- *   serviceData: (!Array<{uuid: string, data: !Array<number>}>|undefined)
- * }}
+ * Event whose listeners take a Request parameter.
+ * @constructor
  */
-chrome.bluetoothLowEnergy.Advertisement;
+chrome.bluetoothLowEnergy.RequestEvent = function() {};
 
 
 /**
- * @param {!chrome.bluetoothLowEnergy.Advertisement} advertisement
- * @param {function(number)} callback
- * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-registerAdvertisement
+ * @param {function(!chrome.bluetoothLowEnergy.Request, string): void}
+ *     callback
+ * @return {undefined}
  */
-chrome.bluetoothLowEnergy.registerAdvertisement =
-    function(advertisement, callback) {};
+chrome.bluetoothLowEnergy.RequestEvent.prototype.addListener = function(
+    callback) {};
 
 
 /**
- * @param {number} advertisementId
- * @param {function()} callback
- * @see https://developer.chrome.com/apps/bluetoothLowEnergy#method-unregisterAdvertisement
+ * @param {function(!chrome.bluetoothLowEnergy.Request, string): void}
+ *     callback
+ * @return {undefined}
  */
-chrome.bluetoothLowEnergy.unregisterAdvertisement =
-    function(advertisementId, callback) {};
+chrome.bluetoothLowEnergy.RequestEvent.prototype.removeListener = function(
+    callback) {};
+
+
+/**
+ * @param {function(!chrome.bluetoothLowEnergy.Request, string): void}
+ *     callback
+ * @return {boolean}
+ */
+chrome.bluetoothLowEnergy.RequestEvent.prototype.hasListener = function(
+    callback) {};
+
+
+/** @return {boolean} */
+chrome.bluetoothLowEnergy.RequestEvent.prototype.hasListeners = function() {};
+
+
+/**
+ * @type {!chrome.bluetoothLowEnergy.RequestEvent}
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicReadRequest
+ */
+chrome.bluetoothLowEnergy.onCharacteristicReadRequest;
+
+
+/**
+ * @type {!chrome.bluetoothLowEnergy.RequestEvent}
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicWriteRequest
+ */
+chrome.bluetoothLowEnergy.onCharacteristicWriteRequest;
+
+
+/**
+ * @type {!chrome.bluetoothLowEnergy.RequestEvent}
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorReadRequest
+ */
+chrome.bluetoothLowEnergy.onDescriptorReadRequest;
+
+
+/**
+ * @type {!chrome.bluetoothLowEnergy.RequestEvent}
+ * @see https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorWriteRequest
+ */
+chrome.bluetoothLowEnergy.onDescriptorWriteRequest;
 
 
 /**
@@ -6960,11 +7151,11 @@
 function OnClickData() {}
 
 
-/** @type {number} */
+/** @type {number|string} */
 OnClickData.prototype.menuItemId;
 
 
-/** @type {number} */
+/** @type {number|string} */
 OnClickData.prototype.parentMenuItemId;
 
 
@@ -6988,14 +7179,26 @@
 OnClickData.prototype.frameUrl;
 
 
+/** @type {number} */
+OnClickData.prototype.frameId;
+
+
 /** @type {string} */
 OnClickData.prototype.selectionText;
 
 
-/** @type {string} */
+/** @type {boolean} */
 OnClickData.prototype.editable;
 
 
+/** @type {boolean} */
+OnClickData.prototype.wasChecked;
+
+
+/** @type {boolean} */
+OnClickData.prototype.checked;
+
+
 
 /**
  * @see https://developer.chrome.com/extensions/debugger.html#type-Debuggee
diff --git a/third_party/closure_compiler/externs/polymer-1.0.js b/third_party/closure_compiler/externs/polymer-1.0.js
index 4f3edae..9b48a5a6 100644
--- a/third_party/closure_compiler/externs/polymer-1.0.js
+++ b/third_party/closure_compiler/externs/polymer-1.0.js
@@ -490,7 +490,19 @@
  */
 PolymerElement.prototype.unlinkPaths = function(path) {}
 
-Polymer.Base;
+/**
+ * Copies own properties (including accessor descriptors) from a source
+ * object to a target object.
+ *
+ * @param {?Object} target Target object to copy properties to.
+ * @param {?Object} source Source object to copy properties from.
+ * @return {?Object} Target object that was passed as first argument or source
+ *     object if the target was null.
+ */
+PolymerElement.prototype.extend = function(target, source) {};
+
+/** @const */
+Polymer.Base = {};
 
 /**
  * Used by the promise-polyfill on its own.
@@ -502,6 +514,13 @@
 Polymer.Base.async = function(method, wait) {};
 
 /**
+ * @param {string} tag
+ * @param {!Object=} props
+ * @return {!Element}
+ */
+Polymer.Base.create = function(tag, props) {};
+
+/**
  * Copies own properties (including accessor descriptors) from a source
  * object to a target object.
  *
@@ -525,6 +544,15 @@
 Polymer.Base.getPropertyInfo = function(property) {};
 
 /**
+ * Dynamically imports an HTML document.
+ * @param {string} href
+ * @param {Function=} onload
+ * @param {Function=} onerror
+ * @param {boolean=} async
+ */
+Polymer.Base.importHref = function(href, onload, onerror, async) {};
+
+/**
  * Copies props from a source object to a target object.
  *
  * Note, this method uses a simple `for...in` strategy for enumerating
@@ -537,7 +565,52 @@
  */
 Polymer.Base.mixin = function(target, source) {};
 
-Polymer.Gestures;
+/**
+ * @param {string|!Array<string|number>} path
+ * @param {!Object=} root
+ * @return {*}
+ */
+Polymer.Base.get = function(path, root) {};
+
+/**
+ * @param {string} type
+ * @param {*=} detail
+ * @param {!Object=} options
+ * @return {!CustomEvent}
+ */
+Polymer.Base.fire = function(type, detail, options) {};
+
+/**
+ * @param {...*} var_args
+ * For Polymer-internal use only.
+ */
+Polymer.Base._warn = function(var_args) {};
+
+/**
+ * @param {...*} var_args
+ * For Polymer-internal use only.
+ */
+Polymer.Base._error = function(var_args) {};
+
+/** @const */
+Polymer.Gestures = {};
+
+/**
+ * @param {!Node} node
+ * @param {string} evType
+ * @param {?Function} handler
+ * @return {boolean}
+ * @deprecated Use addListener.
+ */
+Polymer.Gestures.add = function(node, evType, handler) {};
+
+/**
+ * @param {!Node} node
+ * @param {string} evType
+ * @param {?Function} handler
+ * @return {boolean}
+ */
+Polymer.Gestures.addListener = function(node, evType, handler) {};
 
 /**
  * Gets the original target of the given event.
@@ -623,8 +696,9 @@
  * @param {string} href
  * @param {Function=} onload
  * @param {Function=} onerror
+ * @param {boolean=} async
  */
-PolymerElement.prototype.importHref = function(href, onload, onerror) {};
+PolymerElement.prototype.importHref = function(href, onload, onerror, async) {};
 
 /**
  * Checks whether an element is in this element's light DOM tree.
@@ -945,7 +1019,8 @@
 PolymerEventApi.prototype.event;
 
 
-Polymer.Async;
+/** @const */
+Polymer.Async = {};
 
 /**
  * @param {function()} callback
@@ -1004,7 +1079,8 @@
 Polymer.isInstance = function(object) {};
 
 
-Polymer.CaseMap;
+/** @const */
+Polymer.CaseMap = {};
 
 /**
  * Convert a string from dash to camel-case.
@@ -1091,8 +1167,12 @@
 /**
  * Settings pulled from
  * https://github.com/Polymer/polymer/blob/master/src/lib/settings.html
+ * @const
  */
-Polymer.Settings;
+Polymer.Settings = {};
+
+/** @type {string} */
+Polymer.Settings.dom;
 
 /** @type {boolean} */
 Polymer.Settings.wantShadow;
@@ -1415,7 +1495,8 @@
  */
 Polymer.ResolveUrl.resolveUrl = function(url, baseURI) {}
 
-Polymer.RenderStatus;
+/** @const */
+Polymer.RenderStatus = {};
 
 /**
  * Makes callback when first render occurs or immediately if render has occured.
@@ -1435,7 +1516,7 @@
 
 /**
  * Static analysis for Polymer.
- * @type {!Object}
+ * @const
  */
 var hydrolysis = {};
 
@@ -1461,9 +1542,9 @@
 /**
  * Contains information useful for debugging. Should not be used in production
  * code and the API may change on short notice.
- * @type {!Object}
+ * @const
  */
-Polymer.telemetry;
+Polymer.telemetry = {};
 
 /**
  * Number of elements instantiated so far.
@@ -1478,7 +1559,8 @@
  */
 Polymer.telemetry.registrations;
 
-Polymer.AppLayout;
+/** @const */
+Polymer.AppLayout = {};
 
 /** @constructor */
 Polymer.AppLayout.LocalDomWithBackground = function(){};
diff --git a/tools/gn/args.cc b/tools/gn/args.cc
index 0dcceecd..1a01a50c 100644
--- a/tools/gn/args.cc
+++ b/tools/gn/args.cc
@@ -316,6 +316,7 @@
   static const char kArm[] = "arm";
   static const char kArm64[] = "arm64";
   static const char kMips[] = "mipsel";
+  static const char kMips64[] = "mips64el";
   static const char kS390X[] = "s390x";
   static const char kPPC64[] = "ppc64";
   const char* arch = nullptr;
@@ -333,6 +334,8 @@
     arch = kArm64;
   else if (os_arch == "mips")
     arch = kMips;
+  else if (os_arch == "mips64")
+    arch = kMips64;
   else if (os_arch == "s390x")
     arch = kS390X;
   else if (os_arch == "ppc64" || os_arch == "ppc64le")
diff --git a/tools/traffic_annotation/auditor/tests/git_list.txt b/tools/traffic_annotation/auditor/tests/git_list.txt
new file mode 100644
index 0000000..ea49712
--- /dev/null
+++ b/tools/traffic_annotation/auditor/tests/git_list.txt
@@ -0,0 +1,6 @@
+tools/traffic_annotation/auditor/tests/git_list.txt
+tools/traffic_annotation/auditor/tests/irrelevant_file_content.cc
+tools/traffic_annotation/auditor/tests/irrelevant_file_content.mm
+tools/traffic_annotation/auditor/tests/irrelevant_file_name.txt
+tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.cc
+tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.mm
diff --git a/tools/traffic_annotation/auditor/tests/irrelevant_file_content.cc b/tools/traffic_annotation/auditor/tests/irrelevant_file_content.cc
new file mode 100644
index 0000000..a1411e9e
--- /dev/null
+++ b/tools/traffic_annotation/auditor/tests/irrelevant_file_content.cc
@@ -0,0 +1,11 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is a sample file that has relevant file extension but does not includes
+// any keywords relevant to network traffic annotation should not be included
+// in tests.
+
+#include "net/traffic_annotation/network_traffic.h"
+
+// Some other content including network and traffic and annotation!
\ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/irrelevant_file_content.mm b/tools/traffic_annotation/auditor/tests/irrelevant_file_content.mm
new file mode 100644
index 0000000..a1411e9e
--- /dev/null
+++ b/tools/traffic_annotation/auditor/tests/irrelevant_file_content.mm
@@ -0,0 +1,11 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is a sample file that has relevant file extension but does not includes
+// any keywords relevant to network traffic annotation should not be included
+// in tests.
+
+#include "net/traffic_annotation/network_traffic.h"
+
+// Some other content including network and traffic and annotation!
\ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/irrelevant_file_name.txt b/tools/traffic_annotation/auditor/tests/irrelevant_file_name.txt
new file mode 100644
index 0000000..4882cb4f
--- /dev/null
+++ b/tools/traffic_annotation/auditor/tests/irrelevant_file_name.txt
@@ -0,0 +1,9 @@
+This is a sample file that includes some keywords relevant to network traffic
+annotation but does not have proper file extension and so should not be included
+in tests:
+
+#include "net/traffic_annotation/network_traffic_annotation.h"
+
+NetworkTrafficAnnotationTag
+
+NO_TRAFFIC_ANNOTATION_YET
\ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.cc b/tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.cc
new file mode 100644
index 0000000..7149e9c3
--- /dev/null
+++ b/tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.cc
@@ -0,0 +1,9 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is a sample file that has relevant file extension and includes
+// some keywords relevant to network traffic annotation and should be included
+// in tests.
+
+PARTIAL_TRAFFIC_ANNOTATION_FOR_TESTS
\ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.mm b/tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.mm
new file mode 100644
index 0000000..1f2a921b
--- /dev/null
+++ b/tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.mm
@@ -0,0 +1,9 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is a sample file that has relevant file extension and includes
+// some keywords relevant to network traffic annotation and should be included
+// in tests.
+
+#include "net/traffic_annotation/network_traffic_annotation.h"
\ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc b/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
index 6e071799..bc965a59 100644
--- a/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
+++ b/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
@@ -386,6 +386,11 @@
     if (!strncmp(file_path.c_str(), ignore_path.c_str(), ignore_path.length()))
       return true;
   }
+
+  // If the given filepath did not match the rules with the specified type,
+  // check it with rules of type 'ALL' as well.
+  if (whitelist_type != AuditorException::ExceptionType::ALL)
+    return IsWhitelisted(file_path, AuditorException::ExceptionType::ALL);
   return false;
 }
 
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_auditor_unittest.cc b/tools/traffic_annotation/auditor/traffic_annotation_auditor_unittest.cc
index ba9af1d..ee350ab 100644
--- a/tools/traffic_annotation/auditor/traffic_annotation_auditor_unittest.cc
+++ b/tools/traffic_annotation/auditor/traffic_annotation_auditor_unittest.cc
@@ -3,19 +3,54 @@
 // found in the LICENSE file.
 
 #include "tools/traffic_annotation/auditor/traffic_annotation_auditor.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/path_service.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "tools/traffic_annotation/auditor/traffic_annotation_file_filter.h"
 
 namespace {
 
 #define TEST_HASH_CODE(X)                                  \
   EXPECT_EQ(TrafficAnnotationAuditor::ComputeHashValue(X), \
             net::DefineNetworkTrafficAnnotation(X, "").unique_id_hash_code)
+
+const char* kIrrelevantFiles[] = {
+    "tools/traffic_annotation/auditor/tests/git_list.txt",
+    "tools/traffic_annotation/auditor/tests/irrelevant_file_content.cc",
+    "tools/traffic_annotation/auditor/tests/irrelevant_file_content.mm",
+    "tools/traffic_annotation/auditor/tests/irrelevant_file_name.txt"};
+
+const char* kRelevantFiles[] = {
+    "tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.cc",
+    "tools/traffic_annotation/auditor/tests/relevant_file_name_and_content.mm"};
 }
 
 using namespace testing;
 
-typedef ::testing::Test TrafficAnnotationAuditorTest;
+class TrafficAnnotationAuditorTest : public ::testing::Test {
+ public:
+  void SetUp() override {
+    if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_path_)) {
+      LOG(ERROR) << "Could not get current directory to find source path.";
+      return;
+    }
+
+    git_list_mock_file_ = source_path_.Append(FILE_PATH_LITERAL("tools"))
+                              .Append(FILE_PATH_LITERAL("traffic_annotation"))
+                              .Append(FILE_PATH_LITERAL("auditor"))
+                              .Append(FILE_PATH_LITERAL("tests"))
+                              .Append(FILE_PATH_LITERAL("git_list.txt"));
+  }
+
+ protected:
+  base::FilePath source_path_;
+  base::FilePath build_path_;  // Currently stays empty. Will be set if access
+                               // to a compiled build directory would be
+                               // granted.
+  base::FilePath git_list_mock_file_;
+};
 
 // Tests if the two hash computation functions have the same result.
 TEST_F(TrafficAnnotationAuditorTest, HashFunctionCheck) {
@@ -25,4 +60,91 @@
   TEST_HASH_CODE("ID123");
   TEST_HASH_CODE(
       "a_unique_looooooooooooooooooooooooooooooooooooooooooooooooooooooong_id");
+}
+
+// Tests if TrafficAnnotationFileFilter::GetFilesFromGit function returns
+// correct files given a mock git list file. It also inherently checks
+// TrafficAnnotationFileFilter::IsFileRelevant.
+TEST_F(TrafficAnnotationAuditorTest, GetFilesFromGit) {
+  TrafficAnnotationFileFilter filter;
+  filter.SetGitMockFileForTesting(git_list_mock_file_);
+  filter.GetFilesFromGit(source_path_);
+
+  const std::vector<std::string> git_files = filter.git_files();
+
+  EXPECT_EQ(git_files.size(), arraysize(kRelevantFiles));
+  for (const char* filepath : kRelevantFiles) {
+    EXPECT_NE(std::find(git_files.begin(), git_files.end(), filepath),
+              git_files.end());
+  }
+
+  for (const char* filepath : kIrrelevantFiles) {
+    EXPECT_EQ(std::find(git_files.begin(), git_files.end(), filepath),
+              git_files.end());
+  }
+}
+
+// Tests if TrafficAnnotationFileFilter::GetRelevantFiles gives the correct list
+// of files, given a mock git list file.
+TEST_F(TrafficAnnotationAuditorTest, RelevantFilesReceived) {
+  TrafficAnnotationFileFilter filter;
+  filter.SetGitMockFileForTesting(git_list_mock_file_);
+  filter.GetFilesFromGit(source_path_);
+
+  unsigned int git_files_count = filter.git_files().size();
+
+  std::vector<std::string> ignore_list;
+  std::vector<std::string> file_paths;
+
+  // Check if all files are returned with no ignore list and directory.
+  filter.GetRelevantFiles(base::FilePath(), ignore_list, "", &file_paths);
+  EXPECT_EQ(file_paths.size(), git_files_count);
+
+  // Check if a file is ignored if it is added to ignore list.
+  ignore_list.push_back(file_paths[0]);
+  file_paths.clear();
+  filter.GetRelevantFiles(base::FilePath(), ignore_list, "", &file_paths);
+  EXPECT_EQ(file_paths.size(), git_files_count - 1);
+  EXPECT_EQ(std::find(file_paths.begin(), file_paths.end(), ignore_list[0]),
+            file_paths.end());
+
+  // Check if files are filtered based on given directory.
+  ignore_list.clear();
+  file_paths.clear();
+  filter.GetRelevantFiles(base::FilePath(), ignore_list,
+                          "tools/traffic_annotation", &file_paths);
+  EXPECT_EQ(file_paths.size(), git_files_count);
+  file_paths.clear();
+  filter.GetRelevantFiles(base::FilePath(), ignore_list, "content",
+                          &file_paths);
+  EXPECT_EQ(file_paths.size(), 0u);
+}
+
+// Tests if TrafficAnnotationFileFilter::IsWhitelisted works as expected.
+// Inherently checks if TrafficAnnotationFileFilter::LoadWhiteList works and
+// AuditorException rules are correctly deserialized.
+TEST_F(TrafficAnnotationAuditorTest, IsWhitelisted) {
+  TrafficAnnotationAuditor auditor(source_path_, build_path_);
+
+  for (unsigned int i = 0;
+       i < static_cast<unsigned int>(
+               AuditorException::ExceptionType::EXCEPTION_TYPE_LAST);
+       i++) {
+    AuditorException::ExceptionType type =
+        static_cast<AuditorException::ExceptionType>(i);
+    // Anything in /tools directory is whitelisted for all types.
+    EXPECT_TRUE(auditor.IsWhitelisted("tools/something.cc", type));
+    EXPECT_TRUE(auditor.IsWhitelisted("tools/somewhere/something.mm", type));
+
+    // Anything in a general folder is not whitelisted for any type
+    EXPECT_FALSE(auditor.IsWhitelisted("something.cc", type));
+    EXPECT_FALSE(auditor.IsWhitelisted("content/something.mm", type));
+  }
+
+  // Files defining missing annotation functions in net/ are exceptions of
+  // 'missing' type.
+  EXPECT_TRUE(auditor.IsWhitelisted("net/url_request/url_fetcher.cc",
+                                    AuditorException::ExceptionType::MISSING));
+  EXPECT_TRUE(auditor.IsWhitelisted("net/url_request/url_request_context.cc",
+                                    AuditorException::ExceptionType::MISSING));
 }
\ No newline at end of file
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_file_filter.cc b/tools/traffic_annotation/auditor/traffic_annotation_file_filter.cc
index 8373fb98..046330c6 100644
--- a/tools/traffic_annotation/auditor/traffic_annotation_file_filter.cc
+++ b/tools/traffic_annotation/auditor/traffic_annotation_file_filter.cc
@@ -15,6 +15,7 @@
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
 
 namespace {
 
@@ -54,29 +55,38 @@
 
 void TrafficAnnotationFileFilter::GetFilesFromGit(
     const base::FilePath& source_path) {
-  const base::CommandLine::CharType* args[] =
-#if defined(OS_WIN)
-      {FILE_PATH_LITERAL("git.bat"), FILE_PATH_LITERAL("ls-files")};
-#else
-      {"git", "ls-files"};
-#endif
-  base::CommandLine cmdline(2, args);
-
-  // Change directory to source path to access git.
+  // Change directory to source path to access git and check files.
   base::FilePath original_path;
   base::GetCurrentDirectory(&original_path);
   base::SetCurrentDirectory(source_path);
 
-  // Get list of files from git.
-  std::string results;
-  if (!base::GetAppOutput(cmdline, &results)) {
-    LOG(ERROR) << "Could not get files from git.";
-  } else {
-    for (const std::string file_path : base::SplitString(
-             results, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) {
-      if (IsFileRelevant(file_path))
-        git_files_.push_back(file_path);
+  std::string git_list;
+  if (git_mock_file_for_testing_.empty()) {
+    const base::CommandLine::CharType* args[] =
+#if defined(OS_WIN)
+        {FILE_PATH_LITERAL("git.bat"), FILE_PATH_LITERAL("ls-files")};
+#else
+        {"git", "ls-files"};
+#endif
+    base::CommandLine cmdline(2, args);
+
+    // Get list of files from git.
+    if (!base::GetAppOutput(cmdline, &git_list)) {
+      LOG(ERROR) << "Could not get files from git.";
+      git_list.clear();
     }
+  } else {
+    if (!base::ReadFileToString(git_mock_file_for_testing_, &git_list)) {
+      LOG(ERROR) << "Could not load mock git list file from "
+                 << git_mock_file_for_testing_.MaybeAsASCII().c_str();
+      git_list.clear();
+    }
+  }
+
+  for (const std::string file_path : base::SplitString(
+           git_list, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) {
+    if (IsFileRelevant(file_path))
+      git_files_.push_back(file_path);
   }
 
   base::SetCurrentDirectory(original_path);
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_file_filter.h b/tools/traffic_annotation/auditor/traffic_annotation_file_filter.h
index 0416c542..5b89eda 100644
--- a/tools/traffic_annotation/auditor/traffic_annotation_file_filter.h
+++ b/tools/traffic_annotation/auditor/traffic_annotation_file_filter.h
@@ -8,11 +8,9 @@
 #include <string>
 #include <vector>
 
-namespace base {
-class FilePath;
-}
+#include "base/files/file_path.h"
 
-// Provides the list of files that might be relevent to network traffic
+// Provides the list of files that might be relevant to network traffic
 // annotation by matching filename and searching for keywords in the file
 // content.
 // The file should end with either .cc or .mm and the content should include a
@@ -23,7 +21,7 @@
   TrafficAnnotationFileFilter();
   ~TrafficAnnotationFileFilter();
 
-  // Returns the list of relevant files in the given |directory_name| into the
+  // Adds the list of relevant files in the given |directory_name| to the
   // |file_paths|. If |directory_name| is empty, all files are returned.
   // |source_path| should be the repository source directory, e.g. C:/src.
   // |ignore_list| provides a list of partial paths to ignore.
@@ -35,11 +33,21 @@
   // Checks the name and content of a file and returns true if it is relevant.
   bool IsFileRelevant(const std::string& file_path);
 
- private:
-  // Gets the list of all files in the repository.
+  // Gets the list of all relevant files in the repository and stores them in
+  // |git_files|.
   void GetFilesFromGit(const base::FilePath& source_path);
 
+  // Sets the path to a file that would be used to mock the output of
+  // 'git ls-files' in tests.
+  void SetGitMockFileForTesting(const base::FilePath& file_path) {
+    git_mock_file_for_testing_ = file_path;
+  }
+
+  const std::vector<std::string>& git_files() { return git_files_; }
+
+ private:
   std::vector<std::string> git_files_;
+  base::FilePath git_mock_file_for_testing_;
 };
 
 #endif  // TRAFFIC_ANNOTATION_FILE_FILTER_H_
\ No newline at end of file
diff --git a/ui/android/delegated_frame_host_android.cc b/ui/android/delegated_frame_host_android.cc
index 029bbab..6753f4b 100644
--- a/ui/android/delegated_frame_host_android.cc
+++ b/ui/android/delegated_frame_host_android.cc
@@ -26,7 +26,7 @@
 
 scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer(
     cc::SurfaceManager* surface_manager,
-    cc::SurfaceInfo surface_info,
+    viz::SurfaceInfo surface_info,
     bool surface_opaque) {
   // manager must outlive compositors using it.
   auto layer = cc::SurfaceLayer::Create(surface_manager->reference_factory());
@@ -82,7 +82,7 @@
 
     cc::RenderPass* root_pass = frame.render_pass_list.back().get();
     gfx::Size frame_size = root_pass->output_rect.size();
-    surface_info_ = cc::SurfaceInfo(
+    surface_info_ = viz::SurfaceInfo(
         viz::SurfaceId(frame_sink_id_, local_surface_id), 1.f, frame_size);
     has_transparent_background_ = root_pass->has_transparent_background;
 
@@ -139,7 +139,7 @@
   content_layer_->RemoveFromParent();
   content_layer_ = nullptr;
   support_->EvictCurrentSurface();
-  surface_info_ = cc::SurfaceInfo();
+  surface_info_ = viz::SurfaceInfo();
 }
 
 bool DelegatedFrameHostAndroid::HasDelegatedContent() const {
diff --git a/ui/android/delegated_frame_host_android.h b/ui/android/delegated_frame_host_android.h
index 3f9544c..2428a23 100644
--- a/ui/android/delegated_frame_host_android.h
+++ b/ui/android/delegated_frame_host_android.h
@@ -9,7 +9,7 @@
 #include "base/memory/ref_counted.h"
 #include "cc/output/copy_output_request.h"
 #include "cc/resources/returned_resource.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h"
 #include "components/viz/service/frame_sinks/compositor_frame_sink_support_client.h"
 #include "ui/android/ui_android_export.h"
@@ -98,7 +98,7 @@
   std::unique_ptr<viz::CompositorFrameSinkSupport> support_;
   cc::ExternalBeginFrameSource begin_frame_source_;
 
-  cc::SurfaceInfo surface_info_;
+  viz::SurfaceInfo surface_info_;
   bool has_transparent_background_ = false;
 
   scoped_refptr<cc::SurfaceLayer> content_layer_;
diff --git a/ui/aura/local/window_port_local.cc b/ui/aura/local/window_port_local.cc
index be1c207..8fbaff3 100644
--- a/ui/aura/local/window_port_local.cc
+++ b/ui/aura/local/window_port_local.cc
@@ -129,7 +129,7 @@
                                        const gfx::Size& surface_size) {
   DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_);
   local_surface_id_ = surface_id.local_surface_id();
-  cc::SurfaceInfo surface_info(surface_id, 1.0f, surface_size);
+  viz::SurfaceInfo surface_info(surface_id, 1.0f, surface_size);
   scoped_refptr<cc::SurfaceReferenceFactory> reference_factory =
       aura::Env::GetInstance()
           ->context_factory_private()
diff --git a/ui/aura/mus/client_surface_embedder.cc b/ui/aura/mus/client_surface_embedder.cc
index 2f0e4db..b06e7b5 100644
--- a/ui/aura/mus/client_surface_embedder.cc
+++ b/ui/aura/mus/client_surface_embedder.cc
@@ -32,13 +32,13 @@
 ClientSurfaceEmbedder::~ClientSurfaceEmbedder() = default;
 
 void ClientSurfaceEmbedder::SetPrimarySurfaceInfo(
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   surface_layer_->SetShowPrimarySurface(surface_info, ref_factory_);
   surface_layer_->SetBounds(gfx::Rect(window_->bounds().size()));
 }
 
 void ClientSurfaceEmbedder::SetFallbackSurfaceInfo(
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   surface_layer_->SetFallbackSurface(surface_info);
   UpdateSizeAndGutters();
 }
@@ -46,7 +46,7 @@
 void ClientSurfaceEmbedder::UpdateSizeAndGutters() {
   surface_layer_->SetBounds(gfx::Rect(window_->bounds().size()));
   gfx::Size fallback_surface_size_in_dip;
-  const cc::SurfaceInfo* fallback_surface_info =
+  const viz::SurfaceInfo* fallback_surface_info =
       surface_layer_->GetFallbackSurfaceInfo();
   if (fallback_surface_info) {
     float fallback_device_scale_factor =
diff --git a/ui/aura/mus/client_surface_embedder.h b/ui/aura/mus/client_surface_embedder.h
index b8dcc97..2c63b03e 100644
--- a/ui/aura/mus/client_surface_embedder.h
+++ b/ui/aura/mus/client_surface_embedder.h
@@ -9,10 +9,6 @@
 #include "cc/surfaces/surface_reference_factory.h"
 #include "ui/gfx/geometry/insets.h"
 
-namespace cc {
-class SurfaceInfo;
-}
-
 namespace gfx {
 class Insets;
 }
@@ -21,6 +17,10 @@
 class Layer;
 }
 
+namespace viz {
+class SurfaceInfo;
+}
+
 namespace aura {
 
 class Window;
@@ -37,11 +37,11 @@
 
   // Updates the clip layer and primary SurfaceInfo of the surface layer based
   // on the provided |surface_info|.
-  void SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info);
+  void SetPrimarySurfaceInfo(const viz::SurfaceInfo& surface_info);
 
   // Sets the fallback SurfaceInfo of the surface layer. The clip layer is not
   // updated.
-  void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info);
+  void SetFallbackSurfaceInfo(const viz::SurfaceInfo& surface_info);
 
   // Update the surface layer size and the right and bottom gutter layers for
   // the current window size.
diff --git a/ui/aura/mus/window_mus.h b/ui/aura/mus/window_mus.h
index 5d5d7aa5..acf13fd 100644
--- a/ui/aura/mus/window_mus.h
+++ b/ui/aura/mus/window_mus.h
@@ -90,7 +90,7 @@
       const viz::FrameSinkId& frame_sink_id) = 0;
   virtual const viz::LocalSurfaceId& GetOrAllocateLocalSurfaceId(
       const gfx::Size& new_size) = 0;
-  virtual void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info) = 0;
+  virtual void SetFallbackSurfaceInfo(const viz::SurfaceInfo& surface_info) = 0;
   // The window was deleted on the server side. DestroyFromServer() should
   // result in deleting |this|.
   virtual void DestroyFromServer() = 0;
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc
index d654cfe..3a7adaf 100644
--- a/ui/aura/mus/window_port_mus.cc
+++ b/ui/aura/mus/window_port_mus.cc
@@ -321,7 +321,7 @@
 }
 
 void WindowPortMus::SetFallbackSurfaceInfo(
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   if (!frame_sink_id_.is_valid()) {
     // |primary_surface_info_| shold not be valid, since we didn't know the
     // |frame_sink_id_|.
@@ -565,7 +565,7 @@
   if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid())
     return;
 
-  primary_surface_info_ = cc::SurfaceInfo(
+  primary_surface_info_ = viz::SurfaceInfo(
       viz::SurfaceId(frame_sink_id_, local_surface_id_),
       ScaleFactorForDisplay(window_), last_surface_size_in_pixels_);
   UpdateClientSurfaceEmbedder();
diff --git a/ui/aura/mus/window_port_mus.h b/ui/aura/mus/window_port_mus.h
index 8710483..9311c812 100644
--- a/ui/aura/mus/window_port_mus.h
+++ b/ui/aura/mus/window_port_mus.h
@@ -12,8 +12,8 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
-#include "cc/surfaces/surface_info.h"
 #include "components/viz/client/client_layer_tree_frame_sink.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "services/ui/public/interfaces/cursor/cursor.mojom.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
@@ -62,7 +62,7 @@
     return client_surface_embedder_.get();
   }
 
-  const cc::SurfaceInfo& PrimarySurfaceInfoForTesting() const {
+  const viz::SurfaceInfo& PrimarySurfaceInfoForTesting() const {
     return primary_surface_info_;
   }
 
@@ -236,7 +236,7 @@
   void SetFrameSinkIdFromServer(const viz::FrameSinkId& frame_sink_id) override;
   const viz::LocalSurfaceId& GetOrAllocateLocalSurfaceId(
       const gfx::Size& surface_size_in_pixels) override;
-  void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info) override;
+  void SetFallbackSurfaceInfo(const viz::SurfaceInfo& surface_info) override;
   void DestroyFromServer() override;
   void AddTransientChildFromServer(WindowMus* child) override;
   void RemoveTransientChildFromServer(WindowMus* child) override;
@@ -289,8 +289,8 @@
 
   viz::FrameSinkId frame_sink_id_;
 
-  cc::SurfaceInfo primary_surface_info_;
-  cc::SurfaceInfo fallback_surface_info_;
+  viz::SurfaceInfo primary_surface_info_;
+  viz::SurfaceInfo fallback_surface_info_;
 
   viz::LocalSurfaceId local_surface_id_;
   viz::LocalSurfaceIdAllocator local_surface_id_allocator_;
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
index 0a7f563e..f5ee045 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -1411,7 +1411,7 @@
 
 void WindowTreeClient::OnWindowSurfaceChanged(
     Id window_id,
-    const cc::SurfaceInfo& surface_info) {
+    const viz::SurfaceInfo& surface_info) {
   WindowMus* window = GetWindowByServerId(window_id);
   if (!window)
     return;
diff --git a/ui/aura/mus/window_tree_client.h b/ui/aura/mus/window_tree_client.h
index c5afc8f..b8a61205 100644
--- a/ui/aura/mus/window_tree_client.h
+++ b/ui/aura/mus/window_tree_client.h
@@ -395,7 +395,7 @@
   void OnWindowFocused(Id focused_window_id) override;
   void OnWindowCursorChanged(Id window_id, ui::CursorData cursor) override;
   void OnWindowSurfaceChanged(Id window_id,
-                              const cc::SurfaceInfo& surface_info) override;
+                              const viz::SurfaceInfo& surface_info) override;
   void OnDragDropStart(
       const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data)
       override;
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc
index 7bef567..f6ba1a7 100644
--- a/ui/aura/mus/window_tree_client_unittest.cc
+++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -12,7 +12,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "cc/base/switches.h"
-#include "cc/surfaces/surface_info.h"
+#include "components/viz/common/surfaces/surface_info.h"
 #include "mojo/public/cpp/bindings/map.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "services/ui/public/interfaces/window_manager.mojom.h"
diff --git a/ui/aura/window_delegate.h b/ui/aura/window_delegate.h
index c463cf8..4ef1c7c 100644
--- a/ui/aura/window_delegate.h
+++ b/ui/aura/window_delegate.h
@@ -12,10 +12,6 @@
 #include "ui/events/event_handler.h"
 #include "ui/gfx/native_widget_types.h"
 
-namespace cc {
-class SurfaceInfo;
-}
-
 namespace gfx {
 class Path;
 class Point;
@@ -27,6 +23,10 @@
 class PaintContext;
 }
 
+namespace viz {
+class SurfaceInfo;
+}
+
 namespace aura {
 
 // Delegate interface for aura::Window.
@@ -98,7 +98,7 @@
   // above returns true.
   virtual void GetHitTestMask(gfx::Path* mask) const = 0;
 
-  virtual void OnWindowSurfaceChanged(const cc::SurfaceInfo& surface_info) {}
+  virtual void OnWindowSurfaceChanged(const viz::SurfaceInfo& surface_info) {}
 
  protected:
   ~WindowDelegate() override {}
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 8244d39..6646e58 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -686,7 +686,7 @@
 }
 
 void Layer::SetShowPrimarySurface(
-    const cc::SurfaceInfo& surface_info,
+    const viz::SurfaceInfo& surface_info,
     scoped_refptr<cc::SurfaceReferenceFactory> ref_factory) {
   DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR);
 
@@ -707,7 +707,7 @@
     mirror->dest()->SetShowPrimarySurface(surface_info, ref_factory);
 }
 
-void Layer::SetFallbackSurface(const cc::SurfaceInfo& surface_info) {
+void Layer::SetFallbackSurface(const viz::SurfaceInfo& surface_info) {
   DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR);
   DCHECK(surface_layer_);
 
@@ -718,7 +718,7 @@
     mirror->dest()->SetFallbackSurface(surface_info);
 }
 
-const cc::SurfaceInfo* Layer::GetFallbackSurfaceInfo() const {
+const viz::SurfaceInfo* Layer::GetFallbackSurfaceInfo() const {
   if (surface_layer_)
     return &surface_layer_->fallback_surface_info();
   return nullptr;
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h
index 58a09922..3f69b63 100644
--- a/ui/compositor/layer.h
+++ b/ui/compositor/layer.h
@@ -303,15 +303,15 @@
 
   // Begins showing content from a surface with a particular ID.
   void SetShowPrimarySurface(
-      const cc::SurfaceInfo& surface_info,
+      const viz::SurfaceInfo& surface_info,
       scoped_refptr<cc::SurfaceReferenceFactory> surface_ref);
 
   // In the event that the primary surface is not yet available in the
   // display compositor, the fallback surface will be used.
-  void SetFallbackSurface(const cc::SurfaceInfo& surface_info);
+  void SetFallbackSurface(const viz::SurfaceInfo& surface_info);
 
   // Returns the fallback SurfaceInfo set by SetFallbackSurface.
-  const cc::SurfaceInfo* GetFallbackSurfaceInfo() const;
+  const viz::SurfaceInfo* GetFallbackSurfaceInfo() const;
 
   bool has_external_content() {
     return texture_layer_.get() || surface_layer_.get();
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index fdf12ff..5bd37a2 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -1770,7 +1770,7 @@
   // Showing surface content changes the underlying cc layer.
   before = child->cc_layer_for_testing();
   child->SetShowPrimarySurface(
-      cc::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)),
+      viz::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)),
       new TestSurfaceReferenceFactory());
   EXPECT_TRUE(child->cc_layer_for_testing());
   EXPECT_NE(before.get(), child->cc_layer_for_testing());
@@ -1790,7 +1790,7 @@
   viz::SurfaceId surface_id(
       viz::FrameSinkId(0, 1),
       viz::LocalSurfaceId(2, base::UnguessableToken::Create()));
-  cc::SurfaceInfo surface_info(surface_id, 1.0f, gfx::Size(10, 10));
+  viz::SurfaceInfo surface_info(surface_id, 1.0f, gfx::Size(10, 10));
   layer->SetShowPrimarySurface(surface_info, reference_factory);
 
   const auto mirror = layer->Mirror();
@@ -1803,7 +1803,7 @@
   surface_id =
       viz::SurfaceId(viz::FrameSinkId(1, 2),
                      viz::LocalSurfaceId(3, base::UnguessableToken::Create()));
-  cc::SurfaceInfo surface_info_2(surface_id, 2.0f, gfx::Size(20, 20));
+  viz::SurfaceInfo surface_info_2(surface_id, 2.0f, gfx::Size(20, 20));
   layer->SetShowPrimarySurface(surface_info_2, reference_factory);
 
   // The mirror should continue to use the same cc_layer.
@@ -1823,7 +1823,7 @@
       viz::LocalSurfaceId(2, base::UnguessableToken::Create()));
 
   layer->SetShowPrimarySurface(
-      cc::SurfaceInfo(surface_id, 2.0f, gfx::Size(30, 40)),
+      viz::SurfaceInfo(surface_id, 2.0f, gfx::Size(30, 40)),
       new TestSurfaceReferenceFactory());
 
   EXPECT_EQ(layer->frame_size_in_dip_for_testing(), gfx::Size(15, 20));
@@ -1844,7 +1844,7 @@
   // Showing surface content changes the underlying cc layer.
   scoped_refptr<cc::Layer> before = layer->cc_layer_for_testing();
   layer->SetShowPrimarySurface(
-      cc::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)),
+      viz::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)),
       new TestSurfaceReferenceFactory());
   EXPECT_EQ(layer->layer_grayscale(), 0.5f);
   EXPECT_TRUE(layer->cc_layer_for_testing());
@@ -2168,7 +2168,7 @@
   FrameDamageCheckingDelegate delegate;
   layer->set_delegate(&delegate);
   layer->SetShowPrimarySurface(
-      cc::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)),
+      viz::SurfaceInfo(viz::SurfaceId(), 1.0, gfx::Size(10, 10)),
       new TestSurfaceReferenceFactory());
 
   EXPECT_FALSE(delegate.delegated_frame_damage_called());
diff --git a/ui/events/base_event_utils.cc b/ui/events/base_event_utils.cc
index 76d5714b..6eee6f1 100644
--- a/ui/events/base_event_utils.cc
+++ b/ui/events/base_event_utils.cc
@@ -28,7 +28,7 @@
 
 }  // namespace
 
-base::StaticAtomicSequenceNumber g_next_event_id;
+base::AtomicSequenceNumber g_next_event_id;
 
 uint32_t GetNextTouchEventId() {
   // Set the first touch event ID to 1 because we set id to 0 for other types
@@ -68,4 +68,3 @@
 }
 
 }  // namespace ui
-
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
index 155d53d7..96b9306 100644
--- a/ui/gfx/color_space.cc
+++ b/ui/gfx/color_space.cc
@@ -104,6 +104,21 @@
 }
 
 // static
+ColorSpace ColorSpace::CreateCustom(const SkMatrix44& to_XYZD50,
+                                    ColorSpace::TransferID transfer_id) {
+  DCHECK_NE(transfer_id, ColorSpace::TransferID::CUSTOM);
+  DCHECK_NE(transfer_id, ColorSpace::TransferID::INVALID);
+  ColorSpace result(ColorSpace::PrimaryID::CUSTOM, transfer_id,
+                    ColorSpace::MatrixID::RGB, ColorSpace::RangeID::FULL);
+  for (int row = 0; row < 3; ++row) {
+    for (int col = 0; col < 3; ++col) {
+      result.custom_primary_matrix_[3 * row + col] = to_XYZD50.get(row, col);
+    }
+  }
+  return result;
+}
+
+// static
 ColorSpace ColorSpace::CreateSCRGBLinear() {
   return ColorSpace(PrimaryID::BT709, TransferID::LINEAR_HDR, MatrixID::RGB,
                     RangeID::FULL);
diff --git a/ui/gfx/color_space.h b/ui/gfx/color_space.h
index 4b0d9c4f..61574a5 100644
--- a/ui/gfx/color_space.h
+++ b/ui/gfx/color_space.h
@@ -135,6 +135,8 @@
   static ColorSpace CreateSRGB();
   static ColorSpace CreateDisplayP3D65();
   static ColorSpace CreateCustom(const SkMatrix44& to_XYZD50,
+                                 TransferID transfer_id);
+  static ColorSpace CreateCustom(const SkMatrix44& to_XYZD50,
                                  const SkColorSpaceTransferFn& fn);
   static ColorSpace CreateXYZD50();
 
diff --git a/ui/gfx/generic_shared_memory_id.h b/ui/gfx/generic_shared_memory_id.h
index c9675af..5e73f5e 100644
--- a/ui/gfx/generic_shared_memory_id.h
+++ b/ui/gfx/generic_shared_memory_id.h
@@ -22,7 +22,7 @@
  public:
   int id;
 
-  // Invalid ID is -1 to match semantics of base::StaticAtomicSequenceNumber.
+  // Invalid ID is -1 to match semantics of base::AtomicSequenceNumber.
   GenericSharedMemoryId() : id(-1) {}
   explicit GenericSharedMemoryId(int id) : id(id) {}
   GenericSharedMemoryId(const GenericSharedMemoryId& other) = default;
diff --git a/ui/gfx/icc_profile.cc b/ui/gfx/icc_profile.cc
index 2b11290..a982db5 100644
--- a/ui/gfx/icc_profile.cc
+++ b/ui/gfx/icc_profile.cc
@@ -44,6 +44,91 @@
 static base::LazyInstance<Cache>::DestructorAtExit g_cache =
     LAZY_INSTANCE_INITIALIZER;
 
+void ExtractColorSpaces(const std::vector<char>& data,
+                        gfx::ColorSpace* parametric_color_space,
+                        bool* parametric_color_space_is_accurate,
+                        sk_sp<SkColorSpace>* useable_sk_color_space) {
+  // Initialize the output parameters as invalid.
+  *parametric_color_space = gfx::ColorSpace();
+  *parametric_color_space_is_accurate = false;
+  *useable_sk_color_space = nullptr;
+
+  // Parse the profile and attempt to create a SkColorSpaceXform out of it.
+  sk_sp<SkColorSpace> sk_srgb_color_space = SkColorSpace::MakeSRGB();
+  sk_sp<SkICC> sk_icc = SkICC::Make(data.data(), data.size());
+  if (!sk_icc) {
+    DLOG(ERROR) << "Failed to parse ICC profile to SkICC.";
+    return;
+  }
+  sk_sp<SkColorSpace> sk_icc_color_space =
+      SkColorSpace::MakeICC(data.data(), data.size());
+  if (!sk_icc_color_space) {
+    DLOG(ERROR) << "Failed to parse ICC profile to SkColorSpace.";
+    return;
+  }
+  std::unique_ptr<SkColorSpaceXform> sk_color_space_xform =
+      SkColorSpaceXform::New(sk_srgb_color_space.get(),
+                             sk_icc_color_space.get());
+  if (!sk_color_space_xform) {
+    DLOG(ERROR) << "Parsed ICC profile but can't create SkColorSpaceXform.";
+    return;
+  }
+
+  // Because this SkColorSpace can be used to construct a transform, mark it
+  // as "useable". Mark the "best approximation" as sRGB to start.
+  *useable_sk_color_space = sk_icc_color_space;
+  *parametric_color_space = ColorSpace::CreateSRGB();
+
+  // If our SkColorSpace representation is sRGB then return that.
+  if (SkColorSpace::Equals(sk_srgb_color_space.get(),
+                           sk_icc_color_space.get())) {
+    *parametric_color_space_is_accurate = true;
+    return;
+  }
+
+  // A primary matrix is required for our parametric approximation.
+  SkMatrix44 to_XYZD50_matrix;
+  if (!sk_icc->toXYZD50(&to_XYZD50_matrix)) {
+    DLOG(ERROR) << "Failed to extract ICC profile primary matrix.";
+    return;
+  }
+
+  // Try to directly extract a numerical transfer function.
+  SkColorSpaceTransferFn exact_tr_fn;
+  if (sk_icc->isNumericalTransferFn(&exact_tr_fn)) {
+    *parametric_color_space =
+        gfx::ColorSpace::CreateCustom(to_XYZD50_matrix, exact_tr_fn);
+    *parametric_color_space_is_accurate = true;
+    return;
+  }
+
+  // If that fails, try to numerically approximate the transfer function.
+  SkColorSpaceTransferFn approx_tr_fn;
+  float approx_tr_fn_max_error = 0;
+  if (SkApproximateTransferFn(sk_icc, &approx_tr_fn_max_error, &approx_tr_fn)) {
+    const float kMaxError = 2.f / 256.f;
+    if (approx_tr_fn_max_error < kMaxError) {
+      *parametric_color_space =
+          gfx::ColorSpace::CreateCustom(to_XYZD50_matrix, approx_tr_fn);
+      *parametric_color_space_is_accurate = true;
+      return;
+    } else {
+      DLOG(ERROR)
+          << "Failed to accurately approximate transfer function, error: "
+          << 256.f * approx_tr_fn_max_error << "/256";
+    }
+  } else {
+    DLOG(ERROR) << "Failed approximate transfer function.";
+  }
+
+  // If we fail to get a transfer function, use the sRGB transfer function,
+  // and return false to indicate that the gfx::ColorSpace isn't accurate, but
+  // we can construct accurate LUT transforms using the underlying
+  // SkColorSpace.
+  *parametric_color_space = gfx::ColorSpace::CreateCustom(
+      to_XYZD50_matrix, ColorSpace::TransferID::IEC61966_2_1);
+}
+
 }  // namespace
 
 ICCProfile::ICCProfile() = default;
@@ -178,77 +263,26 @@
     }
   }
 
-  // Parse the profile and attempt to create a SkColorSpaceXform out of it.
-  sk_sp<SkColorSpace> sk_srgb_color_space = SkColorSpace::MakeSRGB();
-  sk_sp<SkICC> sk_icc = SkICC::Make(data_.data(), data_.size());
-  sk_sp<SkColorSpace> sk_icc_color_space;
-  std::unique_ptr<SkColorSpaceXform> sk_color_space_xform;
-  if (sk_icc)
-    sk_icc_color_space = SkColorSpace::MakeICC(data_.data(), data_.size());
-  if (sk_icc_color_space) {
-    sk_color_space_xform = SkColorSpaceXform::New(sk_srgb_color_space.get(),
-                                                  sk_icc_color_space.get());
-  }
-
-  // Attempt to extract a parametric represetation for this space.
-  if (sk_color_space_xform) {
-    bool parametric_color_space_is_accurate = false;
+  // Parse the ICC profile
+  sk_sp<SkColorSpace> useable_sk_color_space;
+  bool parametric_color_space_is_accurate = false;
+  ExtractColorSpaces(data_, &parametric_color_space_,
+                     &parametric_color_space_is_accurate,
+                     &useable_sk_color_space);
+  if (parametric_color_space_is_accurate) {
     successfully_parsed_by_sk_icc_ = true;
-
-    // Populate |parametric_color_space_| as a primary matrix and analytic
-    // transfer function, if possible.
-    SkMatrix44 to_XYZD50_matrix;
-    if (sk_icc->toXYZD50(&to_XYZD50_matrix)) {
-      SkColorSpaceTransferFn fn;
-      // First try to get a numerical transfer function from the profile.
-      if (sk_icc->isNumericalTransferFn(&fn)) {
-        parametric_color_space_is_accurate = true;
-      } else {
-        // If that fails, try to approximate the transfer function.
-        float fn_max_error = 0;
-        bool got_approximate_fn =
-            SkApproximateTransferFn(sk_icc, &fn_max_error, &fn);
-        if (got_approximate_fn) {
-          float kMaxError = 2.f / 256.f;
-          if (fn_max_error < kMaxError) {
-            parametric_color_space_is_accurate = true;
-          } else {
-            DLOG(ERROR) << "ICCProfile transfer function approximation "
-                        << "inexact, error: " << 256.f * fn_max_error << "/256";
-          }
-        } else {
-          // And if that fails, just say that the transfer function was sRGB.
-          DLOG(ERROR) << "Failed to approximate ICCProfile transfer function.";
-          gfx::ColorSpace::CreateSRGB().GetTransferFunction(&fn);
-        }
-      }
-      parametric_color_space_ =
-          gfx::ColorSpace::CreateCustom(to_XYZD50_matrix, fn);
-    } else {
-      DLOG(ERROR) << "Failed to extract ICCProfile primary matrix.";
-      // TODO(ccameron): Get an approximate gamut for rasterization.
-      parametric_color_space_ = gfx::ColorSpace::CreateSRGB();
-    }
-
-    // If the approximation is accurate, then set |parametric_color_space_| and
-    // |color_space_| to the same value, and link them to |this|. Otherwise, set
-    // them separately, and do not link |parametric_color_space_| to |this|.
-    if (parametric_color_space_is_accurate) {
-      parametric_color_space_.icc_profile_id_ = id_;
-      color_space_ = parametric_color_space_;
-    } else {
-      color_space_ = ColorSpace(ColorSpace::PrimaryID::ICC_BASED,
-                                ColorSpace::TransferID::ICC_BASED);
-      color_space_.icc_profile_id_ = id_;
-      color_space_.icc_profile_sk_color_space_ = sk_icc_color_space;
-    }
-  } else if (sk_icc_color_space) {
-    DLOG(ERROR) << "Parsed ICCProfile, but unable to create an "
-                   "SkColorSpaceXform from it.";
-    successfully_parsed_by_sk_icc_ = false;
+    parametric_color_space_.icc_profile_id_ = id_;
+    color_space_ = parametric_color_space_;
+  } else if (useable_sk_color_space) {
+    successfully_parsed_by_sk_icc_ = true;
+    color_space_ = ColorSpace(ColorSpace::PrimaryID::ICC_BASED,
+                              ColorSpace::TransferID::ICC_BASED);
+    color_space_.icc_profile_id_ = id_;
+    color_space_.icc_profile_sk_color_space_ = useable_sk_color_space;
   } else {
-    DLOG(ERROR) << "Unable to parse ICCProfile.";
     successfully_parsed_by_sk_icc_ = false;
+    DCHECK(!color_space_.IsValid());
+    color_space_ = parametric_color_space_;
   }
 
   // Add to the cache.
diff --git a/ui/gfx/icc_profile_unittest.cc b/ui/gfx/icc_profile_unittest.cc
index 590858e..e1222d5a 100644
--- a/ui/gfx/icc_profile_unittest.cc
+++ b/ui/gfx/icc_profile_unittest.cc
@@ -28,9 +28,11 @@
   sk_sp<SkColorSpace> sk_color_space = SkColorSpace::MakeSRGB();
 
   // The ICC profile parser should note that this is SRGB.
+  EXPECT_EQ(icc_profile.GetColorSpace(), ColorSpace::CreateSRGB());
   EXPECT_EQ(icc_profile.GetColorSpace().ToSkColorSpace().get(),
             sk_color_space.get());
   // The parametric generating code should recognize that this is SRGB.
+  EXPECT_EQ(icc_profile.GetParametricColorSpace(), ColorSpace::CreateSRGB());
   EXPECT_EQ(icc_profile.GetParametricColorSpace().ToSkColorSpace().get(),
             sk_color_space.get());
   // The generated color space should recognize that this is SRGB.