diff --git a/DEPS b/DEPS
index 91379d08..e39a328d 100644
--- a/DEPS
+++ b/DEPS
@@ -44,7 +44,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
-  'v8_revision': '568edc40f75d1949a1c39df909106fc07ff613ed',
+  'v8_revision': 'deeaeb8f62e11aa0dd5d3066c92ed92d7f815549',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling swarming_client
   # and whatever else without interference from each other.
@@ -232,7 +232,7 @@
     Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067',
 
   'src/third_party/webrtc':
-    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '1a3548e5f94b36db3bdf50107b2a0972edcdc619', # commit position 17851
+    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + 'b5a7da794a580c6554f7c669d5fe3fd6d49f53ee', # commit position 17853
 
   'src/third_party/openmax_dl':
     Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' +  Var('openmax_dl_revision'),
diff --git a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
index dc0881e..85b7148c 100644
--- a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
+++ b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
@@ -282,8 +282,6 @@
     attribute PAGE_RULE
     attribute STYLE_RULE
     attribute SUPPORTS_RULE
-    attribute WEBKIT_KEYFRAMES_RULE
-    attribute WEBKIT_KEYFRAME_RULE
     getter cssText
     getter parentRule
     getter parentStyleSheet
diff --git a/base/BUILD.gn b/base/BUILD.gn
index e6b2c64..d096f012 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -981,6 +981,8 @@
     "trace_event/memory_infra_background_whitelist.h",
     "trace_event/memory_peak_detector.cc",
     "trace_event/memory_peak_detector.h",
+    "trace_event/memory_tracing_observer.cc",
+    "trace_event/memory_tracing_observer.h",
     "trace_event/memory_usage_estimator.cc",
     "trace_event/memory_usage_estimator.h",
     "trace_event/process_memory_dump.cc",
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index ed73b9e7..10e5d1b1 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -36,6 +36,7 @@
 #include "base/trace_event/memory_dump_session_state.h"
 #include "base/trace_event/memory_infra_background_whitelist.h"
 #include "base/trace_event/memory_peak_detector.h"
+#include "base/trace_event/memory_tracing_observer.h"
 #include "base/trace_event/process_memory_dump.h"
 #include "base/trace_event/trace_event.h"
 #include "base/trace_event/trace_event_argument.h"
@@ -50,10 +51,6 @@
 
 namespace {
 
-const int kTraceEventNumArgs = 1;
-const char* kTraceEventArgNames[] = {"dumps"};
-const unsigned char kTraceEventArgTypes[] = {TRACE_VALUE_TYPE_CONVERTABLE};
-
 StaticAtomicSequenceNumber g_next_guid;
 MemoryDumpManager* g_instance_for_testing = nullptr;
 
@@ -199,7 +196,6 @@
 }
 
 MemoryDumpManager::~MemoryDumpManager() {
-  TraceLog::GetInstance()->RemoveEnabledStateObserver(this);
 }
 
 void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
@@ -290,14 +286,9 @@
                                         TraceLog::FILTERING_MODE);
   }
 
-  // If tracing was enabled before initializing MemoryDumpManager, we missed the
-  // OnTraceLogEnabled() event. Synthetize it so we can late-join the party.
-  // IsEnabled is called before adding observer to avoid calling
-  // OnTraceLogEnabled twice.
-  bool is_tracing_already_enabled = TraceLog::GetInstance()->IsEnabled();
-  TraceLog::GetInstance()->AddEnabledStateObserver(this);
-  if (is_tracing_already_enabled)
-    OnTraceLogEnabled();
+  // TODO(hjd): Move out of MDM. See: crbug.com/703184
+  tracing_observer_ =
+      MakeUnique<MemoryTracingObserver>(TraceLog::GetInstance(), this);
 }
 
 void MemoryDumpManager::RegisterDumpProvider(
@@ -723,7 +714,6 @@
   return sum / 1024;
 }
 
-// static
 void MemoryDumpManager::FinalizeDumpAndAddToTrace(
     std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state) {
   HEAP_PROFILER_SCOPED_IGNORE;
@@ -734,7 +724,7 @@
         pmd_async_state->callback_task_runner;
     callback_task_runner->PostTask(
         FROM_HERE, BindOnce(&MemoryDumpManager::FinalizeDumpAndAddToTrace,
-                            Passed(&pmd_async_state)));
+                            Unretained(this), Passed(&pmd_async_state)));
     return;
   }
 
@@ -743,26 +733,17 @@
   // The results struct to fill.
   // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
   base::Optional<MemoryDumpCallbackResult> result;
+
+  bool dump_successful = pmd_async_state->dump_successful;
+
   for (const auto& kv : pmd_async_state->process_dumps) {
     ProcessId pid = kv.first;  // kNullProcessId for the current process.
     ProcessMemoryDump* process_memory_dump = kv.second.get();
-    std::unique_ptr<TracedValue> traced_value(new TracedValue);
-    process_memory_dump->AsValueInto(traced_value.get());
-    traced_value->SetString("level_of_detail",
-                            MemoryDumpLevelOfDetailToString(
-                                pmd_async_state->req_args.level_of_detail));
-    const char* const event_name =
-        MemoryDumpTypeToString(pmd_async_state->req_args.dump_type);
 
-    std::unique_ptr<ConvertableToTraceFormat> event_value(
-        std::move(traced_value));
-    TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID(
-        TRACE_EVENT_PHASE_MEMORY_DUMP,
-        TraceLog::GetCategoryGroupEnabled(kTraceCategory), event_name,
-        trace_event_internal::kGlobalScope, dump_guid, pid,
-        kTraceEventNumArgs, kTraceEventArgNames,
-        kTraceEventArgTypes, nullptr /* arg_values */, &event_value,
-        TRACE_EVENT_FLAG_HAS_ID);
+    bool added_to_trace = tracing_observer_->AddDumpToTraceIfEnabled(
+        &pmd_async_state->req_args, pid, process_memory_dump);
+
+    dump_successful = dump_successful && added_to_trace;
 
     // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
     // Don't try to fill the struct in detailed mode since it is hard to avoid
@@ -794,17 +775,8 @@
     }
   }
 
-  bool tracing_still_enabled;
-  TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &tracing_still_enabled);
-  if (!tracing_still_enabled) {
-    pmd_async_state->dump_successful = false;
-    VLOG(1) << kLogPrefix << " failed because tracing was disabled before"
-            << " the dump was completed";
-  }
-
   if (!pmd_async_state->callback.is_null()) {
-    pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful,
-                                  result);
+    pmd_async_state->callback.Run(dump_guid, dump_successful, result);
     pmd_async_state->callback.Reset();
   }
 
@@ -812,17 +784,8 @@
                                   TRACE_ID_LOCAL(dump_guid));
 }
 
-void MemoryDumpManager::OnTraceLogEnabled() {
-  bool enabled;
-  TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &enabled);
-  if (!enabled)
-    return;
-
-  // Initialize the TraceLog for the current thread. This is to avoid that the
-  // TraceLog memory dump provider is registered lazily in the PostTask() below
-  // while the |lock_| is taken;
-  TraceLog::GetInstance()->InitializeThreadLocalEventBufferIfSupported();
-
+void MemoryDumpManager::Enable(
+    const TraceConfig::MemoryDumpConfig& memory_dump_config) {
   // Spin-up the thread used to invoke unbound dump providers.
   std::unique_ptr<Thread> dump_thread(new Thread("MemoryInfra"));
   if (!dump_thread->Start()) {
@@ -830,10 +793,6 @@
     return;
   }
 
-  const TraceConfig& trace_config =
-      TraceLog::GetInstance()->GetCurrentTraceConfig();
-  const TraceConfig::MemoryDumpConfig& memory_dump_config =
-      trace_config.memory_dump_config();
   scoped_refptr<MemoryDumpSessionState> session_state =
       new MemoryDumpSessionState;
   session_state->SetAllowedDumpModes(memory_dump_config.allowed_dump_modes);
@@ -918,7 +877,7 @@
   }
 }
 
-void MemoryDumpManager::OnTraceLogDisabled() {
+void MemoryDumpManager::Disable() {
   // There might be a memory dump in progress while this happens. Therefore,
   // ensure that the MDM state which depends on the tracing enabled / disabled
   // state is always accessed by the dumping methods holding the |lock_|.
diff --git a/base/trace_event/memory_dump_manager.h b/base/trace_event/memory_dump_manager.h
index d359a8c3..1583c9e 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -39,6 +39,7 @@
 
 namespace trace_event {
 
+class MemoryTracingObserver;
 class MemoryDumpManagerDelegate;
 class MemoryDumpProvider;
 class MemoryDumpSessionState;
@@ -46,7 +47,7 @@
 // This is the interface exposed to the rest of the codebase to deal with
 // memory tracing. The main entry point for clients is represented by
 // RequestDumpPoint(). The extension by Un(RegisterDumpProvider).
-class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
+class BASE_EXPORT MemoryDumpManager {
  public:
   static const char* const kTraceCategory;
   static const char* const kLogPrefix;
@@ -119,9 +120,15 @@
   void RequestGlobalDump(MemoryDumpType dump_type,
                          MemoryDumpLevelOfDetail level_of_detail);
 
-  // TraceLog::EnabledStateObserver implementation.
-  void OnTraceLogEnabled() override;
-  void OnTraceLogDisabled() override;
+  // Prepare MemoryDumpManager for RequestGlobalMemoryDump calls.
+  // Starts the MemoryDumpManager thread.
+  // Also uses the given config to initialize the peak detector,
+  // scheduler and heap profiler.
+  void Enable(const TraceConfig::MemoryDumpConfig&);
+
+  // Tearsdown the MemoryDumpManager thread and various other state set up by
+  // Enable.
+  void Disable();
 
   // Enable heap profiling if kEnableHeapProfiling is specified.
   void EnableHeapProfilingIfNeeded();
@@ -230,11 +237,12 @@
   static const char* const kSystemAllocatorPoolName;
 
   MemoryDumpManager();
-  ~MemoryDumpManager() override;
+  virtual ~MemoryDumpManager();
 
   static void SetInstanceForTesting(MemoryDumpManager* instance);
   static uint32_t GetDumpsSumKb(const std::string&, const ProcessMemoryDump*);
-  static void FinalizeDumpAndAddToTrace(
+
+  void FinalizeDumpAndAddToTrace(
       std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state);
 
   // Internal, used only by MemoryDumpManagerDelegate.
@@ -284,6 +292,7 @@
       strict_thread_check_blacklist_;
 
   std::unique_ptr<MemoryDumpManagerDelegate> delegate_;
+  std::unique_ptr<MemoryTracingObserver> tracing_observer_;
 
   // Protects from concurrent accesses to the |dump_providers_*| and |delegate_|
   // to guard against disabling logging while dumping on another thread.
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index ba76b9a..2bbfd3b 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -1015,64 +1015,6 @@
   DisableTracing();
 }
 
-// Tests against race conditions that might arise when disabling tracing in the
-// middle of a global memory dump.
-// Flaky on iOS, see crbug.com/706961
-#if defined(OS_IOS)
-#define MAYBE_DisableTracingWhileDumping DISABLED_DisableTracingWhileDumping
-#else
-#define MAYBE_DisableTracingWhileDumping DisableTracingWhileDumping
-#endif
-TEST_F(MemoryDumpManagerTest, MAYBE_DisableTracingWhileDumping) {
-  base::WaitableEvent tracing_disabled_event(
-      WaitableEvent::ResetPolicy::AUTOMATIC,
-      WaitableEvent::InitialState::NOT_SIGNALED);
-  InitializeMemoryDumpManager(false /* is_coordinator */);
-
-  // Register a bound dump provider.
-  std::unique_ptr<Thread> mdp_thread(new Thread("test thread"));
-  mdp_thread->Start();
-  MockMemoryDumpProvider mdp_with_affinity;
-  RegisterDumpProvider(&mdp_with_affinity, mdp_thread->task_runner(),
-                       kDefaultOptions);
-
-  // Register also an unbound dump provider. Unbound dump providers are always
-  // invoked after bound ones.
-  MockMemoryDumpProvider unbound_mdp;
-  RegisterDumpProvider(&unbound_mdp, nullptr, kDefaultOptions);
-
-  EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory);
-  EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(1);
-  EXPECT_CALL(mdp_with_affinity, OnMemoryDump(_, _))
-      .Times(1)
-      .WillOnce(
-          Invoke([&tracing_disabled_event](const MemoryDumpArgs&,
-                                           ProcessMemoryDump* pmd) -> bool {
-            tracing_disabled_event.Wait();
-
-            // At this point tracing has been disabled and the
-            // MemoryDumpManager.dump_thread_ has been shut down.
-            return true;
-          }));
-
-  // |unbound_mdp| should never be invoked because the thread for unbound dump
-  // providers has been shutdown in the meanwhile.
-  EXPECT_CALL(unbound_mdp, OnMemoryDump(_, _)).Times(0);
-
-  last_callback_success_ = true;
-  RunLoop run_loop;
-  GlobalMemoryDumpCallback callback =
-      Bind(&MemoryDumpManagerTest::GlobalDumpCallbackAdapter, Unretained(this),
-           ThreadTaskRunnerHandle::Get(), run_loop.QuitClosure());
-  mdm_->RequestGlobalDump(MemoryDumpType::EXPLICITLY_TRIGGERED,
-                          MemoryDumpLevelOfDetail::DETAILED, callback);
-  DisableTracing();
-  tracing_disabled_event.Signal();
-  run_loop.Run();
-
-  EXPECT_FALSE(last_callback_success_);
-}
-
 // Tests against race conditions that can happen if tracing is disabled before
 // the CreateProcessDump() call. Real-world regression: crbug.com/580295 .
 TEST_F(MemoryDumpManagerTest, DisableTracingRightBeforeStartOfDump) {
@@ -1308,5 +1250,36 @@
   thread.Stop();
 }
 
+// Tests that we can manually take a dump without enabling tracing.
+TEST_F(MemoryDumpManagerTest, DumpWithTracingDisabled) {
+  InitializeMemoryDumpManager(false /* is_coordinator */);
+  MockMemoryDumpProvider mdp;
+  RegisterDumpProvider(&mdp, ThreadTaskRunnerHandle::Get());
+
+  DisableTracing();
+
+  const TraceConfig& trace_config =
+      TraceConfig(TraceConfigMemoryTestUtil::GetTraceConfig_NoTriggers());
+  const TraceConfig::MemoryDumpConfig& memory_dump_config =
+      trace_config.memory_dump_config();
+
+  mdm_->Enable(memory_dump_config);
+
+  EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _)).Times(3);
+  EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(3).WillRepeatedly(Return(true));
+  last_callback_success_ = true;
+  for (int i = 0; i < 3; ++i)
+    RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED,
+                             MemoryDumpLevelOfDetail::DETAILED);
+  // The callback result should actually be false since (for the moment at
+  // least) a true result means that as well as the dump generally being
+  // successful we also managed to add the dump to the trace.
+  EXPECT_FALSE(last_callback_success_);
+
+  mdm_->Disable();
+
+  mdm_->UnregisterDumpProvider(&mdp);
+}
+
 }  // namespace trace_event
 }  // namespace base
diff --git a/base/trace_event/memory_tracing_observer.cc b/base/trace_event/memory_tracing_observer.cc
new file mode 100644
index 0000000..3130b20
--- /dev/null
+++ b/base/trace_event/memory_tracing_observer.cc
@@ -0,0 +1,96 @@
+// 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.
+
+#include "base/trace_event/memory_tracing_observer.h"
+
+#include "base/trace_event/memory_dump_manager.h"
+#include "base/trace_event/trace_event_argument.h"
+
+namespace base {
+namespace trace_event {
+
+namespace {
+
+const int kTraceEventNumArgs = 1;
+const char* kTraceEventArgNames[] = {"dumps"};
+const unsigned char kTraceEventArgTypes[] = {TRACE_VALUE_TYPE_CONVERTABLE};
+
+bool IsMemoryInfraTracingEnabled() {
+  bool enabled;
+  TRACE_EVENT_CATEGORY_GROUP_ENABLED(MemoryDumpManager::kTraceCategory,
+                                     &enabled);
+  return enabled;
+}
+
+};  // namespace
+
+MemoryTracingObserver::MemoryTracingObserver(
+    TraceLog* trace_log,
+    MemoryDumpManager* memory_dump_manager)
+    : memory_dump_manager_(memory_dump_manager), trace_log_(trace_log) {
+  // If tracing was enabled before initializing MemoryDumpManager, we missed the
+  // OnTraceLogEnabled() event. Synthetize it so we can late-join the party.
+  // IsEnabled is called before adding observer to avoid calling
+  // OnTraceLogEnabled twice.
+  bool is_tracing_already_enabled = trace_log_->IsEnabled();
+  trace_log_->AddEnabledStateObserver(this);
+  if (is_tracing_already_enabled)
+    OnTraceLogEnabled();
+}
+
+MemoryTracingObserver::~MemoryTracingObserver() {
+  trace_log_->RemoveEnabledStateObserver(this);
+}
+
+void MemoryTracingObserver::OnTraceLogEnabled() {
+  if (!IsMemoryInfraTracingEnabled())
+    return;
+
+  // Initialize the TraceLog for the current thread. This is to avoids that the
+  // TraceLog memory dump provider is registered lazily during the MDM Enable()
+  TraceLog::GetInstance()->InitializeThreadLocalEventBufferIfSupported();
+
+  const TraceConfig& trace_config =
+      TraceLog::GetInstance()->GetCurrentTraceConfig();
+  const TraceConfig::MemoryDumpConfig& memory_dump_config =
+      trace_config.memory_dump_config();
+
+  memory_dump_manager_->Enable(memory_dump_config);
+}
+
+void MemoryTracingObserver::OnTraceLogDisabled() {
+  memory_dump_manager_->Disable();
+}
+
+bool MemoryTracingObserver::AddDumpToTraceIfEnabled(
+    const MemoryDumpRequestArgs* req_args,
+    const ProcessId pid,
+    const ProcessMemoryDump* process_memory_dump) {
+  // If tracing has been disabled early out to avoid the cost of serializing the
+  // dump then ignoring the result.
+  if (!IsMemoryInfraTracingEnabled())
+    return false;
+
+  const uint64_t dump_guid = req_args->dump_guid;
+
+  std::unique_ptr<TracedValue> traced_value(new TracedValue);
+  process_memory_dump->AsValueInto(traced_value.get());
+  traced_value->SetString("level_of_detail", MemoryDumpLevelOfDetailToString(
+                                                 req_args->level_of_detail));
+  const char* const event_name = MemoryDumpTypeToString(req_args->dump_type);
+
+  std::unique_ptr<ConvertableToTraceFormat> event_value(
+      std::move(traced_value));
+  TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID(
+      TRACE_EVENT_PHASE_MEMORY_DUMP,
+      TraceLog::GetCategoryGroupEnabled(MemoryDumpManager::kTraceCategory),
+      event_name, trace_event_internal::kGlobalScope, dump_guid, pid,
+      kTraceEventNumArgs, kTraceEventArgNames, kTraceEventArgTypes,
+      nullptr /* arg_values */, &event_value, TRACE_EVENT_FLAG_HAS_ID);
+
+  return true;
+}
+
+}  // namespace trace_event
+}  // namespace base
diff --git a/base/trace_event/memory_tracing_observer.h b/base/trace_event/memory_tracing_observer.h
new file mode 100644
index 0000000..1efea18
--- /dev/null
+++ b/base/trace_event/memory_tracing_observer.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_
+#define BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_
+
+#include "base/macros.h"
+#include "base/trace_event/memory_dump_manager.h"
+#include "base/trace_event/trace_event.h"
+
+namespace base {
+
+namespace trace_event {
+
+// Observes TraceLog for Enable/Disable events and when they occur Enables and
+// Disables the MemoryDumpManager with the correct state based on reading the
+// trace log. Also provides a method for adding a dump to the trace.
+class BASE_EXPORT MemoryTracingObserver
+    : public TraceLog::EnabledStateObserver {
+ public:
+  static const char* const kTraceCategory;
+
+  MemoryTracingObserver(TraceLog*, MemoryDumpManager*);
+  ~MemoryTracingObserver() override;
+
+  // TraceLog::EnabledStateObserver implementation.
+  void OnTraceLogEnabled() override;
+  void OnTraceLogDisabled() override;
+
+  bool AddDumpToTraceIfEnabled(const MemoryDumpRequestArgs*,
+                               const ProcessId,
+                               const ProcessMemoryDump*);
+
+ private:
+  MemoryDumpManager* const memory_dump_manager_;
+  TraceLog* const trace_log_;
+
+  DISALLOW_COPY_AND_ASSIGN(MemoryTracingObserver);
+};
+
+}  // namespace trace_event
+}  // namespace base
+
+#endif  // BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java
index b3d078b3..8de1e4e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java
@@ -13,6 +13,7 @@
 import android.view.MenuItem.OnMenuItemClickListener;
 import android.view.View;
 
+import org.chromium.base.metrics.RecordUserAction;
 import org.chromium.chrome.R;
 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
 import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate;
@@ -123,6 +124,8 @@
         // https://crbug.com/638555, https://crbug.com/636296).
         mTouchEnabledDelegate.setTouchEnabled(false);
         mContextMenuOpen = true;
+
+        RecordUserAction.record("Suggestions.ContextMenu.Shown");
     }
 
     @Override
@@ -184,18 +187,23 @@
             switch (item.getItemId()) {
                 case ID_OPEN_IN_NEW_WINDOW:
                     mDelegate.openItem(WindowOpenDisposition.NEW_WINDOW);
+                    RecordUserAction.record("Suggestions.ContextMenu.OpenItemInNewWindow");
                     return true;
                 case ID_OPEN_IN_NEW_TAB:
                     mDelegate.openItem(WindowOpenDisposition.NEW_BACKGROUND_TAB);
+                    RecordUserAction.record("Suggestions.ContextMenu.OpenItemInNewTab");
                     return true;
                 case ID_OPEN_IN_INCOGNITO_TAB:
                     mDelegate.openItem(WindowOpenDisposition.OFF_THE_RECORD);
+                    RecordUserAction.record("Suggestions.ContextMenu.OpenItemInIncognitoTab");
                     return true;
                 case ID_SAVE_FOR_OFFLINE:
                     mDelegate.openItem(WindowOpenDisposition.SAVE_TO_DISK);
+                    RecordUserAction.record("Suggestions.ContextMenu.DownloadItem");
                     return true;
                 case ID_REMOVE:
                     mDelegate.removeItem();
+                    RecordUserAction.record("Suggestions.ContextMenu.RemoveItem");
                     return true;
                 default:
                     return false;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGroup.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGroup.java
index 2918a5f..460bb3b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGroup.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGroup.java
@@ -25,6 +25,7 @@
 import org.chromium.base.Callback;
 import org.chromium.base.Log;
 import org.chromium.base.VisibleForTesting;
+import org.chromium.base.metrics.RecordUserAction;
 import org.chromium.chrome.R;
 import org.chromium.chrome.browser.ChromeFeatureList;
 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback;
@@ -486,6 +487,8 @@
         @Override
         public void onResult(String restoredUrl) {
             mPendingInsertionUrl = restoredUrl;
+
+            RecordUserAction.record("Suggestions.Tile.RemovalUndone");
         }
     }
 
diff --git a/chrome/browser/devtools/serialize_host_descriptions.cc b/chrome/browser/devtools/serialize_host_descriptions.cc
index 5e5c19f..26aa020 100644
--- a/chrome/browser/devtools/serialize_host_descriptions.cc
+++ b/chrome/browser/devtools/serialize_host_descriptions.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/devtools/serialize_host_descriptions.h"
 
 #include <map>
+#include <unordered_set>
 #include <utility>
 
 #include "base/memory/ptr_util.h"
@@ -40,14 +41,14 @@
 // Takes a vector of host description and converts it into:
 // |children|: a map from a host's representation to representations of its
 //             children,
-// |roots|: a vector of representations of hosts with no parents, and
+// |roots|: a set of representations of hosts with no parents, and
 // |representations|: a vector actually storing all those representations to
 //                    which the rest just points.
 void CreateDictionaryForest(
     std::vector<HostDescriptionNode> hosts,
     std::map<base::DictionaryValue*, std::vector<base::DictionaryValue*>>*
         children,
-    std::vector<base::DictionaryValue*>* roots,
+    std::unordered_set<base::DictionaryValue*>* roots,
     std::vector<base::DictionaryValue>* representations) {
   representations->reserve(hosts.size());
   children->clear();
@@ -59,7 +60,10 @@
   // First move the representations and map the names to them.
   for (HostDescriptionNode& node : hosts) {
     representations->push_back(std::move(node.representation));
-    name_to_representation[node.name] = &representations->back();
+    // If there are multiple nodes with the same name, subsequent insertions
+    // will be ignored, so only the first node with a given name will be
+    // referenced by |roots| and |children|.
+    name_to_representation.emplace(node.name, &representations->back());
   }
 
   // Now compute children.
@@ -67,12 +71,12 @@
     base::DictionaryValue* node_rep = name_to_representation[node.name];
     base::StringPiece parent_name = node.parent_name;
     if (parent_name.empty()) {
-      roots->push_back(node_rep);
+      roots->insert(node_rep);
       continue;
     }
     auto node_it = name_to_representation.find(parent_name);
     if (node_it == name_to_representation.end()) {
-      roots->push_back(node_rep);
+      roots->insert(node_rep);
       continue;
     }
     (*children)[name_to_representation[parent_name]].push_back(node_rep);
@@ -89,7 +93,7 @@
   std::vector<base::DictionaryValue> representations;
   std::map<base::DictionaryValue*, std::vector<base::DictionaryValue*>>
       children;
-  std::vector<base::DictionaryValue*> roots;
+  std::unordered_set<base::DictionaryValue*> roots;
 
   CreateDictionaryForest(std::move(hosts), &children, &roots, &representations);
 
diff --git a/chrome/browser/devtools/serialize_host_descriptions_unittest.cc b/chrome/browser/devtools/serialize_host_descriptions_unittest.cc
index c2213b4..856dc1a 100644
--- a/chrome/browser/devtools/serialize_host_descriptions_unittest.cc
+++ b/chrome/browser/devtools/serialize_host_descriptions_unittest.cc
@@ -11,42 +11,78 @@
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using ::testing::UnorderedElementsAre;
+
 namespace {
 
-HostDescriptionNode GetDummyNode() {
-  return {std::string(), std::string(), base::DictionaryValue()};
+HostDescriptionNode GetNodeWithLabel(const char* name, int label) {
+  HostDescriptionNode node = {name, std::string(), base::DictionaryValue()};
+  node.representation.SetInteger("label", label);
+  return node;
 }
 
-HostDescriptionNode GetNodeWithLabel(int id) {
-  base::DictionaryValue dict;
-  dict.SetInteger("label", id);
-  return {std::string(), std::string(), std::move(dict)};
+// Returns the list of children of |arg|.
+const base::Value* GetChildren(const base::Value& arg) {
+  const base::DictionaryValue* dict = nullptr;
+  EXPECT_TRUE(arg.GetAsDictionary(&dict));
+
+  const base::Value* children = nullptr;
+  if (!dict->Get("children", &children))
+    return nullptr;
+  EXPECT_EQ(base::Value::Type::LIST, children->type());
+  return children;
 }
 
-int GetLabel(const base::DictionaryValue* dict) {
+// Checks that |arg| is a description of a node with label |l|.
+bool CheckLabel(const base::Value& arg, int l) {
+  const base::DictionaryValue* dict = nullptr;
+  EXPECT_TRUE(arg.GetAsDictionary(&dict));
   int result = 0;
-  EXPECT_TRUE(dict->GetInteger("label", &result));
-  return result;
+  if (!dict->GetInteger("label", &result))
+    return false;
+  return l == result;
+}
+
+// Matches every |arg| with label |label| and checks that it has no children.
+MATCHER_P(EmptyNode, label, "") {
+  if (!CheckLabel(arg, label))
+    return false;
+  EXPECT_FALSE(GetChildren(arg));
+  return true;
 }
 
 }  // namespace
 
-TEST(SerializeDictionaryForestTest, Empty) {
+TEST(SerializeHostDescriptionTest, Empty) {
   base::ListValue result =
       SerializeHostDescriptions(std::vector<HostDescriptionNode>(), "123");
-  EXPECT_TRUE(result.empty());
+  EXPECT_THAT(result.base::Value::GetList(), ::testing::IsEmpty());
 }
 
 // Test serializing a forest of stubs (no edges).
-TEST(SerializeDictionaryForestTest, Stubs) {
+TEST(SerializeHostDescriptionTest, Stubs) {
   base::ListValue result = SerializeHostDescriptions(
-      {GetDummyNode(), GetDummyNode(), GetDummyNode()}, "123");
-  EXPECT_EQ(3u, result.GetSize());
-  for (const base::Value& value : result) {
-    const base::DictionaryValue* dict = nullptr;
-    ASSERT_TRUE(value.GetAsDictionary(&dict));
-    EXPECT_FALSE(dict->HasKey("123"));
-  }
+      {GetNodeWithLabel("1", 1), GetNodeWithLabel("2", 2),
+       GetNodeWithLabel("3", 3)},
+      "children");
+  EXPECT_THAT(result.base::Value::GetList(),
+              UnorderedElementsAre(EmptyNode(1), EmptyNode(2), EmptyNode(3)));
+}
+
+// Test handling multiple nodes sharing the same name.
+TEST(SerializeHostDescriptionTest, SameNames) {
+  std::vector<HostDescriptionNode> nodes = {
+      GetNodeWithLabel("A", 1), GetNodeWithLabel("A", 2),
+      GetNodeWithLabel("A", 3), GetNodeWithLabel("B", 4),
+      GetNodeWithLabel("C", 5)};
+
+  base::ListValue result =
+      SerializeHostDescriptions(std::move(nodes), "children");
+
+  // Only the first node called "A", and both nodes "B" and "C" should be
+  // returned.
+  EXPECT_THAT(result.base::Value::GetList(),
+              UnorderedElementsAre(EmptyNode(1), EmptyNode(4), EmptyNode(5)));
 }
 
 // Test serializing a small forest, of this structure:
@@ -54,12 +90,39 @@
 // 0 -- 6
 //   \ 1
 //   \ 3
-TEST(SerializeDictionaryForestTest, Forest) {
+
+namespace {
+
+// Matchers for non-empty nodes specifically in this test:
+MATCHER(Node2, "") {
+  if (!CheckLabel(arg, 2))
+    return false;
+  EXPECT_THAT(GetChildren(arg)->GetList(), UnorderedElementsAre(EmptyNode(4)));
+  return true;
+}
+
+MATCHER(Node5, "") {
+  if (!CheckLabel(arg, 5))
+    return false;
+  EXPECT_THAT(GetChildren(arg)->GetList(), UnorderedElementsAre(Node2()));
+  return true;
+}
+
+MATCHER(Node0, "") {
+  if (!CheckLabel(arg, 0))
+    return false;
+  EXPECT_THAT(GetChildren(arg)->GetList(),
+              UnorderedElementsAre(EmptyNode(1), EmptyNode(3), EmptyNode(6)));
+  return true;
+}
+
+}  // namespace
+
+TEST(SerializeHostDescriptionTest, Forest) {
   std::vector<HostDescriptionNode> nodes(7);
   const char* kNames[] = {"0", "1", "2", "3", "4", "5", "6"};
   for (size_t i = 0; i < 7; ++i) {
-    nodes[i] = GetNodeWithLabel(i);
-    nodes[i].name = kNames[i];
+    nodes[i] = GetNodeWithLabel(kNames[i], i);
   }
   nodes[2].parent_name = "5";
   nodes[4].parent_name = "2";
@@ -70,47 +133,6 @@
   base::ListValue result =
       SerializeHostDescriptions(std::move(nodes), "children");
 
-  EXPECT_EQ(2u, result.GetSize());
-  const base::Value* value = nullptr;
-  const base::DictionaryValue* dict = nullptr;
-  const base::ListValue* list = nullptr;
-
-  // Check the result. Note that sibling nodes are in the same order in which
-  // they appear in |nodes|.
-
-  // Node 0
-  ASSERT_TRUE(result.Get(0, &value));
-  ASSERT_TRUE(value->GetAsDictionary(&dict));
-  EXPECT_EQ(0, GetLabel(dict));
-  ASSERT_TRUE(dict->GetList("children", &list));
-  EXPECT_EQ(3u, list->GetSize());
-
-  // Nodes 1, 3, 6
-  constexpr int kLabels[] = {1, 3, 6};
-  for (int i = 0; i < 3; ++i) {
-    ASSERT_TRUE(list->Get(i, &value));
-    ASSERT_TRUE(value->GetAsDictionary(&dict));
-    EXPECT_EQ(kLabels[i], GetLabel(dict));
-    EXPECT_FALSE(dict->HasKey("children"));
-  }
-
-  // Node 5
-  ASSERT_TRUE(result.Get(1, &value));
-  ASSERT_TRUE(value->GetAsDictionary(&dict));
-  EXPECT_EQ(5, GetLabel(dict));
-  ASSERT_TRUE(dict->GetList("children", &list));
-  EXPECT_EQ(1u, list->GetSize());
-
-  // Node 2
-  ASSERT_TRUE(list->Get(0, &value));
-  ASSERT_TRUE(value->GetAsDictionary(&dict));
-  EXPECT_EQ(2, GetLabel(dict));
-  ASSERT_TRUE(dict->GetList("children", &list));
-  EXPECT_EQ(1u, list->GetSize());
-
-  // Node 4
-  ASSERT_TRUE(list->Get(0, &value));
-  ASSERT_TRUE(value->GetAsDictionary(&dict));
-  EXPECT_EQ(4, GetLabel(dict));
-  EXPECT_FALSE(dict->HasKey("children"));
+  EXPECT_THAT(result.base::Value::GetList(),
+              UnorderedElementsAre(Node0(), Node5()));
 }
diff --git a/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h
index bcebe45..0fdd257 100644
--- a/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h
@@ -17,12 +17,24 @@
 class PrerenderManager;
 }
 
-// Observer recording metrics related to NoStatePrefetch.
+// Observer responsible for recording First Contentful Paint metrics related to
+// NoStatePrefetch.
+//
+// This observer should be attached to all WebContents instances that are _not_
+// being prerendered. For prerendered page loads, analagous metrics are recorded
+// via |PrerenderPageLoadMetricsObserver|. This allows to compare FCP metrics
+// between three mechanisms: Prerender, NoStatePrefetch, Noop.
+//
+// To record the histograms the knowledge of this class is combined with
+// information from |PrerenderManager|:
+//   * the kind of prefetch, i.e.: prerender::Origin
+//   * whether the load was eligible for prefetch/prerender (also how long ago)
 class NoStatePrefetchPageLoadMetricsObserver
     : public page_load_metrics::PageLoadMetricsObserver {
  public:
   // Returns a NoStatePrefetchPageLoadMetricsObserver, or nullptr if it is not
-  // needed.
+  // needed. Note: can return nullptr at startup, which is believed to be
+  // happening rarely.
   static std::unique_ptr<NoStatePrefetchPageLoadMetricsObserver> CreateIfNeeded(
       content::WebContents* web_contents);
 
diff --git a/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.h
index 1aac140..1db7261 100644
--- a/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.h
@@ -17,7 +17,11 @@
 class PrerenderManager;
 }
 
-// Observer recording metrics related to prerender.
+// Observer responsible for recording First Contentful Paing metrics related to
+// Prerender.
+//
+// To record FCP metrics for non-Prerender loads, the
+// |NoStatePrefetchPageLoadMetricsObserver| is used.
 class PrerenderPageLoadMetricsObserver
     : public page_load_metrics::PageLoadMetricsObserver {
  public:
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index db276ab7..48d092d 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -198,10 +198,19 @@
                                    bool is_main_resource,
                                    int redirect_count);
 
-  // Records the time to first contentful paint for loads that previously had a
-  // no state prefetch load.  Must not be called for prefetch loads themselves
-  // (which are never rendered anyway).  |is_no_store| must be true if the main
-  // resource has a "no-store" cache control HTTP header.
+  // Called to record the time to First Contentful Paint for all pages that were
+  // not prerendered.
+  //
+  // As part of recording, determines whether the load had previously matched
+  // the criteria for triggering a NoStatePrefetch. In the prerendering
+  // experimental group such triggering makes the page prerendered, while in the
+  // group doing only 'simple loads' it would have been a noop.
+  //
+  // Must not be called for prefetch loads themselves (which are never painted
+  // anyway). The |is_no_store| must be true iff the main resource has a
+  // "no-store" cache control HTTP header. The |was_hidden| tells whether the
+  // the page was hidden at least once between starting the load and registering
+  // the FCP.
   void RecordNoStateFirstContentfulPaint(const GURL& url,
                                          bool is_no_store,
                                          bool was_hidden,
diff --git a/chrome/browser/prerender/prerender_test_utils.cc b/chrome/browser/prerender/prerender_test_utils.cc
index f3d0c5a..ab55265 100644
--- a/chrome/browser/prerender/prerender_test_utils.cc
+++ b/chrome/browser/prerender/prerender_test_utils.cc
@@ -15,6 +15,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/post_task.h"
 #include "base/threading/sequenced_worker_pool.h"
 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h"
 #include "chrome/browser/prerender/prerender_manager.h"
@@ -60,8 +61,12 @@
             request,
             delegate,
             file,
-            BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
-                base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)) {}
+            base::CreateTaskRunnerWithTraits(
+                base::TaskTraits()
+                    .MayBlock()
+                    .WithPriority(base::TaskPriority::BACKGROUND)
+                    .WithShutdownBehavior(
+                        base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN))) {}
 
   void set_start_callback(const base::Closure& start_callback) {
     start_callback_ = start_callback;
@@ -193,11 +198,13 @@
       return new HangingURLRequestJob(request, network_delegate);
     }
     return new net::URLRequestMockHTTPJob(
-        request,
-        network_delegate,
-        file_,
-        BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
-            base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
+        request, network_delegate, file_,
+        base::CreateTaskRunnerWithTraits(
+            base::TaskTraits()
+                .MayBlock()
+                .WithPriority(base::TaskPriority::BACKGROUND)
+                .WithShutdownBehavior(
+                    base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
   }
 
  private:
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc
index 25067a0..1a4dae5b 100644
--- a/components/browser_sync/profile_sync_service.cc
+++ b/components/browser_sync/profile_sync_service.cc
@@ -2199,7 +2199,9 @@
 
 bool ProfileSyncService::IsSyncRequested() const {
   DCHECK(thread_checker_.CalledOnValidThread());
-  return sync_prefs_.IsSyncRequested();
+  // When local sync is on sync should be considered requsted or otherwise it
+  // will not resume after the policy or the flag has been removed.
+  return sync_prefs_.IsSyncRequested() || sync_prefs_.IsLocalSyncEnabled();
 }
 
 SigninManagerBase* ProfileSyncService::signin() const {
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc
index fc0d17f4..4dd3cb8 100644
--- a/components/browser_sync/profile_sync_service_unittest.cc
+++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -386,7 +386,6 @@
 TEST_F(ProfileSyncServiceTest, SuccessfulLocalBackendInitialization) {
   prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
                           base::MakeUnique<base::Value>(false));
-  IssueTestTokens();
   CreateServiceWithLocalSyncBackend();
   ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
   ExpectSyncEngineCreation(1);
@@ -943,6 +942,34 @@
   EXPECT_FALSE(service()->GetLocalDeviceInfoProvider()->GetLocalDeviceInfo());
 }
 
+// Verify a that local sync mode resumes after the policy is lifted.
+TEST_F(ProfileSyncServiceTest, LocalBackendDisabledByPolicy) {
+  prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+                          base::MakeUnique<base::Value>(false));
+  CreateServiceWithLocalSyncBackend();
+  ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
+  ExpectSyncEngineCreation(1);
+  InitializeForNthSync();
+  EXPECT_FALSE(service()->IsManaged());
+  EXPECT_TRUE(service()->IsSyncActive());
+
+  prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+                          base::MakeUnique<base::Value>(true));
+
+  EXPECT_TRUE(service()->IsManaged());
+  EXPECT_FALSE(service()->IsSyncActive());
+
+  prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+                          base::MakeUnique<base::Value>(false));
+
+  ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
+  ExpectSyncEngineCreation(1);
+
+  service()->RequestStart();
+  EXPECT_FALSE(service()->IsManaged());
+  EXPECT_TRUE(service()->IsSyncActive());
+}
+
 // Regression test for crbug/555434. The issue is that check for sessions DTC in
 // OnSessionRestoreComplete was creating map entry with nullptr which later was
 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
diff --git a/components/policy/core/browser/proxy_policy_handler.cc b/components/policy/core/browser/proxy_policy_handler.cc
index 77c1aa9a..7bcba462 100644
--- a/components/policy/core/browser/proxy_policy_handler.cc
+++ b/components/policy/core/browser/proxy_policy_handler.cc
@@ -8,7 +8,6 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/values.h"
 #include "components/policy/core/browser/configuration_policy_handler.h"
diff --git a/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc b/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc
index 62c73b2..e5d4b165 100644
--- a/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc
+++ b/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.cc
@@ -21,15 +21,15 @@
 
 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchAbortEvent(
     const std::string& tag,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchAbortEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchAbortEventCallback callback) {
   last_tag_ = tag;
 
   if (fail_abort_event_) {
-    callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
-                 base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
+                            base::Time::Now());
   } else {
-    callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
   if (abort_event_closure_)
@@ -39,16 +39,16 @@
 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchClickEvent(
     const std::string& tag,
     mojom::BackgroundFetchState state,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchClickEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchClickEventCallback callback) {
   last_tag_ = tag;
   last_state_ = state;
 
   if (fail_click_event_) {
-    callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
-                 base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
+                            base::Time::Now());
   } else {
-    callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
   if (click_event_closure_)
@@ -58,16 +58,16 @@
 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchFailEvent(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchFailEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchFailEventCallback callback) {
   last_tag_ = tag;
   last_fetches_ = fetches;
 
   if (fail_fetch_fail_event_) {
-    callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
-                 base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
+                            base::Time::Now());
   } else {
-    callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
   if (fetch_fail_event_closure_)
@@ -77,16 +77,16 @@
 void BackgroundFetchEmbeddedWorkerTestHelper::OnBackgroundFetchedEvent(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchedEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchBackgroundFetchedEventCallback
+        callback) {
   last_tag_ = tag;
   last_fetches_ = fetches;
 
   if (fail_fetched_event_) {
-    callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
-                 base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
+                            base::Time::Now());
   } else {
-    callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
   if (fetched_event_closure_)
diff --git a/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h b/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
index 531427e..07abed7 100644
--- a/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
+++ b/content/browser/background_fetch/background_fetch_embedded_worker_test_helper.h
@@ -63,23 +63,23 @@
   // EmbeddedWorkerTestHelper overrides:
   void OnBackgroundFetchAbortEvent(
       const std::string& tag,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchAbortEventCallback& callback) override;
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchAbortEventCallback callback) override;
   void OnBackgroundFetchClickEvent(
       const std::string& tag,
       mojom::BackgroundFetchState state,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchClickEventCallback& callback) override;
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchClickEventCallback callback) override;
   void OnBackgroundFetchFailEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchFailEventCallback& callback) override;
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchFailEventCallback callback) override;
   void OnBackgroundFetchedEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchedEventCallback& callback) override;
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchedEventCallback callback) override;
 
  private:
   bool fail_abort_event_ = false;
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 293e2851..45cf9cf 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2440,7 +2440,7 @@
 
 void RenderFrameHostImpl::CreateNewWindow(
     mojom::CreateNewWindowParamsPtr params,
-    const CreateNewWindowCallback& callback) {
+    CreateNewWindowCallback callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   bool no_javascript_access = false;
@@ -2461,7 +2461,7 @@
 
   mojom::CreateNewWindowReplyPtr reply = mojom::CreateNewWindowReply::New();
   if (!can_create_window) {
-    RunCreateWindowCompleteCallback(callback, std::move(reply),
+    RunCreateWindowCompleteCallback(std::move(callback), std::move(reply),
                                     MSG_ROUTING_NONE, MSG_ROUTING_NONE,
                                     MSG_ROUTING_NONE, 0);
     return;
@@ -2527,7 +2527,7 @@
     if (!succeeded) {
       DCHECK(!RenderFrameHost::FromID(render_process_id, main_frame_route_id));
       DCHECK(!RenderViewHost::FromID(render_process_id, render_view_route_id));
-      RunCreateWindowCompleteCallback(callback, std::move(reply),
+      RunCreateWindowCompleteCallback(std::move(callback), std::move(reply),
                                       MSG_ROUTING_NONE, MSG_ROUTING_NONE,
                                       MSG_ROUTING_NONE, 0);
       return;
@@ -2537,12 +2537,12 @@
   }
 
   RunCreateWindowCompleteCallback(
-      callback, std::move(reply), render_view_route_id, main_frame_route_id,
-      main_frame_widget_route_id, cloned_namespace->id());
+      std::move(callback), std::move(reply), render_view_route_id,
+      main_frame_route_id, main_frame_widget_route_id, cloned_namespace->id());
 }
 
 void RenderFrameHostImpl::RunCreateWindowCompleteCallback(
-    const CreateNewWindowCallback& callback,
+    CreateNewWindowCallback callback,
     mojom::CreateNewWindowReplyPtr reply,
     int render_view_route_id,
     int main_frame_route_id,
@@ -2553,7 +2553,7 @@
   reply->main_frame_widget_route_id = main_frame_widget_route_id;
   reply->cloned_session_storage_namespace_id =
       cloned_session_storage_namespace_id;
-  callback.Run(std::move(reply));
+  std::move(callback).Run(std::move(reply));
 }
 
 void RenderFrameHostImpl::RegisterMojoInterfaces() {
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index 183c3e5d..b2e398f 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -789,9 +789,9 @@
 
   // mojom::FrameHost
   void CreateNewWindow(mojom::CreateNewWindowParamsPtr params,
-                       const CreateNewWindowCallback& callback) override;
+                       CreateNewWindowCallback callback) override;
 
-  void RunCreateWindowCompleteCallback(const CreateNewWindowCallback& callback,
+  void RunCreateWindowCompleteCallback(CreateNewWindowCallback callback,
                                        mojom::CreateNewWindowReplyPtr reply,
                                        int render_view_route_id,
                                        int main_frame_route_id,
diff --git a/content/browser/frame_host/render_frame_message_filter.cc b/content/browser/frame_host/render_frame_message_filter.cc
index 35f7afc..bbbb37d 100644
--- a/content/browser/frame_host/render_frame_message_filter.cc
+++ b/content/browser/frame_host/render_frame_message_filter.cc
@@ -327,7 +327,7 @@
     int render_frame_id,
     const GURL& url,
     const GURL& first_party_for_cookies,
-    const GetCookiesCallback& callback,
+    GetCookiesCallback callback,
     const net::CookieList& cookie_list) {
   net::URLRequestContext* context = GetRequestContextForURL(url);
   // Check the policy for get cookies, and pass cookie_list to the
@@ -336,9 +336,9 @@
       GetContentClient()->browser()->AllowGetCookie(
           url, first_party_for_cookies, cookie_list, resource_context_,
           render_process_id_, render_frame_id)) {
-    callback.Run(net::CookieStore::BuildCookieLine(cookie_list));
+    std::move(callback).Run(net::CookieStore::BuildCookieLine(cookie_list));
   } else {
-    callback.Run(std::string());
+    std::move(callback).Run(std::string());
   }
 }
 
@@ -408,13 +408,13 @@
 void RenderFrameMessageFilter::GetCookies(int render_frame_id,
                                           const GURL& url,
                                           const GURL& first_party_for_cookies,
-                                          const GetCookiesCallback& callback) {
+                                          GetCookiesCallback callback) {
   ChildProcessSecurityPolicyImpl* policy =
       ChildProcessSecurityPolicyImpl::GetInstance();
   if (!policy->CanAccessDataForOrigin(render_process_id_, url)) {
     bad_message::ReceivedBadMessage(this,
                                     bad_message::RFMF_GET_COOKIES_BAD_ORIGIN);
-    callback.Run(std::string());
+    std::move(callback).Run(std::string());
     return;
   }
 
@@ -441,7 +441,8 @@
   context->cookie_store()->GetCookieListWithOptionsAsync(
       url, options,
       base::Bind(&RenderFrameMessageFilter::CheckPolicyForCookies, this,
-                 render_frame_id, url, first_party_for_cookies, callback));
+                 render_frame_id, url, first_party_for_cookies,
+                 base::Passed(&callback)));
 }
 
 #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/content/browser/frame_host/render_frame_message_filter.h b/content/browser/frame_host/render_frame_message_filter.h
index 05500b4..3f49cc4 100644
--- a/content/browser/frame_host/render_frame_message_filter.h
+++ b/content/browser/frame_host/render_frame_message_filter.h
@@ -96,7 +96,7 @@
   void CheckPolicyForCookies(int render_frame_id,
                              const GURL& url,
                              const GURL& first_party_for_cookies,
-                             const GetCookiesCallback& callback,
+                             GetCookiesCallback callback,
                              const net::CookieList& cookie_list);
 
   void OnDownloadUrl(const FrameHostMsg_DownloadUrl_Params& params);
@@ -120,8 +120,7 @@
   void GetCookies(int render_frame_id,
                   const GURL& url,
                   const GURL& first_party_for_cookies,
-                  const GetCookiesCallback& callback) override;
-
+                  GetCookiesCallback callback) override;
 
 #if BUILDFLAG(ENABLE_PLUGINS)
   void OnGetPlugins(bool refresh,
diff --git a/content/browser/leveldb_wrapper_impl.cc b/content/browser/leveldb_wrapper_impl.cc
index 44cac2cc..8fc9e2f1 100644
--- a/content/browser/leveldb_wrapper_impl.cc
+++ b/content/browser/leveldb_wrapper_impl.cc
@@ -109,10 +109,10 @@
 void LevelDBWrapperImpl::Put(const std::vector<uint8_t>& key,
                              const std::vector<uint8_t>& value,
                              const std::string& source,
-                             const PutCallback& callback) {
+                             PutCallback callback) {
   if (!map_) {
     LoadMap(base::Bind(&LevelDBWrapperImpl::Put, base::Unretained(this), key,
-                       value, source, callback));
+                       value, source, base::Passed(&callback)));
     return;
   }
 
@@ -121,7 +121,7 @@
   auto found = map_->find(key);
   if (found != map_->end()) {
     if (found->second == value) {
-      callback.Run(true);  // Key already has this value.
+      std::move(callback).Run(true);  // Key already has this value.
       return;
     }
     old_item_size = key.size() + found->second.size();
@@ -133,7 +133,7 @@
   // Only check quota if the size is increasing, this allows
   // shrinking changes to pre-existing maps that are over budget.
   if (new_item_size > old_item_size && new_bytes_used > max_size_) {
-    callback.Run(false);
+    std::move(callback).Run(false);
     return;
   }
 
@@ -161,21 +161,21 @@
           observer->KeyChanged(key, value, old_value, source);
         });
   }
-  callback.Run(true);
+  std::move(callback).Run(true);
 }
 
 void LevelDBWrapperImpl::Delete(const std::vector<uint8_t>& key,
                                 const std::string& source,
-                                const DeleteCallback& callback) {
+                                DeleteCallback callback) {
   if (!map_) {
     LoadMap(base::Bind(&LevelDBWrapperImpl::Delete, base::Unretained(this), key,
-                       source, callback));
+                       source, base::Passed(&callback)));
     return;
   }
 
   auto found = map_->find(key);
   if (found == map_->end()) {
-    callback.Run(true);
+    std::move(callback).Run(true);
     return;
   }
 
@@ -191,20 +191,19 @@
       [&key, &source, &old_value](mojom::LevelDBObserver* observer) {
         observer->KeyDeleted(key, old_value, source);
       });
-  callback.Run(true);
+  std::move(callback).Run(true);
 }
 
 void LevelDBWrapperImpl::DeleteAll(const std::string& source,
-                                   const DeleteAllCallback& callback) {
+                                   DeleteAllCallback callback) {
   if (!map_) {
-    LoadMap(
-        base::Bind(&LevelDBWrapperImpl::DeleteAll, base::Unretained(this),
-                    source, callback));
+    LoadMap(base::Bind(&LevelDBWrapperImpl::DeleteAll, base::Unretained(this),
+                       source, base::Passed(&callback)));
     return;
   }
 
   if (map_->empty()) {
-    callback.Run(true);
+    std::move(callback).Run(true);
     return;
   }
 
@@ -220,31 +219,32 @@
       [&source](mojom::LevelDBObserver* observer) {
         observer->AllDeleted(source);
       });
-  callback.Run(true);
+  std::move(callback).Run(true);
 }
 
 void LevelDBWrapperImpl::Get(const std::vector<uint8_t>& key,
-                             const GetCallback& callback) {
+                             GetCallback callback) {
   if (!map_) {
     LoadMap(base::Bind(&LevelDBWrapperImpl::Get, base::Unretained(this), key,
-                       callback));
+                       base::Passed(&callback)));
     return;
   }
 
   auto found = map_->find(key);
   if (found == map_->end()) {
-    callback.Run(false, std::vector<uint8_t>());
+    std::move(callback).Run(false, std::vector<uint8_t>());
     return;
   }
-  callback.Run(true, found->second);
+  std::move(callback).Run(true, found->second);
 }
 
 void LevelDBWrapperImpl::GetAll(
     mojom::LevelDBWrapperGetAllCallbackAssociatedPtrInfo complete_callback,
-    const GetAllCallback& callback) {
+    GetAllCallback callback) {
   if (!map_) {
     LoadMap(base::Bind(&LevelDBWrapperImpl::GetAll, base::Unretained(this),
-                       base::Passed(std::move(complete_callback)), callback));
+                       base::Passed(&complete_callback),
+                       base::Passed(&callback)));
     return;
   }
 
@@ -255,7 +255,7 @@
     kv->value = it.second;
     all.push_back(std::move(kv));
   }
-  callback.Run(leveldb::mojom::DatabaseError::OK, std::move(all));
+  std::move(callback).Run(leveldb::mojom::DatabaseError::OK, std::move(all));
   if (complete_callback.is_valid()) {
     mojom::LevelDBWrapperGetAllCallbackAssociatedPtr complete_ptr;
     complete_ptr.Bind(std::move(complete_callback));
diff --git a/content/browser/leveldb_wrapper_impl.h b/content/browser/leveldb_wrapper_impl.h
index 3b4adba3..9a59a64 100644
--- a/content/browser/leveldb_wrapper_impl.h
+++ b/content/browser/leveldb_wrapper_impl.h
@@ -83,17 +83,16 @@
   void Put(const std::vector<uint8_t>& key,
            const std::vector<uint8_t>& value,
            const std::string& source,
-           const PutCallback& callback) override;
+           PutCallback callback) override;
   void Delete(const std::vector<uint8_t>& key,
               const std::string& source,
-              const DeleteCallback& callback) override;
+              DeleteCallback callback) override;
   void DeleteAll(const std::string& source,
-                 const DeleteAllCallback& callback) override;
-  void Get(const std::vector<uint8_t>& key,
-           const GetCallback& callback) override;
+                 DeleteAllCallback callback) override;
+  void Get(const std::vector<uint8_t>& key, GetCallback callback) override;
   void GetAll(
       mojom::LevelDBWrapperGetAllCallbackAssociatedPtrInfo complete_callback,
-      const GetAllCallback& callback) override;
+      GetAllCallback callback) override;
 
  private:
   // Used to rate limit commits.
diff --git a/content/browser/loader/mojo_async_resource_handler_unittest.cc b/content/browser/loader/mojo_async_resource_handler_unittest.cc
index dc175b44..906c85fe5e 100644
--- a/content/browser/loader/mojo_async_resource_handler_unittest.cc
+++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -310,7 +310,7 @@
   void SyncLoad(int32_t routing_id,
                 int32_t request_id,
                 const ResourceRequest& url_request,
-                const SyncLoadCallback& callback) override {
+                SyncLoadCallback callback) override {
     NOTREACHED();
   }
 
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_network_service.cc
index 5ff9458..f6f5ba88 100644
--- a/content/browser/loader/navigation_url_loader_network_service.cc
+++ b/content/browser/loader/navigation_url_loader_network_service.cc
@@ -141,7 +141,7 @@
 void NavigationURLLoaderNetworkService::OnUploadProgress(
     int64_t current_position,
     int64_t total_size,
-    const OnUploadProgressCallback& callback) {}
+    OnUploadProgressCallback callback) {}
 
 void NavigationURLLoaderNetworkService::OnReceiveCachedMetadata(
     const std::vector<uint8_t>& data) {}
diff --git a/content/browser/loader/navigation_url_loader_network_service.h b/content/browser/loader/navigation_url_loader_network_service.h
index a60b276..8223c83a 100644
--- a/content/browser/loader/navigation_url_loader_network_service.h
+++ b/content/browser/loader/navigation_url_loader_network_service.h
@@ -52,7 +52,7 @@
   void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override;
   void OnUploadProgress(int64_t current_position,
                         int64_t total_size,
-                        const OnUploadProgressCallback& callback) override;
+                        OnUploadProgressCallback callback) override;
   void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override;
   void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
   void OnStartLoadingResponseBody(
diff --git a/content/browser/loader/resource_message_filter.cc b/content/browser/loader/resource_message_filter.cc
index 750c2d5a..57d7409 100644
--- a/content/browser/loader/resource_message_filter.cc
+++ b/content/browser/loader/resource_message_filter.cc
@@ -100,9 +100,9 @@
 void ResourceMessageFilter::SyncLoad(int32_t routing_id,
                                      int32_t request_id,
                                      const ResourceRequest& url_request,
-                                     const SyncLoadCallback& callback) {
+                                     SyncLoadCallback callback) {
   URLLoaderFactoryImpl::SyncLoad(requester_info_.get(), routing_id, request_id,
-                                 url_request, callback);
+                                 url_request, std::move(callback));
 }
 
 int ResourceMessageFilter::child_id() const {
diff --git a/content/browser/loader/resource_message_filter.h b/content/browser/loader/resource_message_filter.h
index 89e1c46..4e4d580 100644
--- a/content/browser/loader/resource_message_filter.h
+++ b/content/browser/loader/resource_message_filter.h
@@ -79,7 +79,7 @@
   void SyncLoad(int32_t routing_id,
                 int32_t request_id,
                 const ResourceRequest& request,
-                const SyncLoadCallback& callback) override;
+                SyncLoadCallback callback) override;
   int child_id() const;
 
   ResourceRequesterInfo* requester_info_for_test() {
diff --git a/content/browser/loader/test_url_loader_client.cc b/content/browser/loader/test_url_loader_client.cc
index e405274..deab6e3 100644
--- a/content/browser/loader/test_url_loader_client.cc
+++ b/content/browser/loader/test_url_loader_client.cc
@@ -73,9 +73,10 @@
   body_transfer_size_ += transfer_size_diff;
 }
 
-void TestURLLoaderClient::OnUploadProgress(int64_t current_position,
-                                           int64_t total_size,
-                                           const base::Closure& ack_callback) {
+void TestURLLoaderClient::OnUploadProgress(
+    int64_t current_position,
+    int64_t total_size,
+    OnUploadProgressCallback ack_callback) {
   EXPECT_TRUE(ack_callback);
   EXPECT_FALSE(has_received_response_);
   EXPECT_FALSE(has_received_completion_);
@@ -85,7 +86,7 @@
   has_received_upload_progress_ = true;
   current_upload_position_ = current_position;
   total_upload_size_ = total_size;
-  ack_callback.Run();
+  std::move(ack_callback).Run();
 }
 
 void TestURLLoaderClient::OnStartLoadingResponseBody(
diff --git a/content/browser/loader/test_url_loader_client.h b/content/browser/loader/test_url_loader_client.h
index 94084a0..ba50bc7 100644
--- a/content/browser/loader/test_url_loader_client.h
+++ b/content/browser/loader/test_url_loader_client.h
@@ -39,7 +39,7 @@
   void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
   void OnUploadProgress(int64_t current_position,
                         int64_t total_size,
-                        const base::Closure& ack_callback) override;
+                        OnUploadProgressCallback ack_callback) override;
   void OnStartLoadingResponseBody(
       mojo::ScopedDataPipeConsumerHandle body) override;
   void OnComplete(const ResourceRequestCompletionStatus& status) override;
diff --git a/content/browser/loader/url_loader_factory_impl.cc b/content/browser/loader/url_loader_factory_impl.cc
index 09a314ab..048e212e 100644
--- a/content/browser/loader/url_loader_factory_impl.cc
+++ b/content/browser/loader/url_loader_factory_impl.cc
@@ -15,20 +15,19 @@
 
 namespace {
 
-void DispatchSyncLoadResult(
-    const URLLoaderFactoryImpl::SyncLoadCallback& callback,
-    const SyncLoadResult* result) {
+void DispatchSyncLoadResult(URLLoaderFactoryImpl::SyncLoadCallback callback,
+                            const SyncLoadResult* result) {
   // |result| can be null when a loading task is aborted unexpectedly. Reply
   // with a failure result on that case.
   // TODO(tzik): Test null-result case.
   if (!result) {
     SyncLoadResult failure;
     failure.error_code = net::ERR_FAILED;
-    callback.Run(failure);
+    std::move(callback).Run(failure);
     return;
   }
 
-  callback.Run(*result);
+  std::move(callback).Run(*result);
 }
 
 } // namespace
@@ -62,9 +61,9 @@
 void URLLoaderFactoryImpl::SyncLoad(int32_t routing_id,
                                     int32_t request_id,
                                     const ResourceRequest& url_request,
-                                    const SyncLoadCallback& callback) {
+                                    SyncLoadCallback callback) {
   SyncLoad(requester_info_.get(), routing_id, request_id, url_request,
-           callback);
+           std::move(callback));
 }
 
 // static
@@ -90,14 +89,15 @@
                                     int32_t routing_id,
                                     int32_t request_id,
                                     const ResourceRequest& url_request,
-                                    const SyncLoadCallback& callback) {
+                                    SyncLoadCallback callback) {
   DCHECK(ResourceDispatcherHostImpl::Get()
              ->io_thread_task_runner()
              ->BelongsToCurrentThread());
 
   ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
-  rdh->OnSyncLoadWithMojo(requester_info, routing_id, request_id, url_request,
-                          base::Bind(&DispatchSyncLoadResult, callback));
+  rdh->OnSyncLoadWithMojo(
+      requester_info, routing_id, request_id, url_request,
+      base::Bind(&DispatchSyncLoadResult, base::Passed(&callback)));
 }
 
 void URLLoaderFactoryImpl::Create(
diff --git a/content/browser/loader/url_loader_factory_impl.h b/content/browser/loader/url_loader_factory_impl.h
index e7bea1b..585b2144 100644
--- a/content/browser/loader/url_loader_factory_impl.h
+++ b/content/browser/loader/url_loader_factory_impl.h
@@ -31,7 +31,7 @@
   void SyncLoad(int32_t routing_id,
                 int32_t request_id,
                 const ResourceRequest& request,
-                const SyncLoadCallback& callback) override;
+                SyncLoadCallback callback) override;
 
   static void CreateLoaderAndStart(ResourceRequesterInfo* requester_info,
                                    mojom::URLLoaderAssociatedRequest request,
@@ -43,7 +43,7 @@
                        int32_t routing_id,
                        int32_t request_id,
                        const ResourceRequest& request,
-                       const SyncLoadCallback& callback);
+                       SyncLoadCallback callback);
 
   // Creates a URLLoaderFactoryImpl instance. The instance is held by the
   // StrongBinding in it, so this function doesn't return the instance.
diff --git a/content/browser/payments/payment_app_content_unittest_base.cc b/content/browser/payments/payment_app_content_unittest_base.cc
index de3629b..6f9ce5a 100644
--- a/content/browser/payments/payment_app_content_unittest_base.cc
+++ b/content/browser/payments/payment_app_content_unittest_base.cc
@@ -70,10 +70,11 @@
   void OnPaymentRequestEvent(
       payments::mojom::PaymentAppRequestPtr app_request,
       payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchPaymentRequestEventCallback& callback) override {
+      mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback
+          callback) override {
     EmbeddedWorkerTestHelper::OnPaymentRequestEvent(
-        std::move(app_request), std::move(response_callback), callback);
+        std::move(app_request), std::move(response_callback),
+        std::move(callback));
   }
 
   int64_t last_sw_registration_id_;
diff --git a/content/browser/push_messaging/push_messaging_manager.cc b/content/browser/push_messaging/push_messaging_manager.cc
index d019cb6f..1a79fc2b 100644
--- a/content/browser/push_messaging/push_messaging_manager.cc
+++ b/content/browser/push_messaging/push_messaging_manager.cc
@@ -103,7 +103,7 @@
 
 struct PushMessagingManager::RegisterData {
   RegisterData();
-  RegisterData(const RegisterData& other) = default;
+  RegisterData(RegisterData&& other) = default;
   bool FromDocument() const;
   GURL requesting_origin;
   int64_t service_worker_registration_id;
@@ -122,7 +122,7 @@
   // Public Register methods on UI thread --------------------------------------
 
   // Callback called on UI thread.
-  void SubscribeDidGetInfoOnUI(const RegisterData& data,
+  void SubscribeDidGetInfoOnUI(RegisterData data,
                                const std::string& push_subscription_id,
                                const std::string& sender_id,
                                bool is_valid,
@@ -130,12 +130,12 @@
                                const std::vector<uint8_t>& auth);
 
   // Called via PostTask from IO thread.
-  void RegisterOnUI(const RegisterData& data);
+  void RegisterOnUI(RegisterData data);
 
   // Public Unregister methods on UI thread ------------------------------------
 
   // Called via PostTask from IO thread.
-  void UnregisterFromService(const UnsubscribeCallback& callback,
+  void UnregisterFromService(UnsubscribeCallback callback,
                              int64_t service_worker_registration_id,
                              const GURL& requesting_origin,
                              const std::string& sender_id);
@@ -143,7 +143,7 @@
   // Public GetSubscription methods on UI thread -------------------------------
 
   // Callback called on UI thread.
-  void GetSubscriptionDidGetInfoOnUI(const GetSubscriptionCallback& callback,
+  void GetSubscriptionDidGetInfoOnUI(GetSubscriptionCallback callback,
                                      const GURL& origin,
                                      int64_t service_worker_registration_id,
                                      const GURL& endpoint,
@@ -154,14 +154,14 @@
 
   // Callback called on UI thread.
   void GetSubscriptionDidUnsubscribe(
-      const GetSubscriptionCallback& callback,
+      GetSubscriptionCallback callback,
       PushGetRegistrationStatus get_status,
       PushUnregistrationStatus unsubscribe_status);
 
   // Public GetPermission methods on UI thread ---------------------------------
 
   // Called via PostTask from IO thread.
-  void GetPermissionStatusOnUI(const GetPermissionStatusCallback& callback,
+  void GetPermissionStatusOnUI(GetPermissionStatusCallback callback,
                                const GURL& requesting_origin,
                                bool user_visible);
 
@@ -173,7 +173,7 @@
       int64_t service_worker_registration_id,
       const std::string& sender_id,
       const std::string& push_subscription_id,
-      const PushMessagingService::SubscriptionInfoCallback& callback);
+      PushMessagingService::SubscriptionInfoCallback callback);
 
   // Called (directly) from both the UI and IO threads.
   bool is_incognito() const { return is_incognito_; }
@@ -193,10 +193,10 @@
 
   // Private Register methods on UI thread -------------------------------------
 
-  void DidRequestPermissionInIncognito(const RegisterData& data,
+  void DidRequestPermissionInIncognito(RegisterData data,
                                        blink::mojom::PermissionStatus status);
 
-  void DidRegister(const RegisterData& data,
+  void DidRegister(RegisterData data,
                    const std::string& push_registration_id,
                    const std::vector<uint8_t>& p256dh,
                    const std::vector<uint8_t>& auth,
@@ -204,7 +204,7 @@
 
   // Private Unregister methods on UI thread -----------------------------------
 
-  void DidUnregisterFromService(const UnsubscribeCallback& callback,
+  void DidUnregisterFromService(UnsubscribeCallback callback,
                                 int64_t service_worker_registration_id,
                                 PushUnregistrationStatus unregistration_status);
 
@@ -279,7 +279,7 @@
 void PushMessagingManager::Subscribe(int32_t render_frame_id,
                                      int64_t service_worker_registration_id,
                                      const PushSubscriptionOptions& options,
-                                     const SubscribeCallback& callback) {
+                                     SubscribeCallback callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   // TODO(mvanouwerkerk): Validate arguments?
   RegisterData data;
@@ -288,7 +288,7 @@
   data.render_frame_id = render_frame_id;
 
   data.service_worker_registration_id = service_worker_registration_id;
-  data.callback = callback;
+  data.callback = std::move(callback);
   data.options = options;
 
   ServiceWorkerRegistration* service_worker_registration =
@@ -296,22 +296,24 @@
           data.service_worker_registration_id);
   if (!service_worker_registration ||
       !service_worker_registration->active_version()) {
-    SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER);
+    SendSubscriptionError(std::move(data),
+                          PUSH_REGISTRATION_STATUS_NO_SERVICE_WORKER);
     return;
   }
   data.requesting_origin = service_worker_registration->pattern().GetOrigin();
 
   DCHECK(!(data.options.sender_info.empty() && data.FromDocument()));
 
+  int64_t registration_id = data.service_worker_registration_id;
   service_worker_context_->GetRegistrationUserData(
-      data.service_worker_registration_id,
+      registration_id,
       {kPushRegistrationIdServiceWorkerKey, kPushSenderIdServiceWorkerKey},
       base::Bind(&PushMessagingManager::DidCheckForExistingRegistration,
-                 weak_factory_io_to_io_.GetWeakPtr(), data));
+                 weak_factory_io_to_io_.GetWeakPtr(), base::Passed(&data)));
 }
 
 void PushMessagingManager::DidCheckForExistingRegistration(
-    const RegisterData& data,
+    RegisterData data,
     const std::vector<std::string>& push_registration_id_and_sender_id,
     ServiceWorkerStatusCode service_worker_status) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -322,21 +324,26 @@
     std::string fixed_sender_id =
         FixSenderInfo(data.options.sender_info, stored_sender_id);
     if (fixed_sender_id.empty()) {
-      SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_NO_SENDER_ID);
+      SendSubscriptionError(std::move(data),
+                            PUSH_REGISTRATION_STATUS_NO_SENDER_ID);
       return;
     }
     if (fixed_sender_id != stored_sender_id) {
-      SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_SENDER_ID_MISMATCH);
+      SendSubscriptionError(std::move(data),
+                            PUSH_REGISTRATION_STATUS_SENDER_ID_MISMATCH);
       return;
     }
+
+    GURL requesting_origin = data.requesting_origin;
+    int64_t registration_id = data.service_worker_registration_id;
     BrowserThread::PostTask(
         BrowserThread::UI, FROM_HERE,
         base::Bind(&Core::GetSubscriptionInfoOnUI,
-                   base::Unretained(ui_core_.get()), data.requesting_origin,
-                   data.service_worker_registration_id, fixed_sender_id,
-                   push_subscription_id,
+                   base::Unretained(ui_core_.get()), requesting_origin,
+                   registration_id, fixed_sender_id, push_subscription_id,
                    base::Bind(&Core::SubscribeDidGetInfoOnUI, ui_core_weak_ptr_,
-                              data, push_subscription_id, fixed_sender_id)));
+                              base::Passed(&data), push_subscription_id,
+                              fixed_sender_id)));
     return;
   }
   // TODO(johnme): The spec allows the register algorithm to reject with an
@@ -345,21 +352,23 @@
   // attempting to do a fresh registration?
   // https://w3c.github.io/push-api/#widl-PushRegistrationManager-register-Promise-PushRegistration
   if (!data.options.sender_info.empty()) {
-    BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
-                            base::Bind(&Core::RegisterOnUI,
-                                       base::Unretained(ui_core_.get()), data));
+    BrowserThread::PostTask(
+        BrowserThread::UI, FROM_HERE,
+        base::Bind(&Core::RegisterOnUI, base::Unretained(ui_core_.get()),
+                   base::Passed(&data)));
   } else {
     // There is no existing registration and the sender_info passed in was
     // empty, but perhaps there is a stored sender id we can use.
+    int64_t registration_id = data.service_worker_registration_id;
     service_worker_context_->GetRegistrationUserData(
-        data.service_worker_registration_id, {kPushSenderIdServiceWorkerKey},
+        registration_id, {kPushSenderIdServiceWorkerKey},
         base::Bind(&PushMessagingManager::DidGetSenderIdFromStorage,
-                   weak_factory_io_to_io_.GetWeakPtr(), data));
+                   weak_factory_io_to_io_.GetWeakPtr(), base::Passed(&data)));
   }
 }
 
 void PushMessagingManager::Core::SubscribeDidGetInfoOnUI(
-    const RegisterData& data,
+    RegisterData data,
     const std::string& push_subscription_id,
     const std::string& sender_id,
     bool is_valid,
@@ -370,7 +379,8 @@
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         base::Bind(&PushMessagingManager::SendSubscriptionSuccess, io_parent_,
-                   data, PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE,
+                   base::Passed(&data),
+                   PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE,
                    push_subscription_id, p256dh, auth));
   } else {
     PushMessagingService* push_service = service();
@@ -381,7 +391,8 @@
       BrowserThread::PostTask(
           BrowserThread::IO, FROM_HERE,
           base::Bind(&PushMessagingManager::SendSubscriptionError, io_parent_,
-                     data, PUSH_REGISTRATION_STATUS_RENDERER_SHUTDOWN));
+                     base::Passed(&data),
+                     PUSH_REGISTRATION_STATUS_RENDERER_SHUTDOWN));
       return;
     }
 
@@ -394,14 +405,16 @@
     // be logged to UMA as a separate subscription attempt.
     RecordRegistrationStatus(PUSH_REGISTRATION_STATUS_STORAGE_CORRUPT);
 
+    int64_t registration_id = data.service_worker_registration_id;
+    GURL requesting_origin = data.requesting_origin;
     auto try_again_on_io = base::Bind(
         &PushMessagingManager::DidCheckForExistingRegistration, io_parent_,
-        data,
+        base::Passed(&data),
         std::vector<std::string>() /* push_registration_id_and_sender_id */,
         SERVICE_WORKER_ERROR_NOT_FOUND);
     push_service->Unsubscribe(
-        PUSH_UNREGISTRATION_REASON_SUBSCRIBE_STORAGE_CORRUPT,
-        data.requesting_origin, data.service_worker_registration_id, sender_id,
+        PUSH_UNREGISTRATION_REASON_SUBSCRIBE_STORAGE_CORRUPT, requesting_origin,
+        registration_id, sender_id,
         base::Bind(&UnregisterCallbackToClosure,
                    base::Bind(IgnoreResult(&BrowserThread::PostTask),
                               BrowserThread::IO, FROM_HERE, try_again_on_io)));
@@ -409,12 +422,13 @@
 }
 
 void PushMessagingManager::DidGetSenderIdFromStorage(
-    const RegisterData& data,
+    RegisterData data,
     const std::vector<std::string>& stored_sender_id,
     ServiceWorkerStatusCode service_worker_status) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (service_worker_status != SERVICE_WORKER_OK) {
-    SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_NO_SENDER_ID);
+    SendSubscriptionError(std::move(data),
+                          PUSH_REGISTRATION_STATUS_NO_SENDER_ID);
     return;
   }
   DCHECK_EQ(1u, stored_sender_id.size());
@@ -423,19 +437,19 @@
   std::string fixed_sender_id =
       FixSenderInfo(data.options.sender_info, stored_sender_id[0]);
   if (fixed_sender_id.empty()) {
-    SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_NO_SENDER_ID);
+    SendSubscriptionError(std::move(data),
+                          PUSH_REGISTRATION_STATUS_NO_SENDER_ID);
     return;
   }
-  RegisterData mutated_data = data;
-  mutated_data.options.sender_info = fixed_sender_id;
+  data.options.sender_info = fixed_sender_id;
   BrowserThread::PostTask(
       BrowserThread::UI, FROM_HERE,
       base::Bind(&Core::RegisterOnUI, base::Unretained(ui_core_.get()),
-                 mutated_data));
+                 base::Passed(&data)));
 }
 
 void PushMessagingManager::Core::RegisterOnUI(
-    const PushMessagingManager::RegisterData& data) {
+    PushMessagingManager::RegisterData data) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   PushMessagingService* push_service = service();
   if (!push_service) {
@@ -446,7 +460,8 @@
       BrowserThread::PostTask(
           BrowserThread::IO, FROM_HERE,
           base::Bind(&PushMessagingManager::SendSubscriptionError, io_parent_,
-                     data, PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE));
+                     base::Passed(&data),
+                     PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE));
     } else {
       // Prevent websites from detecting incognito mode, by emulating what would
       // have happened if we had a PushMessagingService available.
@@ -455,7 +470,7 @@
         BrowserThread::PostTask(
             BrowserThread::IO, FROM_HERE,
             base::Bind(&PushMessagingManager::SendSubscriptionError, io_parent_,
-                       data,
+                       base::Passed(&data),
                        PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED));
       } else {
         RenderFrameHost* render_frame_host =
@@ -475,7 +490,7 @@
                 BrowserThread::IO, FROM_HERE,
                 base::Bind(
                     &PushMessagingManager::SendSubscriptionError, io_parent_,
-                    data,
+                    base::Passed(&data),
                     PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED));
 
             return;
@@ -484,47 +499,52 @@
           // Request push messaging permission (which will fail, since
           // notifications aren't supported in incognito), so the website can't
           // detect whether incognito is active.
+          GURL requesting_origin = data.requesting_origin;
           browser_context->GetPermissionManager()->RequestPermission(
               PermissionType::PUSH_MESSAGING, render_frame_host,
-              data.requesting_origin, false /* user_gesture */,
+              requesting_origin, false /* user_gesture */,
               base::Bind(
                   &PushMessagingManager::Core::DidRequestPermissionInIncognito,
-                  weak_factory_ui_to_ui_.GetWeakPtr(), data));
+                  weak_factory_ui_to_ui_.GetWeakPtr(), base::Passed(&data)));
         }
       }
     }
     return;
   }
 
+  int64_t registration_id = data.service_worker_registration_id;
+  GURL requesting_origin = data.requesting_origin;
+  PushSubscriptionOptions options = data.options;
+  int render_frame_id = data.render_frame_id;
   if (data.FromDocument()) {
     push_service->SubscribeFromDocument(
-        data.requesting_origin, data.service_worker_registration_id,
-        render_process_id_, data.render_frame_id, data.options,
+        requesting_origin, registration_id, render_process_id_, render_frame_id,
+        options,
         base::Bind(&Core::DidRegister, weak_factory_ui_to_ui_.GetWeakPtr(),
-                   data));
+                   base::Passed(&data)));
   } else {
     push_service->SubscribeFromWorker(
-        data.requesting_origin, data.service_worker_registration_id,
-        data.options,
+        requesting_origin, registration_id, options,
         base::Bind(&Core::DidRegister, weak_factory_ui_to_ui_.GetWeakPtr(),
-                   data));
+                   base::Passed(&data)));
   }
 }
 
 void PushMessagingManager::Core::DidRequestPermissionInIncognito(
-    const RegisterData& data,
+    RegisterData data,
     blink::mojom::PermissionStatus status) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   // Notification permission should always be denied in incognito.
   DCHECK_EQ(blink::mojom::PermissionStatus::DENIED, status);
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
-      base::Bind(&PushMessagingManager::SendSubscriptionError, io_parent_, data,
+      base::Bind(&PushMessagingManager::SendSubscriptionError, io_parent_,
+                 base::Passed(&data),
                  PUSH_REGISTRATION_STATUS_INCOGNITO_PERMISSION_DENIED));
 }
 
 void PushMessagingManager::Core::DidRegister(
-    const RegisterData& data,
+    RegisterData data,
     const std::string& push_registration_id,
     const std::vector<uint8_t>& p256dh,
     const std::vector<uint8_t>& auth,
@@ -534,59 +554,63 @@
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         base::Bind(&PushMessagingManager::PersistRegistrationOnIO, io_parent_,
-                   data, push_registration_id, p256dh, auth));
+                   base::Passed(&data), push_registration_id, p256dh, auth));
   } else {
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         base::Bind(&PushMessagingManager::SendSubscriptionError, io_parent_,
-                   data, status));
+                   base::Passed(&data), status));
   }
 }
 
 void PushMessagingManager::PersistRegistrationOnIO(
-    const RegisterData& data,
+    RegisterData data,
     const std::string& push_registration_id,
     const std::vector<uint8_t>& p256dh,
     const std::vector<uint8_t>& auth) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
+  GURL requesting_origin = data.requesting_origin;
+  int64_t registration_id = data.service_worker_registration_id;
+  std::string sender_info = data.options.sender_info;
   service_worker_context_->StoreRegistrationUserData(
-      data.service_worker_registration_id, data.requesting_origin,
+      registration_id, requesting_origin,
       {{kPushRegistrationIdServiceWorkerKey, push_registration_id},
-       {kPushSenderIdServiceWorkerKey, data.options.sender_info}},
+       {kPushSenderIdServiceWorkerKey, sender_info}},
       base::Bind(&PushMessagingManager::DidPersistRegistrationOnIO,
-                 weak_factory_io_to_io_.GetWeakPtr(), data,
+                 weak_factory_io_to_io_.GetWeakPtr(), base::Passed(&data),
                  push_registration_id, p256dh, auth));
 }
 
 void PushMessagingManager::DidPersistRegistrationOnIO(
-    const RegisterData& data,
+    RegisterData data,
     const std::string& push_registration_id,
     const std::vector<uint8_t>& p256dh,
     const std::vector<uint8_t>& auth,
     ServiceWorkerStatusCode service_worker_status) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (service_worker_status == SERVICE_WORKER_OK) {
-    SendSubscriptionSuccess(data,
+    SendSubscriptionSuccess(std::move(data),
                             PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE,
                             push_registration_id, p256dh, auth);
   } else {
     // TODO(johnme): Unregister, so PushMessagingServiceImpl can decrease count.
-    SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_STORAGE_ERROR);
+    SendSubscriptionError(std::move(data),
+                          PUSH_REGISTRATION_STATUS_STORAGE_ERROR);
   }
 }
 
 void PushMessagingManager::SendSubscriptionError(
-    const RegisterData& data,
+    RegisterData data,
     PushRegistrationStatus status) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
-  data.callback.Run(status, base::nullopt /* endpoint */,
-                    base::nullopt /* options */, base::nullopt /* p256dh */,
-                    base::nullopt /* auth */);
+  std::move(data.callback)
+      .Run(status, base::nullopt /* endpoint */, base::nullopt /* options */,
+           base::nullopt /* p256dh */, base::nullopt /* auth */);
   RecordRegistrationStatus(status);
 }
 
 void PushMessagingManager::SendSubscriptionSuccess(
-    const RegisterData& data,
+    RegisterData data,
     PushRegistrationStatus status,
     const std::string& push_subscription_id,
     const std::vector<uint8_t>& p256dh,
@@ -596,14 +620,15 @@
     // This shouldn't be possible in incognito mode, since we've already checked
     // that we have an existing registration. Hence it's ok to throw an error.
     DCHECK(!ui_core_->is_incognito());
-    SendSubscriptionError(data, PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE);
+    SendSubscriptionError(std::move(data),
+                          PUSH_REGISTRATION_STATUS_SERVICE_NOT_AVAILABLE);
     return;
   }
 
   const GURL endpoint = CreateEndpoint(
       IsApplicationServerKey(data.options.sender_info), push_subscription_id);
 
-  data.callback.Run(status, endpoint, data.options, p256dh, auth);
+  std::move(data.callback).Run(status, endpoint, data.options, p256dh, auth);
 
   RecordRegistrationStatus(status);
 }
@@ -613,26 +638,27 @@
 // -----------------------------------------------------------------------------
 
 void PushMessagingManager::Unsubscribe(int64_t service_worker_registration_id,
-                                       const UnsubscribeCallback& callback) {
+                                       UnsubscribeCallback callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   ServiceWorkerRegistration* service_worker_registration =
       service_worker_context_->GetLiveRegistration(
           service_worker_registration_id);
   if (!service_worker_registration) {
-    DidUnregister(callback, PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER);
+    DidUnregister(std::move(callback),
+                  PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER);
     return;
   }
 
   service_worker_context_->GetRegistrationUserData(
       service_worker_registration_id, {kPushSenderIdServiceWorkerKey},
       base::Bind(&PushMessagingManager::UnsubscribeHavingGottenSenderId,
-                 weak_factory_io_to_io_.GetWeakPtr(), callback,
+                 weak_factory_io_to_io_.GetWeakPtr(), base::Passed(&callback),
                  service_worker_registration_id,
                  service_worker_registration->pattern().GetOrigin()));
 }
 
 void PushMessagingManager::UnsubscribeHavingGottenSenderId(
-    const UnsubscribeCallback& callback,
+    UnsubscribeCallback callback,
     int64_t service_worker_registration_id,
     const GURL& requesting_origin,
     const std::vector<std::string>& sender_ids,
@@ -647,12 +673,12 @@
   BrowserThread::PostTask(
       BrowserThread::UI, FROM_HERE,
       base::Bind(&Core::UnregisterFromService, base::Unretained(ui_core_.get()),
-                 callback, service_worker_registration_id, requesting_origin,
-                 sender_id));
+                 base::Passed(&callback), service_worker_registration_id,
+                 requesting_origin, sender_id));
 }
 
 void PushMessagingManager::Core::UnregisterFromService(
-    const UnsubscribeCallback& callback,
+    UnsubscribeCallback callback,
     int64_t service_worker_registration_id,
     const GURL& requesting_origin,
     const std::string& sender_id) {
@@ -664,7 +690,8 @@
     DCHECK(!is_incognito());
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
-        base::Bind(&PushMessagingManager::DidUnregister, io_parent_, callback,
+        base::Bind(&PushMessagingManager::DidUnregister, io_parent_,
+                   base::Passed(&callback),
                    PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE));
     return;
   }
@@ -673,24 +700,24 @@
       PUSH_UNREGISTRATION_REASON_JAVASCRIPT_API, requesting_origin,
       service_worker_registration_id, sender_id,
       base::Bind(&Core::DidUnregisterFromService,
-                 weak_factory_ui_to_ui_.GetWeakPtr(), callback,
+                 weak_factory_ui_to_ui_.GetWeakPtr(), base::Passed(&callback),
                  service_worker_registration_id));
 }
 
 void PushMessagingManager::Core::DidUnregisterFromService(
-    const UnsubscribeCallback& callback,
+    UnsubscribeCallback callback,
     int64_t service_worker_registration_id,
     PushUnregistrationStatus unregistration_status) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
-      base::Bind(&PushMessagingManager::DidUnregister, io_parent_, callback,
-                 unregistration_status));
+      base::Bind(&PushMessagingManager::DidUnregister, io_parent_,
+                 base::Passed(&callback), unregistration_status));
 }
 
 void PushMessagingManager::DidUnregister(
-    const UnsubscribeCallback& callback,
+    UnsubscribeCallback callback,
     PushUnregistrationStatus unregistration_status) {
   // Only called from IO thread, but would be safe to call from UI thread.
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -698,21 +725,21 @@
     case PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED:
     case PUSH_UNREGISTRATION_STATUS_PENDING_NETWORK_ERROR:
     case PUSH_UNREGISTRATION_STATUS_PENDING_SERVICE_ERROR:
-      callback.Run(blink::WebPushError::kErrorTypeNone,
-                   true /* did_unsubscribe */,
-                   base::nullopt /* error_message */);
+      std::move(callback).Run(blink::WebPushError::kErrorTypeNone,
+                              true /* did_unsubscribe */,
+                              base::nullopt /* error_message */);
       break;
     case PUSH_UNREGISTRATION_STATUS_SUCCESS_WAS_NOT_REGISTERED:
-      callback.Run(blink::WebPushError::kErrorTypeNone,
-                   false /* did_unsubscribe */,
-                   base::nullopt /* error_message */);
+      std::move(callback).Run(blink::WebPushError::kErrorTypeNone,
+                              false /* did_unsubscribe */,
+                              base::nullopt /* error_message */);
       break;
     case PUSH_UNREGISTRATION_STATUS_NO_SERVICE_WORKER:
     case PUSH_UNREGISTRATION_STATUS_SERVICE_NOT_AVAILABLE:
     case PUSH_UNREGISTRATION_STATUS_STORAGE_ERROR:
-      callback.Run(blink::WebPushError::kErrorTypeAbort, false,
-                   std::string(PushUnregistrationStatusToString(
-                       unregistration_status)) /* error_message */);
+      std::move(callback).Run(blink::WebPushError::kErrorTypeAbort, false,
+                              std::string(PushUnregistrationStatusToString(
+                                  unregistration_status)) /* error_message */);
       break;
     case PUSH_UNREGISTRATION_STATUS_NETWORK_ERROR:
       NOTREACHED();
@@ -727,19 +754,19 @@
 
 void PushMessagingManager::GetSubscription(
     int64_t service_worker_registration_id,
-    const GetSubscriptionCallback& callback) {
+    GetSubscriptionCallback callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   // TODO(johnme): Validate arguments?
   service_worker_context_->GetRegistrationUserData(
       service_worker_registration_id,
       {kPushRegistrationIdServiceWorkerKey, kPushSenderIdServiceWorkerKey},
       base::Bind(&PushMessagingManager::DidGetSubscription,
-                 weak_factory_io_to_io_.GetWeakPtr(), callback,
+                 weak_factory_io_to_io_.GetWeakPtr(), base::Passed(&callback),
                  service_worker_registration_id));
 }
 
 void PushMessagingManager::DidGetSubscription(
-    const GetSubscriptionCallback& callback,
+    GetSubscriptionCallback callback,
     int64_t service_worker_registration_id,
     const std::vector<std::string>& push_subscription_id_and_sender_info,
     ServiceWorkerStatusCode service_worker_status) {
@@ -783,9 +810,9 @@
                      service_worker_registration_id, sender_info,
                      push_subscription_id,
                      base::Bind(&Core::GetSubscriptionDidGetInfoOnUI,
-                                ui_core_weak_ptr_, callback, origin,
-                                service_worker_registration_id, endpoint,
-                                sender_info)));
+                                ui_core_weak_ptr_, base::Passed(&callback),
+                                origin, service_worker_registration_id,
+                                endpoint, sender_info)));
 
       return;
     }
@@ -820,14 +847,14 @@
       break;
     }
   }
-  callback.Run(get_status, base::nullopt /* endpoint */,
-               base::nullopt /* options */, base::nullopt /* p256dh */,
-               base::nullopt /* auth */);
+  std::move(callback).Run(get_status, base::nullopt /* endpoint */,
+                          base::nullopt /* options */,
+                          base::nullopt /* p256dh */, base::nullopt /* auth */);
   RecordGetRegistrationStatus(get_status);
 }
 
 void PushMessagingManager::Core::GetSubscriptionDidGetInfoOnUI(
-    const GetSubscriptionCallback& callback,
+    GetSubscriptionCallback callback,
     const GURL& origin,
     int64_t service_worker_registration_id,
     const GURL& endpoint,
@@ -847,9 +874,9 @@
 
     PushGetRegistrationStatus status = PUSH_GETREGISTRATION_STATUS_SUCCESS;
 
-    BrowserThread::PostTask(
-        BrowserThread::IO, FROM_HERE,
-        base::Bind(callback, status, endpoint, options, p256dh, auth));
+    BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+                            base::BindOnce(std::move(callback), status,
+                                           endpoint, options, p256dh, auth));
 
     RecordGetRegistrationStatus(status);
   } else {
@@ -860,9 +887,11 @@
       // shutting down.
       BrowserThread::PostTask(
           BrowserThread::IO, FROM_HERE,
-          base::Bind(callback, PUSH_GETREGISTRATION_STATUS_RENDERER_SHUTDOWN,
-                     base::nullopt /* endpoint */, base::nullopt /* options */,
-                     base::nullopt /* p256dh */, base::nullopt /* auth */));
+          base::BindOnce(std::move(callback),
+                         PUSH_GETREGISTRATION_STATUS_RENDERER_SHUTDOWN,
+                         base::nullopt /* endpoint */,
+                         base::nullopt /* options */,
+                         base::nullopt /* p256dh */, base::nullopt /* auth */));
       return;
     }
 
@@ -877,22 +906,23 @@
         PUSH_UNREGISTRATION_REASON_GET_SUBSCRIPTION_STORAGE_CORRUPT, origin,
         service_worker_registration_id, sender_info,
         base::Bind(&Core::GetSubscriptionDidUnsubscribe,
-                   weak_factory_ui_to_ui_.GetWeakPtr(), callback, status));
+                   weak_factory_ui_to_ui_.GetWeakPtr(), base::Passed(&callback),
+                   status));
 
     RecordGetRegistrationStatus(status);
   }
 }
 
 void PushMessagingManager::Core::GetSubscriptionDidUnsubscribe(
-    const GetSubscriptionCallback& callback,
+    GetSubscriptionCallback callback,
     PushGetRegistrationStatus get_status,
     PushUnregistrationStatus unsubscribe_status) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
-      base::Bind(callback, get_status, base::nullopt /* endpoint */,
-                 base::nullopt /* options */, base::nullopt /* p256dh */,
-                 base::nullopt /* auth */));
+      base::BindOnce(std::move(callback), get_status,
+                     base::nullopt /* endpoint */, base::nullopt /* options */,
+                     base::nullopt /* p256dh */, base::nullopt /* auth */));
 }
 
 // GetPermission methods on both IO and UI threads, merged in order of use from
@@ -902,28 +932,28 @@
 void PushMessagingManager::GetPermissionStatus(
     int64_t service_worker_registration_id,
     bool user_visible,
-    const GetPermissionStatusCallback& callback) {
+    GetPermissionStatusCallback callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   ServiceWorkerRegistration* service_worker_registration =
       service_worker_context_->GetLiveRegistration(
           service_worker_registration_id);
   if (!service_worker_registration) {
     // Return error: ErrorTypeAbort.
-    callback.Run(blink::WebPushError::kErrorTypeAbort,
-                 blink::kWebPushPermissionStatusDenied);
+    std::move(callback).Run(blink::WebPushError::kErrorTypeAbort,
+                            blink::kWebPushPermissionStatusDenied);
     return;
   }
 
   BrowserThread::PostTask(
       BrowserThread::UI, FROM_HERE,
       base::Bind(&Core::GetPermissionStatusOnUI,
-                 base::Unretained(ui_core_.get()), callback,
+                 base::Unretained(ui_core_.get()), base::Passed(&callback),
                  service_worker_registration->pattern().GetOrigin(),
                  user_visible));
 }
 
 void PushMessagingManager::Core::GetPermissionStatusOnUI(
-    const GetPermissionStatusCallback& callback,
+    GetPermissionStatusCallback callback,
     const GURL& requesting_origin,
     bool user_visible) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -934,8 +964,9 @@
       BrowserThread::PostTask(
           BrowserThread::IO, FROM_HERE,
           // Return error: ErrorTypeNotSupported.
-          base::Bind(callback, blink::WebPushError::kErrorTypeNotSupported,
-                     blink::kWebPushPermissionStatusDenied));
+          base::BindOnce(std::move(callback),
+                         blink::WebPushError::kErrorTypeNotSupported,
+                         blink::kWebPushPermissionStatusDenied));
       return;
     }
     permission_status =
@@ -947,14 +978,15 @@
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         // Return error: ErrorTypeAbort.
-        base::Bind(callback, blink::WebPushError::kErrorTypeAbort,
-                   blink::kWebPushPermissionStatusDenied));
+        base::BindOnce(std::move(callback),
+                       blink::WebPushError::kErrorTypeAbort,
+                       blink::kWebPushPermissionStatusDenied));
     return;
   }
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
-      base::Bind(callback, blink::WebPushError::kErrorTypeNone,
-                 permission_status));
+      base::BindOnce(std::move(callback), blink::WebPushError::kErrorTypeNone,
+                     permission_status));
 }
 
 // Helper methods on both IO and UI threads, merged from
@@ -966,17 +998,19 @@
     int64_t service_worker_registration_id,
     const std::string& sender_id,
     const std::string& push_subscription_id,
-    const PushMessagingService::SubscriptionInfoCallback& callback) {
+    PushMessagingService::SubscriptionInfoCallback callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   PushMessagingService* push_service = service();
   if (!push_service) {
-    callback.Run(false /* is_valid */, std::vector<uint8_t>() /* p256dh */,
-                 std::vector<uint8_t>() /* auth */);
+    std::move(callback).Run(false /* is_valid */,
+                            std::vector<uint8_t>() /* p256dh */,
+                            std::vector<uint8_t>() /* auth */);
     return;
   }
 
   push_service->GetSubscriptionInfo(origin, service_worker_registration_id,
-                                    sender_id, push_subscription_id, callback);
+                                    sender_id, push_subscription_id,
+                                    std::move(callback));
 }
 
 GURL PushMessagingManager::CreateEndpoint(
diff --git a/content/browser/push_messaging/push_messaging_manager.h b/content/browser/push_messaging/push_messaging_manager.h
index 126266a4..12df9b4 100644
--- a/content/browser/push_messaging/push_messaging_manager.h
+++ b/content/browser/push_messaging/push_messaging_manager.h
@@ -41,15 +41,14 @@
   void Subscribe(int32_t render_frame_id,
                  int64_t service_worker_registration_id,
                  const PushSubscriptionOptions& options,
-                 const SubscribeCallback& callback) override;
+                 SubscribeCallback callback) override;
   void Unsubscribe(int64_t service_worker_registration_id,
-                   const UnsubscribeCallback& callback) override;
+                   UnsubscribeCallback callback) override;
   void GetSubscription(int64_t service_worker_registration_id,
-                       const GetSubscriptionCallback& callback) override;
-  void GetPermissionStatus(
-      int64_t service_worker_registration_id,
-      bool user_visible,
-      const GetPermissionStatusCallback& callback) override;
+                       GetSubscriptionCallback callback) override;
+  void GetPermissionStatus(int64_t service_worker_registration_id,
+                           bool user_visible,
+                           GetPermissionStatusCallback callback) override;
 
  private:
   struct RegisterData;
@@ -62,50 +61,49 @@
   ~PushMessagingManager() override;
 
   void DidCheckForExistingRegistration(
-      const RegisterData& data,
+      RegisterData data,
       const std::vector<std::string>& push_registration_id,
       ServiceWorkerStatusCode service_worker_status);
 
-  void DidGetSenderIdFromStorage(const RegisterData& data,
+  void DidGetSenderIdFromStorage(RegisterData data,
                                  const std::vector<std::string>& sender_id,
                                  ServiceWorkerStatusCode service_worker_status);
 
   // Called via PostTask from UI thread.
-  void PersistRegistrationOnIO(const RegisterData& data,
+  void PersistRegistrationOnIO(RegisterData data,
                                const std::string& push_registration_id,
                                const std::vector<uint8_t>& p256dh,
                                const std::vector<uint8_t>& auth);
 
   void DidPersistRegistrationOnIO(
-      const RegisterData& data,
+      RegisterData data,
       const std::string& push_registration_id,
       const std::vector<uint8_t>& p256dh,
       const std::vector<uint8_t>& auth,
       ServiceWorkerStatusCode service_worker_status);
 
   // Called both from IO thread, and via PostTask from UI thread.
-  void SendSubscriptionError(const RegisterData& data,
-                             PushRegistrationStatus status);
+  void SendSubscriptionError(RegisterData data, PushRegistrationStatus status);
   // Called both from IO thread, and via PostTask from UI thread.
-  void SendSubscriptionSuccess(const RegisterData& data,
+  void SendSubscriptionSuccess(RegisterData data,
                                PushRegistrationStatus status,
                                const std::string& push_subscription_id,
                                const std::vector<uint8_t>& p256dh,
                                const std::vector<uint8_t>& auth);
 
   void UnsubscribeHavingGottenSenderId(
-      const UnsubscribeCallback& callback,
+      UnsubscribeCallback callback,
       int64_t service_worker_registration_id,
       const GURL& requesting_origin,
       const std::vector<std::string>& sender_id,
       ServiceWorkerStatusCode service_worker_status);
 
   // Called both from IO thread, and via PostTask from UI thread.
-  void DidUnregister(const UnsubscribeCallback& callback,
+  void DidUnregister(UnsubscribeCallback callback,
                      PushUnregistrationStatus unregistration_status);
 
   void DidGetSubscription(
-      const GetSubscriptionCallback& callback,
+      GetSubscriptionCallback callback,
       int64_t service_worker_registration_id,
       const std::vector<std::string>& push_subscription_id_and_sender_info,
       ServiceWorkerStatusCode service_worker_status);
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
index 9f31b8a..4c136921 100644
--- a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
+++ b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
@@ -142,7 +142,7 @@
     bool request_video_input,
     bool request_audio_output,
     const url::Origin& security_origin,
-    const EnumerateDevicesCallback& client_callback) {
+    EnumerateDevicesCallback client_callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
   if (!request_audio_input && !request_video_input && !request_audio_output) {
@@ -172,12 +172,12 @@
       security_origin,
       base::Bind(&MediaDevicesDispatcherHost::DoEnumerateDevices,
                  weak_factory_.GetWeakPtr(), devices_to_enumerate,
-                 security_origin, client_callback));
+                 security_origin, base::Passed(&client_callback)));
 }
 
 void MediaDevicesDispatcherHost::GetVideoInputCapabilities(
     const url::Origin& security_origin,
-    const GetVideoInputCapabilitiesCallback& client_callback) {
+    GetVideoInputCapabilitiesCallback client_callback) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!MediaStreamManager::IsOriginAllowed(render_process_id_,
                                            security_origin)) {
@@ -189,7 +189,8 @@
   GetDefaultMediaDeviceID(
       MEDIA_DEVICE_TYPE_VIDEO_INPUT, render_process_id_, render_frame_id_,
       base::Bind(&MediaDevicesDispatcherHost::GotDefaultVideoInputDeviceID,
-                 weak_factory_.GetWeakPtr(), security_origin, client_callback));
+                 weak_factory_.GetWeakPtr(), security_origin,
+                 base::Passed(&client_callback)));
 }
 
 void MediaDevicesDispatcherHost::SubscribeDeviceChangeNotifications(
@@ -312,20 +313,20 @@
 void MediaDevicesDispatcherHost::DoEnumerateDevices(
     const MediaDevicesManager::BoolDeviceTypes& requested_types,
     const url::Origin& security_origin,
-    const EnumerateDevicesCallback& client_callback,
+    EnumerateDevicesCallback client_callback,
     const MediaDevicesManager::BoolDeviceTypes& has_permissions) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   media_stream_manager_->media_devices_manager()->EnumerateDevices(
       requested_types,
       base::Bind(&MediaDevicesDispatcherHost::DevicesEnumerated,
                  weak_factory_.GetWeakPtr(), requested_types, security_origin,
-                 client_callback, has_permissions));
+                 base::Passed(&client_callback), has_permissions));
 }
 
 void MediaDevicesDispatcherHost::DevicesEnumerated(
     const MediaDevicesManager::BoolDeviceTypes& requested_types,
     const url::Origin& security_origin,
-    const EnumerateDevicesCallback& client_callback,
+    EnumerateDevicesCallback client_callback,
     const MediaDevicesManager::BoolDeviceTypes& has_permissions,
     const MediaDeviceEnumeration& enumeration) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -340,24 +341,24 @@
                                               security_origin, device_info));
     }
   }
-  client_callback.Run(result);
+  std::move(client_callback).Run(result);
 }
 
 void MediaDevicesDispatcherHost::GotDefaultVideoInputDeviceID(
     const url::Origin& security_origin,
-    const GetVideoInputCapabilitiesCallback& client_callback,
+    GetVideoInputCapabilitiesCallback client_callback,
     const std::string& default_device_id) {
   MediaDevicesManager::BoolDeviceTypes devices_to_enumerate;
   devices_to_enumerate[MEDIA_DEVICE_TYPE_VIDEO_INPUT] = true;
   media_stream_manager_->video_capture_manager()->EnumerateDevices(
       base::Bind(&MediaDevicesDispatcherHost::FinalizeGetVideoInputCapabilities,
-                 weak_factory_.GetWeakPtr(), security_origin, client_callback,
-                 default_device_id));
+                 weak_factory_.GetWeakPtr(), security_origin,
+                 base::Passed(&client_callback), default_device_id));
 }
 
 void MediaDevicesDispatcherHost::FinalizeGetVideoInputCapabilities(
     const url::Origin& security_origin,
-    const GetVideoInputCapabilitiesCallback& client_callback,
+    GetVideoInputCapabilitiesCallback client_callback,
     const std::string& default_device_id,
     const media::VideoCaptureDeviceDescriptors& device_descriptors) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -400,7 +401,7 @@
     }
   }
 
-  client_callback.Run(std::move(video_input_capabilities));
+  std::move(client_callback).Run(std::move(video_input_capabilities));
 }
 
 media::VideoCaptureFormats MediaDevicesDispatcherHost::GetVideoInputFormats(
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host.h b/content/browser/renderer_host/media/media_devices_dispatcher_host.h
index b39e4f7..00854914 100644
--- a/content/browser/renderer_host/media/media_devices_dispatcher_host.h
+++ b/content/browser/renderer_host/media/media_devices_dispatcher_host.h
@@ -43,15 +43,14 @@
                      ::mojom::MediaDevicesDispatcherHostRequest request);
 
   // ::mojom::MediaDevicesDispatcherHost implementation.
-  void EnumerateDevices(
-      bool request_audio_input,
-      bool request_video_input,
-      bool request_audio_output,
-      const url::Origin& security_origin,
-      const EnumerateDevicesCallback& client_callback) override;
+  void EnumerateDevices(bool request_audio_input,
+                        bool request_video_input,
+                        bool request_audio_output,
+                        const url::Origin& security_origin,
+                        EnumerateDevicesCallback client_callback) override;
   void GetVideoInputCapabilities(
       const url::Origin& security_origin,
-      const GetVideoInputCapabilitiesCallback& client_callback) override;
+      GetVideoInputCapabilitiesCallback client_callback) override;
   void SubscribeDeviceChangeNotifications(
       MediaDeviceType type,
       uint32_t subscription_id,
@@ -73,24 +72,24 @@
   void DoEnumerateDevices(
       const MediaDevicesManager::BoolDeviceTypes& requested_types,
       const url::Origin& security_origin,
-      const EnumerateDevicesCallback& client_callback,
+      EnumerateDevicesCallback client_callback,
       const MediaDevicesManager::BoolDeviceTypes& permissions);
 
   void DevicesEnumerated(
       const MediaDevicesManager::BoolDeviceTypes& requested_types,
       const url::Origin& security_origin,
-      const EnumerateDevicesCallback& client_callback,
+      EnumerateDevicesCallback client_callback,
       const MediaDevicesManager::BoolDeviceTypes& has_permissions,
       const MediaDeviceEnumeration& enumeration);
 
   void GotDefaultVideoInputDeviceID(
       const url::Origin& security_origin,
-      const GetVideoInputCapabilitiesCallback& client_callback,
+      GetVideoInputCapabilitiesCallback client_callback,
       const std::string& default_device_id);
 
   void FinalizeGetVideoInputCapabilities(
       const url::Origin& security_origin,
-      const GetVideoInputCapabilitiesCallback& client_callback,
+      GetVideoInputCapabilitiesCallback client_callback,
       const std::string& default_device_id,
       const media::VideoCaptureDeviceDescriptors& device_descriptors);
 
diff --git a/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.cc b/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.cc
index 5ebd4a6..d45ff4f 100644
--- a/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.cc
+++ b/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.cc
@@ -55,7 +55,7 @@
     media::mojom::AudioOutputStreamProviderRequest stream_provider_request,
     int64_t session_id,
     const std::string& device_id,
-    const RequestDeviceAuthorizationCallback& callback) {
+    RequestDeviceAuthorizationCallback callback) {
   DCHECK(thread_checker_.CalledOnValidThread());
   const base::TimeTicks auth_start_time = base::TimeTicks::Now();
 
@@ -63,7 +63,7 @@
     mojo::ReportBadMessage("session_id is not in integer range");
     // Note: We must call the callback even though we are killing the renderer.
     // This is mandated by mojo.
-    callback.Run(
+    std::move(callback).Run(
         media::OutputDeviceStatus::OUTPUT_DEVICE_STATUS_ERROR_NOT_AUTHORIZED,
         media::AudioParameters::UnavailableDeviceParams(), std::string());
     return;
@@ -76,7 +76,8 @@
                      RequestDeviceAuthorizationForOrigin,
                  weak_ptr_factory_.GetWeakPtr(), auth_start_time,
                  base::Passed(&stream_provider_request),
-                 static_cast<int>(session_id), device_id, callback));
+                 static_cast<int>(session_id), device_id,
+                 base::Passed(&callback)));
 }
 
 void RenderFrameAudioOutputStreamFactory::RequestDeviceAuthorizationForOrigin(
@@ -84,20 +85,21 @@
     media::mojom::AudioOutputStreamProviderRequest stream_provider_request,
     int session_id,
     const std::string& device_id,
-    const RequestDeviceAuthorizationCallback& callback,
+    RequestDeviceAuthorizationCallback callback,
     const url::Origin& origin) {
   DCHECK(thread_checker_.CalledOnValidThread());
   context_->RequestDeviceAuthorization(
       render_frame_id_, session_id, device_id, origin,
       base::Bind(&RenderFrameAudioOutputStreamFactory::AuthorizationCompleted,
                  weak_ptr_factory_.GetWeakPtr(), auth_start_time,
-                 base::Passed(&stream_provider_request), callback, origin));
+                 base::Passed(&stream_provider_request),
+                 base::Passed(&callback), origin));
 }
 
 void RenderFrameAudioOutputStreamFactory::AuthorizationCompleted(
     base::TimeTicks auth_start_time,
     media::mojom::AudioOutputStreamProviderRequest request,
-    const RequestDeviceAuthorizationCallback& callback,
+    RequestDeviceAuthorizationCallback callback,
     const url::Origin& origin,
     media::OutputDeviceStatus status,
     bool should_send_id,
@@ -107,9 +109,9 @@
   UMALogDeviceAuthorizationTime(auth_start_time);
 
   if (status != media::OUTPUT_DEVICE_STATUS_OK) {
-    callback.Run(media::OutputDeviceStatus(status),
-                 media::AudioParameters::UnavailableDeviceParams(),
-                 std::string());
+    std::move(callback).Run(media::OutputDeviceStatus(status),
+                            media::AudioParameters::UnavailableDeviceParams(),
+                            std::string());
     return;
   }
 
@@ -124,10 +126,10 @@
           base::Bind(&RenderFrameAudioOutputStreamFactory::RemoveStream,
                      base::Unretained(this))));
 
-  callback.Run(media::OutputDeviceStatus(status), params,
-               should_send_id
-                   ? context_->GetHMACForDeviceId(origin, raw_device_id)
-                   : std::string());
+  std::move(callback).Run(
+      media::OutputDeviceStatus(status), params,
+      should_send_id ? context_->GetHMACForDeviceId(origin, raw_device_id)
+                     : std::string());
 }
 
 void RenderFrameAudioOutputStreamFactory::RemoveStream(
diff --git a/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h b/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h
index e34682d0..fbc8341 100644
--- a/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h
+++ b/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h
@@ -38,20 +38,20 @@
       media::mojom::AudioOutputStreamProviderRequest stream_provider,
       int64_t session_id,
       const std::string& device_id,
-      const RequestDeviceAuthorizationCallback& callback) override;
+      RequestDeviceAuthorizationCallback callback) override;
 
   void RequestDeviceAuthorizationForOrigin(
       base::TimeTicks auth_start_time,
       media::mojom::AudioOutputStreamProviderRequest stream_provider_request,
       int session_id,
       const std::string& device_id,
-      const RequestDeviceAuthorizationCallback& callback,
+      RequestDeviceAuthorizationCallback callback,
       const url::Origin& origin);
 
   void AuthorizationCompleted(
       base::TimeTicks auth_start_time,
       media::mojom::AudioOutputStreamProviderRequest request,
-      const RequestDeviceAuthorizationCallback& callback,
+      RequestDeviceAuthorizationCallback callback,
       const url::Origin& origin,
       media::OutputDeviceStatus status,
       bool should_send_id,
diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc
index 8da0fd61..a51f00e5 100644
--- a/content/browser/renderer_host/media/video_capture_host.cc
+++ b/content/browser/renderer_host/media/video_capture_host.cc
@@ -234,7 +234,7 @@
 void VideoCaptureHost::GetDeviceSupportedFormats(
     int32_t device_id,
     int32_t session_id,
-    const GetDeviceSupportedFormatsCallback& callback) {
+    GetDeviceSupportedFormatsCallback callback) {
   DVLOG(1) << __func__ << " " << device_id;
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   media::VideoCaptureFormats supported_formats;
@@ -242,13 +242,13 @@
            ->GetDeviceSupportedFormats(session_id, &supported_formats)) {
     DLOG(WARNING) << "Could not retrieve device supported formats";
   }
-  callback.Run(supported_formats);
+  std::move(callback).Run(supported_formats);
 }
 
 void VideoCaptureHost::GetDeviceFormatsInUse(
     int32_t device_id,
     int32_t session_id,
-    const GetDeviceFormatsInUseCallback& callback) {
+    GetDeviceFormatsInUseCallback callback) {
   DVLOG(1) << __func__ << " " << device_id;
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   media::VideoCaptureFormats formats_in_use;
@@ -256,7 +256,7 @@
            session_id, &formats_in_use)) {
     DLOG(WARNING) << "Could not retrieve device format(s) in use";
   }
-  callback.Run(formats_in_use);
+  std::move(callback).Run(formats_in_use);
 }
 
 void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) {
diff --git a/content/browser/renderer_host/media/video_capture_host.h b/content/browser/renderer_host/media/video_capture_host.h
index 04c5cc9..9669c35 100644
--- a/content/browser/renderer_host/media/video_capture_host.h
+++ b/content/browser/renderer_host/media/video_capture_host.h
@@ -71,11 +71,10 @@
   void GetDeviceSupportedFormats(
       int32_t device_id,
       int32_t session_id,
-      const GetDeviceSupportedFormatsCallback& callback) override;
-  void GetDeviceFormatsInUse(
-      int32_t device_id,
-      int32_t session_id,
-      const GetDeviceFormatsInUseCallback& callback) override;
+      GetDeviceSupportedFormatsCallback callback) override;
+  void GetDeviceFormatsInUse(int32_t device_id,
+                             int32_t session_id,
+                             GetDeviceFormatsInUseCallback callback) override;
 
   void DoError(VideoCaptureControllerID id);
   void DoEnded(VideoCaptureControllerID id);
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index dcb2f999..90008a31 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -195,25 +195,24 @@
 }
 
 void RenderMessageFilter::GenerateRoutingID(
-    const GenerateRoutingIDCallback& callback) {
-  callback.Run(render_widget_helper_->GetNextRoutingID());
+    GenerateRoutingIDCallback callback) {
+  std::move(callback).Run(render_widget_helper_->GetNextRoutingID());
 }
 
-void RenderMessageFilter::CreateNewWidget(
-    int32_t opener_id,
-    blink::WebPopupType popup_type,
-    const CreateNewWidgetCallback& callback) {
+void RenderMessageFilter::CreateNewWidget(int32_t opener_id,
+                                          blink::WebPopupType popup_type,
+                                          CreateNewWidgetCallback callback) {
   int route_id = MSG_ROUTING_NONE;
   render_widget_helper_->CreateNewWidget(opener_id, popup_type, &route_id);
-  callback.Run(route_id);
+  std::move(callback).Run(route_id);
 }
 
 void RenderMessageFilter::CreateFullscreenWidget(
     int opener_id,
-    const CreateFullscreenWidgetCallback& callback) {
+    CreateFullscreenWidgetCallback callback) {
   int route_id = 0;
   render_widget_helper_->CreateNewFullscreenWidget(opener_id, &route_id);
-  callback.Run(route_id);
+  std::move(callback).Run(route_id);
 }
 
 void RenderMessageFilter::GetSharedBitmapManager(
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index cbd1030..3042317 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -111,13 +111,12 @@
 #endif
 
   // mojom::RenderMessageFilter:
-  void GenerateRoutingID(const GenerateRoutingIDCallback& routing_id) override;
+  void GenerateRoutingID(GenerateRoutingIDCallback routing_id) override;
   void CreateNewWidget(int32_t opener_id,
                        blink::WebPopupType popup_type,
-                       const CreateNewWidgetCallback& callback) override;
-  void CreateFullscreenWidget(
-      int opener_id,
-      const CreateFullscreenWidgetCallback& callback) override;
+                       CreateNewWidgetCallback callback) override;
+  void CreateFullscreenWidget(int opener_id,
+                              CreateFullscreenWidgetCallback callback) override;
   void GetSharedBitmapManager(
       cc::mojom::SharedBitmapManagerAssociatedRequest request) override;
 
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc
index 388d075..fd6cdd6 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.cc
+++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -158,46 +158,45 @@
 
   ~MockServiceWorkerEventDispatcher() override {}
 
-  void DispatchActivateEvent(
-      const DispatchActivateEventCallback& callback) override {
+  void DispatchActivateEvent(DispatchActivateEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnActivateEventStub(callback);
+    helper_->OnActivateEventStub(std::move(callback));
   }
 
   void DispatchBackgroundFetchAbortEvent(
       const std::string& tag,
-      const DispatchBackgroundFetchAbortEventCallback& callback) override {
+      DispatchBackgroundFetchAbortEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnBackgroundFetchAbortEventStub(tag, callback);
+    helper_->OnBackgroundFetchAbortEventStub(tag, std::move(callback));
   }
 
   void DispatchBackgroundFetchClickEvent(
       const std::string& tag,
       mojom::BackgroundFetchState state,
-      const DispatchBackgroundFetchClickEventCallback& callback) override {
+      DispatchBackgroundFetchClickEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnBackgroundFetchClickEventStub(tag, state, callback);
+    helper_->OnBackgroundFetchClickEventStub(tag, state, std::move(callback));
   }
 
   void DispatchBackgroundFetchFailEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const DispatchBackgroundFetchFailEventCallback& callback) override {
+      DispatchBackgroundFetchFailEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnBackgroundFetchFailEventStub(tag, fetches, callback);
+    helper_->OnBackgroundFetchFailEventStub(tag, fetches, std::move(callback));
   }
 
   void DispatchBackgroundFetchedEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const DispatchBackgroundFetchedEventCallback& callback) override {
+      DispatchBackgroundFetchedEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnBackgroundFetchedEventStub(tag, fetches, callback);
+    helper_->OnBackgroundFetchedEventStub(tag, fetches, std::move(callback));
   }
 
   void DispatchFetchEvent(
@@ -205,12 +204,12 @@
       const ServiceWorkerFetchRequest& request,
       mojom::FetchEventPreloadHandlePtr preload_handle,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const DispatchFetchEventCallback& callback) override {
+      DispatchFetchEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnFetchEventStub(thread_id_, fetch_event_id, request,
-                              std::move(preload_handle),
-                              std::move(response_callback), callback);
+    helper_->OnFetchEventStub(
+        thread_id_, fetch_event_id, request, std::move(preload_handle),
+        std::move(response_callback), std::move(callback));
   }
 
   void DispatchNotificationClickEvent(
@@ -218,34 +217,35 @@
       const PlatformNotificationData& notification_data,
       int action_index,
       const base::Optional<base::string16>& reply,
-      const DispatchNotificationClickEventCallback& callback) override {
+      DispatchNotificationClickEventCallback callback) override {
     if (!helper_)
       return;
     helper_->OnNotificationClickEventStub(notification_id, notification_data,
-                                          action_index, reply, callback);
+                                          action_index, reply,
+                                          std::move(callback));
   }
 
   void DispatchNotificationCloseEvent(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
-      const DispatchNotificationCloseEventCallback& callback) override {
+      DispatchNotificationCloseEventCallback callback) override {
     if (!helper_)
       return;
     helper_->OnNotificationCloseEventStub(notification_id, notification_data,
-                                          callback);
+                                          std::move(callback));
   }
 
   void DispatchPushEvent(const PushEventPayload& payload,
-                         const DispatchPushEventCallback& callback) override {
+                         DispatchPushEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnPushEventStub(payload, callback);
+    helper_->OnPushEventStub(payload, std::move(callback));
   }
 
   void DispatchSyncEvent(
       const std::string& tag,
       blink::mojom::BackgroundSyncEventLastChance last_chance,
-      const DispatchSyncEventCallback& callback) override {
+      DispatchSyncEventCallback callback) override {
     NOTIMPLEMENTED();
   }
 
@@ -253,22 +253,24 @@
       int payment_request_id,
       payments::mojom::PaymentAppRequestPtr app_request,
       payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-      const DispatchPaymentRequestEventCallback& callback) override {
+      DispatchPaymentRequestEventCallback callback) override {
     if (!helper_)
       return;
     helper_->OnPaymentRequestEventStub(std::move(app_request),
-                                       std::move(response_callback), callback);
+                                       std::move(response_callback),
+                                       std::move(callback));
   }
 
   void DispatchExtendableMessageEvent(
       mojom::ExtendableMessageEventPtr event,
-      const DispatchExtendableMessageEventCallback& callback) override {
+      DispatchExtendableMessageEventCallback callback) override {
     if (!helper_)
       return;
-    helper_->OnExtendableMessageEventStub(std::move(event), callback);
+    helper_->OnExtendableMessageEventStub(std::move(event),
+                                          std::move(callback));
   }
 
-  void Ping(const PingCallback& callback) override { callback.Run(); }
+  void Ping(PingCallback callback) override { std::move(callback).Run(); }
 
  private:
   base::WeakPtr<EmbeddedWorkerTestHelper> helper_;
@@ -429,48 +431,48 @@
 }
 
 void EmbeddedWorkerTestHelper::OnActivateEvent(
-    const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+    mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback
         callback) {
   dispatched_events()->push_back(Event::Activate);
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchAbortEvent(
     const std::string& tag,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchAbortEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchAbortEventCallback callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchClickEvent(
     const std::string& tag,
     mojom::BackgroundFetchState state,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchClickEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchClickEventCallback callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchFailEvent(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchFailEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchFailEventCallback callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchedEvent(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchedEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::DispatchBackgroundFetchedEventCallback
+        callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnExtendableMessageEvent(
     mojom::ExtendableMessageEventPtr event,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchExtendableMessageEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::DispatchExtendableMessageEventCallback
+        callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnInstallEvent(int embedded_worker_id,
@@ -489,7 +491,7 @@
     const ServiceWorkerFetchRequest& /* request */,
     mojom::FetchEventPreloadHandlePtr /* preload_handle */,
     mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-    const FetchCallback& finish_callback) {
+    FetchCallback finish_callback) {
   response_callback->OnResponse(
       ServiceWorkerResponse(
           base::MakeUnique<std::vector<GURL>>(), 200, "OK",
@@ -501,14 +503,13 @@
           base::MakeUnique<
               ServiceWorkerHeaderList>() /* cors_exposed_header_names */),
       base::Time::Now());
-  finish_callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+  std::move(finish_callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnPushEvent(
     const PushEventPayload& payload,
-    const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback&
-        callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnNotificationClickEvent(
@@ -516,27 +517,27 @@
     const PlatformNotificationData& notification_data,
     int action_index,
     const base::Optional<base::string16>& reply,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchNotificationClickEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::DispatchNotificationClickEventCallback
+        callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnNotificationCloseEvent(
     const std::string& notification_id,
     const PlatformNotificationData& notification_data,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchNotificationCloseEventCallback& callback) {
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    mojom::ServiceWorkerEventDispatcher::DispatchNotificationCloseEventCallback
+        callback) {
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::OnPaymentRequestEvent(
     payments::mojom::PaymentAppRequestPtr app_request,
     payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchPaymentRequestEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback
+        callback) {
   response_callback->OnPaymentAppResponse(
       payments::mojom::PaymentAppResponse::New(), base::Time::Now());
-  callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+  std::move(callback).Run(SERVICE_WORKER_OK, base::Time::Now());
 }
 
 void EmbeddedWorkerTestHelper::SimulateWorkerReadyForInspection(
@@ -677,62 +678,64 @@
 }
 
 void EmbeddedWorkerTestHelper::OnActivateEventStub(
-    const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+    mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback
         callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnActivateEvent,
-                            AsWeakPtr(), callback));
+                            AsWeakPtr(), base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchAbortEventStub(
     const std::string& tag,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchAbortEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchAbortEventCallback callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE,
       base::Bind(&EmbeddedWorkerTestHelper::OnBackgroundFetchAbortEvent,
-                 AsWeakPtr(), tag, callback));
+                 AsWeakPtr(), tag, base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchClickEventStub(
     const std::string& tag,
     mojom::BackgroundFetchState state,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchClickEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchClickEventCallback callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE,
       base::Bind(&EmbeddedWorkerTestHelper::OnBackgroundFetchClickEvent,
-                 AsWeakPtr(), tag, state, callback));
+                 AsWeakPtr(), tag, state, base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchFailEventStub(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchFailEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::
+        DispatchBackgroundFetchFailEventCallback callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE,
       base::Bind(&EmbeddedWorkerTestHelper::OnBackgroundFetchFailEvent,
-                 AsWeakPtr(), tag, fetches, callback));
+                 AsWeakPtr(), tag, fetches, base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnBackgroundFetchedEventStub(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchBackgroundFetchedEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchBackgroundFetchedEventCallback
+        callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnBackgroundFetchedEvent,
-                            AsWeakPtr(), tag, fetches, callback));
+      FROM_HERE,
+      base::Bind(&EmbeddedWorkerTestHelper::OnBackgroundFetchedEvent,
+                 AsWeakPtr(), tag, fetches, base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnExtendableMessageEventStub(
     mojom::ExtendableMessageEventPtr event,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchExtendableMessageEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchExtendableMessageEventCallback
+        callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnExtendableMessageEvent,
-                            AsWeakPtr(), base::Passed(&event), callback));
+      FROM_HERE,
+      base::Bind(&EmbeddedWorkerTestHelper::OnExtendableMessageEvent,
+                 AsWeakPtr(), base::Passed(&event), base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnInstallEventStub(int request_id) {
@@ -748,13 +751,14 @@
     const ServiceWorkerFetchRequest& request,
     mojom::FetchEventPreloadHandlePtr preload_handle,
     mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-    const FetchCallback& finish_callback) {
+    FetchCallback finish_callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE,
       base::Bind(&EmbeddedWorkerTestHelper::OnFetchEvent, AsWeakPtr(),
                  thread_id_embedded_worker_id_map_[thread_id], fetch_event_id,
                  request, base::Passed(&preload_handle),
-                 base::Passed(&response_callback), finish_callback));
+                 base::Passed(&response_callback),
+                 base::Passed(&finish_callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnNotificationClickEventStub(
@@ -762,44 +766,43 @@
     const PlatformNotificationData& notification_data,
     int action_index,
     const base::Optional<base::string16>& reply,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchNotificationClickEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchNotificationClickEventCallback
+        callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnNotificationClickEvent,
                             AsWeakPtr(), notification_id, notification_data,
-                            action_index, reply, callback));
+                            action_index, reply, base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnNotificationCloseEventStub(
     const std::string& notification_id,
     const PlatformNotificationData& notification_data,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchNotificationCloseEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchNotificationCloseEventCallback
+        callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE,
-      base::Bind(&EmbeddedWorkerTestHelper::OnNotificationCloseEvent,
-                 AsWeakPtr(), notification_id, notification_data, callback));
+      FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnNotificationCloseEvent,
+                            AsWeakPtr(), notification_id, notification_data,
+                            base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnPushEventStub(
     const PushEventPayload& payload,
-    const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback&
-        callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE, base::Bind(&EmbeddedWorkerTestHelper::OnPushEvent, AsWeakPtr(),
-                            payload, callback));
+                            payload, base::Passed(&callback)));
 }
 
 void EmbeddedWorkerTestHelper::OnPaymentRequestEventStub(
     payments::mojom::PaymentAppRequestPtr app_request,
     payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-    const mojom::ServiceWorkerEventDispatcher::
-        DispatchPaymentRequestEventCallback& callback) {
+    mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback
+        callback) {
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE,
       base::Bind(&EmbeddedWorkerTestHelper::OnPaymentRequestEvent, AsWeakPtr(),
-                 base::Passed(std::move(app_request)),
-                 base::Passed(std::move(response_callback)), callback));
+                 base::Passed(&app_request), base::Passed(&response_callback),
+                 base::Passed(&callback)));
 }
 
 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h
index 62c16408..041bd97 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.h
+++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -64,8 +64,8 @@
  public:
   enum class Event { Activate };
   using FetchCallback =
-      base::Callback<void(ServiceWorkerStatusCode,
-                          base::Time /* dispatch_event_time */)>;
+      base::OnceCallback<void(ServiceWorkerStatusCode,
+                              base::Time /* dispatch_event_time */)>;
 
   class MockEmbeddedWorkerInstanceClient
       : public mojom::EmbeddedWorkerInstanceClient {
@@ -187,31 +187,31 @@
   // worker. By default they just return success via
   // SimulateSendReplyToBrowser.
   virtual void OnActivateEvent(
-      const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+      mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback
           callback);
   virtual void OnBackgroundFetchAbortEvent(
       const std::string& tag,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchAbortEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchAbortEventCallback callback);
   virtual void OnBackgroundFetchClickEvent(
       const std::string& tag,
       mojom::BackgroundFetchState state,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchClickEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchClickEventCallback callback);
   virtual void OnBackgroundFetchFailEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchFailEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchFailEventCallback callback);
   virtual void OnBackgroundFetchedEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchedEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchedEventCallback callback);
   virtual void OnExtendableMessageEvent(
       mojom::ExtendableMessageEventPtr event,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchExtendableMessageEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchExtendableMessageEventCallback callback);
   virtual void OnInstallEvent(int embedded_worker_id, int request_id);
   virtual void OnFetchEvent(
       int embedded_worker_id,
@@ -219,28 +219,27 @@
       const ServiceWorkerFetchRequest& request,
       mojom::FetchEventPreloadHandlePtr preload_handle,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback);
+      FetchCallback finish_callback);
   virtual void OnNotificationClickEvent(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
       int action_index,
       const base::Optional<base::string16>& reply,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchNotificationClickEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchNotificationClickEventCallback callback);
   virtual void OnNotificationCloseEvent(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchNotificationCloseEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchNotificationCloseEventCallback callback);
   virtual void OnPushEvent(
       const PushEventPayload& payload,
-      const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback&
-          callback);
+      mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback callback);
   virtual void OnPaymentRequestEvent(
       payments::mojom::PaymentAppRequestPtr data,
       payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchPaymentRequestEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback
+          callback);
 
   // These functions simulate sending an EmbeddedHostMsg message through the
   // legacy IPC system to the browser.
@@ -270,31 +269,31 @@
                              int embedded_worker_id,
                              const IPC::Message& message);
   void OnActivateEventStub(
-      const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+      mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback
           callback);
   void OnBackgroundFetchAbortEventStub(
       const std::string& tag,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchAbortEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchAbortEventCallback callback);
   void OnBackgroundFetchClickEventStub(
       const std::string& tag,
       mojom::BackgroundFetchState state,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchClickEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchClickEventCallback callback);
   void OnBackgroundFetchFailEventStub(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchFailEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchFailEventCallback callback);
   void OnBackgroundFetchedEventStub(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchBackgroundFetchedEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchBackgroundFetchedEventCallback callback);
   void OnExtendableMessageEventStub(
       mojom::ExtendableMessageEventPtr event,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchExtendableMessageEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchExtendableMessageEventCallback callback);
   void OnInstallEventStub(int request_id);
   void OnFetchEventStub(
       int thread_id,
@@ -302,28 +301,27 @@
       const ServiceWorkerFetchRequest& request,
       mojom::FetchEventPreloadHandlePtr preload_handle,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback);
+      FetchCallback finish_callback);
   void OnNotificationClickEventStub(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
       int action_index,
       const base::Optional<base::string16>& reply,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchNotificationClickEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchNotificationClickEventCallback callback);
   void OnNotificationCloseEventStub(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchNotificationCloseEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchNotificationCloseEventCallback callback);
   void OnPushEventStub(
       const PushEventPayload& payload,
-      const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback&
-          callback);
+      mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback callback);
   void OnPaymentRequestEventStub(
       payments::mojom::PaymentAppRequestPtr data,
       payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchPaymentRequestEventCallback& callback);
+      mojom::ServiceWorkerEventDispatcher::DispatchPaymentRequestEventCallback
+          callback);
 
   std::unique_ptr<TestBrowserContext> browser_context_;
   std::unique_ptr<MockRenderProcessHost> render_process_host_;
diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc
index 0dbdf1c..03265cd9 100644
--- a/content/browser/service_worker/service_worker_context_unittest.cc
+++ b/content/browser/service_worker/service_worker_context_unittest.cc
@@ -98,11 +98,11 @@
   RejectActivateTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {}
 
   void OnActivateEvent(
-      const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+      mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback
           callback) override {
     dispatched_events()->push_back(Event::Activate);
-    callback.Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
-                 base::Time::Now());
+    std::move(callback).Run(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED,
+                            base::Time::Now());
   }
 };
 
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
index e004748..e4deaa6 100644
--- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc
+++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -150,8 +150,9 @@
   }
   void OnUploadProgress(int64_t current_position,
                         int64_t total_size,
-                        const base::Closure& ack_callback) override {
-    client_->OnUploadProgress(current_position, total_size, ack_callback);
+                        OnUploadProgressCallback ack_callback) override {
+    client_->OnUploadProgress(current_position, total_size,
+                              std::move(ack_callback));
   }
   void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override {
     client_->OnReceiveCachedMetadata(data);
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc
index 5c0d7ea..78e8928 100644
--- a/content/browser/service_worker/service_worker_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -1481,10 +1481,10 @@
   }
 
   void OnActivateEvent(
-      const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback&
+      mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback
           callback) override {
-    callback.Run(EventResultToStatus(activate_event_result_),
-                 base::Time::Now());
+    std::move(callback).Run(EventResultToStatus(activate_event_result_),
+                            base::Time::Now());
   }
 
   void set_install_callback(const base::Closure& callback) {
diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
index e8df538..a93b314 100644
--- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
@@ -406,7 +406,7 @@
       const ServiceWorkerFetchRequest& /* request */,
       mojom::FetchEventPreloadHandlePtr /* preload_handle */,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback) override {
+      FetchCallback finish_callback) override {
     context()->RemoveProviderHost(mock_render_process_id(), kProviderID);
     response_callback->OnResponse(
         ServiceWorkerResponse(
@@ -419,7 +419,7 @@
             base::MakeUnique<
                 ServiceWorkerHeaderList>() /* cors_exposed_header_names */),
         base::Time::Now());
-    finish_callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(finish_callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
  private:
@@ -492,7 +492,7 @@
       const ServiceWorkerFetchRequest& /* request */,
       mojom::FetchEventPreloadHandlePtr /* preload_handle */,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback) override {
+      FetchCallback finish_callback) override {
     response_callback->OnResponse(
         ServiceWorkerResponse(
             base::MakeUnique<std::vector<GURL>>(), 200, "OK",
@@ -504,7 +504,7 @@
             base::MakeUnique<
                 ServiceWorkerHeaderList>() /* cors_exposed_header_names */),
         base::Time::Now());
-    finish_callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(finish_callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
   std::string blob_uuid_;
@@ -585,7 +585,7 @@
       const ServiceWorkerFetchRequest& /* request */,
       mojom::FetchEventPreloadHandlePtr /* preload_handle */,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback) override {
+      FetchCallback finish_callback) override {
     ASSERT_FALSE(stream_handle_.is_null());
     response_callback->OnResponseStream(
         ServiceWorkerResponse(
@@ -597,7 +597,7 @@
             base::MakeUnique<
                 ServiceWorkerHeaderList>() /* cors_exposed_header_names */),
         std::move(stream_handle_), base::Time::Now());
-    finish_callback.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(finish_callback).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
   blink::mojom::ServiceWorkerStreamHandlePtr stream_handle_;
@@ -977,9 +977,10 @@
       const ServiceWorkerFetchRequest& /* request */,
       mojom::FetchEventPreloadHandlePtr /* preload_handle */,
       mojom::ServiceWorkerFetchResponseCallbackPtr /* response_callback */,
-      const FetchCallback& finish_callback) override {
+      FetchCallback finish_callback) override {
     SimulateWorkerStopped(embedded_worker_id);
-    finish_callback.Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
+    std::move(finish_callback)
+        .Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
   }
 
  private:
@@ -1054,7 +1055,7 @@
   ~EarlyResponseHelper() override {}
 
   void FinishWaitUntil() {
-    finish_callback_.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(finish_callback_).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
  protected:
@@ -1064,8 +1065,8 @@
       const ServiceWorkerFetchRequest& /* request */,
       mojom::FetchEventPreloadHandlePtr /* preload_handle */,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback) override {
-    finish_callback_ = finish_callback;
+      FetchCallback finish_callback) override {
+    finish_callback_ = std::move(finish_callback);
     response_callback->OnResponse(
         ServiceWorkerResponse(
             base::MakeUnique<std::vector<GURL>>(), 200, "OK",
@@ -1131,7 +1132,7 @@
             base::MakeUnique<
                 ServiceWorkerHeaderList>() /* cors_exposed_header_names */),
         base::Time::Now());
-    finish_callback_.Run(SERVICE_WORKER_OK, base::Time::Now());
+    std::move(finish_callback_).Run(SERVICE_WORKER_OK, base::Time::Now());
   }
 
  protected:
@@ -1141,11 +1142,11 @@
       const ServiceWorkerFetchRequest& /* request */,
       mojom::FetchEventPreloadHandlePtr /* preload_handle */,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const FetchCallback& finish_callback) override {
+      FetchCallback finish_callback) override {
     embedded_worker_id_ = embedded_worker_id;
     fetch_event_id_ = fetch_event_id;
     response_callback_ = std::move(response_callback);
-    finish_callback_ = finish_callback;
+    finish_callback_ = std::move(finish_callback);
   }
 
  private:
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc
index 08aa0d18..53a36271 100644
--- a/content/browser/service_worker/service_worker_version_unittest.cc
+++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -834,10 +834,10 @@
 
   void OnExtendableMessageEvent(
       mojom::ExtendableMessageEventPtr event,
-      const mojom::ServiceWorkerEventDispatcher::
-          DispatchExtendableMessageEventCallback& callback) override {
+      mojom::ServiceWorkerEventDispatcher::
+          DispatchExtendableMessageEventCallback callback) override {
     EXPECT_FALSE(extendable_message_event_callback_);
-    extendable_message_event_callback_ = callback;
+    extendable_message_event_callback_ = std::move(callback);
   }
 
   void OnStopWorker(int embedded_worker_id) override {
@@ -847,10 +847,13 @@
                    base::Unretained(this), embedded_worker_id);
   }
 
-  const mojom::ServiceWorkerEventDispatcher::
-      DispatchExtendableMessageEventCallback&
-      extendable_message_event_callback() {
-    return extendable_message_event_callback_;
+  bool has_extendable_message_event_callback() {
+    return !extendable_message_event_callback_.is_null();
+  }
+
+  mojom::ServiceWorkerEventDispatcher::DispatchExtendableMessageEventCallback
+  TakeExtendableMessageEventCallback() {
+    return std::move(extendable_message_event_callback_);
   }
 
   const base::Closure& stop_worker_callback() { return stop_worker_callback_; }
@@ -869,11 +872,15 @@
     return base::MakeUnique<MessageReceiverControlEvents>();
   }
 
-  const mojom::ServiceWorkerEventDispatcher::
-      DispatchExtendableMessageEventCallback&
-      extendable_message_event_callback() {
+  bool has_extendable_message_event_callback() {
     return static_cast<MessageReceiverControlEvents*>(helper_.get())
-        ->extendable_message_event_callback();
+        ->has_extendable_message_event_callback();
+  }
+
+  mojom::ServiceWorkerEventDispatcher::DispatchExtendableMessageEventCallback
+  TakeExtendableMessageEventCallback() {
+    return static_cast<MessageReceiverControlEvents*>(helper_.get())
+        ->TakeExtendableMessageEventCallback();
   }
 
   const base::Closure& stop_worker_callback() {
@@ -900,14 +907,14 @@
                              CreateReceiverOnCurrentThread(&error_status));
 
   // Dispatch a dummy event whose response will be received by SWVersion.
-  EXPECT_FALSE(extendable_message_event_callback());
+  EXPECT_FALSE(has_extendable_message_event_callback());
   version_->event_dispatcher()->DispatchExtendableMessageEvent(
       mojom::ExtendableMessageEvent::New(),
       version_->CreateSimpleEventCallback(request_id));
 
   base::RunLoop().RunUntilIdle();
   // The renderer should have received an ExtendableMessageEvent request.
-  EXPECT_TRUE(extendable_message_event_callback());
+  EXPECT_TRUE(has_extendable_message_event_callback());
 
   // Callback has not completed yet.
   EXPECT_EQ(SERVICE_WORKER_ERROR_NETWORK, error_status);
@@ -930,8 +937,8 @@
 
   // Simulate the renderer aborting the pending event.
   // This should not crash: https://crbug.com/676984.
-  extendable_message_event_callback().Run(SERVICE_WORKER_ERROR_ABORT,
-                                          base::Time::Now());
+  TakeExtendableMessageEventCallback().Run(SERVICE_WORKER_ERROR_ABORT,
+                                           base::Time::Now());
   base::RunLoop().RunUntilIdle();
 
   // Simulate the renderer stopping the worker.
diff --git a/content/child/url_loader_client_impl.cc b/content/child/url_loader_client_impl.cc
index 3d1ecb1a..dd7e1b5 100644
--- a/content/child/url_loader_client_impl.cc
+++ b/content/child/url_loader_client_impl.cc
@@ -202,9 +202,10 @@
   }
 }
 
-void URLLoaderClientImpl::OnUploadProgress(int64_t current_position,
-                                           int64_t total_size,
-                                           const base::Closure& ack_callback) {
+void URLLoaderClientImpl::OnUploadProgress(
+    int64_t current_position,
+    int64_t total_size,
+    OnUploadProgressCallback ack_callback) {
   if (NeedsStoringMessage()) {
     StoreAndDispatch(
         ResourceMsg_UploadProgress(request_id_, current_position, total_size));
@@ -212,7 +213,7 @@
     resource_dispatcher_->OnUploadProgress(request_id_, current_position,
                                            total_size);
   }
-  ack_callback.Run();
+  std::move(ack_callback).Run();
 }
 
 }  // namespace content
diff --git a/content/child/url_loader_client_impl.h b/content/child/url_loader_client_impl.h
index 0c5678d0..39fb7db 100644
--- a/content/child/url_loader_client_impl.h
+++ b/content/child/url_loader_client_impl.h
@@ -58,7 +58,7 @@
   void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override;
   void OnUploadProgress(int64_t current_position,
                         int64_t total_size,
-                        const base::Closure& ack_callback) override;
+                        OnUploadProgressCallback ack_callback) override;
   void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override;
   void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
   void OnStartLoadingResponseBody(
diff --git a/content/child/url_loader_client_impl_unittest.cc b/content/child/url_loader_client_impl_unittest.cc
index 5db264a..c65186c 100644
--- a/content/child/url_loader_client_impl_unittest.cc
+++ b/content/child/url_loader_client_impl_unittest.cc
@@ -62,7 +62,7 @@
   void SyncLoad(int32_t routing_id,
                 int32_t request_id,
                 const ResourceRequest& request,
-                const SyncLoadCallback& callback) override {
+                SyncLoadCallback callback) override {
     NOTREACHED();
   }
 
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index f56c199..10424ed 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -642,4 +642,5 @@
   export_class_attribute = "CONTENT_EXPORT"
   export_define = "CONTENT_IMPLEMENTATION=1"
   export_header = "content/common/content_export.h"
+  use_once_callback = true
 }
diff --git a/content/network/network_service_url_loader_factory_impl.cc b/content/network/network_service_url_loader_factory_impl.cc
index 18670d0..3566c33c 100644
--- a/content/network/network_service_url_loader_factory_impl.cc
+++ b/content/network/network_service_url_loader_factory_impl.cc
@@ -32,12 +32,12 @@
     int32_t routing_id,
     int32_t request_id,
     const ResourceRequest& url_request,
-    const SyncLoadCallback& callback) {
+    SyncLoadCallback callback) {
   NOTIMPLEMENTED();
 
   SyncLoadResult result;
   result.error_code = net::ERR_NOT_IMPLEMENTED;
-  callback.Run(result);
+  std::move(callback).Run(result);
 }
 
 }  // namespace content
diff --git a/content/network/network_service_url_loader_factory_impl.h b/content/network/network_service_url_loader_factory_impl.h
index be7e866..4891b16 100644
--- a/content/network/network_service_url_loader_factory_impl.h
+++ b/content/network/network_service_url_loader_factory_impl.h
@@ -31,7 +31,7 @@
   void SyncLoad(int32_t routing_id,
                 int32_t request_id,
                 const ResourceRequest& request,
-                const SyncLoadCallback& callback) override;
+                SyncLoadCallback callback) override;
 
  private:
   // Not owned.
diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc
index aeb37bb6..99ff137b 100644
--- a/content/public/test/mock_render_thread.cc
+++ b/content/public/test/mock_render_thread.cc
@@ -33,14 +33,14 @@
   ~MockRenderMessageFilterImpl() override {}
 
   // mojom::RenderMessageFilter:
-  void GenerateRoutingID(const GenerateRoutingIDCallback& callback) override {
+  void GenerateRoutingID(GenerateRoutingIDCallback callback) override {
     NOTREACHED();
-    callback.Run(MSG_ROUTING_NONE);
+    std::move(callback).Run(MSG_ROUTING_NONE);
   }
 
   void CreateNewWidget(int32_t opener_id,
-                      blink::WebPopupType popup_type,
-                      const CreateNewWidgetCallback& callback) override {
+                       blink::WebPopupType popup_type,
+                       CreateNewWidgetCallback callback) override {
     // See comment in CreateNewWindow().
     NOTREACHED();
   }
@@ -54,7 +54,7 @@
 
   void CreateFullscreenWidget(
       int opener_id,
-      const CreateFullscreenWidgetCallback& callback) override {
+      CreateFullscreenWidgetCallback callback) override {
     NOTREACHED();
   }
 
diff --git a/content/renderer/image_downloader/image_downloader_impl.cc b/content/renderer/image_downloader/image_downloader_impl.cc
index 8d1eff8f..0cb07d3 100644
--- a/content/renderer/image_downloader/image_downloader_impl.cc
+++ b/content/renderer/image_downloader/image_downloader_impl.cc
@@ -113,19 +113,19 @@
                                         bool is_favicon,
                                         uint32_t max_bitmap_size,
                                         bool bypass_cache,
-                                        const DownloadImageCallback& callback) {
+                                        DownloadImageCallback callback) {
   std::vector<SkBitmap> result_images;
   std::vector<gfx::Size> result_original_image_sizes;
 
   ImageDownloaderBase::DownloadImage(
       image_url, is_favicon, bypass_cache,
       base::Bind(&ImageDownloaderImpl::DidDownloadImage, base::Unretained(this),
-                 max_bitmap_size, callback));
+                 max_bitmap_size, base::Passed(&callback)));
 }
 
 void ImageDownloaderImpl::DidDownloadImage(
     uint32_t max_image_size,
-    const DownloadImageCallback& callback,
+    DownloadImageCallback callback,
     int32_t http_status_code,
     const std::vector<SkBitmap>& images) {
   std::vector<SkBitmap> result_images;
@@ -133,7 +133,8 @@
   FilterAndResizeImagesForMaximalSize(images, max_image_size, &result_images,
                                       &result_original_image_sizes);
 
-  callback.Run(http_status_code, result_images, result_original_image_sizes);
+  std::move(callback).Run(http_status_code, result_images,
+                          result_original_image_sizes);
 }
 
 void ImageDownloaderImpl::OnDestruct() {
diff --git a/content/renderer/image_downloader/image_downloader_impl.h b/content/renderer/image_downloader/image_downloader_impl.h
index f9cfb638..e244dc4 100644
--- a/content/renderer/image_downloader/image_downloader_impl.h
+++ b/content/renderer/image_downloader/image_downloader_impl.h
@@ -31,7 +31,7 @@
                      bool is_favicon,
                      uint32_t max_bitmap_size,
                      bool bypass_cache,
-                     const DownloadImageCallback& callback) override;
+                     DownloadImageCallback callback) override;
 
   // Called when downloading finishes. All frames in |images| whose size <=
   // |max_image_size| will be returned through |callback|. If all of the frames
@@ -39,7 +39,7 @@
   // |max_image_size| and is the only result. |max_image_size| == 0 is
   // interpreted as no max image size.
   void DidDownloadImage(uint32_t max_bitmap_size,
-                        const DownloadImageCallback& callback,
+                        DownloadImageCallback callback,
                         int32_t http_status_code,
                         const std::vector<SkBitmap>& images);
 
diff --git a/content/renderer/media/media_devices_event_dispatcher_unittest.cc b/content/renderer/media/media_devices_event_dispatcher_unittest.cc
index 8d2d975..b1ee1c332 100644
--- a/content/renderer/media/media_devices_event_dispatcher_unittest.cc
+++ b/content/renderer/media/media_devices_event_dispatcher_unittest.cc
@@ -35,21 +35,26 @@
  public:
   MockMediaDevicesDispatcherHost() : binding_(this) {}
 
-  MOCK_METHOD5(EnumerateDevices,
-               void(bool request_audio_input,
-                    bool request_video_input,
-                    bool request_audio_output,
-                    const url::Origin& security_origin,
-                    const EnumerateDevicesCallback& callback));
   MOCK_METHOD3(SubscribeDeviceChangeNotifications,
                void(MediaDeviceType type,
                     uint32_t subscription_id,
                     const url::Origin& security_origin));
   MOCK_METHOD2(UnsubscribeDeviceChangeNotifications,
                void(MediaDeviceType type, uint32_t subscription_id));
-  MOCK_METHOD2(GetVideoInputCapabilities,
-               void(const url::Origin& security_origin,
-                    const GetVideoInputCapabilitiesCallback& client_callback));
+
+  void EnumerateDevices(bool request_audio_input,
+                        bool request_video_input,
+                        bool request_audio_output,
+                        const url::Origin& security_origin,
+                        EnumerateDevicesCallback) override {
+    NOTREACHED();
+  }
+
+  void GetVideoInputCapabilities(
+      const url::Origin& security_origin,
+      GetVideoInputCapabilitiesCallback client_callback) override {
+    NOTREACHED();
+  }
 
   ::mojom::MediaDevicesDispatcherHostPtr CreateInterfacePtrAndBind() {
     return binding_.CreateInterfacePtrAndBind();
diff --git a/content/renderer/media/user_media_client_impl_unittest.cc b/content/renderer/media/user_media_client_impl_unittest.cc
index 9735d97..e3e803f 100644
--- a/content/renderer/media/user_media_client_impl_unittest.cc
+++ b/content/renderer/media/user_media_client_impl_unittest.cc
@@ -118,7 +118,7 @@
                         bool request_video_input,
                         bool request_audio_output,
                         const url::Origin& security_origin,
-                        const EnumerateDevicesCallback& callback) override {
+                        EnumerateDevicesCallback callback) override {
     std::vector<std::vector<MediaDeviceInfo>> result(NUM_MEDIA_DEVICE_TYPES);
     if (request_audio_input) {
       result[MEDIA_DEVICE_TYPE_AUDIO_INPUT].push_back(MediaDeviceInfo(
@@ -136,12 +136,12 @@
       result[MEDIA_DEVICE_TYPE_AUDIO_OUTPUT].push_back(MediaDeviceInfo(
           kFakeAudioOutputDeviceId1, "Fake Audio Input 1", "fake_group 1"));
     }
-    callback.Run(result);
+    std::move(callback).Run(result);
   }
 
   void GetVideoInputCapabilities(
       const url::Origin& security_origin,
-      const GetVideoInputCapabilitiesCallback& client_callback) override {
+      GetVideoInputCapabilitiesCallback client_callback) override {
     ::mojom::VideoInputDeviceCapabilitiesPtr device =
         ::mojom::VideoInputDeviceCapabilities::New();
     device->device_id = kFakeVideoInputDeviceId1;
@@ -158,7 +158,7 @@
         gfx::Size(640, 480), 30.0f, media::PIXEL_FORMAT_I420));
     result.push_back(std::move(device));
 
-    client_callback.Run(std::move(result));
+    std::move(client_callback).Run(std::move(result));
   }
 
   MOCK_METHOD3(SubscribeDeviceChangeNotifications,
diff --git a/content/renderer/media/video_capture_impl_manager_unittest.cc b/content/renderer/media/video_capture_impl_manager_unittest.cc
index 1f33992..5189c7f 100644
--- a/content/renderer/media/video_capture_impl_manager_unittest.cc
+++ b/content/renderer/media/video_capture_impl_manager_unittest.cc
@@ -82,12 +82,18 @@
   MOCK_METHOD1(RequestRefreshFrame, void(int32_t));
   MOCK_METHOD3(ReleaseBuffer,
                void(int32_t, int32_t, double));
-  MOCK_METHOD3(GetDeviceSupportedFormats,
-               void(int32_t,
-                    int32_t,
-                    const GetDeviceSupportedFormatsCallback&));
-  MOCK_METHOD3(GetDeviceFormatsInUse,
-               void(int32_t, int32_t, const GetDeviceFormatsInUseCallback&));
+
+  void GetDeviceSupportedFormats(int32_t,
+                                 int32_t,
+                                 GetDeviceSupportedFormatsCallback) override {
+    NOTREACHED();
+  }
+
+  void GetDeviceFormatsInUse(int32_t,
+                             int32_t,
+                             GetDeviceFormatsInUseCallback) override {
+    NOTREACHED();
+  }
 
   PauseResumeCallback* const pause_callback_;
   const base::Closure destruct_callback_;
diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc
index 562492b..58b630a1 100644
--- a/content/renderer/media/video_capture_impl_unittest.cc
+++ b/content/renderer/media/video_capture_impl_unittest.cc
@@ -25,9 +25,10 @@
 
 const int kSessionId = 11;
 
-void RunEmptyFormatsCallback(const VideoCaptureDeviceFormatsCB& callback) {
+void RunEmptyFormatsCallback(
+    mojom::VideoCaptureHost::GetDeviceSupportedFormatsCallback& callback) {
   media::VideoCaptureFormats formats;
-  callback.Run(formats);
+  std::move(callback).Run(formats);
 }
 
 ACTION(DoNothing) {}
@@ -36,9 +37,9 @@
 class MockMojoVideoCaptureHost : public mojom::VideoCaptureHost {
  public:
   MockMojoVideoCaptureHost() : released_buffer_count_(0) {
-    ON_CALL(*this, GetDeviceSupportedFormats(_, _, _))
+    ON_CALL(*this, GetDeviceSupportedFormatsMock(_, _, _))
         .WillByDefault(WithArgs<2>(Invoke(RunEmptyFormatsCallback)));
-    ON_CALL(*this, GetDeviceFormatsInUse(_, _, _))
+    ON_CALL(*this, GetDeviceFormatsInUseMock(_, _, _))
         .WillByDefault(WithArgs<2>(Invoke(RunEmptyFormatsCallback)));
     ON_CALL(*this, ReleaseBuffer(_, _, _))
         .WillByDefault(InvokeWithoutArgs(
@@ -60,12 +61,23 @@
                void(int32_t, int32_t, const media::VideoCaptureParams&));
   MOCK_METHOD1(RequestRefreshFrame, void(int32_t));
   MOCK_METHOD3(ReleaseBuffer, void(int32_t, int32_t, double));
-  MOCK_METHOD3(GetDeviceSupportedFormats,
-               void(int32_t,
-                    int32_t,
-                    const GetDeviceSupportedFormatsCallback&));
-  MOCK_METHOD3(GetDeviceFormatsInUse,
-               void(int32_t, int32_t, const GetDeviceFormatsInUseCallback&));
+  MOCK_METHOD3(GetDeviceSupportedFormatsMock,
+               void(int32_t, int32_t, GetDeviceSupportedFormatsCallback&));
+  MOCK_METHOD3(GetDeviceFormatsInUseMock,
+               void(int32_t, int32_t, GetDeviceFormatsInUseCallback&));
+
+  void GetDeviceSupportedFormats(
+      int32_t arg1,
+      int32_t arg2,
+      GetDeviceSupportedFormatsCallback arg3) override {
+    GetDeviceSupportedFormatsMock(arg1, arg2, arg3);
+  }
+
+  void GetDeviceFormatsInUse(int32_t arg1,
+                             int32_t arg2,
+                             GetDeviceFormatsInUseCallback arg3) override {
+    GetDeviceFormatsInUseMock(arg1, arg2, arg3);
+  }
 
   int released_buffer_count() const { return released_buffer_count_; }
   void increase_released_buffer_count() { released_buffer_count_++; }
@@ -233,7 +245,7 @@
 TEST_F(VideoCaptureImplTest, GetDeviceFormats) {
   EXPECT_CALL(*this, OnDeviceSupportedFormats(_));
   EXPECT_CALL(mock_video_capture_host_,
-              GetDeviceSupportedFormats(_, kSessionId, _));
+              GetDeviceSupportedFormatsMock(_, kSessionId, _));
 
   GetDeviceSupportedFormats();
 }
@@ -243,7 +255,7 @@
 TEST_F(VideoCaptureImplTest, TwoClientsGetDeviceFormats) {
   EXPECT_CALL(*this, OnDeviceSupportedFormats(_)).Times(2);
   EXPECT_CALL(mock_video_capture_host_,
-              GetDeviceSupportedFormats(_, kSessionId, _))
+              GetDeviceSupportedFormatsMock(_, kSessionId, _))
       .Times(2);
 
   GetDeviceSupportedFormats();
@@ -255,7 +267,7 @@
 TEST_F(VideoCaptureImplTest, GetDeviceFormatsInUse) {
   EXPECT_CALL(*this, OnDeviceFormatsInUse(_));
   EXPECT_CALL(mock_video_capture_host_,
-              GetDeviceFormatsInUse(_, kSessionId, _));
+              GetDeviceFormatsInUseMock(_, kSessionId, _));
 
   GetDeviceFormatsInUse();
 }
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
index c621eda..096ad12 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -247,14 +247,15 @@
 template <typename T>
 void AbortPendingEventCallbacks(T& callbacks) {
   for (typename T::iterator it(&callbacks); !it.IsAtEnd(); it.Advance()) {
-    it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
+    std::move(*it.GetCurrentValue())
+        .Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
   }
 }
 
 template <typename Key, typename Callback>
 void AbortPendingEventCallbacks(std::map<Key, Callback>& callbacks) {
-  for (const auto& it : callbacks)
-    it.second.Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
+  for (auto& item : callbacks)
+    std::move(item.second).Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
 }
 
 }  // namespace
@@ -263,7 +264,7 @@
 // worker thread.
 struct ServiceWorkerContextClient::WorkerContextData {
   using SimpleEventCallback =
-      base::Callback<void(ServiceWorkerStatusCode, base::Time)>;
+      base::OnceCallback<void(ServiceWorkerStatusCode, base::Time)>;
   using ClientsCallbacksMap =
       IDMap<std::unique_ptr<blink::WebServiceWorkerClientsCallbacks>>;
   using ClaimClientsCallbacksMap =
@@ -273,24 +274,24 @@
   using SkipWaitingCallbacksMap =
       IDMap<std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks>>;
   using ActivateEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchActivateEventCallback>>;
+      IDMap<std::unique_ptr<DispatchActivateEventCallback>>;
   using BackgroundFetchAbortEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchBackgroundFetchAbortEventCallback>>;
+      IDMap<std::unique_ptr<DispatchBackgroundFetchAbortEventCallback>>;
   using BackgroundFetchClickEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchBackgroundFetchClickEventCallback>>;
+      IDMap<std::unique_ptr<DispatchBackgroundFetchClickEventCallback>>;
   using BackgroundFetchFailEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchBackgroundFetchFailEventCallback>>;
+      IDMap<std::unique_ptr<DispatchBackgroundFetchFailEventCallback>>;
   using BackgroundFetchedEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchBackgroundFetchedEventCallback>>;
-  using SyncEventCallbacksMap = IDMap<std::unique_ptr<const SyncCallback>>;
+      IDMap<std::unique_ptr<DispatchBackgroundFetchedEventCallback>>;
+  using SyncEventCallbacksMap = IDMap<std::unique_ptr<SyncCallback>>;
   using NotificationClickEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchNotificationClickEventCallback>>;
+      IDMap<std::unique_ptr<DispatchNotificationClickEventCallback>>;
   using NotificationCloseEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchNotificationCloseEventCallback>>;
+      IDMap<std::unique_ptr<DispatchNotificationCloseEventCallback>>;
   using PushEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchPushEventCallback>>;
+      IDMap<std::unique_ptr<DispatchPushEventCallback>>;
   using ExtendableMessageEventCallbacksMap =
-      IDMap<std::unique_ptr<const DispatchExtendableMessageEventCallback>>;
+      IDMap<std::unique_ptr<DispatchExtendableMessageEventCallback>>;
   using NavigationPreloadRequestsMap = IDMap<
       std::unique_ptr<ServiceWorkerContextClient::NavigationPreloadRequest>>;
 
@@ -341,8 +342,7 @@
       payment_response_callbacks;
 
   // Pending callbacks for Payment Request Events.
-  std::map<int /* payment_request_id */,
-           const DispatchPaymentRequestEventCallback>
+  std::map<int /* payment_request_id */, DispatchPaymentRequestEventCallback>
       payment_request_event_callbacks;
 
   // Pending callbacks for Notification Click Events.
@@ -426,7 +426,7 @@
 
   void OnUploadProgress(int64_t current_position,
                         int64_t total_size,
-                        const base::Closure& ack_callback) override {
+                        OnUploadProgressCallback ack_callback) override {
     NOTREACHED();
   }
 
@@ -823,11 +823,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchActivateEventCallback* callback =
+  DispatchActivateEventCallback* callback =
       context_->activate_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->activate_event_callbacks.Remove(request_id);
 }
 
@@ -835,11 +836,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchBackgroundFetchAbortEventCallback* callback =
+  DispatchBackgroundFetchAbortEventCallback* callback =
       context_->background_fetch_abort_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->background_fetch_abort_event_callbacks.Remove(request_id);
 }
 
@@ -847,11 +849,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchBackgroundFetchClickEventCallback* callback =
+  DispatchBackgroundFetchClickEventCallback* callback =
       context_->background_fetch_click_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->background_fetch_click_event_callbacks.Remove(request_id);
 }
 
@@ -859,11 +862,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchBackgroundFetchFailEventCallback* callback =
+  DispatchBackgroundFetchFailEventCallback* callback =
       context_->background_fetch_fail_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->background_fetch_fail_event_callbacks.Remove(request_id);
 }
 
@@ -871,11 +875,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchBackgroundFetchedEventCallback* callback =
+  DispatchBackgroundFetchedEventCallback* callback =
       context_->background_fetched_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->background_fetched_event_callbacks.Remove(request_id);
 }
 
@@ -883,11 +888,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchExtendableMessageEventCallback* callback =
+  DispatchExtendableMessageEventCallback* callback =
       context_->message_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->message_event_callbacks.Remove(request_id);
 }
 
@@ -961,11 +967,11 @@
     int fetch_event_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const WorkerContextData::SimpleEventCallback& callback =
-      context_->fetch_event_callbacks[fetch_event_id];
+  WorkerContextData::SimpleEventCallback callback =
+      std::move(context_->fetch_event_callbacks[fetch_event_id]);
   DCHECK(callback);
-  callback.Run(EventResultToStatus(result),
-               base::Time::FromDoubleT(event_dispatch_time));
+  std::move(callback).Run(EventResultToStatus(result),
+                          base::Time::FromDoubleT(event_dispatch_time));
   context_->fetch_event_callbacks.erase(fetch_event_id);
 }
 
@@ -973,12 +979,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchNotificationClickEventCallback* callback =
+  DispatchNotificationClickEventCallback* callback =
       context_->notification_click_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
 
   context_->notification_click_event_callbacks.Remove(request_id);
 }
@@ -987,12 +993,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchNotificationCloseEventCallback* callback =
+  DispatchNotificationCloseEventCallback* callback =
       context_->notification_close_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
 
   context_->notification_close_event_callbacks.Remove(request_id);
 }
@@ -1001,11 +1007,12 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchPushEventCallback* callback =
+  DispatchPushEventCallback* callback =
       context_->push_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->push_event_callbacks.Remove(request_id);
 }
 
@@ -1013,11 +1020,11 @@
     int request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const SyncCallback* callback =
-      context_->sync_event_callbacks.Lookup(request_id);
+  SyncCallback* callback = context_->sync_event_callbacks.Lookup(request_id);
   DCHECK(callback);
-  callback->Run(EventResultToStatus(result),
-                base::Time::FromDoubleT(event_dispatch_time));
+  DCHECK(*callback);
+  std::move(*callback).Run(EventResultToStatus(result),
+                           base::Time::FromDoubleT(event_dispatch_time));
   context_->sync_event_callbacks.Remove(request_id);
 }
 
@@ -1039,10 +1046,10 @@
     int payment_request_id,
     blink::WebServiceWorkerEventResult result,
     double event_dispatch_time) {
-  const DispatchPaymentRequestEventCallback& callback =
-      context_->payment_request_event_callbacks[payment_request_id];
-  callback.Run(EventResultToStatus(result),
-               base::Time::FromDoubleT(event_dispatch_time));
+  DispatchPaymentRequestEventCallback callback =
+      std::move(context_->payment_request_event_callbacks[payment_request_id]);
+  std::move(callback).Run(EventResultToStatus(result),
+                          base::Time::FromDoubleT(event_dispatch_time));
   context_->payment_request_event_callbacks.erase(payment_request_id);
 }
 
@@ -1129,11 +1136,11 @@
 void ServiceWorkerContextClient::DispatchSyncEvent(
     const std::string& tag,
     blink::mojom::BackgroundSyncEventLastChance last_chance,
-    const DispatchSyncEventCallback& callback) {
+    DispatchSyncEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchSyncEvent");
   int request_id = context_->sync_event_callbacks.Add(
-      base::MakeUnique<SyncCallback>(callback));
+      base::MakeUnique<SyncCallback>(std::move(callback)));
 
   // TODO(shimazu): Use typemap when this is moved to blink-side.
   blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance =
@@ -1150,13 +1157,13 @@
     int payment_request_id,
     payments::mojom::PaymentAppRequestPtr app_request,
     payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-    const DispatchPaymentRequestEventCallback& callback) {
+    DispatchPaymentRequestEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchPaymentRequestEvent");
   context_->payment_response_callbacks.insert(
       std::make_pair(payment_request_id, std::move(response_callback)));
   context_->payment_request_event_callbacks.insert(
-      std::make_pair(payment_request_id, callback));
+      std::make_pair(payment_request_id, std::move(callback)));
 
   blink::WebPaymentAppRequest webAppRequest =
       mojo::ConvertTo<blink::WebPaymentAppRequest>(std::move(app_request));
@@ -1193,21 +1200,22 @@
 }
 
 void ServiceWorkerContextClient::DispatchActivateEvent(
-    const DispatchActivateEventCallback& callback) {
+    DispatchActivateEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchActivateEvent");
   int request_id = context_->activate_event_callbacks.Add(
-      base::MakeUnique<DispatchActivateEventCallback>(callback));
+      base::MakeUnique<DispatchActivateEventCallback>(std::move(callback)));
   proxy_->DispatchActivateEvent(request_id);
 }
 
 void ServiceWorkerContextClient::DispatchBackgroundFetchAbortEvent(
     const std::string& tag,
-    const DispatchBackgroundFetchAbortEventCallback& callback) {
+    DispatchBackgroundFetchAbortEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchBackgroundFetchAbortEvent");
   int request_id = context_->background_fetch_abort_event_callbacks.Add(
-      base::MakeUnique<DispatchBackgroundFetchAbortEventCallback>(callback));
+      base::MakeUnique<DispatchBackgroundFetchAbortEventCallback>(
+          std::move(callback)));
 
   proxy_->DispatchBackgroundFetchAbortEvent(request_id,
                                             blink::WebString::FromUTF8(tag));
@@ -1216,11 +1224,12 @@
 void ServiceWorkerContextClient::DispatchBackgroundFetchClickEvent(
     const std::string& tag,
     mojom::BackgroundFetchState state,
-    const DispatchBackgroundFetchClickEventCallback& callback) {
+    DispatchBackgroundFetchClickEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchBackgroundFetchClickEvent");
   int request_id = context_->background_fetch_click_event_callbacks.Add(
-      base::MakeUnique<DispatchBackgroundFetchClickEventCallback>(callback));
+      base::MakeUnique<DispatchBackgroundFetchClickEventCallback>(
+          std::move(callback)));
 
   // TODO(peter): Use typemap when this is moved to blink-side.
   blink::WebServiceWorkerContextProxy::BackgroundFetchState web_state =
@@ -1234,11 +1243,12 @@
 void ServiceWorkerContextClient::DispatchBackgroundFetchFailEvent(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const DispatchBackgroundFetchFailEventCallback& callback) {
+    DispatchBackgroundFetchFailEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchBackgroundFetchFailEvent");
   int request_id = context_->background_fetch_fail_event_callbacks.Add(
-      base::MakeUnique<DispatchBackgroundFetchFailEventCallback>(callback));
+      base::MakeUnique<DispatchBackgroundFetchFailEventCallback>(
+          std::move(callback)));
 
   blink::WebVector<blink::WebBackgroundFetchSettledFetch> web_fetches(
       fetches.size());
@@ -1254,11 +1264,12 @@
 void ServiceWorkerContextClient::DispatchBackgroundFetchedEvent(
     const std::string& tag,
     const std::vector<BackgroundFetchSettledFetch>& fetches,
-    const DispatchBackgroundFetchedEventCallback& callback) {
+    DispatchBackgroundFetchedEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchBackgroundFetchedEvent");
   int request_id = context_->background_fetched_event_callbacks.Add(
-      base::MakeUnique<DispatchBackgroundFetchedEventCallback>(callback));
+      base::MakeUnique<DispatchBackgroundFetchedEventCallback>(
+          std::move(callback)));
 
   blink::WebVector<blink::WebBackgroundFetchSettledFetch> web_fetches(
       fetches.size());
@@ -1273,11 +1284,12 @@
 
 void ServiceWorkerContextClient::DispatchExtendableMessageEvent(
     mojom::ExtendableMessageEventPtr event,
-    const DispatchExtendableMessageEventCallback& callback) {
+    DispatchExtendableMessageEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchExtendableMessageEvent");
   int request_id = context_->message_event_callbacks.Add(
-      base::MakeUnique<DispatchExtendableMessageEventCallback>(callback));
+      base::MakeUnique<DispatchExtendableMessageEventCallback>(
+          std::move(callback)));
 
   blink::WebMessagePortChannelArray ports =
       WebMessagePortChannelImpl::CreateFromMessagePipeHandles(
@@ -1317,7 +1329,7 @@
     const ServiceWorkerFetchRequest& request,
     mojom::FetchEventPreloadHandlePtr preload_handle,
     mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-    const DispatchFetchEventCallback& callback) {
+    DispatchFetchEventCallback callback) {
   std::unique_ptr<NavigationPreloadRequest> preload_request =
       preload_handle
           ? base::MakeUnique<NavigationPreloadRequest>(
@@ -1351,12 +1363,13 @@
     const PlatformNotificationData& notification_data,
     int action_index,
     const base::Optional<base::string16>& reply,
-    const DispatchNotificationClickEventCallback& callback) {
+    DispatchNotificationClickEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchNotificationClickEvent");
 
   int request_id = context_->notification_click_event_callbacks.Add(
-      base::MakeUnique<DispatchNotificationClickEventCallback>(callback));
+      base::MakeUnique<DispatchNotificationClickEventCallback>(
+          std::move(callback)));
 
   blink::WebString web_reply;
   if (reply)
@@ -1370,12 +1383,13 @@
 void ServiceWorkerContextClient::DispatchNotificationCloseEvent(
     const std::string& notification_id,
     const PlatformNotificationData& notification_data,
-    const DispatchNotificationCloseEventCallback& callback) {
+    DispatchNotificationCloseEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchNotificationCloseEvent");
 
   int request_id = context_->notification_close_event_callbacks.Add(
-      base::MakeUnique<DispatchNotificationCloseEventCallback>(callback));
+      base::MakeUnique<DispatchNotificationCloseEventCallback>(
+          std::move(callback)));
 
   proxy_->DispatchNotificationCloseEvent(
       request_id, blink::WebString::FromUTF8(notification_id),
@@ -1384,11 +1398,11 @@
 
 void ServiceWorkerContextClient::DispatchPushEvent(
     const PushEventPayload& payload,
-    const DispatchPushEventCallback& callback) {
+    DispatchPushEventCallback callback) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::DispatchPushEvent");
   int request_id = context_->push_event_callbacks.Add(
-      base::MakeUnique<DispatchPushEventCallback>(callback));
+      base::MakeUnique<DispatchPushEventCallback>(std::move(callback)));
 
   // Only set data to be a valid string if the payload had decrypted data.
   blink::WebString data;
@@ -1581,8 +1595,8 @@
   context_->claim_clients_callbacks.Remove(request_id);
 }
 
-void ServiceWorkerContextClient::Ping(const PingCallback& callback) {
-  callback.Run();
+void ServiceWorkerContextClient::Ping(PingCallback callback) {
+  std::move(callback).Run();
 }
 
 void ServiceWorkerContextClient::OnNavigationPreloadResponse(
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h
index f73acbb..835f079 100644
--- a/content/renderer/service_worker/service_worker_context_client.h
+++ b/content/renderer/service_worker/service_worker_context_client.h
@@ -68,11 +68,11 @@
                                    public mojom::ServiceWorkerEventDispatcher {
  public:
   using SyncCallback =
-      base::Callback<void(ServiceWorkerStatusCode,
-                          base::Time /* dispatch_event_time */)>;
+      base::OnceCallback<void(ServiceWorkerStatusCode,
+                              base::Time /* dispatch_event_time */)>;
   using FetchCallback =
-      base::Callback<void(ServiceWorkerStatusCode,
-                          base::Time /* dispatch_event_time */)>;
+      base::OnceCallback<void(ServiceWorkerStatusCode,
+                              base::Time /* dispatch_event_time */)>;
 
   // Returns a thread-specific client instance.  This does NOT create a
   // new instance.
@@ -231,54 +231,53 @@
       const ServiceWorkerVersionAttributes& attrs);
 
   // mojom::ServiceWorkerEventDispatcher
-  void DispatchActivateEvent(
-      const DispatchActivateEventCallback& callback) override;
+  void DispatchActivateEvent(DispatchActivateEventCallback callback) override;
   void DispatchBackgroundFetchAbortEvent(
       const std::string& tag,
-      const DispatchBackgroundFetchAbortEventCallback& callback) override;
+      DispatchBackgroundFetchAbortEventCallback callback) override;
   void DispatchBackgroundFetchClickEvent(
       const std::string& tag,
       mojom::BackgroundFetchState state,
-      const DispatchBackgroundFetchClickEventCallback& callback) override;
+      DispatchBackgroundFetchClickEventCallback callback) override;
   void DispatchBackgroundFetchFailEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const DispatchBackgroundFetchFailEventCallback& callback) override;
+      DispatchBackgroundFetchFailEventCallback callback) override;
   void DispatchBackgroundFetchedEvent(
       const std::string& tag,
       const std::vector<BackgroundFetchSettledFetch>& fetches,
-      const DispatchBackgroundFetchedEventCallback& callback) override;
+      DispatchBackgroundFetchedEventCallback callback) override;
   void DispatchExtendableMessageEvent(
       mojom::ExtendableMessageEventPtr event,
-      const DispatchExtendableMessageEventCallback& callback) override;
+      DispatchExtendableMessageEventCallback callback) override;
   void DispatchFetchEvent(
       int fetch_event_id,
       const ServiceWorkerFetchRequest& request,
       mojom::FetchEventPreloadHandlePtr preload_handle,
       mojom::ServiceWorkerFetchResponseCallbackPtr response_callback,
-      const DispatchFetchEventCallback& callback) override;
+      DispatchFetchEventCallback callback) override;
   void DispatchNotificationClickEvent(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
       int action_index,
       const base::Optional<base::string16>& reply,
-      const DispatchNotificationClickEventCallback& callback) override;
+      DispatchNotificationClickEventCallback callback) override;
   void DispatchNotificationCloseEvent(
       const std::string& notification_id,
       const PlatformNotificationData& notification_data,
-      const DispatchNotificationCloseEventCallback& callback) override;
+      DispatchNotificationCloseEventCallback callback) override;
   void DispatchPushEvent(const PushEventPayload& payload,
-                         const DispatchPushEventCallback& callback) override;
+                         DispatchPushEventCallback callback) override;
   void DispatchSyncEvent(
       const std::string& tag,
       blink::mojom::BackgroundSyncEventLastChance last_chance,
-      const DispatchSyncEventCallback& callback) override;
+      DispatchSyncEventCallback callback) override;
   void DispatchPaymentRequestEvent(
       int payment_request_id,
       payments::mojom::PaymentAppRequestPtr app_request,
       payments::mojom::PaymentAppResponseCallbackPtr response_callback,
-      const DispatchPaymentRequestEventCallback& callback) override;
-  void Ping(const PingCallback& callback) override;
+      DispatchPaymentRequestEventCallback callback) override;
+  void Ping(PingCallback callback) override;
 
   void OnInstallEvent(int request_id);
   void OnNotificationClickEvent(
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc
index 3ae3715c..2ef6960c 100644
--- a/content/test/test_render_frame.cc
+++ b/content/test/test_render_frame.cc
@@ -21,12 +21,12 @@
   ~MockFrameHost() override = default;
 
   void CreateNewWindow(mojom::CreateNewWindowParamsPtr params,
-                       const CreateNewWindowCallback& callback) override {
+                       CreateNewWindowCallback callback) override {
     mojom::CreateNewWindowReplyPtr reply = mojom::CreateNewWindowReply::New();
     MockRenderThread* mock_render_thread =
         static_cast<MockRenderThread*>(RenderThread::Get());
     mock_render_thread->OnCreateWindow(*params, reply.get());
-    callback.Run(std::move(reply));
+    std::move(callback).Run(std::move(reply));
   }
 
   void Bind(mojo::ScopedInterfaceEndpointHandle handle) {
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 15f20c7..f8c9b5cf 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -503,7 +503,6 @@
   std::string sender = signal->GetSender();
   if (service_name_owner_ != sender) {
     LOG(ERROR) << "Rejecting a message from a wrong sender.";
-    UMA_HISTOGRAM_COUNTS("DBus.RejectedSignalCount", 1);
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
   }
 
diff --git a/dbus/signal_sender_verification_unittest.cc b/dbus/signal_sender_verification_unittest.cc
index 7f5c7906..3a5f299 100644
--- a/dbus/signal_sender_verification_unittest.cc
+++ b/dbus/signal_sender_verification_unittest.cc
@@ -197,27 +197,15 @@
   ASSERT_EQ(kMessage, test_signal_string_);
 }
 
-// Disabled, http://crbug.com/407063 .
-TEST_F(SignalSenderVerificationTest, DISABLED_TestSignalRejected) {
-  // To make sure the histogram instance is created.
-  UMA_HISTOGRAM_COUNTS("DBus.RejectedSignalCount", 0);
-  base::HistogramBase* reject_signal_histogram =
-        base::StatisticsRecorder::FindHistogram("DBus.RejectedSignalCount");
-  std::unique_ptr<base::HistogramSamples> samples1(
-      reject_signal_histogram->SnapshotSamples());
-
+TEST_F(SignalSenderVerificationTest, TestSignalRejected) {
   const char kNewMessage[] = "hello, new world";
   test_service2_->SendTestSignal(kNewMessage);
 
   // This test tests that our callback is NOT called by the ObjectProxy.
   // Sleep to have message delivered to the client via the D-Bus service.
-  base::PlatformThread::Sleep(TestTimeouts::action_timeout());
-
-  std::unique_ptr<base::HistogramSamples> samples2(
-      reject_signal_histogram->SnapshotSamples());
+  base::PlatformThread::Sleep(TestTimeouts::tiny_timeout());
 
   ASSERT_EQ("", test_signal_string_);
-  EXPECT_EQ(samples1->TotalCount() + 1, samples2->TotalCount());
 }
 
 TEST_F(SignalSenderVerificationTest, TestOwnerChanged) {
diff --git a/media/midi/BUILD.gn b/media/midi/BUILD.gn
index b53cad0..ea6be175 100644
--- a/media/midi/BUILD.gn
+++ b/media/midi/BUILD.gn
@@ -144,8 +144,6 @@
     sources += [
       "dynamically_initialized_midi_manager_win.cc",
       "dynamically_initialized_midi_manager_win.h",
-      "midi_manager_win.cc",
-      "midi_manager_win.h",
       "midi_manager_winrt.cc",
       "midi_manager_winrt.h",
     ]
diff --git a/media/midi/OWNERS b/media/midi/OWNERS
index 76b1362a..66324a3 100644
--- a/media/midi/OWNERS
+++ b/media/midi/OWNERS
@@ -1,8 +1,8 @@
-# On Android port and USB support, yhirano@ is the best reviewer.
-# On Win32 port, yukawa@ is the best reviewer.
+# Following reviewers should be able to review all code under //media/midi.
+# But it would be a good idea to involve {yukawa,agoode}@chromium.org if
+# they are the original author of files you are touching.
 toyoshim@chromium.org
 yhirano@chromium.org
-yukawa@chromium.org
 
 per-file *.mojom=set noparent
 per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/media/midi/dynamically_initialized_midi_manager_win.cc b/media/midi/dynamically_initialized_midi_manager_win.cc
index 25615424..58c3a6a 100644
--- a/media/midi/dynamically_initialized_midi_manager_win.cc
+++ b/media/midi/dynamically_initialized_midi_manager_win.cc
@@ -22,10 +22,13 @@
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/synchronization/lock.h"
+#include "base/win/windows_version.h"
 #include "device/usb/usb_ids.h"
 #include "media/midi/message_util.h"
+#include "media/midi/midi_manager_winrt.h"
 #include "media/midi/midi_port_info.h"
 #include "media/midi/midi_service.h"
+#include "media/midi/midi_switches.h"
 
 namespace midi {
 
@@ -852,4 +855,11 @@
                  base::Unretained(this), client, data.size()));
 }
 
+MidiManager* MidiManager::Create(MidiService* service) {
+  if (base::FeatureList::IsEnabled(features::kMidiManagerWinrt) &&
+      base::win::GetVersion() >= base::win::VERSION_WIN10)
+    return new MidiManagerWinrt(service);
+  return new DynamicallyInitializedMidiManagerWin(service);
+}
+
 }  // namespace midi
diff --git a/media/midi/midi_manager_win.cc b/media/midi/midi_manager_win.cc
deleted file mode 100644
index 2a7265ce..0000000
--- a/media/midi/midi_manager_win.cc
+++ /dev/null
@@ -1,1212 +0,0 @@
-// Copyright 2013 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.
-
-#include "media/midi/midi_manager_win.h"
-
-#include <windows.h>
-#include <ks.h>
-#include <ksmedia.h>
-#include <mmreg.h>
-// Prevent unnecessary functions from being included from <mmsystem.h>
-#define MMNODRV
-#define MMNOSOUND
-#define MMNOWAVE
-#define MMNOAUX
-#define MMNOMIXER
-#define MMNOTIMER
-#define MMNOJOY
-#define MMNOMCI
-#define MMNOMMIO
-#include <mmsystem.h>
-#include <stddef.h>
-
-#include <algorithm>
-#include <functional>
-#include <queue>
-#include <string>
-
-#include "base/bind.h"
-#include "base/containers/hash_tables.h"
-#include "base/feature_list.h"
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "base/strings/string16.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/system_monitor/system_monitor.h"
-#include "base/threading/thread_checker.h"
-#include "base/timer/timer.h"
-#include "base/win/message_window.h"
-#include "base/win/windows_version.h"
-#include "device/usb/usb_ids.h"
-#include "media/midi/dynamically_initialized_midi_manager_win.h"
-#include "media/midi/message_util.h"
-#include "media/midi/midi_manager_winrt.h"
-#include "media/midi/midi_message_queue.h"
-#include "media/midi/midi_port_info.h"
-#include "media/midi/midi_switches.h"
-
-namespace midi {
-namespace {
-
-using mojom::PortState;
-using mojom::Result;
-
-static const size_t kBufferLength = 32 * 1024;
-
-// We assume that nullpter represents an invalid MIDI handle.
-const HMIDIIN kInvalidMidiInHandle = nullptr;
-const HMIDIOUT kInvalidMidiOutHandle = nullptr;
-
-std::string GetInErrorMessage(MMRESULT result) {
-  wchar_t text[MAXERRORLENGTH];
-  MMRESULT get_result = midiInGetErrorText(result, text, arraysize(text));
-  if (get_result != MMSYSERR_NOERROR) {
-    DLOG(ERROR) << "Failed to get error message."
-                << " original error: " << result
-                << " midiInGetErrorText error: " << get_result;
-    return std::string();
-  }
-  return base::WideToUTF8(text);
-}
-
-std::string GetOutErrorMessage(MMRESULT result) {
-  wchar_t text[MAXERRORLENGTH];
-  MMRESULT get_result = midiOutGetErrorText(result, text, arraysize(text));
-  if (get_result != MMSYSERR_NOERROR) {
-    DLOG(ERROR) << "Failed to get error message."
-                << " original error: " << result
-                << " midiOutGetErrorText error: " << get_result;
-    return std::string();
-  }
-  return base::WideToUTF8(text);
-}
-
-std::string MmversionToString(MMVERSION version) {
-  return base::StringPrintf("%d.%d", HIBYTE(version), LOBYTE(version));
-}
-
-void CloseOutputPortOnTaskThread(HMIDIOUT midi_out_handle) {
-  midiOutClose(midi_out_handle);
-}
-
-class MIDIHDRDeleter {
- public:
-  void operator()(MIDIHDR* header) {
-    if (!header)
-      return;
-    delete[] static_cast<char*>(header->lpData);
-    header->lpData = NULL;
-    header->dwBufferLength = 0;
-    delete header;
-  }
-};
-
-using ScopedMIDIHDR = std::unique_ptr<MIDIHDR, MIDIHDRDeleter>;
-
-ScopedMIDIHDR CreateMIDIHDR(size_t size) {
-  ScopedMIDIHDR header(new MIDIHDR);
-  ZeroMemory(header.get(), sizeof(*header));
-  header->lpData = new char[size];
-  header->dwBufferLength = static_cast<DWORD>(size);
-  return header;
-}
-
-void SendShortMidiMessageInternal(HMIDIOUT midi_out_handle,
-                                  const std::vector<uint8_t>& message) {
-  DCHECK_LE(message.size(), static_cast<size_t>(3))
-      << "A short MIDI message should be up to 3 bytes.";
-
-  DWORD packed_message = 0;
-  for (size_t i = 0; i < message.size(); ++i)
-    packed_message |= (static_cast<uint32_t>(message[i]) << (i * 8));
-  MMRESULT result = midiOutShortMsg(midi_out_handle, packed_message);
-  DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-      << "Failed to output short message: " << GetOutErrorMessage(result);
-}
-
-void SendLongMidiMessageInternal(HMIDIOUT midi_out_handle,
-                                 const std::vector<uint8_t>& message) {
-  // Implementation note:
-  // Sending a long MIDI message can be performed synchronously or
-  // asynchronously depending on the driver. There are 2 options to support both
-  // cases:
-  // 1) Call midiOutLongMsg() API and wait for its completion within this
-  //   function. In this approach, we can avoid memory copy by directly pointing
-  //   |message| as the data buffer to be sent.
-  // 2) Allocate a buffer and copy |message| to it, then call midiOutLongMsg()
-  //   API. The buffer will be freed in the MOM_DONE event hander, which tells
-  //   us that the task of midiOutLongMsg() API is completed.
-  // Here we choose option 2) in favor of asynchronous design.
-
-  // Note for built-in USB-MIDI driver:
-  // From an observation on Windows 7/8.1 with a USB-MIDI keyboard,
-  // midiOutLongMsg() will be always blocked. Sending 64 bytes or less data
-  // takes roughly 300 usecs. Sending 2048 bytes or more data takes roughly
-  // |message.size() / (75 * 1024)| secs in practice. Here we put 256 KB size
-  // limit on SysEx message, with hoping that midiOutLongMsg will be blocked at
-  // most 4 sec or so with a typical USB-MIDI device.
-  // TODO(crbug.com/383578): This restriction should be removed once Web MIDI
-  // defines a standardized way to handle large sysex messages.
-  const size_t kSysExSizeLimit = 256 * 1024;
-  if (message.size() >= kSysExSizeLimit) {
-    DVLOG(1) << "Ingnoreing SysEx message due to the size limit"
-             << ", size = " << message.size();
-    return;
-  }
-
-  ScopedMIDIHDR midi_header(CreateMIDIHDR(message.size()));
-  std::copy(message.begin(), message.end(), midi_header->lpData);
-
-  MMRESULT result = midiOutPrepareHeader(midi_out_handle, midi_header.get(),
-                                         sizeof(*midi_header));
-  if (result != MMSYSERR_NOERROR) {
-    DLOG(ERROR) << "Failed to prepare output buffer: "
-                << GetOutErrorMessage(result);
-    return;
-  }
-
-  result =
-      midiOutLongMsg(midi_out_handle, midi_header.get(), sizeof(*midi_header));
-  if (result != MMSYSERR_NOERROR) {
-    DLOG(ERROR) << "Failed to output long message: "
-                << GetOutErrorMessage(result);
-    result = midiOutUnprepareHeader(midi_out_handle, midi_header.get(),
-                                    sizeof(*midi_header));
-    DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-        << "Failed to uninitialize output buffer: "
-        << GetOutErrorMessage(result);
-    return;
-  }
-
-  // The ownership of |midi_header| is moved to MOM_DONE event handler.
-  ignore_result(midi_header.release());
-}
-
-template <size_t array_size>
-base::string16 AsString16(const wchar_t(&buffer)[array_size]) {
-  size_t len = 0;
-  for (len = 0; len < array_size; ++len) {
-    if (buffer[len] == L'\0')
-      break;
-  }
-  return base::string16(buffer, len);
-}
-
-struct MidiDeviceInfo final {
-  explicit MidiDeviceInfo(const MIDIINCAPS2W& caps)
-      : manufacturer_id(caps.wMid),
-        product_id(caps.wPid),
-        driver_version(caps.vDriverVersion),
-        product_name(AsString16(caps.szPname)),
-        usb_vendor_id(ExtractUsbVendorIdIfExists(caps)),
-        usb_product_id(ExtractUsbProductIdIfExists(caps)),
-        is_usb_device(IsUsbDevice(caps)),
-        is_software_synth(false) {}
-  explicit MidiDeviceInfo(const MIDIOUTCAPS2W& caps)
-      : manufacturer_id(caps.wMid),
-        product_id(caps.wPid),
-        driver_version(caps.vDriverVersion),
-        product_name(AsString16(caps.szPname)),
-        usb_vendor_id(ExtractUsbVendorIdIfExists(caps)),
-        usb_product_id(ExtractUsbProductIdIfExists(caps)),
-        is_usb_device(IsUsbDevice(caps)),
-        is_software_synth(IsSoftwareSynth(caps)) {}
-  explicit MidiDeviceInfo(const MidiDeviceInfo& info)
-      : manufacturer_id(info.manufacturer_id),
-        product_id(info.product_id),
-        driver_version(info.driver_version),
-        product_name(info.product_name),
-        usb_vendor_id(info.usb_vendor_id),
-        usb_product_id(info.usb_product_id),
-        is_usb_device(info.is_usb_device),
-        is_software_synth(info.is_software_synth) {}
-  // Currently only following entities are considered when testing the equality
-  // of two MIDI devices.
-  // TODO(toyoshim): Consider to calculate MIDIPort.id here and use it as the
-  // key. See crbug.com/467448.  Then optimize the data for |MidiPortInfo|.
-  const uint16_t manufacturer_id;
-  const uint16_t product_id;
-  const uint32_t driver_version;
-  const base::string16 product_name;
-  const uint16_t usb_vendor_id;
-  const uint16_t usb_product_id;
-  const bool is_usb_device;
-  const bool is_software_synth;
-
-  // Required to be used as the key of base::hash_map.
-  bool operator==(const MidiDeviceInfo& that) const {
-    return manufacturer_id == that.manufacturer_id &&
-           product_id == that.product_id &&
-           driver_version == that.driver_version &&
-           product_name == that.product_name &&
-           is_usb_device == that.is_usb_device &&
-           (is_usb_device && usb_vendor_id == that.usb_vendor_id &&
-            usb_product_id == that.usb_product_id);
-  }
-
-  // Hash function to be used in base::hash_map.
-  struct Hasher {
-    size_t operator()(const MidiDeviceInfo& info) const {
-      size_t hash = info.manufacturer_id;
-      hash *= 131;
-      hash += info.product_id;
-      hash *= 131;
-      hash += info.driver_version;
-      hash *= 131;
-      hash += info.product_name.size();
-      hash *= 131;
-      if (!info.product_name.empty()) {
-        hash += info.product_name[0];
-      }
-      hash *= 131;
-      hash += info.usb_vendor_id;
-      hash *= 131;
-      hash += info.usb_product_id;
-      return hash;
-    }
-  };
-
- private:
-  static bool IsUsbDevice(const MIDIINCAPS2W& caps) {
-    return IS_COMPATIBLE_USBAUDIO_MID(&caps.ManufacturerGuid) &&
-           IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid);
-  }
-  static bool IsUsbDevice(const MIDIOUTCAPS2W& caps) {
-    return IS_COMPATIBLE_USBAUDIO_MID(&caps.ManufacturerGuid) &&
-           IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid);
-  }
-  static bool IsSoftwareSynth(const MIDIOUTCAPS2W& caps) {
-    return caps.wTechnology == MOD_SWSYNTH;
-  }
-  static uint16_t ExtractUsbVendorIdIfExists(const MIDIINCAPS2W& caps) {
-    if (!IS_COMPATIBLE_USBAUDIO_MID(&caps.ManufacturerGuid))
-      return 0;
-    return EXTRACT_USBAUDIO_MID(&caps.ManufacturerGuid);
-  }
-  static uint16_t ExtractUsbVendorIdIfExists(const MIDIOUTCAPS2W& caps) {
-    if (!IS_COMPATIBLE_USBAUDIO_MID(&caps.ManufacturerGuid))
-      return 0;
-    return EXTRACT_USBAUDIO_MID(&caps.ManufacturerGuid);
-  }
-  static uint16_t ExtractUsbProductIdIfExists(const MIDIINCAPS2W& caps) {
-    if (!IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid))
-      return 0;
-    return EXTRACT_USBAUDIO_PID(&caps.ProductGuid);
-  }
-  static uint16_t ExtractUsbProductIdIfExists(const MIDIOUTCAPS2W& caps) {
-    if (!IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid))
-      return 0;
-    return EXTRACT_USBAUDIO_PID(&caps.ProductGuid);
-  }
-};
-
-std::string GetManufacturerName(const MidiDeviceInfo& info) {
-  if (info.is_usb_device) {
-    const char* name = device::UsbIds::GetVendorName(info.usb_vendor_id);
-    return std::string(name ? name : "");
-  }
-
-  switch (info.manufacturer_id) {
-    case MM_MICROSOFT:
-      return "Microsoft Corporation";
-    default:
-      // TODO(toyoshim): Support other manufacture IDs.  crbug.com/472341.
-      return "";
-  }
-}
-
-bool IsUnsupportedDevice(const MidiDeviceInfo& info) {
-  return info.is_software_synth && info.manufacturer_id == MM_MICROSOFT &&
-         (info.product_id == MM_MSFT_WDMAUDIO_MIDIOUT ||
-          info.product_id == MM_MSFT_GENERIC_MIDISYNTH);
-}
-
-using PortNumberCache =
-    base::hash_map<MidiDeviceInfo,
-                   std::priority_queue<uint32_t,
-                                       std::vector<uint32_t>,
-                                       std::greater<uint32_t>>,
-                   MidiDeviceInfo::Hasher>;
-
-struct MidiInputDeviceState final
-    : base::RefCountedThreadSafe<MidiInputDeviceState> {
-  explicit MidiInputDeviceState(const MidiDeviceInfo& device_info)
-      : device_info(device_info),
-        midi_handle(kInvalidMidiInHandle),
-        port_index(0),
-        port_age(0),
-        start_time_initialized(false) {}
-
-  const MidiDeviceInfo device_info;
-  HMIDIIN midi_handle;
-  ScopedMIDIHDR midi_header;
-  // Since Win32 multimedia system uses a relative time offset from when
-  // |midiInStart| API is called, we need to record when it is called.
-  base::TimeTicks start_time;
-  // 0-based port index.  We will try to reuse the previous port index when the
-  // MIDI device is closed then reopened.
-  uint32_t port_index;
-  // A sequence number which represents how many times |port_index| is reused.
-  // We can remove this field if we decide not to clear unsent events
-  // when the device is disconnected.
-  // See https://github.com/WebAudio/web-midi-api/issues/133
-  uint64_t port_age;
-  // True if |start_time| is initialized. This field is not used so far, but
-  // kept for the debugging purpose.
-  bool start_time_initialized;
-
- private:
-  friend class base::RefCountedThreadSafe<MidiInputDeviceState>;
-  ~MidiInputDeviceState() {}
-};
-
-struct MidiOutputDeviceState final
-    : base::RefCountedThreadSafe<MidiOutputDeviceState> {
-  explicit MidiOutputDeviceState(const MidiDeviceInfo& device_info)
-      : device_info(device_info),
-        midi_handle(kInvalidMidiOutHandle),
-        port_index(0),
-        port_age(0),
-        closed(false) {}
-
-  const MidiDeviceInfo device_info;
-  HMIDIOUT midi_handle;
-  // 0-based port index.  We will try to reuse the previous port index when the
-  // MIDI device is closed then reopened.
-  uint32_t port_index;
-  // A sequence number which represents how many times |port_index| is reused.
-  // We can remove this field if we decide not to clear unsent events
-  // when the device is disconnected.
-  // See https://github.com/WebAudio/web-midi-api/issues/133
-  uint64_t port_age;
-  // True if the device is already closed and |midi_handle| is considered to be
-  // invalid.
-  // TODO(toyoshim): Use std::atomic<bool> when it is allowed in Chromium
-  // project.
-  volatile bool closed;
-
- private:
-  friend class base::RefCountedThreadSafe<MidiOutputDeviceState>;
-  ~MidiOutputDeviceState() {}
-};
-
-// The core logic of MIDI device handling for Windows. Basically this class is
-// shared among following 4 threads:
-//  1. Chrome IO Thread
-//  2. OS Multimedia Thread
-//  3. Task Thread
-//  4. Sender Thread
-//
-// Chrome IO Thread:
-//  MidiManager runs on Chrome IO thread. Device change notification is
-//  delivered to the thread through the SystemMonitor service.
-//  OnDevicesChanged() callback is invoked to update the MIDI device list.
-//  Note that in the current implementation we will try to open all the
-//  existing devices in practice. This is OK because trying to reopen a MIDI
-//  device that is already opened would simply fail, and there is no unwilling
-//  side effect.
-//
-// OS Multimedia Thread:
-//  This thread is maintained by the OS as a part of MIDI runtime, and
-//  responsible for receiving all the system initiated events such as device
-//  close, and receiving data. For performance reasons, most of potentially
-//  blocking operations will be dispatched into Task Thread.
-//
-// Task Thread:
-//  This thread will be used to call back following methods of MidiManager.
-//  - MidiManager::CompleteInitialization
-//  - MidiManager::AddInputPort
-//  - MidiManager::AddOutputPort
-//  - MidiManager::SetInputPortState
-//  - MidiManager::SetOutputPortState
-//  - MidiManager::ReceiveMidiData
-//
-// Sender Thread:
-//  This thread will be used to call Win32 APIs to send MIDI message at the
-//  specified time. We don't want to call MIDI send APIs on Task Thread
-//  because those APIs could be performed synchronously, hence they could block
-//  the caller thread for a while. See the comment in
-//  SendLongMidiMessageInternal for details. Currently we expect that the
-//  blocking time would be less than 1 second.
-class MidiServiceWinImpl : public MidiServiceWin,
-                           public base::SystemMonitor::DevicesChangedObserver {
- public:
-  MidiServiceWinImpl()
-      : delegate_(nullptr),
-        sender_thread_("Windows MIDI sender thread"),
-        task_thread_("Windows MIDI task thread"),
-        destructor_started(false) {}
-
-  ~MidiServiceWinImpl() final {
-    // Start() and Stop() of the threads, and AddDevicesChangeObserver() and
-    // RemoveDevicesChangeObserver() should be called on the same thread.
-    DCHECK(thread_checker_.CalledOnValidThread());
-
-    destructor_started = true;
-    base::SystemMonitor::Get()->RemoveDevicesChangedObserver(this);
-    {
-      std::vector<HMIDIIN> input_devices;
-      {
-        base::AutoLock auto_lock(input_ports_lock_);
-        for (auto it : input_device_map_)
-          input_devices.push_back(it.first);
-      }
-      {
-        for (auto* handle : input_devices) {
-          MMRESULT result = midiInClose(handle);
-          if (result == MIDIERR_STILLPLAYING) {
-            result = midiInReset(handle);
-            DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-                << "midiInReset failed: " << GetInErrorMessage(result);
-            result = midiInClose(handle);
-          }
-          DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-              << "midiInClose failed: " << GetInErrorMessage(result);
-        }
-      }
-    }
-    {
-      std::vector<HMIDIOUT> output_devices;
-      {
-        base::AutoLock auto_lock(output_ports_lock_);
-        for (auto it : output_device_map_)
-          output_devices.push_back(it.first);
-      }
-      {
-        for (auto* handle : output_devices) {
-          MMRESULT result = midiOutClose(handle);
-          if (result == MIDIERR_STILLPLAYING) {
-            result = midiOutReset(handle);
-            DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-                << "midiOutReset failed: " << GetOutErrorMessage(result);
-            result = midiOutClose(handle);
-          }
-          DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-              << "midiOutClose failed: " << GetOutErrorMessage(result);
-        }
-      }
-    }
-    sender_thread_.Stop();
-    task_thread_.Stop();
-  }
-
-  // MidiServiceWin overrides:
-  void InitializeAsync(MidiServiceWinDelegate* delegate) final {
-    // Start() and Stop() of the threads, and AddDevicesChangeObserver() and
-    // RemoveDevicesChangeObserver() should be called on the same thread.
-    DCHECK(thread_checker_.CalledOnValidThread());
-
-    delegate_ = delegate;
-
-    sender_thread_.Start();
-    task_thread_.Start();
-
-    // Start monitoring device changes. This should start before the
-    // following UpdateDeviceList() call not to miss the event happening
-    // between the call and the observer registration.
-    base::SystemMonitor::Get()->AddDevicesChangedObserver(this);
-
-    UpdateDeviceList();
-
-    task_thread_.task_runner()->PostTask(
-        FROM_HERE,
-        base::Bind(&MidiServiceWinImpl::CompleteInitializationOnTaskThread,
-                   base::Unretained(this), Result::OK));
-  }
-
-  void SendMidiDataAsync(uint32_t port_number,
-                         const std::vector<uint8_t>& data,
-                         base::TimeTicks time) final {
-    if (destructor_started) {
-      LOG(ERROR) << "ThreadSafeSendData failed because MidiServiceWinImpl is "
-                    "being destructed.  port: " << port_number;
-      return;
-    }
-    auto state = GetOutputDeviceFromPort(port_number);
-    if (!state) {
-      LOG(ERROR) << "ThreadSafeSendData failed due to an invalid port number. "
-                 << "port: " << port_number;
-      return;
-    }
-    if (state->closed) {
-      LOG(ERROR)
-          << "ThreadSafeSendData failed because target port is already closed."
-          << "port: " << port_number;
-      return;
-    }
-    const auto now = base::TimeTicks::Now();
-    if (now < time) {
-      sender_thread_.task_runner()->PostDelayedTask(
-          FROM_HERE, base::Bind(&MidiServiceWinImpl::SendOnSenderThread,
-                                base::Unretained(this), port_number,
-                                state->port_age, data, time),
-          time - now);
-    } else {
-      sender_thread_.task_runner()->PostTask(
-          FROM_HERE, base::Bind(&MidiServiceWinImpl::SendOnSenderThread,
-                                base::Unretained(this), port_number,
-                                state->port_age, data, time));
-    }
-  }
-
-  // base::SystemMonitor::DevicesChangedObserver overrides:
-  void OnDevicesChanged(base::SystemMonitor::DeviceType device_type) final {
-    DCHECK(thread_checker_.CalledOnValidThread());
-    if (destructor_started)
-      return;
-
-    switch (device_type) {
-      case base::SystemMonitor::DEVTYPE_AUDIO:
-      case base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE:
-        // Add case of other unrelated device types here.
-        return;
-      case base::SystemMonitor::DEVTYPE_UNKNOWN:
-        // Interested in MIDI devices. Try updating the device list.
-        UpdateDeviceList();
-        break;
-        // No default here to capture new DeviceType by compile time.
-    }
-  }
-
- private:
-  scoped_refptr<MidiInputDeviceState> GetInputDeviceFromHandle(
-      HMIDIIN midi_handle) {
-    base::AutoLock auto_lock(input_ports_lock_);
-    const auto it = input_device_map_.find(midi_handle);
-    return (it != input_device_map_.end() ? it->second : nullptr);
-  }
-
-  scoped_refptr<MidiOutputDeviceState> GetOutputDeviceFromHandle(
-      HMIDIOUT midi_handle) {
-    base::AutoLock auto_lock(output_ports_lock_);
-    const auto it = output_device_map_.find(midi_handle);
-    return (it != output_device_map_.end() ? it->second : nullptr);
-  }
-
-  scoped_refptr<MidiOutputDeviceState> GetOutputDeviceFromPort(
-      uint32_t port_number) {
-    base::AutoLock auto_lock(output_ports_lock_);
-    if (output_ports_.size() <= port_number)
-      return nullptr;
-    return output_ports_[port_number];
-  }
-
-  void UpdateDeviceList() {
-    task_thread_.task_runner()->PostTask(
-        FROM_HERE, base::Bind(&MidiServiceWinImpl::UpdateDeviceListOnTaskThread,
-                              base::Unretained(this)));
-  }
-
-  /////////////////////////////////////////////////////////////////////////////
-  // Callbacks on the OS multimedia thread.
-  /////////////////////////////////////////////////////////////////////////////
-
-  static void CALLBACK
-  OnMidiInEventOnMainlyMultimediaThread(HMIDIIN midi_in_handle,
-                                        UINT message,
-                                        DWORD_PTR instance,
-                                        DWORD_PTR param1,
-                                        DWORD_PTR param2) {
-    MidiServiceWinImpl* self = reinterpret_cast<MidiServiceWinImpl*>(instance);
-    if (!self)
-      return;
-    switch (message) {
-      case MIM_OPEN:
-        self->OnMidiInOpen(midi_in_handle);
-        break;
-      case MIM_DATA:
-        self->OnMidiInDataOnMultimediaThread(midi_in_handle, param1, param2);
-        break;
-      case MIM_LONGDATA:
-        self->OnMidiInLongDataOnMultimediaThread(midi_in_handle, param1,
-                                                 param2);
-        break;
-      case MIM_CLOSE:
-        self->OnMidiInCloseOnMultimediaThread(midi_in_handle);
-        break;
-    }
-  }
-
-  void OnMidiInOpen(HMIDIIN midi_in_handle) {
-    UINT device_id = 0;
-    MMRESULT result = midiInGetID(midi_in_handle, &device_id);
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "midiInGetID failed: " << GetInErrorMessage(result);
-      return;
-    }
-    MIDIINCAPS2W caps = {};
-    result = midiInGetDevCaps(device_id, reinterpret_cast<LPMIDIINCAPSW>(&caps),
-                              sizeof(caps));
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "midiInGetDevCaps failed: " << GetInErrorMessage(result);
-      return;
-    }
-    auto state =
-        make_scoped_refptr(new MidiInputDeviceState(MidiDeviceInfo(caps)));
-    state->midi_handle = midi_in_handle;
-    state->midi_header = CreateMIDIHDR(kBufferLength);
-    const auto& state_device_info = state->device_info;
-    bool add_new_port = false;
-    uint32_t port_number = 0;
-    {
-      base::AutoLock auto_lock(input_ports_lock_);
-      const auto it = unused_input_ports_.find(state_device_info);
-      if (it == unused_input_ports_.end()) {
-        port_number = static_cast<uint32_t>(input_ports_.size());
-        add_new_port = true;
-        input_ports_.push_back(nullptr);
-        input_ports_ages_.push_back(0);
-      } else {
-        port_number = it->second.top();
-        it->second.pop();
-        if (it->second.empty()) {
-          unused_input_ports_.erase(it);
-        }
-      }
-      input_ports_[port_number] = state;
-
-      input_ports_ages_[port_number] += 1;
-      input_device_map_[input_ports_[port_number]->midi_handle] =
-          input_ports_[port_number];
-      input_ports_[port_number]->port_index = port_number;
-      input_ports_[port_number]->port_age = input_ports_ages_[port_number];
-    }
-    // Several initial startup tasks cannot be done in MIM_OPEN handler.
-    task_thread_.task_runner()->PostTask(
-        FROM_HERE, base::Bind(&MidiServiceWinImpl::StartInputDeviceOnTaskThread,
-                              base::Unretained(this), midi_in_handle));
-    if (add_new_port) {
-      const MidiPortInfo port_info(
-          // TODO(toyoshim): Use a hash ID insted crbug.com/467448
-          base::IntToString(static_cast<int>(port_number)),
-          GetManufacturerName(state_device_info),
-          base::WideToUTF8(state_device_info.product_name),
-          MmversionToString(state_device_info.driver_version),
-          PortState::OPENED);
-      task_thread_.task_runner()->PostTask(
-          FROM_HERE, base::Bind(&MidiServiceWinImpl::AddInputPortOnTaskThread,
-                                base::Unretained(this), port_info));
-    } else {
-      task_thread_.task_runner()->PostTask(
-          FROM_HERE,
-          base::Bind(&MidiServiceWinImpl::SetInputPortStateOnTaskThread,
-                     base::Unretained(this), port_number,
-                     PortState::CONNECTED));
-    }
-  }
-
-  void OnMidiInDataOnMultimediaThread(HMIDIIN midi_in_handle,
-                                      DWORD_PTR param1,
-                                      DWORD_PTR param2) {
-    auto state = GetInputDeviceFromHandle(midi_in_handle);
-    if (!state)
-      return;
-    const uint8_t status_byte = static_cast<uint8_t>(param1 & 0xff);
-    const uint8_t first_data_byte = static_cast<uint8_t>((param1 >> 8) & 0xff);
-    const uint8_t second_data_byte =
-        static_cast<uint8_t>((param1 >> 16) & 0xff);
-    const DWORD elapsed_ms = param2;
-    const size_t len = GetMessageLength(status_byte);
-    const uint8_t kData[] = {status_byte, first_data_byte, second_data_byte};
-    std::vector<uint8_t> data;
-    data.assign(kData, kData + len);
-    DCHECK_LE(len, arraysize(kData));
-    // MIM_DATA/MIM_LONGDATA message treats the time when midiInStart() is
-    // called as the origin of |elapsed_ms|.
-    // http://msdn.microsoft.com/en-us/library/windows/desktop/dd757284.aspx
-    // http://msdn.microsoft.com/en-us/library/windows/desktop/dd757286.aspx
-    const base::TimeTicks event_time =
-        state->start_time + base::TimeDelta::FromMilliseconds(elapsed_ms);
-    task_thread_.task_runner()->PostTask(
-        FROM_HERE, base::Bind(&MidiServiceWinImpl::ReceiveMidiDataOnTaskThread,
-                              base::Unretained(this), state->port_index, data,
-                              event_time));
-  }
-
-  void OnMidiInLongDataOnMultimediaThread(HMIDIIN midi_in_handle,
-                                          DWORD_PTR param1,
-                                          DWORD_PTR param2) {
-    auto state = GetInputDeviceFromHandle(midi_in_handle);
-    if (!state)
-      return;
-    MIDIHDR* header = reinterpret_cast<MIDIHDR*>(param1);
-    const DWORD elapsed_ms = param2;
-    MMRESULT result = MMSYSERR_NOERROR;
-    if (destructor_started) {
-      if (state->midi_header &&
-          (state->midi_header->dwFlags & MHDR_PREPARED) == MHDR_PREPARED) {
-        result =
-            midiInUnprepareHeader(state->midi_handle, state->midi_header.get(),
-                                  sizeof(*state->midi_header));
-        DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-            << "Failed to uninitialize input buffer: "
-            << GetInErrorMessage(result);
-      }
-      return;
-    }
-    if (header->dwBytesRecorded > 0) {
-      const uint8_t* src = reinterpret_cast<const uint8_t*>(header->lpData);
-      std::vector<uint8_t> data;
-      data.assign(src, src + header->dwBytesRecorded);
-      // MIM_DATA/MIM_LONGDATA message treats the time when midiInStart() is
-      // called as the origin of |elapsed_ms|.
-      // http://msdn.microsoft.com/en-us/library/windows/desktop/dd757284.aspx
-      // http://msdn.microsoft.com/en-us/library/windows/desktop/dd757286.aspx
-      const base::TimeTicks event_time =
-          state->start_time + base::TimeDelta::FromMilliseconds(elapsed_ms);
-      task_thread_.task_runner()->PostTask(
-          FROM_HERE,
-          base::Bind(&MidiServiceWinImpl::ReceiveMidiDataOnTaskThread,
-                     base::Unretained(this), state->port_index, data,
-                     event_time));
-    }
-    result = midiInAddBuffer(state->midi_handle, header, sizeof(*header));
-    DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-        << "Failed to attach input buffer: " << GetInErrorMessage(result)
-        << "port number:" << state->port_index;
-  }
-
-  void OnMidiInCloseOnMultimediaThread(HMIDIIN midi_in_handle) {
-    auto state = GetInputDeviceFromHandle(midi_in_handle);
-    if (!state)
-      return;
-    const uint32_t port_number = state->port_index;
-    const auto device_info(state->device_info);
-    {
-      base::AutoLock auto_lock(input_ports_lock_);
-      input_device_map_.erase(state->midi_handle);
-      input_ports_[port_number] = nullptr;
-      input_ports_ages_[port_number] += 1;
-      unused_input_ports_[device_info].push(port_number);
-    }
-    task_thread_.task_runner()->PostTask(
-        FROM_HERE,
-        base::Bind(&MidiServiceWinImpl::SetInputPortStateOnTaskThread,
-                   base::Unretained(this), port_number,
-                   PortState::DISCONNECTED));
-  }
-
-  static void CALLBACK
-  OnMidiOutEventOnMainlyMultimediaThread(HMIDIOUT midi_out_handle,
-                                         UINT message,
-                                         DWORD_PTR instance,
-                                         DWORD_PTR param1,
-                                         DWORD_PTR param2) {
-    MidiServiceWinImpl* self = reinterpret_cast<MidiServiceWinImpl*>(instance);
-    if (!self)
-      return;
-    switch (message) {
-      case MOM_OPEN:
-        self->OnMidiOutOpen(midi_out_handle, param1, param2);
-        break;
-      case MOM_DONE:
-        self->OnMidiOutDoneOnMultimediaThread(midi_out_handle, param1);
-        break;
-      case MOM_CLOSE:
-        self->OnMidiOutCloseOnMultimediaThread(midi_out_handle);
-        break;
-    }
-  }
-
-  void OnMidiOutOpen(HMIDIOUT midi_out_handle,
-                     DWORD_PTR param1,
-                     DWORD_PTR param2) {
-    UINT device_id = 0;
-    MMRESULT result = midiOutGetID(midi_out_handle, &device_id);
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "midiOutGetID failed: " << GetOutErrorMessage(result);
-      return;
-    }
-    MIDIOUTCAPS2W caps = {};
-    result = midiOutGetDevCaps(
-        device_id, reinterpret_cast<LPMIDIOUTCAPSW>(&caps), sizeof(caps));
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "midiInGetDevCaps failed: " << GetOutErrorMessage(result);
-      return;
-    }
-    auto state =
-        make_scoped_refptr(new MidiOutputDeviceState(MidiDeviceInfo(caps)));
-    state->midi_handle = midi_out_handle;
-    const auto& state_device_info = state->device_info;
-    if (IsUnsupportedDevice(state_device_info)) {
-      task_thread_.task_runner()->PostTask(
-          FROM_HERE, base::Bind(&CloseOutputPortOnTaskThread, midi_out_handle));
-      return;
-    }
-    bool add_new_port = false;
-    uint32_t port_number = 0;
-    {
-      base::AutoLock auto_lock(output_ports_lock_);
-      const auto it = unused_output_ports_.find(state_device_info);
-      if (it == unused_output_ports_.end()) {
-        port_number = static_cast<uint32_t>(output_ports_.size());
-        add_new_port = true;
-        output_ports_.push_back(nullptr);
-        output_ports_ages_.push_back(0);
-      } else {
-        port_number = it->second.top();
-        it->second.pop();
-        if (it->second.empty())
-          unused_output_ports_.erase(it);
-      }
-      output_ports_[port_number] = state;
-      output_ports_ages_[port_number] += 1;
-      output_device_map_[output_ports_[port_number]->midi_handle] =
-          output_ports_[port_number];
-      output_ports_[port_number]->port_index = port_number;
-      output_ports_[port_number]->port_age = output_ports_ages_[port_number];
-    }
-    if (add_new_port) {
-      const MidiPortInfo port_info(
-          // TODO(toyoshim): Use a hash ID insted. crbug.com/467448
-          base::IntToString(static_cast<int>(port_number)),
-          GetManufacturerName(state_device_info),
-          base::WideToUTF8(state_device_info.product_name),
-          MmversionToString(state_device_info.driver_version),
-          PortState::OPENED);
-      task_thread_.task_runner()->PostTask(
-          FROM_HERE, base::Bind(&MidiServiceWinImpl::AddOutputPortOnTaskThread,
-                                base::Unretained(this), port_info));
-    } else {
-      task_thread_.task_runner()->PostTask(
-          FROM_HERE,
-          base::Bind(&MidiServiceWinImpl::SetOutputPortStateOnTaskThread,
-                     base::Unretained(this), port_number,
-                     PortState::CONNECTED));
-    }
-  }
-
-  void OnMidiOutDoneOnMultimediaThread(HMIDIOUT midi_out_handle,
-                                       DWORD_PTR param1) {
-    auto state = GetOutputDeviceFromHandle(midi_out_handle);
-    if (!state)
-      return;
-    // Take ownership of the MIDIHDR object.
-    ScopedMIDIHDR header(reinterpret_cast<MIDIHDR*>(param1));
-    if (!header)
-      return;
-    MMRESULT result = midiOutUnprepareHeader(state->midi_handle, header.get(),
-                                             sizeof(*header));
-    DLOG_IF(ERROR, result != MMSYSERR_NOERROR)
-        << "Failed to uninitialize output buffer: "
-        << GetOutErrorMessage(result);
-  }
-
-  void OnMidiOutCloseOnMultimediaThread(HMIDIOUT midi_out_handle) {
-    auto state = GetOutputDeviceFromHandle(midi_out_handle);
-    if (!state)
-      return;
-    const uint32_t port_number = state->port_index;
-    const auto device_info(state->device_info);
-    {
-      base::AutoLock auto_lock(output_ports_lock_);
-      output_device_map_.erase(state->midi_handle);
-      output_ports_[port_number] = nullptr;
-      output_ports_ages_[port_number] += 1;
-      unused_output_ports_[device_info].push(port_number);
-      state->closed = true;
-    }
-    task_thread_.task_runner()->PostTask(
-        FROM_HERE,
-        base::Bind(&MidiServiceWinImpl::SetOutputPortStateOnTaskThread,
-                   base::Unretained(this), port_number,
-                   PortState::DISCONNECTED));
-  }
-
-  /////////////////////////////////////////////////////////////////////////////
-  // Callbacks on the sender thread.
-  /////////////////////////////////////////////////////////////////////////////
-
-  void AssertOnSenderThread() {
-    DCHECK_EQ(sender_thread_.GetThreadId(), base::PlatformThread::CurrentId());
-  }
-
-  void SendOnSenderThread(uint32_t port_number,
-                          uint64_t port_age,
-                          const std::vector<uint8_t>& data,
-                          base::TimeTicks time) {
-    AssertOnSenderThread();
-    if (destructor_started) {
-      LOG(ERROR) << "ThreadSafeSendData failed because MidiServiceWinImpl is "
-                    "being destructed. port: " << port_number;
-    }
-    auto state = GetOutputDeviceFromPort(port_number);
-    if (!state) {
-      LOG(ERROR) << "ThreadSafeSendData failed due to an invalid port number. "
-                 << "port: " << port_number;
-      return;
-    }
-    if (state->closed) {
-      LOG(ERROR)
-          << "ThreadSafeSendData failed because target port is already closed."
-          << "port: " << port_number;
-      return;
-    }
-    if (state->port_age != port_age) {
-      LOG(ERROR)
-          << "ThreadSafeSendData failed because target port is being closed."
-          << "port: " << port_number << "expected port age: " << port_age
-          << "actual port age: " << state->port_age;
-    }
-
-    // MIDI Running status must be filtered out.
-    MidiMessageQueue message_queue(false);
-    message_queue.Add(data);
-    std::vector<uint8_t> message;
-    while (true) {
-      if (destructor_started)
-        break;
-      if (state->closed)
-        break;
-      message_queue.Get(&message);
-      if (message.empty())
-        break;
-      // SendShortMidiMessageInternal can send a MIDI message up to 3 bytes.
-      if (message.size() <= 3)
-        SendShortMidiMessageInternal(state->midi_handle, message);
-      else
-        SendLongMidiMessageInternal(state->midi_handle, message);
-    }
-  }
-
-  /////////////////////////////////////////////////////////////////////////////
-  // Callbacks on the task thread.
-  /////////////////////////////////////////////////////////////////////////////
-
-  void AssertOnTaskThread() {
-    DCHECK_EQ(task_thread_.GetThreadId(), base::PlatformThread::CurrentId());
-  }
-
-  void UpdateDeviceListOnTaskThread() {
-    AssertOnTaskThread();
-    const UINT num_in_devices = midiInGetNumDevs();
-    for (UINT device_id = 0; device_id < num_in_devices; ++device_id) {
-      // Here we use |CALLBACK_FUNCTION| to subscribe MIM_DATA, MIM_LONGDATA,
-      // MIM_OPEN, and MIM_CLOSE events.
-      // - MIM_DATA: This is the only way to get a short MIDI message with
-      //     timestamp information.
-      // - MIM_LONGDATA: This is the only way to get a long MIDI message with
-      //     timestamp information.
-      // - MIM_OPEN: This event is sent the input device is opened. Note that
-      //     this message is called on the caller thread.
-      // - MIM_CLOSE: This event is sent when 1) midiInClose() is called, or 2)
-      //     the MIDI device becomes unavailable for some reasons, e.g., the
-      //     cable is disconnected. As for the former case, HMIDIOUT will be
-      //     invalidated soon after the callback is finished. As for the later
-      //     case, however, HMIDIOUT continues to be valid until midiInClose()
-      //     is called.
-      HMIDIIN midi_handle = kInvalidMidiInHandle;
-      const MMRESULT result = midiInOpen(
-          &midi_handle, device_id,
-          reinterpret_cast<DWORD_PTR>(&OnMidiInEventOnMainlyMultimediaThread),
-          reinterpret_cast<DWORD_PTR>(this), CALLBACK_FUNCTION);
-      DLOG_IF(ERROR, result != MMSYSERR_NOERROR && result != MMSYSERR_ALLOCATED)
-          << "Failed to open output device. "
-          << " id: " << device_id << " message: " << GetInErrorMessage(result);
-    }
-
-    const UINT num_out_devices = midiOutGetNumDevs();
-    for (UINT device_id = 0; device_id < num_out_devices; ++device_id) {
-      // Here we use |CALLBACK_FUNCTION| to subscribe MOM_DONE, MOM_OPEN, and
-      // MOM_CLOSE events.
-      // - MOM_DONE: SendLongMidiMessageInternal() relies on this event to clean
-      //     up the backing store where a long MIDI message is stored.
-      // - MOM_OPEN: This event is sent the output device is opened. Note that
-      //     this message is called on the caller thread.
-      // - MOM_CLOSE: This event is sent when 1) midiOutClose() is called, or 2)
-      //     the MIDI device becomes unavailable for some reasons, e.g., the
-      //     cable is disconnected. As for the former case, HMIDIOUT will be
-      //     invalidated soon after the callback is finished. As for the later
-      //     case, however, HMIDIOUT continues to be valid until midiOutClose()
-      //     is called.
-      HMIDIOUT midi_handle = kInvalidMidiOutHandle;
-      const MMRESULT result = midiOutOpen(
-          &midi_handle, device_id,
-          reinterpret_cast<DWORD_PTR>(&OnMidiOutEventOnMainlyMultimediaThread),
-          reinterpret_cast<DWORD_PTR>(this), CALLBACK_FUNCTION);
-      DLOG_IF(ERROR, result != MMSYSERR_NOERROR && result != MMSYSERR_ALLOCATED)
-          << "Failed to open output device. "
-          << " id: " << device_id << " message: " << GetOutErrorMessage(result);
-    }
-  }
-
-  void StartInputDeviceOnTaskThread(HMIDIIN midi_in_handle) {
-    AssertOnTaskThread();
-    auto state = GetInputDeviceFromHandle(midi_in_handle);
-    if (!state)
-      return;
-    MMRESULT result =
-        midiInPrepareHeader(state->midi_handle, state->midi_header.get(),
-                            sizeof(*state->midi_header));
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "Failed to initialize input buffer: "
-                  << GetInErrorMessage(result);
-      return;
-    }
-    result = midiInAddBuffer(state->midi_handle, state->midi_header.get(),
-                             sizeof(*state->midi_header));
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "Failed to attach input buffer: "
-                  << GetInErrorMessage(result);
-      return;
-    }
-    result = midiInStart(state->midi_handle);
-    if (result != MMSYSERR_NOERROR) {
-      DLOG(ERROR) << "Failed to start input port: "
-                  << GetInErrorMessage(result);
-      return;
-    }
-    state->start_time = base::TimeTicks::Now();
-    state->start_time_initialized = true;
-  }
-
-  void CompleteInitializationOnTaskThread(Result result) {
-    AssertOnTaskThread();
-    delegate_->OnCompleteInitialization(result);
-  }
-
-  void ReceiveMidiDataOnTaskThread(uint32_t port_index,
-                                   std::vector<uint8_t> data,
-                                   base::TimeTicks time) {
-    AssertOnTaskThread();
-    delegate_->OnReceiveMidiData(port_index, data, time);
-  }
-
-  void AddInputPortOnTaskThread(MidiPortInfo info) {
-    AssertOnTaskThread();
-    delegate_->OnAddInputPort(info);
-  }
-
-  void AddOutputPortOnTaskThread(MidiPortInfo info) {
-    AssertOnTaskThread();
-    delegate_->OnAddOutputPort(info);
-  }
-
-  void SetInputPortStateOnTaskThread(uint32_t port_index, PortState state) {
-    AssertOnTaskThread();
-    delegate_->OnSetInputPortState(port_index, state);
-  }
-
-  void SetOutputPortStateOnTaskThread(uint32_t port_index, PortState state) {
-    AssertOnTaskThread();
-    delegate_->OnSetOutputPortState(port_index, state);
-  }
-
-  /////////////////////////////////////////////////////////////////////////////
-  // Fields:
-  /////////////////////////////////////////////////////////////////////////////
-
-  // Does not take ownership.
-  MidiServiceWinDelegate* delegate_;
-
-  base::ThreadChecker thread_checker_;
-
-  base::Thread sender_thread_;
-  base::Thread task_thread_;
-
-  base::Lock input_ports_lock_;
-  base::hash_map<HMIDIIN, scoped_refptr<MidiInputDeviceState>>
-      input_device_map_;                // GUARDED_BY(input_ports_lock_)
-  PortNumberCache unused_input_ports_;  // GUARDED_BY(input_ports_lock_)
-  std::vector<scoped_refptr<MidiInputDeviceState>>
-      input_ports_;                       // GUARDED_BY(input_ports_lock_)
-  std::vector<uint64_t> input_ports_ages_;  // GUARDED_BY(input_ports_lock_)
-
-  base::Lock output_ports_lock_;
-  base::hash_map<HMIDIOUT, scoped_refptr<MidiOutputDeviceState>>
-      output_device_map_;                // GUARDED_BY(output_ports_lock_)
-  PortNumberCache unused_output_ports_;  // GUARDED_BY(output_ports_lock_)
-  std::vector<scoped_refptr<MidiOutputDeviceState>>
-      output_ports_;                       // GUARDED_BY(output_ports_lock_)
-  std::vector<uint64_t> output_ports_ages_;  // GUARDED_BY(output_ports_lock_)
-
-  // True if one thread reached MidiServiceWinImpl::~MidiServiceWinImpl(). Note
-  // that MidiServiceWinImpl::~MidiServiceWinImpl() is blocked until
-  // |sender_thread_|, and |task_thread_| are stopped.
-  // This flag can be used as the signal that when background tasks must be
-  // interrupted.
-  // TODO(toyoshim): Use std::atomic<bool> when it is allowed.
-  volatile bool destructor_started;
-
-  DISALLOW_COPY_AND_ASSIGN(MidiServiceWinImpl);
-};
-
-}  // namespace
-
-MidiManagerWin::MidiManagerWin(MidiService* service) : MidiManager(service) {}
-
-MidiManagerWin::~MidiManagerWin() {
-}
-
-void MidiManagerWin::StartInitialization() {
-  midi_service_.reset(new MidiServiceWinImpl);
-  // Note that |CompleteInitialization()| will be called from the callback.
-  midi_service_->InitializeAsync(this);
-}
-
-void MidiManagerWin::Finalize() {
-  midi_service_.reset();
-}
-
-void MidiManagerWin::DispatchSendMidiData(MidiManagerClient* client,
-                                          uint32_t port_index,
-                                          const std::vector<uint8_t>& data,
-                                          double timestamp) {
-  if (!midi_service_)
-    return;
-
-  base::TimeTicks time_to_send = base::TimeTicks::Now();
-  if (timestamp != 0.0) {
-    time_to_send =
-        base::TimeTicks() + base::TimeDelta::FromMicroseconds(
-                                timestamp * base::Time::kMicrosecondsPerSecond);
-  }
-  midi_service_->SendMidiDataAsync(port_index, data, time_to_send);
-
-  // TOOD(toyoshim): This calculation should be done when the date is actually
-  // sent.
-  client->AccumulateMidiBytesSent(data.size());
-}
-
-void MidiManagerWin::OnCompleteInitialization(Result result) {
-  CompleteInitialization(result);
-}
-
-void MidiManagerWin::OnAddInputPort(MidiPortInfo info) {
-  AddInputPort(info);
-}
-
-void MidiManagerWin::OnAddOutputPort(MidiPortInfo info) {
-  AddOutputPort(info);
-}
-
-void MidiManagerWin::OnSetInputPortState(uint32_t port_index, PortState state) {
-  SetInputPortState(port_index, state);
-}
-
-void MidiManagerWin::OnSetOutputPortState(uint32_t port_index,
-                                          PortState state) {
-  SetOutputPortState(port_index, state);
-}
-
-void MidiManagerWin::OnReceiveMidiData(uint32_t port_index,
-                                       const std::vector<uint8_t>& data,
-                                       base::TimeTicks time) {
-  ReceiveMidiData(port_index, &data[0], data.size(), time);
-}
-
-MidiManager* MidiManager::Create(MidiService* service) {
-  if (base::FeatureList::IsEnabled(features::kMidiManagerWinrt) &&
-      base::win::GetVersion() >= base::win::VERSION_WIN10)
-    return new MidiManagerWinrt(service);
-  if (base::FeatureList::IsEnabled(features::kMidiManagerDynamicInstantiation))
-    return new DynamicallyInitializedMidiManagerWin(service);
-  return new MidiManagerWin(service);
-}
-
-}  // namespace midi
diff --git a/media/midi/midi_manager_win.h b/media/midi/midi_manager_win.h
deleted file mode 100644
index 123bdd0..0000000
--- a/media/midi/midi_manager_win.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2013 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.
-
-#ifndef MEDIA_MIDI_MIDI_MANAGER_WIN_H_
-#define MEDIA_MIDI_MIDI_MANAGER_WIN_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/threading/thread.h"
-#include "base/time/time.h"
-#include "media/midi/midi_manager.h"
-#include "media/midi/midi_service.mojom.h"
-
-namespace midi {
-
-class MidiService;
-
-class MidiServiceWinDelegate {
- public:
-  virtual ~MidiServiceWinDelegate() {}
-  virtual void OnCompleteInitialization(mojom::Result result) = 0;
-  virtual void OnAddInputPort(MidiPortInfo info) = 0;
-  virtual void OnAddOutputPort(MidiPortInfo info) = 0;
-  virtual void OnSetInputPortState(uint32_t port_index,
-                                   mojom::PortState state) = 0;
-  virtual void OnSetOutputPortState(uint32_t port_index,
-                                    mojom::PortState state) = 0;
-  virtual void OnReceiveMidiData(uint32_t port_index,
-                                 const std::vector<uint8_t>& data,
-                                 base::TimeTicks time) = 0;
-};
-
-class MidiServiceWin {
- public:
-  virtual ~MidiServiceWin() {}
-  // This method may return before the initialization is completed.
-  virtual void InitializeAsync(MidiServiceWinDelegate* delegate) = 0;
-  // This method may return before the specified data is actually sent.
-  virtual void SendMidiDataAsync(uint32_t port_number,
-                                 const std::vector<uint8_t>& data,
-                                 base::TimeTicks time) = 0;
-};
-
-class MidiManagerWin final : public MidiManager, public MidiServiceWinDelegate {
- public:
-  explicit MidiManagerWin(MidiService* service);
-  ~MidiManagerWin() override;
-
-  // MidiManager overrides:
-  void StartInitialization() final;
-  void Finalize() final;
-  void DispatchSendMidiData(MidiManagerClient* client,
-                            uint32_t port_index,
-                            const std::vector<uint8_t>& data,
-                            double timestamp) final;
-
-  // MidiServiceWinDelegate overrides:
-  void OnCompleteInitialization(mojom::Result result) final;
-  void OnAddInputPort(MidiPortInfo info) final;
-  void OnAddOutputPort(MidiPortInfo info) final;
-  void OnSetInputPortState(uint32_t port_index, mojom::PortState state) final;
-  void OnSetOutputPortState(uint32_t port_index, mojom::PortState state) final;
-  void OnReceiveMidiData(uint32_t port_index,
-                         const std::vector<uint8_t>& data,
-                         base::TimeTicks time) final;
-
- private:
-  std::unique_ptr<MidiServiceWin> midi_service_;
-  DISALLOW_COPY_AND_ASSIGN(MidiManagerWin);
-};
-
-}  // namespace midi
-
-#endif  // MEDIA_MIDI_MIDI_MANAGER_WIN_H_
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index 529c49d..fb3d1dd 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -110,7 +110,7 @@
     include_dirs += [ "//third_party/skia/include/utils/ios" ]
   }
 
-  defines = [ "SK_IGNORE_GASP_VERSION_CHECK" ]
+  defines = []
 
   if (is_component_build) {
     defines += [ "SKIA_IMPLEMENTATION=1" ]
diff --git a/third_party/WebKit/LayoutTests/animations/animation-css-rule-types-expected.txt b/third_party/WebKit/LayoutTests/animations/animation-css-rule-types-expected.txt
index 5f204042..4cffd7ac 100644
--- a/third_party/WebKit/LayoutTests/animations/animation-css-rule-types-expected.txt
+++ b/third_party/WebKit/LayoutTests/animations/animation-css-rule-types-expected.txt
@@ -5,8 +5,6 @@
 
 PASS ruleType is 7
 PASS ruleType is 8
-PASS ruleType is 7
-PASS ruleType is 8
 If we got to this point then we did not crash and the test has passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace-expected.txt b/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace-expected.txt
index 7c46bfc..634f0e60 100644
--- a/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace-expected.txt
+++ b/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace-expected.txt
@@ -1,2 +1,2 @@
-Tests parsing the @-webkit-keyframes rule without closing brace. "User agents must close all open constructs ... at the end of the style sheet." (http://www.w3.org/TR/CSS21/syndata.html#parsing-errors). So it must be parsed as if all braces are closed.
+Tests parsing the @keyframes rule without closing brace. "User agents must close all open constructs ... at the end of the style sheet." (http://www.w3.org/TR/CSS21/syndata.html#parsing-errors). So it must be parsed as if all braces are closed.
 PASS: keyframes rule has length 4
diff --git a/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace.html b/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace.html
index 1c70bcf..6f320d3 100644
--- a/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace.html
+++ b/third_party/WebKit/LayoutTests/animations/keyframe-autoclose-brace.html
@@ -6,7 +6,7 @@
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Tests CSS parser autocloses braces.</title>
   <style type="text/css" media="screen">
-    @-webkit-keyframes foo {
+    @keyframes foo {
         from { left: 100px; }
         40%  { left: 200px; }
         60%  { left: 200px; }
@@ -18,7 +18,7 @@
         var ss = document.styleSheets;
         for (var i = 0; i < ss.length; ++i) {
             for (var j = 0; j < ss[i].cssRules.length; ++j) {
-                if (ss[i].cssRules[j].type == window.CSSRule.WEBKIT_KEYFRAMES_RULE && ss[i].cssRules[j].name == rule)
+                if (ss[i].cssRules[j].type == window.CSSRule.KEYFRAMES_RULE && ss[i].cssRules[j].name == rule)
                     return ss[i].cssRules[j];
             }
         }
@@ -41,7 +41,7 @@
   </script>
 </head>
 <body onload="test()">
-<div>Tests parsing the @-webkit-keyframes rule without closing brace. &quot;User agents must close all open constructs ... at the end of the style sheet.&quot;
+<div>Tests parsing the @keyframes rule without closing brace. &quot;User agents must close all open constructs ... at the end of the style sheet.&quot;
 (<a href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors">http://www.w3.org/TR/CSS21/syndata.html#parsing-errors</a>). So it must be parsed as if
 all braces are closed.</div>
 <div id="console"></div>
diff --git a/third_party/WebKit/LayoutTests/animations/keyframes-rule-expected.txt b/third_party/WebKit/LayoutTests/animations/keyframes-rule-expected.txt
index 7f65905d..9d8a6799 100644
--- a/third_party/WebKit/LayoutTests/animations/keyframes-rule-expected.txt
+++ b/third_party/WebKit/LayoutTests/animations/keyframes-rule-expected.txt
@@ -6,16 +6,16 @@
 Constants
 PASS CSSKeyframeRule exists on Window object
 PASS CSSKeyframesRule exists on Window object
-PASS WEBKIT_KEYFRAME_RULE exists on Window.CSSRule object
-PASS WEBKIT_KEYFRAMES_RULE exists on Window.CSSRule object
+PASS WEBKIT_KEYFRAME_RULE does not exist on Window.CSSRule object
+PASS WEBKIT_KEYFRAMES_RULE does not exist on Window.CSSRule object
 PASS KEYFRAME_RULE exists on Window.CSSRule object
 PASS KEYFRAMES_RULE exists on Window.CSSRule object
 
 Basic queries
-PASS keyframes1.type is window.CSSRule.WEBKIT_KEYFRAMES_RULE
+PASS keyframes1.type is window.CSSRule.KEYFRAMES_RULE
 PASS keyframes1.name is 'test1'
 PASS rules1.length is 2
-PASS rules1.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules1.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules1.item(0).cssText is '0% { left: 10px; }'
 PASS rules1.item(1).cssText is '100% { left: 20px; }'
 
@@ -32,10 +32,10 @@
 PASS rules2.item(5).cssText is '10% { left: 30px; }'
 
 Keys
-PASS keyframes3.type is window.CSSRule.WEBKIT_KEYFRAMES_RULE
+PASS keyframes3.type is window.CSSRule.KEYFRAMES_RULE
 PASS keyframes3.name is 'test3'
 PASS rules3.length is 3
-PASS rules3.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules3.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules3.item(0).keyText is '0%'
 PASS rules3.item(1).keyText is '50%, 60%'
 PASS rules3.item(2).keyText is '90%, 100%'
@@ -46,18 +46,18 @@
 Find a rule
 PASS rules3.item(0).style is an instance of CSSStyleDeclaration
 PASS rules3.item(0).style.length is 1
-PASS rule.type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rule.type is window.CSSRule.KEYFRAME_RULE
 PASS rule.cssText is '0% { left: 10px; }'
 
 Find a rule with multiple key values
-PASS rule.type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rule.type is window.CSSRule.KEYFRAME_RULE
 PASS rule.cssText is '50%, 60% { left: 30px; }'
 
 Find a rule using from and to
-PASS keyframes4.type is window.CSSRule.WEBKIT_KEYFRAMES_RULE
-PASS rule.type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS keyframes4.type is window.CSSRule.KEYFRAMES_RULE
+PASS rule.type is window.CSSRule.KEYFRAME_RULE
 PASS rule.cssText is '0% { left: 10px; }'
-PASS rule.type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rule.type is window.CSSRule.KEYFRAME_RULE
 PASS rule.cssText is '100% { left: 20px; }'
 
 Try to find a rule that doesn't exist
@@ -65,58 +65,58 @@
 
 Delete a rule
 PASS rules5.length is 2
-PASS rules5.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules5.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules5.item(0).keyText is '0%'
 PASS rules5.item(1).keyText is '90%, 100%'
 
 Delete a from rule
 PASS rules6.length is 2
-PASS rules6.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules6.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules6.item(0).keyText is '50%'
 PASS rules6.item(1).keyText is '100%'
 
 Delete a rule that doesn't exist
 PASS rules7.length is 2
-PASS rules7.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules7.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules7.item(0).keyText is '0%'
 PASS rules7.item(1).keyText is '90%, 100%'
 
 Set a keyframe key
 PASS rules8.length is 2
-PASS rules8.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules8.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules8.item(0).keyText is '70%'
 PASS rules8.item(1).keyText is '90%, 100%'
 
 Set a keyframe key with 'from'
 PASS rules9.length is 2
-PASS rules9.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules9.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules9.item(0).keyText is '0%'
 PASS rules9.item(1).keyText is '90%, 100%'
 
 Set a keyframe key with multiple values
 PASS rules10.length is 2
-PASS rules10.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules10.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules10.item(0).keyText is '0%, 10%, 0%, 20%, 30%, 100%'
 PASS rules10.item(1).keyText is '90%, 100%'
 
 Set a keyframe key with an out-of-range value
 PASS rules11.item(0).keyText = "40%, -50%, 60%"; threw exception SyntaxError: Failed to set the 'keyText' property on 'CSSKeyframeRule': The key '40%, -50%, 60%' is invalid and cannot be parsed.
 PASS rules11.length is 2
-PASS rules11.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules11.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules11.item(0).keyText is '0%'
 PASS rules11.item(1).keyText is '90%, 100%'
 
 Set a keyframe key with an invalid value
 PASS rules12.item(0).keyText = "foo"; threw exception SyntaxError: Failed to set the 'keyText' property on 'CSSKeyframeRule': The key 'foo' is invalid and cannot be parsed.
 PASS rules12.length is 2
-PASS rules12.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules12.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules12.item(0).keyText is '0%'
 PASS rules12.item(1).keyText is '90%, 100%'
 
 Set a keyframe key with a null value
 PASS rules13.item(0).keyText = null; threw exception SyntaxError: Failed to set the 'keyText' property on 'CSSKeyframeRule': The key 'null' is invalid and cannot be parsed.
 PASS rules13.length is 2
-PASS rules13.item(0).type is window.CSSRule.WEBKIT_KEYFRAME_RULE
+PASS rules13.item(0).type is window.CSSRule.KEYFRAME_RULE
 PASS rules13.item(0).keyText is '0%'
 PASS rules13.item(1).keyText is '90%, 100%'
 PASS successfullyParsed is true
diff --git a/third_party/WebKit/LayoutTests/animations/keyframes-rule.html b/third_party/WebKit/LayoutTests/animations/keyframes-rule.html
index 9b652282..9a9d693 100644
--- a/third_party/WebKit/LayoutTests/animations/keyframes-rule.html
+++ b/third_party/WebKit/LayoutTests/animations/keyframes-rule.html
@@ -1,63 +1,63 @@
 <html>
 <head>
 <style type="text/css" media="screen">
-  @-webkit-keyframes test1 {
+  @keyframes test1 {
     from { left: 10px; }
     to { left: 20px; }
   }
-  @-webkit-keyframes test2 {
+  @keyframes test2 {
     from { left: 10px; }
     to { left: 20px; }
     30% { left: 30px; }
     60% { left: 60px; }
     20% { left: 50px; }
   }
-  @-webkit-keyframes test3 {
+  @keyframes test3 {
     0% { left: 10px; }
     50% , 60% { left: 30px; }
     -10% { left: 50px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test4 {
+  @keyframes test4 {
     from { left: 10px; }
     50% { left: 30px; }
     to { left: 20px; }
   }
-  @-webkit-keyframes test5 {
+  @keyframes test5 {
     0% { left: 10px; }
     50% , 60% { left: 30px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test6 {
+  @keyframes test6 {
     from { left: 10px; }
     50% { left: 30px; }
     to { left: 20px; }
   }
-  @-webkit-keyframes test7 {
+  @keyframes test7 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test8 {
+  @keyframes test8 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test9 {
+  @keyframes test9 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test10 {
+  @keyframes test10 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test11 {
+  @keyframes test11 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test12 {
+  @keyframes test12 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
-  @-webkit-keyframes test13 {
+  @keyframes test13 {
     0% { left: 10px; }
     90%, 100% { left: 20px; }
   }
@@ -81,14 +81,14 @@
     testFailed("CSSKeyframesRule does not exist on Window object");
 
 if (window.CSSRule.WEBKIT_KEYFRAME_RULE)
-    testPassed("WEBKIT_KEYFRAME_RULE exists on Window.CSSRule object");
+    testFailed("WEBKIT_KEYFRAME_RULE exists on Window.CSSRule object");
 else
-    testFailed("WEBKIT_KEYFRAME_RULE does not exist on Window.CSSRule object");
+    testPassed("WEBKIT_KEYFRAME_RULE does not exist on Window.CSSRule object");
 
 if (window.CSSRule.WEBKIT_KEYFRAMES_RULE)
-    testPassed("WEBKIT_KEYFRAMES_RULE exists on Window.CSSRule object");
+    testFailed("WEBKIT_KEYFRAMES_RULE exists on Window.CSSRule object");
 else
-    testFailed("WEBKIT_KEYFRAMES_RULE does not exist on Window.CSSRule object");
+    testPassed("WEBKIT_KEYFRAMES_RULE does not exist on Window.CSSRule object");
 
 if (window.CSSRule.KEYFRAME_RULE)
     testPassed("KEYFRAME_RULE exists on Window.CSSRule object");
@@ -104,12 +104,12 @@
 debug("Basic queries");
 
 var keyframes1 = document.styleSheets.item(0).cssRules.item(0);
-shouldBe("keyframes1.type", "window.CSSRule.WEBKIT_KEYFRAMES_RULE");
+shouldBe("keyframes1.type", "window.CSSRule.KEYFRAMES_RULE");
 shouldBe("keyframes1.name", "'test1'");
 
 var rules1 = keyframes1.cssRules;
 shouldBe("rules1.length", "2");
-shouldBe("rules1.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules1.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules1.item(0).cssText", "'0% { left: 10px; }'");
 shouldBe("rules1.item(1).cssText", "'100% { left: 20px; }'");
 
@@ -144,12 +144,12 @@
 debug("Keys");
 
 var keyframes3 = document.styleSheets.item(0).cssRules.item(2);
-shouldBe("keyframes3.type", "window.CSSRule.WEBKIT_KEYFRAMES_RULE");
+shouldBe("keyframes3.type", "window.CSSRule.KEYFRAMES_RULE");
 shouldBe("keyframes3.name", "'test3'");
 
 var rules3 = keyframes3.cssRules;
 shouldBe("rules3.length", "3");
-shouldBe("rules3.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules3.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules3.item(0).keyText", "'0%'");
 shouldBe("rules3.item(1).keyText", "'50%, 60%'");
 shouldBe("rules3.item(2).keyText", "'90%, 100%'");
@@ -166,7 +166,7 @@
 
 if (!rule)
   testFailed("Could not extract '0%' keyframe rule");
-shouldBe("rule.type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rule.type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rule.cssText", "'0% { left: 10px; }'");
 
 debug("");
@@ -175,21 +175,21 @@
 
 if (!rule)
   testFailed("Could not extract '50%,60%' keyframe rule");
-shouldBe("rule.type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rule.type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rule.cssText", "'50%, 60% { left: 30px; }'");
 
 debug("");
 debug("Find a rule using from and to");
 
 var keyframes4 = document.styleSheets.item(0).cssRules.item(3);
-shouldBe("keyframes4.type", "window.CSSRule.WEBKIT_KEYFRAMES_RULE");
+shouldBe("keyframes4.type", "window.CSSRule.KEYFRAMES_RULE");
 
 rule = keyframes4.findRule("From");
-shouldBe("rule.type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rule.type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rule.cssText", "'0% { left: 10px; }'");
 
 rule = keyframes4.findRule("TO");
-shouldBe("rule.type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rule.type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rule.cssText", "'100% { left: 20px; }'");
 
 debug("");
@@ -208,7 +208,7 @@
 keyframes5.deleteRule("50%,60%");
 var rules5 = keyframes5.cssRules;
 shouldBe("rules5.length", "2");
-shouldBe("rules5.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules5.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules5.item(0).keyText", "'0%'");
 shouldBe("rules5.item(1).keyText", "'90%, 100%'");
 
@@ -219,7 +219,7 @@
 keyframes6.deleteRule("0%");
 var rules6 = keyframes6.cssRules;
 shouldBe("rules6.length", "2");
-shouldBe("rules6.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules6.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules6.item(0).keyText", "'50%'");
 shouldBe("rules6.item(1).keyText", "'100%'");
 
@@ -230,7 +230,7 @@
 keyframes7.deleteRule("70%");
 var rules7 = keyframes7.cssRules;
 shouldBe("rules7.length", "2");
-shouldBe("rules7.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules7.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules7.item(0).keyText", "'0%'");
 shouldBe("rules7.item(1).keyText", "'90%, 100%'");
 
@@ -240,7 +240,7 @@
 var rules8 = document.styleSheets.item(0).cssRules.item(7).cssRules;
 rules8.item(0).keyText = "70%";
 shouldBe("rules8.length", "2");
-shouldBe("rules8.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules8.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules8.item(0).keyText", "'70%'");
 shouldBe("rules8.item(1).keyText", "'90%, 100%'");
 
@@ -250,7 +250,7 @@
 var rules9 = document.styleSheets.item(0).cssRules.item(8).cssRules;
 rules9.item(0).keyText = "from";
 shouldBe("rules9.length", "2");
-shouldBe("rules9.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules9.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules9.item(0).keyText", "'0%'");
 shouldBe("rules9.item(1).keyText", "'90%, 100%'");
 
@@ -260,7 +260,7 @@
 var rules10 = document.styleSheets.item(0).cssRules.item(9).cssRules;
 rules10.item(0).keyText = "0%, 10%, from, 20%, 30%, to";
 shouldBe("rules10.length", "2");
-shouldBe("rules10.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules10.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules10.item(0).keyText", "'0%, 10%, 0%, 20%, 30%, 100%'");
 shouldBe("rules10.item(1).keyText", "'90%, 100%'");
 
@@ -270,7 +270,7 @@
 var rules11 = document.styleSheets.item(0).cssRules.item(10).cssRules;
 shouldThrow('rules11.item(0).keyText = "40%, -50%, 60%";');
 shouldBe("rules11.length", "2");
-shouldBe("rules11.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules11.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules11.item(0).keyText", "'0%'");
 shouldBe("rules11.item(1).keyText", "'90%, 100%'");
 
@@ -280,7 +280,7 @@
 var rules12 = document.styleSheets.item(0).cssRules.item(11).cssRules;
 shouldThrow('rules12.item(0).keyText = "foo";');
 shouldBe("rules12.length", "2");
-shouldBe("rules12.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules12.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules12.item(0).keyText", "'0%'");
 shouldBe("rules12.item(1).keyText", "'90%, 100%'");
 
@@ -290,7 +290,7 @@
 var rules13 = document.styleSheets.item(0).cssRules.item(12).cssRules;
 shouldThrow('rules13.item(0).keyText = null;');
 shouldBe("rules13.length", "2");
-shouldBe("rules13.item(0).type", "window.CSSRule.WEBKIT_KEYFRAME_RULE");
+shouldBe("rules13.item(0).type", "window.CSSRule.KEYFRAME_RULE");
 shouldBe("rules13.item(0).keyText", "'0%'");
 shouldBe("rules13.item(1).keyText", "'90%, 100%'");
 
diff --git a/third_party/WebKit/LayoutTests/animations/script-tests/animation-css-rule-types.js b/third_party/WebKit/LayoutTests/animations/script-tests/animation-css-rule-types.js
index ba44e77..2d76dee 100644
--- a/third_party/WebKit/LayoutTests/animations/script-tests/animation-css-rule-types.js
+++ b/third_party/WebKit/LayoutTests/animations/script-tests/animation-css-rule-types.js
@@ -2,11 +2,7 @@
 'This test checks that the CSSRule RuleTypes for keyframe-related rules are what we expect.'
 );
 
-var ruleType = window.CSSRule.WEBKIT_KEYFRAMES_RULE;
-shouldBe("ruleType", "7");
-ruleType = window.CSSRule.WEBKIT_KEYFRAME_RULE;
-shouldBe("ruleType", "8");
-ruleType = window.CSSRule.KEYFRAMES_RULE;
+var ruleType = window.CSSRule.KEYFRAMES_RULE;
 shouldBe("ruleType", "7");
 ruleType = window.CSSRule.KEYFRAME_RULE;
 shouldBe("ruleType", "8");
diff --git a/third_party/WebKit/LayoutTests/fast/block/block-width-recalc-with-relative-height.html b/third_party/WebKit/LayoutTests/fast/block/block-width-recalc-with-relative-height.html
new file mode 100644
index 0000000..c8e7856
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/block/block-width-recalc-with-relative-height.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<style>
+#container {
+  display: inline-block;
+  height: 100%;
+}
+#middle {
+  height: 100%;
+}
+#stylefloat {
+  height: 100%;
+  float: left;
+}
+img {
+  display: block;
+  min-height: 100%;
+}
+</style>
+
+<p>
+Tests that recalculate block width when parent changes height
+when it has relative height and width auto.
+</p>
+
+<div style="height:100px">
+  <div id="parent1" style="height:100px">
+    <div id="container" data-expected-width=25>
+      <img src='data:image/svg+xml;utf8,<svg height="2px" width="1px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"></svg>'>
+    </div>
+  </div>
+</div>
+
+<div id="parent2" style="height:100px;">
+  <div id="stylefloat" data-expected-width=25>
+    <div id="middle" data-expected-width=25>
+      <img src='data:image/svg+xml;utf8,<svg height="2px" width="1px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"></svg>'>
+    </div>
+  </div>
+</div>
+
+<div id="results"></div>
+
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../../resources/check-layout-th.js"></script>
+<script>
+document.body.offsetTop;
+document.getElementById("parent1").style.height = "50px";
+checkLayout("#container", results);
+
+document.body.offsetTop;
+document.getElementById("parent2").style.height = "50px";
+checkLayout("#stylefloat", results);
+</script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers-expected.txt
index c7ffe7de..b48d365 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers-expected.txt
@@ -15,9 +15,9 @@
 FAIL document.styleSheets[0].cssRules[3].cssRules.foo should be bar (of type string). Was undefined (of type undefined).
 PASS document.styleSheets[0].cssRules[3].type is CSSRule.MEDIA_RULE
 FAIL document.styleSheets[0].cssRules[3].media.foo should be bar (of type string). Was undefined (of type undefined).
-PASS document.styleSheets[0].cssRules[4].type is CSSRule.WEBKIT_KEYFRAMES_RULE
+PASS document.styleSheets[0].cssRules[4].type is CSSRule.KEYFRAMES_RULE
 FAIL document.styleSheets[0].cssRules[4].cssRules.foo should be bar (of type string). Was undefined (of type undefined).
-PASS document.styleSheets[0].cssRules[4].cssRules[0].type is CSSRule.WEBKIT_KEYFRAME_RULE
+PASS document.styleSheets[0].cssRules[4].cssRules[0].type is CSSRule.KEYFRAME_RULE
 FAIL document.styleSheets[0].cssRules[4].cssRules[0].style.foo should be bar (of type string). Was undefined (of type undefined).
 PASS document.styleSheets[0].cssRules[5].type is CSSRule.PAGE_RULE
 FAIL document.styleSheets[0].cssRules[5].style.foo should be bar (of type string). Was undefined (of type undefined).
diff --git a/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers.html b/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers.html
index 9994a0b..c021bc2 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/StyleSheet/gc-rule-children-wrappers.html
@@ -45,8 +45,8 @@
     test("document.styleSheets[0].cssRules[2]", "CSSRule.FONT_FACE_RULE", "style");
     test("document.styleSheets[0].cssRules[3]", "CSSRule.MEDIA_RULE", "cssRules");
     test("document.styleSheets[0].cssRules[3]", "CSSRule.MEDIA_RULE", "media");
-    test("document.styleSheets[0].cssRules[4]", "CSSRule.WEBKIT_KEYFRAMES_RULE", "cssRules");
-    test("document.styleSheets[0].cssRules[4].cssRules[0]", "CSSRule.WEBKIT_KEYFRAME_RULE", "style");
+    test("document.styleSheets[0].cssRules[4]", "CSSRule.KEYFRAMES_RULE", "cssRules");
+    test("document.styleSheets[0].cssRules[4].cssRules[0]", "CSSRule.KEYFRAME_RULE", "style");
     test("document.styleSheets[0].cssRules[5]", "CSSRule.PAGE_RULE", "style");
 
 </script>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure-expected.txt
index acf39a37..e119301 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure-expected.txt
@@ -31,7 +31,7 @@
 PASS getSelection().baseOffset is 1
 PASS getSelection().extentNode is container
 PASS getSelection().extentOffset is 1
-PASS getSelection().type is 'Caret'
+PASS getSelection().type is "Range"
 
 Add a textarea element.
 
@@ -49,7 +49,7 @@
 PASS getSelection().baseOffset is 2
 PASS getSelection().extentNode is container
 PASS getSelection().extentOffset is 2
-PASS getSelection().type is 'Caret'
+PASS getSelection().type is "Range"
 
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure.html b/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure.html
index 0d47ee16..64aefe92 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/shadow-tree-exposure.html
@@ -50,7 +50,7 @@
 shouldBe("getSelection().baseOffset", "1");
 shouldBe("getSelection().extentNode", "container");
 shouldBe("getSelection().extentOffset", "1");
-shouldBe("getSelection().type", "'Caret'");
+shouldBeEqualToString("getSelection().type", "Range");
 
 debug("\nAdd a textarea element.\n");
 
@@ -75,7 +75,7 @@
 shouldBe("getSelection().baseOffset", "2");
 shouldBe("getSelection().extentNode", "container");
 shouldBe("getSelection().extentOffset", "2");
-shouldBe("getSelection().type", "'Caret'");
+shouldBeEqualToString("getSelection().type", "Range");
 
 document.body.removeChild(container);
 
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color-expected.html b/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color-expected.html
new file mode 100644
index 0000000..96c3d229
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color-expected.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+  margin: 50px;
+  border-width: 10px;
+  border-style: solid;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<div id="fixed-color" style="border-color: blue"></div>
+<div id="current-color" style="border-color: green"></div>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color-expected.txt
new file mode 100644
index 0000000..330fd1b6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color-expected.txt
@@ -0,0 +1,24 @@
+{
+  "layers": [
+    {
+      "name": "LayoutView #document",
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "paintInvalidations": [
+        {
+          "object": "LayoutBlockFlow DIV id='currentColor'",
+          "rect": [58, 220, 120, 120],
+          "reason": "style change"
+        }
+      ]
+    }
+  ],
+  "objectPaintInvalidations": [
+    {
+      "object": "LayoutBlockFlow DIV id='currentColor'",
+      "reason": "style change"
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color.html b/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color.html
new file mode 100644
index 0000000..725dab7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/border-current-color.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<style>
+div {
+  margin: 50px;
+  border-width: 10px;
+  border-style: solid;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<div id="fixedColor" style="border-color: blue"></div>
+<div id="currentColor" style="border-color: currentColor"></div>
+<script src="resources/text-based-repaint.js"></script>
+<script>
+function repaintTest() {
+  fixedColor.style.color = 'green';
+  currentColor.style.color = 'green';
+}
+onload = runRepaintAndPixelTest;
+</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/inline-outline-repaint-2-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/inline-outline-repaint-2-expected.txt
index 13de1b3b..c7e7daa 100644
--- a/third_party/WebKit/LayoutTests/paint/invalidation/inline-outline-repaint-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/inline-outline-repaint-2-expected.txt
@@ -9,7 +9,7 @@
         {
           "object": "LayoutInline SPAN",
           "rect": [210, -5, 50, 20],
-          "reason": "style change"
+          "reason": "outline"
         }
       ]
     }
@@ -17,11 +17,11 @@
   "objectPaintInvalidations": [
     {
       "object": "LayoutInline SPAN",
-      "reason": "style change"
+      "reason": "outline"
     },
     {
       "object": "InlineFlowBox",
-      "reason": "style change"
+      "reason": "outline"
     },
     {
       "object": "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color-expected.html b/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color-expected.html
new file mode 100644
index 0000000..9167306d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color-expected.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+div {
+  margin: 50px;
+  outline-width: 10px;
+  outline-style: solid;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<div style="outline-color: blue"></div>
+<div style="outline-color: green"></div>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color-expected.txt
new file mode 100644
index 0000000..89c17e7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color-expected.txt
@@ -0,0 +1,24 @@
+{
+  "layers": [
+    {
+      "name": "LayoutView #document",
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "paintInvalidations": [
+        {
+          "object": "LayoutBlockFlow DIV id='currentColor'",
+          "rect": [48, 190, 120, 120],
+          "reason": "style change"
+        }
+      ]
+    }
+  ],
+  "objectPaintInvalidations": [
+    {
+      "object": "LayoutBlockFlow DIV id='currentColor'",
+      "reason": "style change"
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color.html b/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color.html
new file mode 100644
index 0000000..addf9c8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/outline-current-color.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<style>
+div {
+  margin: 50px;
+  outline-width: 10px;
+  outline-style: solid;
+  width: 100px;
+  height: 100px;
+}
+</style>
+<div id="fixedColor" style="outline-color: blue"></div>
+<div id="currentColor" style="outline-color: currentColor"></div>
+<script src="resources/text-based-repaint.js"></script>
+<script>
+function repaintTest() {
+  fixedColor.style.color = 'green';
+  currentColor.style.color = 'green';
+}
+onload = runRepaintAndPixelTest;
+</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/table/cached-69296-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/table/cached-69296-expected.txt
index bc3b3da..a591684 100644
--- a/third_party/WebKit/LayoutTests/paint/invalidation/table/cached-69296-expected.txt
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/table/cached-69296-expected.txt
@@ -15,36 +15,6 @@
           "object": "LayoutTableRow TR id='row1'",
           "rect": [20, 20, 159, 50],
           "reason": "style change"
-        },
-        {
-          "object": "LayoutTableCell TD",
-          "rect": [126, 20, 54, 51],
-          "reason": "style change"
-        },
-        {
-          "object": "LayoutTableCell TD",
-          "rect": [126, 20, 54, 51],
-          "reason": "style change"
-        },
-        {
-          "object": "LayoutTableCell TD",
-          "rect": [73, 20, 54, 51],
-          "reason": "style change"
-        },
-        {
-          "object": "LayoutTableCell TD",
-          "rect": [73, 20, 54, 51],
-          "reason": "style change"
-        },
-        {
-          "object": "LayoutTableCell TD",
-          "rect": [20, 20, 54, 51],
-          "reason": "style change"
-        },
-        {
-          "object": "LayoutTableCell TD",
-          "rect": [20, 20, 54, 51],
-          "reason": "style change"
         }
       ]
     }
@@ -55,32 +25,8 @@
       "reason": "style change"
     },
     {
-      "object": "LayoutTableCell TD",
-      "reason": "style change"
-    },
-    {
-      "object": "LayoutTableCell TD",
-      "reason": "style change"
-    },
-    {
-      "object": "LayoutTableCell TD",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutTableRow TR id='row1'",
       "reason": "style change"
-    },
-    {
-      "object": "LayoutTableCell TD",
-      "reason": "style change"
-    },
-    {
-      "object": "LayoutTableCell TD",
-      "reason": "style change"
-    },
-    {
-      "object": "LayoutTableCell TD",
-      "reason": "style change"
     }
   ]
 }
diff --git a/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
index fb8f721..3feb1fb9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
@@ -7,8 +7,8 @@
       "drawsContent": true,
       "paintInvalidations": [
         {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 72, 840, 190],
+          "object": "LayoutText #text",
+          "rect": [10, 72, 836, 190],
           "reason": "style change"
         }
       ]
@@ -16,14 +16,6 @@
   ],
   "objectPaintInvalidations": [
     {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutText #text",
       "reason": "style change"
     },
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
index 3f6419f3..3feb1fb9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
@@ -7,11 +7,6 @@
       "drawsContent": true,
       "paintInvalidations": [
         {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 72, 840, 190],
-          "reason": "style change"
-        },
-        {
           "object": "LayoutText #text",
           "rect": [10, 72, 836, 190],
           "reason": "style change"
@@ -21,14 +16,6 @@
   ],
   "objectPaintInvalidations": [
     {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutText #text",
       "reason": "style change"
     },
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png
new file mode 100644
index 0000000..473eaa5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png
new file mode 100644
index 0000000..d3b706d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
similarity index 63%
rename from third_party/WebKit/LayoutTests/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
rename to third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
index 9119a14..6dcb8d97 100644
--- a/third_party/WebKit/LayoutTests/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
@@ -7,8 +7,8 @@
       "drawsContent": true,
       "paintInvalidations": [
         {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 68, 840, 190],
+          "object": "LayoutText #text",
+          "rect": [10, 68, 836, 190],
           "reason": "style change"
         }
       ]
@@ -16,14 +16,6 @@
   ],
   "objectPaintInvalidations": [
     {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutText #text",
       "reason": "style change"
     },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
index 1a4d13a0..d3d1ec8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
@@ -9,7 +9,7 @@
         {
           "object": "LayoutInline SPAN",
           "rect": [210, -5, 50, 20],
-          "reason": "style change"
+          "reason": "outline"
         },
         {
           "object": "LayoutText #text",
@@ -22,11 +22,11 @@
   "objectPaintInvalidations": [
     {
       "object": "LayoutInline SPAN",
-      "reason": "style change"
+      "reason": "outline"
     },
     {
       "object": "InlineFlowBox",
-      "reason": "style change"
+      "reason": "outline"
     },
     {
       "object": "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
similarity index 63%
copy from third_party/WebKit/LayoutTests/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
copy to third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
index 9119a14..6dcb8d97 100644
--- a/third_party/WebKit/LayoutTests/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
@@ -7,8 +7,8 @@
       "drawsContent": true,
       "paintInvalidations": [
         {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 68, 840, 190],
+          "object": "LayoutText #text",
+          "rect": [10, 68, 836, 190],
           "reason": "style change"
         }
       ]
@@ -16,14 +16,6 @@
   ],
   "objectPaintInvalidations": [
     {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutText #text",
       "reason": "style change"
     },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
index dbc8b68..50db6da 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -408,8 +408,6 @@
     attribute PAGE_RULE
     attribute STYLE_RULE
     attribute SUPPORTS_RULE
-    attribute WEBKIT_KEYFRAMES_RULE
-    attribute WEBKIT_KEYFRAME_RULE
     getter cssText
     getter parentRule
     getter parentStyleSheet
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png
index 850d202..48731362 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/css/color-correction-on-text-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png
index 361d50b..1512f442 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/css/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text-autosizing/layout-after-append-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text-autosizing/layout-after-append-expected.png
index b96900dc..5b58aa9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text-autosizing/layout-after-append-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text-autosizing/layout-after-append-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/001-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/001-expected.png
index 7744f63a..6af0e436 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/012-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/012-expected.png
index 1e82336..74adce0d7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/013-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/013-expected.png
index ce400c72..a41ee7d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/013-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/basic/013-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/bidi-img-alt-text-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/bidi-img-alt-text-expected.png
index 3ab4089..c6ae660 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/bidi-img-alt-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/bidi-img-alt-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/cg-fallback-bolding-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/cg-fallback-bolding-expected.png
index 2a8c898..20e668b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/cg-fallback-bolding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/cg-fallback-bolding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/emoticons-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/emoticons-expected.png
index 74e745e..7a3147be 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/emoticons-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/emoticons-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-avoid-ruby-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-avoid-ruby-expected.png
index 537781c..ef5014e 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-avoid-ruby-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-avoid-ruby-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-complex-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-complex-expected.png
index a9e9e8f..edc7805 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-complex-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-complex-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-overlap-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-overlap-expected.png
index d23d969..9cfe593 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-overlap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/emphasis-overlap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/fallback-for-custom-font-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/fallback-for-custom-font-expected.png
index 2961621..81e336d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/fallback-for-custom-font-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/fallback-for-custom-font-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/font-size-adjust-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/font-size-adjust-expected.png
index 66740ded..51d97be 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/font-size-adjust-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/font-size-adjust-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-600-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-600-expected.png
index a3e02c7f..e440861 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-600-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-600-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-variant-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-variant-expected.png
index 2c3a388..9872475f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-variant-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/font-weight-variant-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-CSS-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-CSS-expected.png
index d9a0ef1..214bf45 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-CSS-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-CSS-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-HTML-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-HTML-expected.png
index b3fa703..9fb7125 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-HTML-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-HTML-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-formatting-characters-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-formatting-characters-expected.png
index ea19c08..29ef000 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-formatting-characters-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/bidi-LDB-2-formatting-characters-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/plane2-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/plane2-expected.png
index b9182ecc..47153ea9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/international/plane2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/international/plane2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/line-initial-and-final-swashes-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/line-initial-and-final-swashes-expected.png
index 7a57b4c..18515e4c 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/line-initial-and-final-swashes-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/line-initial-and-final-swashes-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png
index e9e19c9..ad29657 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/shadow-translucent-fill-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/shadow-translucent-fill-expected.png
index 5599a21..90450ef0 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/shadow-translucent-fill-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/shadow-translucent-fill-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/same-script-different-lang-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/same-script-different-lang-expected.png
index b204dd0..603d5df 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/same-script-different-lang-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/same-script-different-lang-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/unicode-fallback-font-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/unicode-fallback-font-expected.png
index 2818db06..a03fce6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/unicode-fallback-font-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/unicode-fallback-font-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/vertical-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/vertical-surrogate-pair-expected.png
index 5e548b6a..21c2115a 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/vertical-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/vertical-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/002-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/002-expected.png
index 3967429..4e2e264 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/003-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/003-expected.png
index 3967429..4e2e264 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/004-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/004-expected.png
index e9cc003..7a73b2eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/005-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/005-expected.png
index e9cc003..7a73b2eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/006-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/006-expected.png
index 4982a1f1..9a91f3ec3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/007-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/007-expected.png
index a41c2e1..6f19a5c5 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/007-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/007-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/008-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/008-expected.png
index 8f72848..5d6faad 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/008-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/008-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/009-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/009-expected.png
index bdc1eb6..c6ab3e3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/009-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/009-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/010-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/010-expected.png
index e9cc003..7a73b2eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/011-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/011-expected.png
index e9cc003..7a73b2eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/012-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/012-expected.png
index ee3099d3..2320b82 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/013-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/013-expected.png
index 64938f9..3c54f2f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/013-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/013-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/014-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/014-expected.png
index f1c73ec..725502fb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/014-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/014-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/015-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/015-expected.png
index e9cc003..7a73b2eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/015-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/015-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/016-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/016-expected.png
index e9cc003..7a73b2eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/016-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/016-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/017-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/017-expected.png
index 40a43e7..b591722 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/017-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/017-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/018-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/018-expected.png
index e947beb..351cd9c7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/018-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/018-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/022-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/022-expected.png
index 2d6cba4..f9f601c 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/022-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/022-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/024-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/024-expected.png
index aab60c7..ebefeba 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/024-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/024-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-newline-box-test-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-newline-box-test-expected.png
index 1854740..7132b0d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-newline-box-test-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-newline-box-test-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png
index af94e977..be85479b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
index ea25821c..51f8ce3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
@@ -7,8 +7,8 @@
       "drawsContent": true,
       "paintInvalidations": [
         {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 72, 839, 190],
+          "object": "LayoutText #text",
+          "rect": [10, 72, 835, 190],
           "reason": "style change"
         }
       ]
@@ -16,14 +16,6 @@
   ],
   "objectPaintInvalidations": [
     {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutText #text",
       "reason": "style change"
     },
diff --git a/third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
similarity index 87%
rename from third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
rename to third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
index d613eeadd..ebacbef 100644
--- a/third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/inline-outline-repaint-2-expected.txt
@@ -9,7 +9,7 @@
         {
           "object": "LayoutInline SPAN",
           "rect": [210, -5, 50, 20],
-          "reason": "style change"
+          "reason": "outline"
         },
         {
           "object": "LayoutText #text",
@@ -22,11 +22,11 @@
   "objectPaintInvalidations": [
     {
       "object": "LayoutInline SPAN",
-      "reason": "style change"
+      "reason": "outline"
     },
     {
       "object": "InlineFlowBox",
-      "reason": "style change"
+      "reason": "outline"
     },
     {
       "object": "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png
index af94e977..be85479b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
index cd0e5b4d1..51f8ce3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
@@ -7,11 +7,6 @@
       "drawsContent": true,
       "paintInvalidations": [
         {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 72, 839, 190],
-          "reason": "style change"
-        },
-        {
           "object": "LayoutText #text",
           "rect": [10, 72, 835, 190],
           "reason": "style change"
@@ -21,14 +16,6 @@
   ],
   "objectPaintInvalidations": [
     {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
       "object": "LayoutText #text",
       "reason": "style change"
     },
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png
new file mode 100644
index 0000000..48731362
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png
new file mode 100644
index 0000000..1512f442
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
index 0931f24a..3bcc2c9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -337,8 +337,6 @@
     attribute PAGE_RULE
     attribute STYLE_RULE
     attribute SUPPORTS_RULE
-    attribute WEBKIT_KEYFRAMES_RULE
-    attribute WEBKIT_KEYFRAME_RULE
     getter cssText
     getter parentRule
     getter parentStyleSheet
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png
index 099d4c9..fc926e86 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/css/color-correction-on-text-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png
index 92a87a8..b94d6b1 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/css/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/display-type-change-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/display-type-change-expected.png
index 4ebfd6f4..ff44704f 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/display-type-change-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/display-type-change-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/hackernews-comments-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/hackernews-comments-expected.png
index 350b4ff..ed7d1d81 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/hackernews-comments-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/hackernews-comments-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/layout-after-append-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/layout-after-append-expected.png
index bab403af9..427f73ac 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/layout-after-append-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/layout-after-append-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/list-item-above-dbcat-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/list-item-above-dbcat-expected.png
index 620b989..33f29be 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/list-item-above-dbcat-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/list-item-above-dbcat-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/supercluster-multiple-layout-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/supercluster-multiple-layout-expected.png
index 684367b..26e8170 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/supercluster-multiple-layout-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/supercluster-multiple-layout-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/css-table-single-cell-lots-of-text-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/css-table-single-cell-lots-of-text-expected.png
index 4c52b0b..360805f 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/css-table-single-cell-lots-of-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/css-table-single-cell-lots-of-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/fixed-table-single-cell-lots-of-text-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/fixed-table-single-cell-lots-of-text-expected.png
index 0cec25e1..e5b9afa 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/fixed-table-single-cell-lots-of-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/fixed-table-single-cell-lots-of-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-table-wrapping-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-table-wrapping-expected.png
index 40255e6..0d5bfd4f 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-table-wrapping-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-table-wrapping-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-tables-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-tables-expected.png
index 5080b43..4f1f229 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-tables-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/nested-tables-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-cell-lots-of-text-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-cell-lots-of-text-expected.png
index 929bef4..0d3c02536 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-cell-lots-of-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-cell-lots-of-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-percent-width-cell-lots-of-text-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-percent-width-cell-lots-of-text-expected.png
index d7a14fc..88672f01 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-percent-width-cell-lots-of-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/single-percent-width-cell-lots-of-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-for-layout-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-for-layout-expected.png
index 152d505..91170f8 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-for-layout-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-for-layout-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-with-inline-block-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-with-inline-block-expected.png
index c238cc4..bbb32a6 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-with-inline-block-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text-autosizing/tables/table-with-inline-block-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/atsui-kerning-and-ligatures-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/atsui-kerning-and-ligatures-expected.png
index 3b41ea1..ff117e4b 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/atsui-kerning-and-ligatures-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/atsui-kerning-and-ligatures-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/001-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/001-expected.png
index c5b111d..12de250a 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/009-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/009-expected.png
index 810c534..24ee5a48 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/009-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/009-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/011-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/011-expected.png
index d3fd3b19..e3a3041 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/012-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/012-expected.png
index 8a8b8ea..2893f5e31 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/013-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/013-expected.png
index 38c68b3..353d0eb 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/013-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/basic/013-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/bidi-img-alt-text-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/bidi-img-alt-text-expected.png
index 7bb8d4a..645d7b7 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/bidi-img-alt-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/bidi-img-alt-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-fallback-bolding-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-fallback-bolding-expected.png
index 5c1207a8..55d9402 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-fallback-bolding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-fallback-bolding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-vs-atsui-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-vs-atsui-expected.png
index 97ee1d4..1f81320 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-vs-atsui-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/cg-vs-atsui-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/color-emoji-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/color-emoji-expected.png
index 2684ded..397f259 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/color-emoji-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/color-emoji-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/complex-text-opacity-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/complex-text-opacity-expected.png
index 14f0ab6..fb49f0b 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/complex-text-opacity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/complex-text-opacity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/decorations-with-text-combine-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/decorations-with-text-combine-expected.png
index 93b0cd6..c6041e7 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/decorations-with-text-combine-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/decorations-with-text-combine-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoji-web-font-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoji-web-font-expected.png
index 77707e0..0876660 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoji-web-font-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoji-web-font-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoticons-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoticons-expected.png
index 6596daf..77ebb25 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoticons-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emoticons-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-avoid-ruby-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-avoid-ruby-expected.png
index e54a4a6..b26a763 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-avoid-ruby-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-avoid-ruby-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-complex-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-complex-expected.png
index 5de082e..714ff04a 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-complex-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-complex-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-ellipsis-complextext-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-ellipsis-complextext-expected.png
index 594b794..a637134 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-ellipsis-complextext-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-ellipsis-complextext-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-overlap-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-overlap-expected.png
index 87180cd..e6cad79 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-overlap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-overlap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/fallback-for-custom-font-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/fallback-for-custom-font-expected.png
index dcf5244..e04e8c7e 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/fallback-for-custom-font-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/fallback-for-custom-font-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/001-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/001-expected.png
index d4ebe4d8..0d39e9e 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/002-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/002-expected.png
index 4ee1b5f..e3909cb 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/003-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/003-expected.png
index e1e896ef..16f4fe9 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/firstline/003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-expected.png
index ba98a01..1bec1cf 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-nested-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-nested-expected.png
index 39b10524..2e808ea 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-nested-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/flexbox-selection-nested-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-kerning-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-kerning-expected.png
index e830092..e7f14474 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-kerning-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-kerning-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-size-adjust-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-size-adjust-expected.png
index f5e7cce..01d635ed1 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-size-adjust-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-size-adjust-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-600-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-600-expected.png
index 6eaa2b4e..bb9b233 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-600-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-600-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-variant-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-variant-expected.png
index d013c1d..55b80be 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-variant-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/font-weight-variant-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/format-control-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/format-control-expected.png
index 68ed195..1536f2a 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/format-control-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/format-control-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/alef-connected-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/alef-connected-expected.png
index bcc0582..eb5b554 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/alef-connected-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/alef-connected-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-CSS-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-CSS-expected.png
index 36f86337..629376fa 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-CSS-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-CSS-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-HTML-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-HTML-expected.png
index 2c7cfd7..02673b4 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-HTML-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-HTML-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-formatting-characters-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-formatting-characters-expected.png
index 303e4c0d..f5a23ef 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-formatting-characters-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-LDB-2-formatting-characters-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-word-spacing-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-word-spacing-rtl-expected.png
index 09c4550..c189e8b 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-word-spacing-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/bidi-word-spacing-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/hebrew-vowels-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/hebrew-vowels-expected.png
index 3045299..f4d7972 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/hebrew-vowels-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/hebrew-vowels-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/mixed-directionality-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/mixed-directionality-selection-expected.png
index 18aac45..89ae5524 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/mixed-directionality-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/mixed-directionality-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/plane2-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/plane2-expected.png
index 5a111237..a7026d2 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/plane2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/plane2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/rtl-white-space-pre-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/rtl-white-space-pre-wrap-expected.png
index c29f7dd..45f8540 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/rtl-white-space-pre-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/international/rtl-white-space-pre-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/letter-spacing-negative-opacity-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/letter-spacing-negative-opacity-expected.png
index 611d61e..eb2de72 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/letter-spacing-negative-opacity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/letter-spacing-negative-opacity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-breaks-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-breaks-expected.png
index ed8b9c0..6e05f53 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-breaks-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-breaks-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-initial-and-final-swashes-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-initial-and-final-swashes-expected.png
index 29d8bb42..20ba5e2 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-initial-and-final-swashes-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/line-initial-and-final-swashes-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-before-surrogate-pair-expected.png
index 67897492..8cf4071 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-hang-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-hang-expected.png
index 3192c7b..c86e44d 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-hang-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/midword-break-hang-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/selection-multiple-runs-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/selection-multiple-runs-expected.png
index 9dcd939..bced79d1 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/selection-multiple-runs-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/selection-multiple-runs-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-no-blur-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-no-blur-expected.png
index 9770152..461f900 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-no-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-no-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-translucent-fill-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-translucent-fill-expected.png
index eff33842..705437e 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-translucent-fill-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/shadow-translucent-fill-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/shaping/same-script-different-lang-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/shaping/same-script-different-lang-expected.png
index 16e7ebdf..46c2747 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/shaping/same-script-different-lang-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/shaping/same-script-different-lang-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-decorations-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-decorations-expected.png
index 5dcd9cc..87ec516 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-decorations-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-decorations-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-expected.png
index 9b41627..6979c0a 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/stroking-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/unicode-fallback-font-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/unicode-fallback-font-expected.png
index a10c666..044a49d 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/unicode-fallback-font-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/unicode-fallback-font-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/vertical-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/vertical-surrogate-pair-expected.png
index 4f74077..9e09153b 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/vertical-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/vertical-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/002-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/002-expected.png
index e6b7ca04..9c1e670 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/003-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/003-expected.png
index e6b7ca04..9c1e670 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/004-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/004-expected.png
index de6007e4..fc6a149 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/005-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/005-expected.png
index 7f177fd..000c49d 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/006-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/006-expected.png
index fb6652a..4658d8d5 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/007-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/007-expected.png
index 27d4ff5..c7f8f254 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/007-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/007-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/008-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/008-expected.png
index 61171fd..7980d212 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/008-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/008-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/009-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/009-expected.png
index a54f8ded..f2e12e7 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/009-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/009-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/010-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/010-expected.png
index de6007e4..fc6a149 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/011-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/011-expected.png
index 7f177fd..000c49d 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/012-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/012-expected.png
index b1d2694..fca1addb 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/013-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/013-expected.png
index 82ec7af..620b2e0 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/013-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/013-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/014-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/014-expected.png
index 36b12148..2b3b381 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/014-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/014-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/015-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/015-expected.png
index de6007e4..fc6a149 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/015-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/015-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/016-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/016-expected.png
index 7f177fd..000c49d 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/016-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/016-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/017-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/017-expected.png
index bcc93443..59cec48 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/017-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/017-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/018-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/018-expected.png
index f55d1f5..70edebe8 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/018-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/018-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/022-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/022-expected.png
index 0ac0a912..866bfc8 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/022-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/022-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/024-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/024-expected.png
index 823befe..5cb4b05 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/024-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/024-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/nbsp-mode-and-linewraps-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/nbsp-mode-and-linewraps-expected.png
index 7c9407a..1e6ad8f 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/nbsp-mode-and-linewraps-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/nbsp-mode-and-linewraps-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/pre-newline-box-test-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/pre-newline-box-test-expected.png
index 4cb3983..8ff8095 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/pre-newline-box-test-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/whitespace/pre-newline-box-test-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png
index 09470cf9..dd07330b 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png
index d45b2f38..b1b9f5f 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/ietestcenter/css3/text/textshadow-010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png
index 65a1bcb..45a4699 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/paint/invalidation/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png
index 4be9b50..be368ab1 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-gradient-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png
index ea73528..e39b3dc7 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/svg/css/text-shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png
index 65a1bcb..45a4699 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/disable-spinvalidation/paint/invalidation/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png
new file mode 100644
index 0000000..fc926e86
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/sharedarraybuffer/fast/css/color-correction-on-text-shadow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png
new file mode 100644
index 0000000..b94d6b1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/sharedarraybuffer/fast/css/shadow-multiple-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt b/third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
deleted file mode 100644
index 18e3373..0000000
--- a/third_party/WebKit/LayoutTests/virtual/disable-spinvalidation/paint/invalidation/single-line-cells-repeating-thead-break-inside-on-thead-only-expected.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-  "layers": [
-    {
-      "name": "LayoutView #document",
-      "bounds": [1059, 585],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "paintInvalidations": [
-        {
-          "object": "LayoutTableCell TH id='target'",
-          "rect": [8, 68, 840, 190],
-          "reason": "style change"
-        },
-        {
-          "object": "LayoutText #text",
-          "rect": [10, 68, 836, 190],
-          "reason": "style change"
-        }
-      ]
-    }
-  ],
-  "objectPaintInvalidations": [
-    {
-      "object": "LayoutTableCell TH id='target'",
-      "reason": "style change"
-    },
-    {
-      "object": "RootInlineBox",
-      "reason": "style change"
-    },
-    {
-      "object": "LayoutText #text",
-      "reason": "style change"
-    },
-    {
-      "object": "InlineTextBox 'Col 1'",
-      "reason": "style change"
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt
index e0ff71e..ec4ed2fa 100644
--- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt
@@ -664,8 +664,6 @@
     attribute STYLE_RULE
     attribute SUPPORTS_RULE
     attribute VIEWPORT_RULE
-    attribute WEBKIT_KEYFRAMES_RULE
-    attribute WEBKIT_KEYFRAME_RULE
     getter cssText
     getter parentRule
     getter parentStyleSheet
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt
index 70a32387..babb200 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/css-properties-as-js-properties-expected.txt
@@ -165,7 +165,6 @@
 letterSpacing
 lightingColor
 lineHeight
-lineHeightStep
 listStyle
 listStyleImage
 listStylePosition
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index 6d9b897..c9e7b53 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -664,8 +664,6 @@
     attribute STYLE_RULE
     attribute SUPPORTS_RULE
     attribute VIEWPORT_RULE
-    attribute WEBKIT_KEYFRAMES_RULE
-    attribute WEBKIT_KEYFRAME_RULE
     getter cssText
     getter parentRule
     getter parentStyleSheet
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
index 12a4ea84..bf557a6d 100644
--- a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
+++ b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
@@ -1074,7 +1074,7 @@
 
 bool CSSAnimations::AnimationEventDelegate::RequiresIterationEvents(
     const AnimationEffectReadOnly& animation_node) {
-  return GetDocument().HasListenerType(Document::ANIMATIONITERATION_LISTENER);
+  return GetDocument().HasListenerType(Document::kAnimationIterationListener);
 }
 
 void CSSAnimations::AnimationEventDelegate::OnEventCondition(
@@ -1090,7 +1090,7 @@
        previous_phase_ == AnimationEffectReadOnly::kPhaseBefore)) {
     const double start_delay = animation_node.SpecifiedTiming().start_delay;
     const double elapsed_time = start_delay < 0 ? -start_delay : 0;
-    MaybeDispatch(Document::ANIMATIONSTART_LISTENER,
+    MaybeDispatch(Document::kAnimationStartListener,
                   EventTypeNames::animationstart, elapsed_time);
   }
 
@@ -1105,13 +1105,13 @@
     const double elapsed_time =
         animation_node.SpecifiedTiming().iteration_duration *
         (previous_iteration_ + 1);
-    MaybeDispatch(Document::ANIMATIONITERATION_LISTENER,
+    MaybeDispatch(Document::kAnimationIterationListener,
                   EventTypeNames::animationiteration, elapsed_time);
   }
 
   if (current_phase == AnimationEffectReadOnly::kPhaseAfter &&
       previous_phase_ != AnimationEffectReadOnly::kPhaseAfter)
-    MaybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animationend,
+    MaybeDispatch(Document::kAnimationEndListener, EventTypeNames::animationend,
                   animation_node.ActiveDurationInternal());
 
   previous_phase_ = current_phase;
@@ -1133,7 +1133,7 @@
       animation_node.GetPhase();
   if (current_phase == AnimationEffectReadOnly::kPhaseAfter &&
       current_phase != previous_phase_ &&
-      GetDocument().HasListenerType(Document::TRANSITIONEND_LISTENER)) {
+      GetDocument().HasListenerType(Document::kTransitionEndListener)) {
     String property_name = property_.IsCSSCustomProperty()
                                ? property_.CustomPropertyName()
                                : getPropertyNameString(property_.CssProperty());
diff --git a/third_party/WebKit/Source/core/css/CSSRule.h b/third_party/WebKit/Source/core/css/CSSRule.h
index 2490dc8..877848c 100644
--- a/third_party/WebKit/Source/core/css/CSSRule.h
+++ b/third_party/WebKit/Source/core/css/CSSRule.h
@@ -49,9 +49,7 @@
     kFontFaceRule = 5,
     kPageRule = 6,
     kKeyframesRule = 7,
-    kWebkitKeyframesRule = kKeyframesRule,
     kKeyframeRule = 8,
-    kWebkitKeyframeRule = kKeyframeRule,
     kNamespaceRule = 10,
     kSupportsRule = 12,
     kViewportRule = 15,
diff --git a/third_party/WebKit/Source/core/css/CSSRule.idl b/third_party/WebKit/Source/core/css/CSSRule.idl
index 23bc3a7..155db65 100644
--- a/third_party/WebKit/Source/core/css/CSSRule.idl
+++ b/third_party/WebKit/Source/core/css/CSSRule.idl
@@ -49,8 +49,4 @@
     // CSS Device Adaptation
     // https://dev.w3.org/csswg/css-device-adapt/#css-rule-interface
     [RuntimeEnabled=CSSViewport] const unsigned short VIEWPORT_RULE = 15;
-
-    // Non-standard APIs
-    const unsigned short WEBKIT_KEYFRAMES_RULE = 7;
-    const unsigned short WEBKIT_KEYFRAME_RULE = 8;
 };
diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/Source/core/dom/BUILD.gn
index d7d88ec..b159e1d9 100644
--- a/third_party/WebKit/Source/core/dom/BUILD.gn
+++ b/third_party/WebKit/Source/core/dom/BUILD.gn
@@ -200,6 +200,8 @@
     "ModulatorImpl.h",
     "ModuleMap.cpp",
     "ModuleMap.h",
+    "ModulePendingScript.cpp",
+    "ModulePendingScript.h",
     "ModuleScript.cpp",
     "ModuleScript.h",
     "MutationCallback.h",
diff --git a/third_party/WebKit/Source/core/dom/CharacterData.cpp b/third_party/WebKit/Source/core/dom/CharacterData.cpp
index 1d832392..13c7c5d0 100644
--- a/third_party/WebKit/Source/core/dom/CharacterData.cpp
+++ b/third_party/WebKit/Source/core/dom/CharacterData.cpp
@@ -213,7 +213,7 @@
   // Spec: https://html.spec.whatwg.org/multipage/syntax.html#insert-a-character
   if (source != kUpdateFromParser && !IsInShadowTree()) {
     if (GetDocument().HasListenerType(
-            Document::DOMCHARACTERDATAMODIFIED_LISTENER))
+            Document::kDOMCharacterDataModifiedListener))
       DispatchScopedEvent(
           MutationEvent::Create(EventTypeNames::DOMCharacterDataModified, true,
                                 nullptr, old_data, data_));
diff --git a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
index c060bbe..17de68f7 100644
--- a/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp
@@ -226,7 +226,7 @@
   return GetResource()->WasCanceled();
 }
 
-KURL ClassicPendingScript::Url() const {
+KURL ClassicPendingScript::UrlForClassicScript() const {
   return GetResource()->Url();
 }
 
diff --git a/third_party/WebKit/Source/core/dom/ClassicPendingScript.h b/third_party/WebKit/Source/core/dom/ClassicPendingScript.h
index a5184e2a..00b2e441 100644
--- a/third_party/WebKit/Source/core/dom/ClassicPendingScript.h
+++ b/third_party/WebKit/Source/core/dom/ClassicPendingScript.h
@@ -53,11 +53,11 @@
   ClassicScript* GetSource(const KURL& document_url,
                            bool& error_occurred) const override;
   bool IsReady() const override;
-  KURL Url() const override;
   bool IsExternal() const override { return GetResource(); }
   bool ErrorOccurred() const override;
   bool WasCanceled() const override;
   void StartStreamingIfPossible(Document*, ScriptStreamer::Type) override;
+  KURL UrlForClassicScript() const override;
   void RemoveFromMemoryCache() override;
   void DisposeInternal() override;
 
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index 5f0ba65d..1fbbcc5 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1237,13 +1237,13 @@
   Document* document = &child.GetDocument();
 
   if (c->parentNode() &&
-      document->HasListenerType(Document::DOMNODEINSERTED_LISTENER))
+      document->HasListenerType(Document::kDOMNodeInsertedListener))
     c->DispatchScopedEvent(MutationEvent::Create(
         EventTypeNames::DOMNodeInserted, true, c->parentNode()));
 
   // dispatch the DOMNodeInsertedIntoDocument event to all descendants
   if (c->isConnected() && document->HasListenerType(
-                              Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) {
+                              Document::kDOMNodeInsertedIntoDocumentListener)) {
     for (; c; c = NodeTraversal::Next(*c, &child))
       c->DispatchScopedEvent(MutationEvent::Create(
           EventTypeNames::DOMNodeInsertedIntoDocument, false));
@@ -1267,7 +1267,7 @@
 
   // Dispatch pre-removal mutation events.
   if (c->parentNode() &&
-      document->HasListenerType(Document::DOMNODEREMOVED_LISTENER)) {
+      document->HasListenerType(Document::kDOMNodeRemovedListener)) {
     NodeChildRemovalTracker scope(child);
     c->DispatchScopedEvent(MutationEvent::Create(EventTypeNames::DOMNodeRemoved,
                                                  true, c->parentNode()));
@@ -1275,7 +1275,7 @@
 
   // Dispatch the DOMNodeRemovedFromDocument event to all descendants.
   if (c->isConnected() && document->HasListenerType(
-                              Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) {
+                              Document::kDOMNodeRemovedFromDocumentListener)) {
     NodeChildRemovalTracker scope(child);
     for (; c; c = NodeTraversal::Next(*c, &child))
       c->DispatchScopedEvent(MutationEvent::Create(
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index d4bd0cf3..38effca 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4556,49 +4556,49 @@
                                        EventTarget& event_target) {
   if (event_type == EventTypeNames::DOMSubtreeModified) {
     UseCounter::Count(*this, UseCounter::kDOMSubtreeModifiedEvent);
-    AddMutationEventListenerTypeIfEnabled(DOMSUBTREEMODIFIED_LISTENER);
+    AddMutationEventListenerTypeIfEnabled(kDOMSubtreeModifiedListener);
   } else if (event_type == EventTypeNames::DOMNodeInserted) {
     UseCounter::Count(*this, UseCounter::kDOMNodeInsertedEvent);
-    AddMutationEventListenerTypeIfEnabled(DOMNODEINSERTED_LISTENER);
+    AddMutationEventListenerTypeIfEnabled(kDOMNodeInsertedListener);
   } else if (event_type == EventTypeNames::DOMNodeRemoved) {
     UseCounter::Count(*this, UseCounter::kDOMNodeRemovedEvent);
-    AddMutationEventListenerTypeIfEnabled(DOMNODEREMOVED_LISTENER);
+    AddMutationEventListenerTypeIfEnabled(kDOMNodeRemovedListener);
   } else if (event_type == EventTypeNames::DOMNodeRemovedFromDocument) {
     UseCounter::Count(*this, UseCounter::kDOMNodeRemovedFromDocumentEvent);
-    AddMutationEventListenerTypeIfEnabled(DOMNODEREMOVEDFROMDOCUMENT_LISTENER);
+    AddMutationEventListenerTypeIfEnabled(kDOMNodeRemovedFromDocumentListener);
   } else if (event_type == EventTypeNames::DOMNodeInsertedIntoDocument) {
     UseCounter::Count(*this, UseCounter::kDOMNodeInsertedIntoDocumentEvent);
-    AddMutationEventListenerTypeIfEnabled(DOMNODEINSERTEDINTODOCUMENT_LISTENER);
+    AddMutationEventListenerTypeIfEnabled(kDOMNodeInsertedIntoDocumentListener);
   } else if (event_type == EventTypeNames::DOMCharacterDataModified) {
     UseCounter::Count(*this, UseCounter::kDOMCharacterDataModifiedEvent);
-    AddMutationEventListenerTypeIfEnabled(DOMCHARACTERDATAMODIFIED_LISTENER);
+    AddMutationEventListenerTypeIfEnabled(kDOMCharacterDataModifiedListener);
   } else if (event_type == EventTypeNames::webkitAnimationStart ||
              event_type == EventTypeNames::animationstart) {
-    AddListenerType(ANIMATIONSTART_LISTENER);
+    AddListenerType(kAnimationStartListener);
   } else if (event_type == EventTypeNames::webkitAnimationEnd ||
              event_type == EventTypeNames::animationend) {
-    AddListenerType(ANIMATIONEND_LISTENER);
+    AddListenerType(kAnimationEndListener);
   } else if (event_type == EventTypeNames::webkitAnimationIteration ||
              event_type == EventTypeNames::animationiteration) {
-    AddListenerType(ANIMATIONITERATION_LISTENER);
+    AddListenerType(kAnimationIterationListener);
     if (View()) {
       // Need to re-evaluate time-to-effect-change for any running animations.
       View()->ScheduleAnimation();
     }
   } else if (event_type == EventTypeNames::webkitTransitionEnd ||
              event_type == EventTypeNames::transitionend) {
-    AddListenerType(TRANSITIONEND_LISTENER);
+    AddListenerType(kTransitionEndListener);
   } else if (event_type == EventTypeNames::scroll) {
-    AddListenerType(SCROLL_LISTENER);
+    AddListenerType(kScrollListener);
   } else if (event_type == EventTypeNames::load) {
     if (Node* node = event_target.ToNode()) {
       if (isHTMLStyleElement(*node)) {
-        AddListenerType(LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT);
+        AddListenerType(kLoadListenerAtCapturePhaseOrAtStyleElement);
         return;
       }
     }
     if (event_target.HasCapturingEventListeners(event_type))
-      AddListenerType(LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT);
+      AddListenerType(kLoadListenerAtCapturePhaseOrAtStyleElement);
   }
 }
 
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h
index 14066c98..c650a95 100644
--- a/third_party/WebKit/Source/core/dom/Document.h
+++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -784,18 +784,18 @@
   // keep track of what types of event listeners are registered, so we don't
   // dispatch events unnecessarily
   enum ListenerType {
-    DOMSUBTREEMODIFIED_LISTENER = 1,
-    DOMNODEINSERTED_LISTENER = 1 << 1,
-    DOMNODEREMOVED_LISTENER = 1 << 2,
-    DOMNODEREMOVEDFROMDOCUMENT_LISTENER = 1 << 3,
-    DOMNODEINSERTEDINTODOCUMENT_LISTENER = 1 << 4,
-    DOMCHARACTERDATAMODIFIED_LISTENER = 1 << 5,
-    ANIMATIONEND_LISTENER = 1 << 6,
-    ANIMATIONSTART_LISTENER = 1 << 7,
-    ANIMATIONITERATION_LISTENER = 1 << 8,
-    TRANSITIONEND_LISTENER = 1 << 9,
-    SCROLL_LISTENER = 1 << 10,
-    LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT = 1 << 11
+    kDOMSubtreeModifiedListener = 1,
+    kDOMNodeInsertedListener = 1 << 1,
+    kDOMNodeRemovedListener = 1 << 2,
+    kDOMNodeRemovedFromDocumentListener = 1 << 3,
+    kDOMNodeInsertedIntoDocumentListener = 1 << 4,
+    kDOMCharacterDataModifiedListener = 1 << 5,
+    kAnimationEndListener = 1 << 6,
+    kAnimationStartListener = 1 << 7,
+    kAnimationIterationListener = 1 << 8,
+    kTransitionEndListener = 1 << 9,
+    kScrollListener = 1 << 10,
+    kLoadListenerAtCapturePhaseOrAtStyleElement = 1 << 11
     // 4 bits remaining
   };
 
diff --git a/third_party/WebKit/Source/core/dom/ModulePendingScript.cpp b/third_party/WebKit/Source/core/dom/ModulePendingScript.cpp
new file mode 100644
index 0000000..f0184b1
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ModulePendingScript.cpp
@@ -0,0 +1,82 @@
+// 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.
+
+#include "core/dom/ModulePendingScript.h"
+
+#include "core/dom/ScriptLoader.h"
+#include "core/frame/LocalFrame.h"
+
+namespace blink {
+
+ModulePendingScriptTreeClient::ModulePendingScriptTreeClient()
+    : module_script_(nullptr), pending_script_(nullptr) {}
+
+void ModulePendingScriptTreeClient::SetPendingScript(
+    ModulePendingScript* pending_script) {
+  DCHECK(!pending_script_);
+  pending_script_ = pending_script;
+
+  if (finished_) {
+    pending_script_->NotifyModuleTreeLoadFinished();
+  }
+}
+
+void ModulePendingScriptTreeClient::NotifyModuleTreeLoadFinished(
+    ModuleScript* module_script) {
+  DCHECK(!(module_script && module_script->InstantiationState() ==
+                                ModuleInstantiationState::kUninstantiated));
+  DCHECK(!finished_);
+  finished_ = true;
+  module_script_ = module_script;
+
+  if (pending_script_)
+    pending_script_->NotifyModuleTreeLoadFinished();
+}
+
+DEFINE_TRACE(ModulePendingScriptTreeClient) {
+  visitor->Trace(module_script_);
+  visitor->Trace(pending_script_);
+  ModuleTreeClient::Trace(visitor);
+}
+
+ModulePendingScript::ModulePendingScript(ScriptElementBase* element,
+                                         ModulePendingScriptTreeClient* client)
+    : PendingScript(element, TextPosition()), module_tree_client_(client) {
+  CHECK(this->GetElement());
+  DCHECK(module_tree_client_);
+  client->SetPendingScript(this);
+}
+
+ModulePendingScript::~ModulePendingScript() {}
+
+void ModulePendingScript::DisposeInternal() {
+  module_tree_client_ = nullptr;
+}
+
+DEFINE_TRACE(ModulePendingScript) {
+  visitor->Trace(module_tree_client_);
+  PendingScript::Trace(visitor);
+}
+
+void ModulePendingScript::NotifyModuleTreeLoadFinished() {
+  CHECK(!IsReady());
+  ready_ = true;
+
+  if (Client())
+    Client()->PendingScriptFinished(this);
+}
+
+Script* ModulePendingScript::GetSource(const KURL& document_url,
+                                       bool& error_occurred) const {
+  CHECK(IsReady());
+  error_occurred = ErrorOccurred();
+  return GetModuleScript();
+}
+
+bool ModulePendingScript::ErrorOccurred() const {
+  CHECK(IsReady());
+  return !GetModuleScript();
+}
+
+}  // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/ModulePendingScript.h b/third_party/WebKit/Source/core/dom/ModulePendingScript.h
new file mode 100644
index 0000000..62ecccb
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ModulePendingScript.h
@@ -0,0 +1,98 @@
+// 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.
+
+#ifndef ModulePendingScript_h
+#define ModulePendingScript_h
+
+#include "core/dom/Modulator.h"
+#include "core/dom/ModuleScript.h"
+#include "core/dom/PendingScript.h"
+
+namespace blink {
+
+class ModulePendingScript;
+
+// ModulePendingScriptTreeClient is used to connect from Modulator::FetchTree()
+// to ModulePendingScript. Because ModulePendingScript is created after
+// Modulator::FetchTree() is called, ModulePendingScriptTreeClient is
+// registered as ModuleTreeClient to FetchTree() first, and later
+// ModulePendingScript is supplied to ModulePendingScriptTreeClient via
+// SetPendingScript() and is notified of module tree load finish.
+class ModulePendingScriptTreeClient final
+    : public GarbageCollectedFinalized<ModulePendingScriptTreeClient>,
+      public ModuleTreeClient {
+  USING_GARBAGE_COLLECTED_MIXIN(ModulePendingScriptTreeClient);
+
+ public:
+  static ModulePendingScriptTreeClient* Create() {
+    return new ModulePendingScriptTreeClient();
+  }
+  virtual ~ModulePendingScriptTreeClient() = default;
+
+  void SetPendingScript(ModulePendingScript* client);
+
+  ModuleScript* GetModuleScript() const { return module_script_; }
+
+  DECLARE_TRACE();
+
+ private:
+  ModulePendingScriptTreeClient();
+
+  // Implements ModuleTreeClient
+  void NotifyModuleTreeLoadFinished(ModuleScript*) override;
+
+  bool finished_ = false;
+  Member<ModuleScript> module_script_;
+  Member<ModulePendingScript> pending_script_;
+};
+
+// PendingScript for a module script
+// https://html.spec.whatwg.org/#module-script.
+class CORE_EXPORT ModulePendingScript : public PendingScript {
+ public:
+  static ModulePendingScript* Create(ScriptElementBase* element,
+                                     ModulePendingScriptTreeClient* client) {
+    return new ModulePendingScript(element, client);
+  }
+
+  ~ModulePendingScript() override;
+
+  void NotifyModuleTreeLoadFinished();
+
+  ModuleScript* GetModuleScript() const {
+    return module_tree_client_->GetModuleScript();
+  }
+
+  DECLARE_TRACE();
+
+ private:
+  ModulePendingScript(ScriptElementBase*, ModulePendingScriptTreeClient*);
+
+  // PendingScript
+  ScriptType GetScriptType() const override { return ScriptType::kModule; }
+  Script* GetSource(const KURL& document_url,
+                    bool& error_occurred) const override;
+  bool IsReady() const override { return ready_; }
+  bool IsExternal() const override { return true; }
+  bool ErrorOccurred() const override;
+  bool WasCanceled() const override { return false; }
+
+  void StartStreamingIfPossible(Document*, ScriptStreamer::Type) override {}
+  KURL UrlForClassicScript() const override {
+    NOTREACHED();
+    return KURL();
+  }
+  void RemoveFromMemoryCache() override { NOTREACHED(); }
+
+  void DisposeInternal() override;
+
+  void CheckState() const override {}
+
+  Member<ModulePendingScriptTreeClient> module_tree_client_;
+  bool ready_ = false;
+};
+
+}  // namespace blink
+
+#endif  // ModulePendingScript_h
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 14d5b5e..d5e59f9 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -1519,11 +1519,10 @@
 
   // There was no difference between the two parent chains, i.e., one was a
   // subset of the other.  The shorter chain is the ancestor.
-  return index1 < index2
-             ? kDocumentPositionFollowing | kDocumentPositionContainedBy |
-                   connection
-             : kDocumentPositionPreceding | kDocumentPositionContains |
-                   connection;
+  return index1 < index2 ? kDocumentPositionFollowing |
+                               kDocumentPositionContainedBy | connection
+                         : kDocumentPositionPreceding |
+                               kDocumentPositionContains | connection;
 }
 
 String Node::DebugName() const {
@@ -2126,7 +2125,7 @@
   DCHECK(!EventDispatchForbiddenScope::IsEventDispatchForbidden());
 #endif
 
-  if (!GetDocument().HasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER))
+  if (!GetDocument().HasListenerType(Document::kDOMSubtreeModifiedListener))
     return;
 
   DispatchScopedEvent(
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.h b/third_party/WebKit/Source/core/dom/PendingScript.h
index f0175f5..6886b9bb 100644
--- a/third_party/WebKit/Source/core/dom/PendingScript.h
+++ b/third_party/WebKit/Source/core/dom/PendingScript.h
@@ -88,14 +88,14 @@
   // https://html.spec.whatwg.org/#the-script-is-ready
   virtual bool IsReady() const = 0;
 
-  virtual KURL Url() const = 0;
   virtual bool IsExternal() const = 0;
   virtual bool ErrorOccurred() const = 0;
   virtual bool WasCanceled() const = 0;
   virtual void StartStreamingIfPossible(Document*, ScriptStreamer::Type) = 0;
 
-  // Used for document.write() intervention.
-  // Has effects only for classic scripts.
+  // The following two methods are used for document.write() intervention and
+  // have effects only for classic scripts.
+  virtual KURL UrlForClassicScript() const = 0;
   virtual void RemoveFromMemoryCache() = 0;
 
   void Dispose();
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 07702b4..4d5544f 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -205,7 +205,9 @@
   // http://msdn.microsoft.com/en-us/library/ms534692(VS.85).aspx
   if (rangeCount() == 0)
     return "None";
-  if (isCollapsed())
+  // Do not use isCollapsed() here. We'd like to return "Range" for
+  // range-selection in text control elements.
+  if (GetFrame()->Selection().GetSelectionInDOMTree().IsCaret())
     return "Caret";
   return "Range";
 }
@@ -442,6 +444,10 @@
   else
     return;
 
+  // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
+  // needs to be audited.  See http://crbug.com/590369 for more details.
+  GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
+
   Element* focused_element = GetFrame()->GetDocument()->FocusedElement();
   GetFrame()->Selection().Modify(alter, direction, granularity);
   if (GetFrame() && GetFrame()->GetDocument() &&
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index cd529ad89..f639ca8 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -377,15 +377,15 @@
                             SelectionDirection direction,
                             TextGranularity granularity,
                             EUserTriggered user_triggered) {
-  SelectionModifier selection_modifier(
-      *GetFrame(), ComputeVisibleSelectionInDOMTreeDeprecated(),
-      x_pos_for_vertical_arrow_navigation_);
+  SelectionModifier selection_modifier(*GetFrame(),
+                                       ComputeVisibleSelectionInDOMTree(),
+                                       x_pos_for_vertical_arrow_navigation_);
   const bool modified =
       selection_modifier.Modify(alter, direction, granularity);
   if (user_triggered == kUserTriggered &&
       selection_modifier.Selection().IsRange() &&
-      ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret() &&
-      DispatchSelectStart(ComputeVisibleSelectionInDOMTreeDeprecated()) !=
+      ComputeVisibleSelectionInDOMTree().IsCaret() &&
+      DispatchSelectStart(ComputeVisibleSelectionInDOMTree()) !=
           DispatchEventResult::kNotCanceled) {
     return false;
   }
@@ -420,8 +420,8 @@
 bool FrameSelection::Modify(EAlteration alter,
                             unsigned vertical_distance,
                             VerticalDirection direction) {
-  SelectionModifier selection_modifier(
-      *GetFrame(), ComputeVisibleSelectionInDOMTreeDeprecated());
+  SelectionModifier selection_modifier(*GetFrame(),
+                                       ComputeVisibleSelectionInDOMTree());
   if (!selection_modifier.ModifyWithPageGranularity(alter, vertical_distance,
                                                     direction)) {
     return false;
@@ -1164,8 +1164,8 @@
   selection_editor_->ClearDocumentCachedRange();
 }
 
-void FrameSelection::LayoutSelectionStartEnd(int& start_pos, int& end_pos) {
-  layout_selection_->SelectionStartEnd(start_pos, end_pos);
+std::pair<int, int> FrameSelection::LayoutSelectionStartEnd() {
+  return layout_selection_->SelectionStartEnd();
 }
 
 void FrameSelection::ClearLayoutSelection() {
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.h b/third_party/WebKit/Source/core/editing/FrameSelection.h
index 20171532..a145ccb 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.h
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.h
@@ -253,7 +253,7 @@
 
   FrameCaret& FrameCaretForTesting() const { return *frame_caret_; }
 
-  void LayoutSelectionStartEnd(int& start_pos, int& end_pos);
+  std::pair<int, int> LayoutSelectionStartEnd();
   void ClearLayoutSelection();
 
   DECLARE_TRACE();
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
index 718f97a..1e65111e8 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -306,10 +306,9 @@
     i->key->SetShouldInvalidateSelection();
 }
 
-void LayoutSelection::SelectionStartEnd(int& start_pos, int& end_pos) {
+std::pair<int, int> LayoutSelection::SelectionStartEnd() {
   Commit();
-  start_pos = selection_start_pos_;
-  end_pos = selection_end_pos_;
+  return std::make_pair(selection_start_pos_, selection_end_pos_);
 }
 
 void LayoutSelection::ClearSelection() {
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.h b/third_party/WebKit/Source/core/editing/LayoutSelection.h
index ac5b3c0..b49f079 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.h
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.h
@@ -55,7 +55,7 @@
       int end_pos,
       SelectionPaintInvalidationMode = kPaintInvalidationNewXOROld);
   void ClearSelection();
-  void SelectionStartEnd(int& start_pos, int& end_pos);
+  std::pair<int, int> SelectionStartEnd();
   void OnDocumentShutdown();
 
   DECLARE_TRACE();
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp b/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
index 8005194..f7afdf5d 100644
--- a/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionTemplate.cpp
@@ -82,6 +82,18 @@
 }
 
 template <typename Strategy>
+bool SelectionTemplate<Strategy>::IsCaret() const {
+  return base_.IsNotNull() && base_ == extent_ &&
+         granularity_ == kCharacterGranularity;
+}
+
+template <typename Strategy>
+bool SelectionTemplate<Strategy>::IsRange() const {
+  return base_ != extent_ ||
+         (base_.IsNotNull() && granularity_ != kCharacterGranularity);
+}
+
+template <typename Strategy>
 bool SelectionTemplate<Strategy>::AssertValidFor(
     const Document& document) const {
   if (!AssertValid())
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplate.h b/third_party/WebKit/Source/core/editing/SelectionTemplate.h
index 3fd2253b..960748f 100644
--- a/third_party/WebKit/Source/core/editing/SelectionTemplate.h
+++ b/third_party/WebKit/Source/core/editing/SelectionTemplate.h
@@ -88,11 +88,11 @@
   TextAffinity Affinity() const { return affinity_; }
   TextGranularity Granularity() const { return granularity_; }
   bool HasTrailingWhitespace() const { return has_trailing_whitespace_; }
-  bool IsCaret() const { return base_.IsNotNull() && base_ == extent_; }
+  bool IsCaret() const;
   bool IsDirectional() const { return is_directional_; }
   bool IsHandleVisible() const { return is_handle_visible_; }
   bool IsNone() const { return base_.IsNull(); }
-  bool IsRange() const { return base_ != extent_; }
+  bool IsRange() const;
 
   // Returns true if |this| selection holds valid values otherwise it causes
   // assertion failure.
diff --git a/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp b/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp
index c2ca811..41dc089 100644
--- a/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp
@@ -109,7 +109,7 @@
     std::unique_ptr<IncrementLoadEventDelayCount> count) {
   if (loaded_sheet_) {
     if (GetDocument().HasListenerType(
-            Document::LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT))
+            Document::kLoadListenerAtCapturePhaseOrAtStyleElement))
       DispatchEvent(Event::Create(EventTypeNames::load));
   } else {
     DispatchEvent(Event::Create(EventTypeNames::error));
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
index ec40bba..6836584e 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -339,8 +339,8 @@
   CHECK_EQ(pending_script->GetScriptType(), ScriptType::kClassic);
 
   if (!pending_script->ErrorOccurred()) {
-    EmitWarningForDocWriteScripts(pending_script->Url().GetString(),
-                                  *document_);
+    EmitWarningForDocWriteScripts(
+        pending_script->UrlForClassicScript().GetString(), *document_);
     return;
   }
 
@@ -348,7 +348,8 @@
   // ERR_CACHE_MISS but other errors are rare with
   // WebCachePolicy::ReturnCacheDataDontLoad.
 
-  EmitErrorForDocWriteScripts(pending_script->Url().GetString(), *document_);
+  EmitErrorForDocWriteScripts(pending_script->UrlForClassicScript().GetString(),
+                              *document_);
   TextPosition starting_position = ParserBlockingScript()->StartingPosition();
   bool is_parser_inserted = script_loader->IsParserInserted();
   // Remove this resource entry from memory cache as the new request
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 4a3b44e4..48702ae 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -2207,4 +2207,9 @@
   return AvailableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
 }
 
+bool LayoutBlock::NeedsPreferredWidthsRecalculation() const {
+  return (HasRelativeLogicalHeight() && Style()->LogicalWidth().IsAuto()) ||
+         LayoutBox::NeedsPreferredWidthsRecalculation();
+}
+
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h
index 2f2e760..e044d10 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -453,6 +453,8 @@
     return IsInline() && IsAtomicInlineLevel();
   }
 
+  bool NeedsPreferredWidthsRecalculation() const override;
+
  private:
   LayoutObjectChildList* VirtualChildren() final { return Children(); }
   const LayoutObjectChildList* VirtualChildren() const final {
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 57050627d..405ead0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1453,9 +1453,9 @@
   return SelectionColor(CSSPropertyWebkitTextEmphasisColor, global_paint_flags);
 }
 
-void LayoutObject::SelectionStartEnd(int& start_pos, int& end_pos) const {
+std::pair<int, int> LayoutObject::SelectionStartEnd() const {
   DCHECK(!View()->NeedsLayout());
-  GetFrame()->Selection().LayoutSelectionStartEnd(start_pos, end_pos);
+  return GetFrame()->Selection().LayoutSelectionStartEnd();
 }
 
 // Called when an object that was floating or positioned becomes a normal flow
@@ -1543,7 +1543,8 @@
   // needed if we have style or text affected by these properties.
   if (diff.TextDecorationOrColorChanged() &&
       !diff.NeedsFullPaintInvalidation()) {
-    if (Style()->HasBorder() || Style()->HasOutline() ||
+    if (Style()->HasBorderColorReferencingCurrentColor() ||
+        Style()->HasOutlineWithCurrentColor() ||
         Style()->HasBackgroundRelatedColorReferencingCurrentColor() ||
         // Skip any text nodes that do not contain text boxes. Whitespace cannot
         // be skipped or we will miss invalidating decorations (e.g.,
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 683424a8..bddde5e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -1544,7 +1544,7 @@
   // to get notified of any image change.
   virtual void ImageChanged(WrappedImagePtr, const IntRect* = nullptr) {}
 
-  void SelectionStartEnd(int& spos, int& epos) const;
+  std::pair<int, int> SelectionStartEnd() const;
 
   void Remove() {
     if (Parent())
@@ -1817,6 +1817,10 @@
         return paint_data->PaintProperties();
       return nullptr;
     }
+    void ClearPaintProperties() {
+      if (auto* paint_data = layout_object_.GetRarePaintData())
+        paint_data->ClearPaintProperties();
+    }
 
     // The following non-const functions for local border box properties should
     // only be called from PaintPropertyTreeBuilder.
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index 497a705..57cb8f8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -367,7 +367,7 @@
 void LayoutText::AbsoluteRectsForRange(Vector<IntRect>& rects,
                                        unsigned start,
                                        unsigned end,
-                                       bool use_selection_height) {
+                                       bool use_selection_height) const {
   // Work around signed/unsigned issues. This function takes unsigneds, and is
   // often passed UINT_MAX to mean "all the way to the end". InlineTextBox
   // coordinates are unsigneds, so changing this function to take ints causes
@@ -486,7 +486,7 @@
 void LayoutText::AbsoluteQuadsForRange(Vector<FloatQuad>& quads,
                                        unsigned start,
                                        unsigned end,
-                                       bool use_selection_height) {
+                                       bool use_selection_height) const {
   // Work around signed/unsigned issues. This function takes unsigneds, and is
   // often passed UINT_MAX to mean "all the way to the end". InlineTextBox
   // coordinates are unsigneds, so changing this function to take ints causes
@@ -1559,7 +1559,7 @@
     if (state == SelectionStart || state == SelectionEnd ||
         state == SelectionBoth) {
       int start_pos, end_pos;
-      SelectionStartEnd(start_pos, end_pos);
+      std::tie(start_pos, end_pos) = SelectionStartEnd();
       if (GetSelectionState() == SelectionStart) {
         end_pos = TextLength();
 
@@ -2025,7 +2025,7 @@
     start_pos = 0;
     end_pos = TextLength();
   } else {
-    SelectionStartEnd(start_pos, end_pos);
+    std::tie(start_pos, end_pos) = SelectionStartEnd();
     if (GetSelectionState() == SelectionStart)
       end_pos = TextLength();
     else if (GetSelectionState() == SelectionEnd)
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.h b/third_party/WebKit/Source/core/layout/LayoutText.h
index 999c943..e2cdafe 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.h
+++ b/third_party/WebKit/Source/core/layout/LayoutText.h
@@ -102,14 +102,14 @@
   void AbsoluteRectsForRange(Vector<IntRect>&,
                              unsigned start_offset = 0,
                              unsigned end_offset = INT_MAX,
-                             bool use_selection_height = false);
+                             bool use_selection_height = false) const;
 
   void AbsoluteQuads(Vector<FloatQuad>&,
                      MapCoordinatesFlags mode = 0) const final;
   void AbsoluteQuadsForRange(Vector<FloatQuad>&,
                              unsigned start_offset = 0,
                              unsigned end_offset = INT_MAX,
-                             bool use_selection_height = false);
+                             bool use_selection_height = false) const;
   FloatRect LocalBoundingBoxRectForAccessibility() const final;
 
   enum ClippingOption { kNoClipping, kClipToEllipsis };
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp
index 343bec14..7016997 100644
--- a/third_party/WebKit/Source/core/layout/LayoutView.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -128,8 +128,6 @@
   DCHECK(!result.GetHitTestLocation().IsRectBasedTest() ||
          result.GetHitTestRequest().ListBased());
 
-  CommitPendingSelection();
-
   uint64_t dom_tree_version = GetDocument().DomTreeVersion();
   HitTestResult cache_result = result;
   bool hit_layer = false;
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutText.h b/third_party/WebKit/Source/core/layout/api/LineLayoutText.h
index 6ae27ae2..3288f1b 100644
--- a/third_party/WebKit/Source/core/layout/api/LineLayoutText.h
+++ b/third_party/WebKit/Source/core/layout/api/LineLayoutText.h
@@ -109,8 +109,8 @@
     return ToText()->HyphenWidth(font, text_direction);
   }
 
-  void SelectionStartEnd(int& spos, int& epos) const {
-    return ToText()->SelectionStartEnd(spos, epos);
+  std::pair<int, int> SelectionStartEnd() const {
+    return ToText()->SelectionStartEnd();
   }
 
   unsigned TextStartOffset() const { return ToText()->TextStartOffset(); }
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
index 2399a9e..7cd6004 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -138,7 +138,7 @@
   if (state == SelectionStart || state == SelectionEnd ||
       state == SelectionBoth) {
     int start_pos, end_pos;
-    GetLineLayoutItem().SelectionStartEnd(start_pos, end_pos);
+    std::tie(start_pos, end_pos) = GetLineLayoutItem().SelectionStartEnd();
     // The position after a hard line break is considered to be past its end.
     // See the corresponding code in InlineTextBox::isSelected.
     int last_selectable = Start() + Len() - (IsLineBreak() ? 1 : 0);
@@ -502,7 +502,7 @@
     start_pos = 0;
     end_pos = GetLineLayoutItem().TextLength();
   } else {
-    GetLineLayoutItem().SelectionStartEnd(start_pos, end_pos);
+    std::tie(start_pos, end_pos) = GetLineLayoutItem().SelectionStartEnd();
     if (GetLineLayoutItem().GetSelectionState() == SelectionStart)
       end_pos = GetLineLayoutItem().TextLength();
     else if (GetLineLayoutItem().GetSelectionState() == SelectionEnd)
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h
index ce9c9d7f..4e7ac3b3 100644
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h
@@ -121,6 +121,13 @@
     // enough to store.
   };
 
+  // Whether pre- and post-context should be used for shaping.
+  enum NGLayoutInlineShapeOptions {
+    kNoContext = 0,
+    kPreContext = 1,
+    kPostContext = 2
+  };
+
   NGLayoutInlineItem(NGLayoutInlineItemType type,
                      unsigned start,
                      unsigned end,
@@ -128,13 +135,14 @@
                      LayoutObject* layout_object = nullptr)
       : start_offset_(start),
         end_offset_(end),
-        bidi_level_(UBIDI_LTR),
         script_(USCRIPT_INVALID_CODE),
-        fallback_priority_(FontFallbackPriority::kInvalid),
-        rotate_sideways_(false),
         style_(style),
         layout_object_(layout_object),
-        type_(type) {
+        type_(type),
+        bidi_level_(UBIDI_LTR),
+        shape_options_(kPreContext | kPostContext),
+        rotate_sideways_(false),
+        fallback_priority_(FontFallbackPriority::kInvalid) {
     DCHECK_GE(end, start);
   }
 
@@ -142,13 +150,17 @@
     return static_cast<NGLayoutInlineItemType>(type_);
   }
 
+  NGLayoutInlineShapeOptions ShapeOptions() const {
+    return static_cast<NGLayoutInlineShapeOptions>(shape_options_);
+  }
+
   unsigned StartOffset() const { return start_offset_; }
   unsigned EndOffset() const { return end_offset_; }
   unsigned Length() const { return end_offset_ - start_offset_; }
   TextDirection Direction() const {
-    return bidi_level_ & 1 ? TextDirection::kRtl : TextDirection::kLtr;
+    return BidiLevel() & 1 ? TextDirection::kRtl : TextDirection::kLtr;
   }
-  UBiDiLevel BidiLevel() const { return bidi_level_; }
+  UBiDiLevel BidiLevel() const { return static_cast<UBiDiLevel>(bidi_level_); }
   UScriptCode GetScript() const { return script_; }
   const ComputedStyle* Style() const { return style_; }
   LayoutObject* GetLayoutObject() const { return layout_object_; }
@@ -177,15 +189,19 @@
  private:
   unsigned start_offset_;
   unsigned end_offset_;
-  UBiDiLevel bidi_level_;
   UScriptCode script_;
-  FontFallbackPriority fallback_priority_;
-  bool rotate_sideways_;
-  const ComputedStyle* style_;
   RefPtr<const ShapeResult> shape_result_;
+  const ComputedStyle* style_;
   LayoutObject* layout_object_;
 
   unsigned type_ : 3;
+  unsigned bidi_level_ : 8;  // UBiDiLevel is defined as uint8_t.
+  unsigned shape_options_ : 2;
+  unsigned rotate_sideways_ : 1;
+
+  // TODO(layout-ng): Do we need fallback_priority_ here? If so we should pack
+  // it with the bit field above.
+  FontFallbackPriority fallback_priority_;
 
   friend class NGInlineNode;
 };
diff --git a/third_party/WebKit/Source/core/page/TouchAdjustment.cpp b/third_party/WebKit/Source/core/page/TouchAdjustment.cpp
index ba1b7cc..0be208d 100644
--- a/third_party/WebKit/Source/core/page/TouchAdjustment.cpp
+++ b/third_party/WebKit/Source/core/page/TouchAdjustment.cpp
@@ -212,15 +212,15 @@
         end_pos = text_layout_object->TextLength();
         break;
       case SelectionStart:
-        text_layout_object->SelectionStartEnd(start_pos, end_pos);
+        std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd();
         end_pos = text_layout_object->TextLength();
         break;
       case SelectionEnd:
-        text_layout_object->SelectionStartEnd(start_pos, end_pos);
+        std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd();
         start_pos = 0;
         break;
       case SelectionBoth:
-        text_layout_object->SelectionStartEnd(start_pos, end_pos);
+        std::tie(start_pos, end_pos) = text_layout_object->SelectionStartEnd();
         break;
       default:
         ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 2e972ab..99a5ed9 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -224,56 +224,75 @@
   frame_view.SetTotalPropertyTreeStateForContents(std::move(contents_state));
 }
 
+static bool NeedsPaintOffsetTranslation(const LayoutObject& object) {
+  if (!object.IsBoxModelObject())
+    return false;
+  const LayoutBoxModelObject& box_model = ToLayoutBoxModelObject(object);
+  if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
+      box_model.IsLayoutView()) {
+    // Root layer scrolling always creates a translation node for LayoutView to
+    // ensure fixed and absolute contexts use the correct transform space.
+    return true;
+  } else if (box_model.HasLayer() &&
+             box_model.Layer()->PaintsWithTransform(
+                 kGlobalPaintFlattenCompositingLayers)) {
+    return true;
+  }
+  return false;
+}
+
 void PaintPropertyTreeBuilder::UpdatePaintOffsetTranslation(
     const LayoutBoxModelObject& object,
     PaintPropertyTreeBuilderContext& context) {
-  bool uses_paint_offset_translation = false;
-  if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
-      object.IsLayoutView()) {
-    // Root layer scrolling always creates a translation node for LayoutView to
-    // ensure fixed and absolute contexts use the correct transform space.
-    uses_paint_offset_translation = true;
-  } else if (object.HasLayer() &&
-             context.current.paint_offset != LayoutPoint() &&
-             object.Layer()->PaintsWithTransform(
-                 kGlobalPaintFlattenCompositingLayers)) {
-    uses_paint_offset_translation = true;
-  }
+  if (NeedsPaintOffsetTranslation(object) &&
+      // As an optimization, skip these paint offset translation nodes when
+      // the offset is an identity. An exception is the layout view because root
+      // layer scrolling needs a transform node to ensure fixed and absolute
+      // descendants use the correct transform space.
+      (object.IsLayoutView() ||
+       context.current.paint_offset != LayoutPoint())) {
+    auto& properties = *object.GetMutableForPainting().PaintProperties();
+    // We should use the same subpixel paint offset values for snapping
+    // regardless of whether a transform is present. If there is a transform
+    // we round the paint offset but keep around the residual fractional
+    // component for the transformed content to paint with.  In spv1 this was
+    // called "subpixel accumulation". For more information, see
+    // PaintLayer::subpixelAccumulation() and
+    // PaintLayerPainter::paintFragmentByApplyingTransform.
+    IntPoint rounded_paint_offset =
+        RoundedIntPoint(context.current.paint_offset);
+    LayoutPoint fractional_paint_offset =
+        LayoutPoint(context.current.paint_offset - rounded_paint_offset);
 
-  if (!uses_paint_offset_translation) {
+    context.force_subtree_update |= properties.UpdatePaintOffsetTranslation(
+        context.current.transform,
+        TransformationMatrix().Translate(rounded_paint_offset.X(),
+                                         rounded_paint_offset.Y()),
+        FloatPoint3D(), context.current.should_flatten_inherited_transform,
+        context.current.rendering_context_id);
+
+    context.current.transform = properties.PaintOffsetTranslation();
+    context.current.paint_offset = fractional_paint_offset;
+    if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
+        object.IsLayoutView()) {
+      context.absolute_position.transform = properties.PaintOffsetTranslation();
+      context.fixed_position.transform = properties.PaintOffsetTranslation();
+      context.absolute_position.paint_offset = LayoutPoint();
+      context.fixed_position.paint_offset = LayoutPoint();
+    }
+  } else {
     if (auto* properties = object.GetMutableForPainting().PaintProperties())
       context.force_subtree_update |= properties->ClearPaintOffsetTranslation();
-    return;
   }
+}
 
-  // We should use the same subpixel paint offset values for snapping
-  // regardless of whether a transform is present. If there is a transform
-  // we round the paint offset but keep around the residual fractional
-  // component for the transformed content to paint with.  In spv1 this was
-  // called "subpixel accumulation". For more information, see
-  // PaintLayer::subpixelAccumulation() and
-  // PaintLayerPainter::paintFragmentByApplyingTransform.
-  IntPoint rounded_paint_offset = RoundedIntPoint(context.current.paint_offset);
-  LayoutPoint fractional_paint_offset =
-      LayoutPoint(context.current.paint_offset - rounded_paint_offset);
-
-  auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
-  context.force_subtree_update |= properties.UpdatePaintOffsetTranslation(
-      context.current.transform,
-      TransformationMatrix().Translate(rounded_paint_offset.X(),
-                                       rounded_paint_offset.Y()),
-      FloatPoint3D(), context.current.should_flatten_inherited_transform,
-      context.current.rendering_context_id);
-
-  context.current.transform = properties.PaintOffsetTranslation();
-  context.current.paint_offset = fractional_paint_offset;
-  if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
-      object.IsLayoutView()) {
-    context.absolute_position.transform = properties.PaintOffsetTranslation();
-    context.fixed_position.transform = properties.PaintOffsetTranslation();
-    context.absolute_position.paint_offset = LayoutPoint();
-    context.fixed_position.paint_offset = LayoutPoint();
-  }
+static bool NeedsTransformForNonRootSVG(const LayoutObject& object) {
+  // TODO(pdr): Check for the presence of a transform instead of the value.
+  // Checking for an identity matrix will cause the property tree structure
+  // to change during animations if the animation passes through the
+  // identity matrix.
+  return object.IsSVGChild() &&
+         !object.LocalToSVGParentTransform().IsIdentity();
 }
 
 // SVG does not use the general transform update of |updateTransform|, instead
@@ -289,13 +308,9 @@
 
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
     AffineTransform transform = object.LocalToSVGParentTransform();
-    // TODO(pdr): Check for the presence of a transform instead of the value.
-    // Checking for an identity matrix will cause the property tree structure
-    // to change during animations if the animation passes through the
-    // identity matrix.
-    if (!transform.IsIdentity()) {
+    if (NeedsTransformForNonRootSVG(object)) {
       // The origin is included in the local transform, so leave origin empty.
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
       context.force_subtree_update |= properties.UpdateTransform(
           context.current.transform, TransformationMatrix(transform),
           FloatPoint3D());
@@ -347,6 +362,14 @@
       style.TransformOriginZ());
 }
 
+static bool NeedsTransform(const LayoutObject& object) {
+  if (!object.IsBox())
+    return false;
+  return object.StyleRef().HasTransform() || object.StyleRef().Preserves3D() ||
+         CompositingReasonsForTransform(ToLayoutBox(object)) !=
+             kCompositingReasonNone;
+}
+
 void PaintPropertyTreeBuilder::UpdateTransform(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
@@ -362,44 +385,37 @@
     // direct compositing reason. The latter is required because this is the
     // only way to represent compositing both an element and its stacking
     // descendants.
-    bool has_transform = false;
-    if (object.IsBox()) {
+    if (NeedsTransform(object)) {
       auto& box = ToLayoutBox(object);
 
       CompositingReasons compositing_reasons =
           CompositingReasonsForTransform(box);
 
-      if (style.HasTransform() || style.Preserves3D() ||
-          compositing_reasons != kCompositingReasonNone) {
-        TransformationMatrix matrix;
-        style.ApplyTransform(
-            matrix, box.Size(), ComputedStyle::kExcludeTransformOrigin,
-            ComputedStyle::kIncludeMotionPath,
-            ComputedStyle::kIncludeIndependentTransformProperties);
+      TransformationMatrix matrix;
+      style.ApplyTransform(
+          matrix, box.Size(), ComputedStyle::kExcludeTransformOrigin,
+          ComputedStyle::kIncludeMotionPath,
+          ComputedStyle::kIncludeIndependentTransformProperties);
 
-        // TODO(trchen): transform-style should only be respected if a
-        // PaintLayer is created. If a node with transform-style: preserve-3d
-        // does not exist in an existing rendering context, it establishes a new
-        // one.
-        unsigned rendering_context_id = context.current.rendering_context_id;
-        if (style.Preserves3D() && !rendering_context_id)
-          rendering_context_id = PtrHash<const LayoutObject>::GetHash(&object);
+      // TODO(trchen): transform-style should only be respected if a
+      // PaintLayer is created. If a node with transform-style: preserve-3d
+      // does not exist in an existing rendering context, it establishes a new
+      // one.
+      unsigned rendering_context_id = context.current.rendering_context_id;
+      if (style.Preserves3D() && !rendering_context_id)
+        rendering_context_id = PtrHash<const LayoutObject>::GetHash(&object);
 
-        CompositorElementId compositor_element_id =
-            style.HasCurrentTransformAnimation()
-                ? CreateDomNodeBasedCompositorElementId(object)
-                : CompositorElementId();
+      CompositorElementId compositor_element_id =
+          style.HasCurrentTransformAnimation()
+              ? CreateDomNodeBasedCompositorElementId(object)
+              : CompositorElementId();
 
-        auto& properties =
-            object.GetMutableForPainting().EnsurePaintProperties();
-        context.force_subtree_update |= properties.UpdateTransform(
-            context.current.transform, matrix, TransformOrigin(box),
-            context.current.should_flatten_inherited_transform,
-            rendering_context_id, compositing_reasons, compositor_element_id);
-        has_transform = true;
-      }
-    }
-    if (!has_transform) {
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
+      context.force_subtree_update |= properties.UpdateTransform(
+          context.current.transform, matrix, TransformOrigin(box),
+          context.current.should_flatten_inherited_transform,
+          rendering_context_id, compositing_reasons, compositor_element_id);
+    } else {
       if (auto* properties = object.GetMutableForPainting().PaintProperties())
         context.force_subtree_update |= properties->ClearTransform();
     }
@@ -461,102 +477,121 @@
   return true;
 }
 
-void PaintPropertyTreeBuilder::UpdateEffect(
-    const LayoutObject& object,
-    PaintPropertyTreeBuilderContext& context) {
+static bool NeedsEffect(const LayoutObject& object) {
   const ComputedStyle& style = object.StyleRef();
 
   const bool is_css_isolated_group =
       object.IsBoxModelObject() && style.IsStackingContext();
-  if (!is_css_isolated_group && !object.IsSVGChild()) {
-    if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-      if (auto* properties = object.GetMutableForPainting().PaintProperties()) {
-        context.force_subtree_update |= properties->ClearEffect();
-        context.force_subtree_update |= properties->ClearMask();
-        context.force_subtree_update |= properties->ClearMaskClip();
-      }
+
+  if (!is_css_isolated_group && !object.IsSVGChild())
+    return false;
+
+  if (object.IsSVG()) {
+    // This handles SVGRoot objects which have PaintLayers.
+    if (object.IsSVGRoot() && object.HasNonIsolatedBlendingDescendants())
+      return true;
+    if (SVGLayoutSupport::IsIsolationRequired(&object))
+      return true;
+  } else if (object.IsBoxModelObject()) {
+    if (PaintLayer* layer = ToLayoutBoxModelObject(object).Layer()) {
+      if (layer->HasNonIsolatedDescendantWithBlendMode())
+        return true;
     }
-    return;
   }
 
+  SkBlendMode blend_mode = object.IsBlendingAllowed()
+                               ? WebCoreCompositeToSkiaComposite(
+                                     kCompositeSourceOver, style.BlendMode())
+                               : SkBlendMode::kSrcOver;
+  if (blend_mode != SkBlendMode::kSrcOver)
+    return true;
+
+  float opacity = style.Opacity();
+  if (opacity != 1.0f)
+    return true;
+
+  if (CompositingReasonFinder::RequiresCompositingForOpacityAnimation(style))
+    return true;
+
+  if (object.IsSVGChild()) {
+    if (SVGResources* resources =
+            SVGResourcesCache::CachedResourcesForLayoutObject(&object)) {
+      if (resources->Masker())
+        return true;
+    }
+  }
+
+  if (object.StyleRef().HasMask())
+    return true;
+
+  return false;
+}
+
+void PaintPropertyTreeBuilder::UpdateEffect(
+    const LayoutObject& object,
+    PaintPropertyTreeBuilderContext& context) {
+  const ComputedStyle& style = object.StyleRef();
+
   // TODO(trchen): Can't omit effect node if we have 3D children.
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
     const ClipPaintPropertyNode* output_clip =
         context.input_clip_of_current_effect;
 
-    bool effect_node_needed = false;
+    if (NeedsEffect(object)) {
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
 
-    // Can't omit effect node if we have paint children with exotic blending.
-    if (object.IsSVG()) {
-      // This handles SVGRoot objects which have PaintLayers.
-      if (object.IsSVGRoot() && object.HasNonIsolatedBlendingDescendants())
-        effect_node_needed = true;
-      else if (SVGLayoutSupport::IsIsolationRequired(&object))
-        effect_node_needed = true;
-    } else if (PaintLayer* layer = ToLayoutBoxModelObject(object).Layer()) {
-      if (layer->HasNonIsolatedDescendantWithBlendMode())
-        effect_node_needed = true;
-    }
+      // We may begin to composite our subtree prior to an animation starts,
+      // but a compositor element ID is only needed when an animation is
+      // current.
+      CompositingReasons compositing_reasons = kCompositingReasonNone;
+      if (CompositingReasonFinder::RequiresCompositingForOpacityAnimation(
+              style)) {
+        compositing_reasons = kCompositingReasonActiveAnimation;
+      }
 
-    SkBlendMode blend_mode = object.IsBlendingAllowed()
-                                 ? WebCoreCompositeToSkiaComposite(
-                                       kCompositeSourceOver, style.BlendMode())
-                                 : SkBlendMode::kSrcOver;
-    if (blend_mode != SkBlendMode::kSrcOver)
-      effect_node_needed = true;
+      IntRect mask_clip;
+      ColorFilter mask_color_filter;
+      bool has_mask = ComputeMaskParameters(
+          mask_clip, mask_color_filter, object, context.current.paint_offset);
+      if (has_mask) {
+        context.force_subtree_update |= properties.UpdateMaskClip(
+            context.current.clip, context.current.transform,
+            FloatRoundedRect(mask_clip));
+        output_clip = properties.MaskClip();
 
-    float opacity = style.Opacity();
-    if (opacity != 1.0f)
-      effect_node_needed = true;
+        // TODO(crbug.com/683425): PaintArtifactCompositor does not handle
+        // grouping (i.e. descendant-dependent compositing reason) properly
+        // yet. This forces masked subtree always create a layer for now.
+        compositing_reasons |= kCompositingReasonIsolateCompositedDescendants;
+      } else {
+        if (auto* properties = object.GetMutableForPainting().PaintProperties())
+          context.force_subtree_update |= properties->ClearMaskClip();
+      }
 
-    // We may begin to composite our subtree prior to an animation starts,
-    // but a compositor element ID is only needed when an animation is current.
-    CompositorElementId compositor_element_id =
-        style.HasCurrentOpacityAnimation()
-            ? CreateDomNodeBasedCompositorElementId(object)
-            : CompositorElementId();
-    CompositingReasons compositing_reasons = kCompositingReasonNone;
-    if (CompositingReasonFinder::RequiresCompositingForOpacityAnimation(
-            style)) {
-      compositing_reasons = kCompositingReasonActiveAnimation;
-      effect_node_needed = true;
-    }
-    DCHECK(!style.HasCurrentOpacityAnimation() ||
-           compositing_reasons != kCompositingReasonNone);
+      SkBlendMode blend_mode =
+          object.IsBlendingAllowed()
+              ? WebCoreCompositeToSkiaComposite(kCompositeSourceOver,
+                                                style.BlendMode())
+              : SkBlendMode::kSrcOver;
 
-    IntRect mask_clip;
-    ColorFilter mask_color_filter;
-    bool has_mask = ComputeMaskParameters(mask_clip, mask_color_filter, object,
-                                          context.current.paint_offset);
-    if (has_mask) {
-      effect_node_needed = true;
+      CompositorElementId compositor_element_id =
+          style.HasCurrentOpacityAnimation()
+              ? CreateDomNodeBasedCompositorElementId(object)
+              : CompositorElementId();
 
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
-      context.force_subtree_update |= properties.UpdateMaskClip(
-          context.current.clip, context.current.transform,
-          FloatRoundedRect(mask_clip));
-      output_clip = properties.MaskClip();
+      DCHECK(!style.HasCurrentOpacityAnimation() ||
+             compositing_reasons != kCompositingReasonNone);
 
-      // TODO(crbug.com/683425): PaintArtifactCompositor does not handle
-      // grouping (i.e. descendant-dependent compositing reason) properly yet.
-      // This forces masked subtree always create a layer for now.
-      compositing_reasons |= kCompositingReasonIsolateCompositedDescendants;
-    } else {
-      if (auto* properties = object.GetMutableForPainting().PaintProperties())
-        context.force_subtree_update |= properties->ClearMaskClip();
-    }
-
-    if (effect_node_needed) {
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
       context.force_subtree_update |= properties.UpdateEffect(
           context.current_effect, context.current.transform, output_clip,
-          kColorFilterNone, CompositorFilterOperations(), opacity, blend_mode,
-          compositing_reasons, compositor_element_id);
+          kColorFilterNone, CompositorFilterOperations(), style.Opacity(),
+          blend_mode, compositing_reasons, compositor_element_id);
       if (has_mask) {
         // TODO(crbug.com/683425): PaintArtifactCompositor does not handle
-        // grouping (i.e. descendant-dependent compositing reason) properly yet.
-        // Adding CompositingReasonSquashingDisallowed forces mask not getting
-        // squashed into a child effect. Have no compositing reason otherwise.
+        // grouping (i.e. descendant-dependent compositing reason) properly
+        // yet. Adding CompositingReasonSquashingDisallowed forces mask not
+        // getting squashed into a child effect. Have no compositing reason
+        // otherwise.
         context.force_subtree_update |= properties.UpdateMask(
             properties.Effect(), context.current.transform, output_clip,
             mask_color_filter, CompositorFilterOperations(), 1.f,
@@ -569,6 +604,7 @@
       if (auto* properties = object.GetMutableForPainting().PaintProperties()) {
         context.force_subtree_update |= properties->ClearEffect();
         context.force_subtree_update |= properties->ClearMask();
+        context.force_subtree_update |= properties->ClearMaskClip();
       }
     }
   }
@@ -584,66 +620,70 @@
   }
 }
 
+static bool NeedsFilter(const LayoutObject& object) {
+  // TODO(trchen): SVG caches filters in SVGResources. Implement it.
+  return object.IsBoxModelObject() && ToLayoutBoxModelObject(object).Layer() &&
+         (object.StyleRef().HasFilter() || object.HasReflection());
+}
+
 void PaintPropertyTreeBuilder::UpdateFilter(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
   const ComputedStyle& style = object.StyleRef();
 
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-    CompositorFilterOperations filter;
-    if (object.IsSVGChild()) {
-      // TODO(trchen): SVG caches filters in SVGResources. Implement it.
-    } else if (PaintLayer* layer = ToLayoutBoxModelObject(object).Layer()) {
-      // TODO(trchen): Eliminate PaintLayer dependency.
-      filter = layer->CreateCompositorFilterOperationsForFilter(style);
-    }
+    if (NeedsFilter(object)) {
+      CompositorFilterOperations filter =
+          ToLayoutBoxModelObject(object)
+              .Layer()
+              ->CreateCompositorFilterOperationsForFilter(style);
 
-    // The CSS filter spec didn't specify how filters interact with overflow
-    // clips. The implementation here mimics the old Blink/WebKit behavior for
-    // backward compatibility.
-    // Basically the output of the filter will be affected by clips that applies
-    // to the current element. The descendants that paints into the input of the
-    // filter ignores any clips collected so far. For example:
-    // <div style="overflow:scroll">
-    //   <div style="filter:blur(1px);">
-    //     <div>A</div>
-    //     <div style="position:absolute;">B</div>
-    //   </div>
-    // </div>
-    // In this example "A" should be clipped if the filter was not present.
-    // With the filter, "A" will be rastered without clipping, but instead
-    // the blurred result will be clipped.
-    // On the other hand, "B" should not be clipped because the overflow clip is
-    // not in its containing block chain, but as the filter output will be
-    // clipped, so a blurred "B" may still be invisible.
-    const ClipPaintPropertyNode* output_clip = context.current.clip;
+      // The CSS filter spec didn't specify how filters interact with overflow
+      // clips. The implementation here mimics the old Blink/WebKit behavior for
+      // backward compatibility.
+      // Basically the output of the filter will be affected by clips that
+      // applies to the current element. The descendants that paints into the
+      // input of the filter ignores any clips collected so far. For example:
+      // <div style="overflow:scroll">
+      //   <div style="filter:blur(1px);">
+      //     <div>A</div>
+      //     <div style="position:absolute;">B</div>
+      //   </div>
+      // </div>
+      // In this example "A" should be clipped if the filter was not present.
+      // With the filter, "A" will be rastered without clipping, but instead
+      // the blurred result will be clipped.
+      // On the other hand, "B" should not be clipped because the overflow clip
+      // is not in its containing block chain, but as the filter output will be
+      // clipped, so a blurred "B" may still be invisible.
+      const ClipPaintPropertyNode* output_clip = context.current.clip;
 
-    // TODO(trchen): A filter may contain spatial operations such that an
-    // output pixel may depend on an input pixel outside of the output clip.
-    // We should generate a special clip node to represent this expansion.
+      // TODO(trchen): A filter may contain spatial operations such that an
+      // output pixel may depend on an input pixel outside of the output clip.
+      // We should generate a special clip node to represent this expansion.
 
-    // We may begin to composite our subtree prior to an animation starts,
-    // but a compositor element ID is only needed when an animation is current.
-    CompositorElementId compositor_element_id =
-        style.HasCurrentFilterAnimation()
-            ? CreateDomNodeBasedCompositorElementId(object)
-            : CompositorElementId();
-    CompositingReasons compositing_reasons =
-        CompositingReasonFinder::RequiresCompositingForFilterAnimation(style)
-            ? kCompositingReasonActiveAnimation
-            : kCompositingReasonNone;
-    DCHECK(!style.HasCurrentFilterAnimation() ||
-           compositing_reasons != kCompositingReasonNone);
+      // We may begin to composite our subtree prior to an animation starts,
+      // but a compositor element ID is only needed when an animation is
+      // current.
+      CompositorElementId compositor_element_id =
+          style.HasCurrentFilterAnimation()
+              ? CreateDomNodeBasedCompositorElementId(object)
+              : CompositorElementId();
+      CompositingReasons compositing_reasons =
+          CompositingReasonFinder::RequiresCompositingForFilterAnimation(style)
+              ? kCompositingReasonActiveAnimation
+              : kCompositingReasonNone;
+      DCHECK(!style.HasCurrentFilterAnimation() ||
+             compositing_reasons != kCompositingReasonNone);
 
-    if (compositing_reasons == kCompositingReasonNone && filter.IsEmpty()) {
-      if (auto* properties = object.GetMutableForPainting().PaintProperties())
-        context.force_subtree_update |= properties->ClearFilter();
-    } else {
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
       context.force_subtree_update |= properties.UpdateFilter(
           context.current_effect, context.current.transform, output_clip,
           kColorFilterNone, std::move(filter), 1.f, SkBlendMode::kSrcOver,
           compositing_reasons, compositor_element_id);
+    } else {
+      if (auto* properties = object.GetMutableForPainting().PaintProperties())
+        context.force_subtree_update |= properties->ClearFilter();
     }
   }
 
@@ -659,11 +699,15 @@
   }
 }
 
+static bool NeedsCssClip(const LayoutObject& object) {
+  return object.HasClip();
+}
+
 void PaintPropertyTreeBuilder::UpdateCssClip(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-    if (object.HasClip()) {
+    if (NeedsCssClip(object)) {
       // Create clip node for descendants that are not fixed position.
       // We don't have to setup context.absolutePosition.clip here because this
       // object must be a container for absolute position descendants, and will
@@ -671,7 +715,7 @@
       DCHECK(object.CanContainAbsolutePositionObjects());
       LayoutRect clip_rect =
           ToLayoutBox(object).ClipRect(context.current.paint_offset);
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
       context.force_subtree_update |= properties.UpdateCssClip(
           context.current.clip, context.current.transform,
           FloatRoundedRect(FloatRect(clip_rect)));
@@ -704,6 +748,16 @@
   }
 }
 
+static bool NeedsScrollbarPaintOffset(const LayoutObject& object) {
+  if (object.IsBoxModelObject()) {
+    if (auto* area = ToLayoutBoxModelObject(object).GetScrollableArea()) {
+      if (area->HorizontalScrollbar() || area->VerticalScrollbar())
+        return true;
+    }
+  }
+  return false;
+}
+
 // TODO(trchen): Remove this once we bake the paint offset into frameRect.
 void PaintPropertyTreeBuilder::UpdateScrollbarPaintOffset(
     const LayoutObject& object,
@@ -711,44 +765,49 @@
   if (!object.NeedsPaintPropertyUpdate() && !context.force_subtree_update)
     return;
 
-  bool needs_scrollbar_paint_offset = false;
-  IntPoint rounded_paint_offset = RoundedIntPoint(context.current.paint_offset);
-  if (rounded_paint_offset != IntPoint() && object.IsBoxModelObject()) {
-    if (auto* area = ToLayoutBoxModelObject(object).GetScrollableArea()) {
-      if (area->HorizontalScrollbar() || area->VerticalScrollbar()) {
-        auto paint_offset = TransformationMatrix().Translate(
-            rounded_paint_offset.X(), rounded_paint_offset.Y());
-        auto& properties =
-            object.GetMutableForPainting().EnsurePaintProperties();
-        context.force_subtree_update |= properties.UpdateScrollbarPaintOffset(
-            context.current.transform, paint_offset, FloatPoint3D());
-        needs_scrollbar_paint_offset = true;
-      }
-    }
+  if (NeedsScrollbarPaintOffset(object)) {
+    IntPoint rounded_paint_offset =
+        RoundedIntPoint(context.current.paint_offset);
+    auto paint_offset = TransformationMatrix().Translate(
+        rounded_paint_offset.X(), rounded_paint_offset.Y());
+    auto& properties = *object.GetMutableForPainting().PaintProperties();
+    context.force_subtree_update |= properties.UpdateScrollbarPaintOffset(
+        context.current.transform, paint_offset, FloatPoint3D());
+  } else {
+    if (auto* properties = object.GetMutableForPainting().PaintProperties())
+      context.force_subtree_update |= properties->ClearScrollbarPaintOffset();
   }
+}
 
-  auto* properties = object.GetMutableForPainting().PaintProperties();
-  if (!needs_scrollbar_paint_offset && properties)
-    context.force_subtree_update |= properties->ClearScrollbarPaintOffset();
+static bool NeedsOverflowScroll(const LayoutObject& object) {
+  return object.IsBox() && ToLayoutBox(object).ShouldClipOverflow();
 }
 
 void PaintPropertyTreeBuilder::UpdateOverflowClip(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
-  if (!object.IsBox())
-    return;
-
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-    const LayoutBox& box = ToLayoutBox(object);
-    // The <input> elements can't have contents thus CSS overflow property
-    // doesn't apply.  However for layout purposes we do generate child layout
-    // objects for them, e.g. button label.  We should clip the overflow from
-    // those children. This is called control clip and we technically treat them
-    // like overflow clip.
-    LayoutRect clip_rect;
-    if (box.ShouldClipOverflow()) {
+    if (NeedsOverflowScroll(object)) {
+      const LayoutBox& box = ToLayoutBox(object);
+      LayoutRect clip_rect;
       clip_rect =
           LayoutRect(box.OverflowClipRect(context.current.paint_offset));
+
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
+      const auto* current_clip = context.current.clip;
+      if (box.StyleRef().HasBorderRadius()) {
+        auto inner_border = box.StyleRef().GetRoundedInnerBorderFor(
+            LayoutRect(context.current.paint_offset, box.Size()));
+        context.force_subtree_update |= properties.UpdateInnerBorderRadiusClip(
+            context.current.clip, context.current.transform, inner_border);
+        current_clip = properties.InnerBorderRadiusClip();
+      } else {
+        context.force_subtree_update |= properties.ClearInnerBorderRadiusClip();
+      }
+
+      context.force_subtree_update |=
+          properties.UpdateOverflowClip(current_clip, context.current.transform,
+                                        FloatRoundedRect(FloatRect(clip_rect)));
     } else {
       if (auto* properties = object.GetMutableForPainting().PaintProperties()) {
         context.force_subtree_update |=
@@ -757,22 +816,6 @@
       }
       return;
     }
-
-    auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
-    const auto* current_clip = context.current.clip;
-    if (box.StyleRef().HasBorderRadius()) {
-      auto inner_border = box.StyleRef().GetRoundedInnerBorderFor(
-          LayoutRect(context.current.paint_offset, box.Size()));
-      context.force_subtree_update |= properties.UpdateInnerBorderRadiusClip(
-          context.current.clip, context.current.transform, inner_border);
-      current_clip = properties.InnerBorderRadiusClip();
-    } else {
-      context.force_subtree_update |= properties.ClearInnerBorderRadiusClip();
-    }
-
-    context.force_subtree_update |=
-        properties.UpdateOverflowClip(current_clip, context.current.transform,
-                                      FloatRoundedRect(FloatRect(clip_rect)));
   }
 
   const auto* properties = object.PaintProperties();
@@ -791,12 +834,16 @@
                           border_box_size.Height()));
 }
 
+static bool NeedsPerspective(const LayoutObject& object) {
+  return object.IsBox() && object.StyleRef().HasPerspective();
+}
+
 void PaintPropertyTreeBuilder::UpdatePerspective(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-    const ComputedStyle& style = object.StyleRef();
-    if (object.IsBox() && style.HasPerspective()) {
+    if (NeedsPerspective(object)) {
+      const ComputedStyle& style = object.StyleRef();
       // The perspective node must not flatten (else nothing will get
       // perspective), but it should still extend the rendering context as
       // most transform nodes do.
@@ -804,7 +851,7 @@
           TransformationMatrix().ApplyPerspective(style.Perspective());
       FloatPoint3D origin = PerspectiveOrigin(ToLayoutBox(object)) +
                             ToLayoutSize(context.current.paint_offset);
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
       context.force_subtree_update |= properties.UpdatePerspective(
           context.current.transform, matrix, origin,
           context.current.should_flatten_inherited_transform,
@@ -822,6 +869,10 @@
   }
 }
 
+static bool NeedsSVGLocalToBorderBoxTransform(const LayoutObject& object) {
+  return object.IsSVGRoot();
+}
+
 void PaintPropertyTreeBuilder::UpdateSvgLocalToBorderBoxTransform(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
@@ -832,8 +883,9 @@
     AffineTransform transform_to_border_box =
         SVGRootPainter(ToLayoutSVGRoot(object))
             .TransformToPixelSnappedBorderBox(context.current.paint_offset);
-    if (!transform_to_border_box.IsIdentity()) {
-      auto& properties = object.GetMutableForPainting().EnsurePaintProperties();
+    if (!transform_to_border_box.IsIdentity() &&
+        NeedsSVGLocalToBorderBoxTransform(object)) {
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
       context.force_subtree_update |=
           properties.UpdateSvgLocalToBorderBoxTransform(
               context.current.transform, transform_to_border_box,
@@ -870,56 +922,58 @@
                                        ancestor_reasons);
 }
 
+static bool NeedsScrollTranslation(const LayoutObject& object) {
+  if (object.HasOverflowClip()) {
+    const LayoutBox& box = ToLayoutBox(object);
+    auto* scrollable_area = box.GetScrollableArea();
+    IntSize scroll_offset = box.ScrolledContentOffset();
+    if (!scroll_offset.IsZero() || scrollable_area->ScrollsOverflow())
+      return true;
+  }
+  return false;
+}
+
 void PaintPropertyTreeBuilder::UpdateScrollAndScrollTranslation(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
   if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-    bool needs_scroll_properties = false;
-    if (object.HasOverflowClip()) {
+    if (NeedsScrollTranslation(object)) {
+      const LayoutBox& box = ToLayoutBox(object);
+      auto* scrollable_area = box.GetScrollableArea();
+      IntSize scroll_offset = box.ScrolledContentOffset();
+      auto& properties = *object.GetMutableForPainting().PaintProperties();
+
+      IntSize scroll_clip = scrollable_area->VisibleContentRect().Size();
+      IntSize scroll_bounds = scrollable_area->ContentsSize();
+      bool user_scrollable_horizontal =
+          scrollable_area->UserInputScrollable(kHorizontalScrollbar);
+      bool user_scrollable_vertical =
+          scrollable_area->UserInputScrollable(kVerticalScrollbar);
+
       auto ancestor_reasons =
           context.current.scroll->GetMainThreadScrollingReasons();
       auto reasons = GetMainThreadScrollingReasons(object, ancestor_reasons);
 
-      const LayoutBox& box = ToLayoutBox(object);
-      auto* scrollable_area = box.GetScrollableArea();
-      IntSize scroll_offset = box.ScrolledContentOffset();
-      if (!scroll_offset.IsZero() || scrollable_area->ScrollsOverflow()) {
-        needs_scroll_properties = true;
-        auto& properties =
-            object.GetMutableForPainting().EnsurePaintProperties();
-
-        IntSize scroll_clip = scrollable_area->VisibleContentRect().Size();
-        IntSize scroll_bounds = scrollable_area->ContentsSize();
-        bool user_scrollable_horizontal =
-            scrollable_area->UserInputScrollable(kHorizontalScrollbar);
-        bool user_scrollable_vertical =
-            scrollable_area->UserInputScrollable(kVerticalScrollbar);
-
-        // Main thread scrolling reasons depend on their ancestor's reasons
-        // so ensure the entire subtree is updated when reasons change.
-        if (auto* existing_scroll_translation =
-                properties.ScrollTranslation()) {
-          auto* existing_scroll_node =
-              existing_scroll_translation->ScrollNode();
-          if (existing_scroll_node->GetMainThreadScrollingReasons() != reasons)
-            context.force_subtree_update = true;
-        }
-
-        CompositorElementId compositor_element_id =
-            CreateDomNodeBasedCompositorElementId(object);
-        TransformationMatrix matrix = TransformationMatrix().Translate(
-            -scroll_offset.Width(), -scroll_offset.Height());
-        context.force_subtree_update |= properties.UpdateScrollTranslation(
-            context.current.transform, matrix, FloatPoint3D(),
-            context.current.should_flatten_inherited_transform,
-            context.current.rendering_context_id, kCompositingReasonNone,
-            compositor_element_id, context.current.scroll, scroll_clip,
-            scroll_bounds, user_scrollable_horizontal, user_scrollable_vertical,
-            reasons, scrollable_area);
+      // Main thread scrolling reasons depend on their ancestor's reasons
+      // so ensure the entire subtree is updated when reasons change.
+      if (auto* existing_scroll_translation = properties.ScrollTranslation()) {
+        auto* existing_scroll_node = existing_scroll_translation->ScrollNode();
+        if (existing_scroll_node->GetMainThreadScrollingReasons() != reasons)
+          context.force_subtree_update = true;
       }
-    }
 
-    if (!needs_scroll_properties) {
+      CompositorElementId compositor_element_id =
+          CreateDomNodeBasedCompositorElementId(object);
+      TransformationMatrix matrix = TransformationMatrix().Translate(
+          -scroll_offset.Width(), -scroll_offset.Height());
+      context.force_subtree_update |= properties.UpdateScrollTranslation(
+          context.current.transform, matrix, FloatPoint3D(),
+          context.current.should_flatten_inherited_transform,
+          context.current.rendering_context_id, kCompositingReasonNone,
+          compositor_element_id, context.current.scroll, scroll_clip,
+          scroll_bounds, user_scrollable_horizontal, user_scrollable_vertical,
+          reasons, scrollable_area);
+    } else {
       // Ensure pre-existing properties are cleared.
       if (auto* properties = object.GetMutableForPainting().PaintProperties())
         context.force_subtree_update |= properties->ClearScrollTranslation();
@@ -934,6 +988,11 @@
   }
 }
 
+static bool NeedsCssClipFixedPosition(const LayoutObject& object) {
+  return !object.IsLayoutView() && !object.CanContainFixedPositionObjects() &&
+         NeedsCssClip(object);
+}
+
 void PaintPropertyTreeBuilder::UpdateOutOfFlowContext(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
@@ -966,8 +1025,8 @@
     // absolute position container. However for fixed-position descendants we
     // need to insert the clip here if we are not a containing block ancestor of
     // them.
-    auto* css_clip =
-        object.GetMutableForPainting().PaintProperties()->CssClip();
+    auto& properties = *object.GetMutableForPainting().PaintProperties();
+    auto* css_clip = properties.CssClip();
 
     // Before we actually create anything, check whether in-flow context and
     // fixed-position context has exactly the same clip. Reuse if possible.
@@ -975,17 +1034,14 @@
       context.fixed_position.clip = css_clip;
     } else {
       if (object.NeedsPaintPropertyUpdate() || context.force_subtree_update) {
-        auto& properties =
-            object.GetMutableForPainting().EnsurePaintProperties();
         context.force_subtree_update |= properties.UpdateCssClipFixedPosition(
             context.fixed_position.clip,
             const_cast<TransformPaintPropertyNode*>(
                 css_clip->LocalTransformSpace()),
             css_clip->ClipRect());
       }
-      const auto* properties = object.PaintProperties();
-      if (properties && properties->CssClipFixedPosition())
-        context.fixed_position.clip = properties->CssClipFixedPosition();
+      if (properties.CssClipFixedPosition())
+        context.fixed_position.clip = properties.CssClipFixedPosition();
       return;
     }
   }
@@ -1108,6 +1164,28 @@
     box.GetMutableForPainting().SetNeedsPaintPropertyUpdate();
 }
 
+void PaintPropertyTreeBuilder::UpdatePaintProperties(
+    const LayoutObject& object,
+    PaintPropertyTreeBuilderContext& context) {
+  bool needs_paint_properties =
+      NeedsPaintOffsetTranslation(object) || NeedsTransform(object) ||
+      NeedsEffect(object) || NeedsTransformForNonRootSVG(object) ||
+      NeedsFilter(object) || NeedsCssClip(object) ||
+      NeedsScrollbarPaintOffset(object) || NeedsOverflowScroll(object) ||
+      NeedsPerspective(object) || NeedsSVGLocalToBorderBoxTransform(object) ||
+      NeedsScrollTranslation(object) || NeedsCssClipFixedPosition(object);
+
+  bool had_paint_properties = object.PaintProperties();
+
+  if (needs_paint_properties) {
+    object.GetMutableForPainting().EnsurePaintProperties();
+  } else {
+    object.GetMutableForPainting().ClearPaintProperties();
+    if (had_paint_properties)
+      context.force_subtree_update = true;
+  }
+}
+
 void PaintPropertyTreeBuilder::UpdatePropertiesForSelf(
     const LayoutObject& object,
     PaintPropertyTreeBuilderContext& context) {
@@ -1118,6 +1196,8 @@
     context = PaintPropertyTreeBuilderContext();
   }
 
+  UpdatePaintProperties(object, context);
+
   // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset
   // can change without needsPaintPropertyUpdate.
   UpdateForObjectLocationAndSize(object, context);
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h
index b86ac35b..4f668ba9 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h
@@ -161,6 +161,12 @@
   ALWAYS_INLINE static void UpdateOutOfFlowContext(
       const LayoutObject&,
       PaintPropertyTreeBuilderContext&);
+
+  // Ensure the ObjectPaintProperties object is created if it will be needed, or
+  // cleared otherwise.
+  ALWAYS_INLINE static void UpdatePaintProperties(
+      const LayoutObject&,
+      PaintPropertyTreeBuilderContext&);
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 2f543611..b14582cd 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -378,8 +378,7 @@
       HTMLNames::styleAttr,
       "margin-left: 50px; margin-top: 100px; width: 400px; height: 300px;");
   GetDocument().View()->UpdateAllLifecyclePhases();
-  EXPECT_EQ(nullptr,
-            transform->GetLayoutObject()->PaintProperties()->Transform());
+  EXPECT_EQ(nullptr, transform->GetLayoutObject()->PaintProperties());
 
   transform->setAttribute(
       HTMLNames::styleAttr,
@@ -479,8 +478,7 @@
       HTMLNames::styleAttr,
       "margin-left: 50px; margin-top: 100px; width: 400px; height: 300px;");
   GetDocument().View()->UpdateAllLifecyclePhases();
-  EXPECT_EQ(nullptr,
-            transform->GetLayoutObject()->PaintProperties()->Transform());
+  EXPECT_EQ(nullptr, transform->GetLayoutObject()->PaintProperties());
 
   transform->setAttribute(
       HTMLNames::styleAttr,
@@ -1943,8 +1941,8 @@
   EXPECT_EQ(TransformationMatrix(),
             svg_with_transform_properties->Transform()->Matrix());
   EXPECT_EQ(LayoutPoint(FloatPoint(0.1, 0)), svg_with_transform.PaintOffset());
-  EXPECT_EQ(nullptr,
-            svg_with_transform_properties->SvgLocalToBorderBoxTransform());
+  EXPECT_TRUE(svg_with_transform_properties->SvgLocalToBorderBoxTransform() ==
+              nullptr);
 
   LayoutObject& rect_with_transform =
       *GetDocument().GetElementById("rect")->GetLayoutObject();
@@ -2335,8 +2333,7 @@
   EXPECT_EQ(a_properties, a->GetLayoutObject()->PaintProperties());
   EXPECT_EQ(a_transform_node, a_properties->Transform());
 
-  EXPECT_EQ(b_properties, b->GetLayoutObject()->PaintProperties());
-  EXPECT_EQ(nullptr, b_properties->Transform());
+  EXPECT_EQ(nullptr, b->GetLayoutObject()->PaintProperties());
 
   EXPECT_EQ(c_properties, c->GetLayoutObject()->PaintProperties());
   EXPECT_EQ(c_transform_node, c_properties->Transform());
@@ -2358,6 +2355,7 @@
   EXPECT_EQ(a_properties, a->GetLayoutObject()->PaintProperties());
   EXPECT_EQ(a_transform_node, a_properties->Transform());
 
+  b_properties = b->GetLayoutObject()->PaintProperties();
   EXPECT_EQ(b_properties, b->GetLayoutObject()->PaintProperties());
   b_transform_node = b_properties->Transform();
   EXPECT_EQ(TransformationMatrix().Translate(4, 5), b_transform_node->Matrix());
@@ -3016,6 +3014,18 @@
       GetLayoutObjectByElementId("absolute")->Container()->IsLayoutBlock());
 }
 
+TEST_P(PaintPropertyTreeBuilderTest, Reflection) {
+  SetBodyInnerHTML(
+      "<div id='filter' style='-webkit-box-reflect: below; height:1000px;'>"
+      "</div>");
+  const ObjectPaintProperties* filter_properties =
+      GetLayoutObjectByElementId("filter")->PaintProperties();
+  EXPECT_TRUE(filter_properties->Filter()->Parent()->IsRoot());
+  EXPECT_EQ(FrameScrollTranslation(),
+            filter_properties->Filter()->LocalTransformSpace());
+  EXPECT_EQ(FrameContentClip(), filter_properties->Filter()->OutputClip());
+}
+
 TEST_P(PaintPropertyTreeBuilderTest, SimpleFilter) {
   SetBodyInnerHTML(
       "<div id='filter' style='filter:opacity(0.5); height:1000px;'>"
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
index 9fdb157..8e6553f 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp
@@ -552,7 +552,8 @@
   // Removing the animation should remove the transform node.
   target->removeAttribute(HTMLNames::classAttr);
   GetDocument().View()->UpdateAllLifecyclePhases();
-  EXPECT_EQ(nullptr, properties->Transform());
+  // Ensure the paint properties object was cleared as it is no longer needed.
+  EXPECT_EQ(nullptr, target->GetLayoutObject()->PaintProperties());
 }
 
 TEST_P(PaintPropertyTreeUpdateTest,
@@ -566,7 +567,7 @@
   // Removing the animation should remove the effect node.
   target->removeAttribute(HTMLNames::classAttr);
   GetDocument().View()->UpdateAllLifecyclePhases();
-  EXPECT_EQ(nullptr, properties->Effect());
+  EXPECT_EQ(nullptr, target->GetLayoutObject()->PaintProperties());
 }
 
 TEST_P(PaintPropertyTreeUpdateTest,
diff --git a/third_party/WebKit/Source/core/paint/PartPainter.cpp b/third_party/WebKit/Source/core/paint/PartPainter.cpp
index 5ecacd1..1b5b232 100644
--- a/third_party/WebKit/Source/core/paint/PartPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PartPainter.cpp
@@ -27,7 +27,7 @@
     return true;
 
   int selection_start, selection_end;
-  layout_part_.SelectionStartEnd(selection_start, selection_end);
+  std::tie(selection_start, selection_end) = layout_part_.SelectionStartEnd();
   if (s == SelectionStart)
     return selection_start == 0;
 
diff --git a/third_party/WebKit/Source/core/paint/RarePaintData.cpp b/third_party/WebKit/Source/core/paint/RarePaintData.cpp
index 0a2ec1f..896be512 100644
--- a/third_party/WebKit/Source/core/paint/RarePaintData.cpp
+++ b/third_party/WebKit/Source/core/paint/RarePaintData.cpp
@@ -23,6 +23,10 @@
   return *paint_properties_.get();
 }
 
+void RarePaintData::ClearPaintProperties() {
+  paint_properties_.reset(nullptr);
+}
+
 void RarePaintData::ClearLocalBorderBoxProperties() {
   local_border_box_properties_ = nullptr;
 }
diff --git a/third_party/WebKit/Source/core/paint/RarePaintData.h b/third_party/WebKit/Source/core/paint/RarePaintData.h
index 3d3e827..a80ac6d 100644
--- a/third_party/WebKit/Source/core/paint/RarePaintData.h
+++ b/third_party/WebKit/Source/core/paint/RarePaintData.h
@@ -32,6 +32,7 @@
     return paint_properties_.get();
   }
   ObjectPaintProperties& EnsurePaintProperties();
+  void ClearPaintProperties();
 
   PropertyTreeState* LocalBorderBoxProperties() const {
     return local_border_box_properties_.get();
diff --git a/third_party/WebKit/Source/core/style/BorderData.h b/third_party/WebKit/Source/core/style/BorderData.h
index 03e386f..f815eea2 100644
--- a/third_party/WebKit/Source/core/style/BorderData.h
+++ b/third_party/WebKit/Source/core/style/BorderData.h
@@ -63,6 +63,13 @@
     return false;
   }
 
+  bool HasBorderColorReferencingCurrentColor() const {
+    return (left_.NonZero() && left_.GetColor().IsCurrentColor()) ||
+           (right_.NonZero() && right_.GetColor().IsCurrentColor()) ||
+           (top_.NonZero() && top_.GetColor().IsCurrentColor()) ||
+           (bottom_.NonZero() && bottom_.GetColor().IsCurrentColor());
+  }
+
   float BorderLeftWidth() const {
     if (left_.Style() == kBorderStyleNone ||
         left_.Style() == kBorderStyleHidden)
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index 840807ef..fd24d447c 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -2953,6 +2953,9 @@
   bool HasBorder() const { return Border().HasBorder(); }
   bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); }
   bool HasBorderRadius() const { return Border().HasBorderRadius(); }
+  bool HasBorderColorReferencingCurrentColor() const {
+    return Border().HasBorderColorReferencingCurrentColor();
+  }
 
   void ResetBorder() {
     ResetBorderImage();
@@ -3044,6 +3047,9 @@
   }
   int OutlineOutsetExtent() const;
   float GetOutlineStrokeWidthForFocusRing() const;
+  bool HasOutlineWithCurrentColor() const {
+    return HasOutline() && OutlineColor().IsCurrentColor();
+  }
 
   // Position utility functions.
   bool HasOutOfFlowPosition() const {
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp b/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp
index 5d615bd..10e0975 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyleTest.cpp
@@ -102,4 +102,27 @@
   EXPECT_TRUE(diff.TransformChanged());
 }
 
+TEST(CompuetedStyleTest, HasOutlineWithCurrentColor) {
+  RefPtr<ComputedStyle> style = ComputedStyle::Create();
+  EXPECT_FALSE(style->HasOutline());
+  EXPECT_FALSE(style->HasOutlineWithCurrentColor());
+  style->SetOutlineColor(StyleColor::CurrentColor());
+  EXPECT_FALSE(style->HasOutlineWithCurrentColor());
+  style->SetOutlineWidth(5);
+  EXPECT_FALSE(style->HasOutlineWithCurrentColor());
+  style->SetOutlineStyle(kBorderStyleSolid);
+  EXPECT_TRUE(style->HasOutlineWithCurrentColor());
+}
+
+TEST(CompuetedStyleTest, HasBorderColorReferencingCurrentColor) {
+  RefPtr<ComputedStyle> style = ComputedStyle::Create();
+  EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor());
+  style->SetBorderBottomColor(StyleColor::CurrentColor());
+  EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor());
+  style->SetBorderBottomWidth(5);
+  EXPECT_FALSE(style->HasBorderColorReferencingCurrentColor());
+  style->SetBorderBottomStyle(kBorderStyleSolid);
+  EXPECT_TRUE(style->HasBorderColorReferencingCurrentColor());
+}
+
 }  // namespace blink
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
index a28865a2..865352c 100644
--- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
+++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
@@ -293,7 +293,7 @@
     },
     {
       name: "CSSSnapSize",
-      status: "stable",
+      status: "experimental",
     },
     {
       name: "CSSStickyPosition",
diff --git a/third_party/WebKit/Source/platform/fonts/Font.cpp b/third_party/WebKit/Source/platform/fonts/Font.cpp
index 2241673..7ee449c 100644
--- a/third_party/WebKit/Source/platform/fonts/Font.cpp
+++ b/third_party/WebKit/Source/platform/fonts/Font.cpp
@@ -150,6 +150,23 @@
   return true;
 }
 
+bool Font::DrawText(PaintCanvas* canvas,
+                    const TextFragmentPaintInfo& text_info,
+                    const FloatPoint& point,
+                    float device_scale_factor,
+                    const PaintFlags& flags) const {
+  // Don't draw anything while we are using custom fonts that are in the process
+  // of loading.
+  if (ShouldSkipDrawing())
+    return false;
+
+  ShapeResultBloberizer bloberizer(*this, device_scale_factor);
+  bloberizer.FillGlyphs(text_info.text, text_info.from, text_info.to,
+                        text_info.shape_result);
+  DrawBlobs(canvas, flags, bloberizer.Blobs(), point);
+  return true;
+}
+
 bool Font::DrawBidiText(PaintCanvas* canvas,
                         const TextRunPaintInfo& run_info,
                         const FloatPoint& point,
diff --git a/third_party/WebKit/Source/platform/fonts/Font.h b/third_party/WebKit/Source/platform/fonts/Font.h
index 081e62ce..4b854c42 100644
--- a/third_party/WebKit/Source/platform/fonts/Font.h
+++ b/third_party/WebKit/Source/platform/fonts/Font.h
@@ -56,6 +56,15 @@
 class TextRun;
 struct TextRunPaintInfo;
 
+// Represents text content of a NGPhysicalTextFragment for painting.
+// TODO(eae): Move to a separate file?
+struct PLATFORM_EXPORT TextFragmentPaintInfo {
+  const StringView text;
+  unsigned from;
+  unsigned to;
+  const ShapeResult* shape_result;
+};
+
 class PLATFORM_EXPORT Font {
   DISALLOW_NEW();
 
@@ -85,6 +94,11 @@
                 const FloatPoint&,
                 float device_scale_factor,
                 const PaintFlags&) const;
+  bool DrawText(PaintCanvas*,
+                const TextFragmentPaintInfo&,
+                const FloatPoint&,
+                float device_scale_factor,
+                const PaintFlags&) const;
   bool DrawBidiText(PaintCanvas*,
                     const TextRunPaintInfo&,
                     const FloatPoint&,
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.cpp
index ad1a6b7e..739cae2 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.cpp
@@ -88,11 +88,9 @@
 float ShapeResultBloberizer::FillGlyphs(
     const TextRunPaintInfo& run_info,
     const ShapeResultBuffer& result_buffer) {
-  // Fast path: full run with no vertical offsets, no text intercepts.
-  if (!run_info.from && run_info.to == run_info.run.length() &&
-      !result_buffer.HasVerticalOffsets() &&
-      GetType() != ShapeResultBloberizer::Type::kTextIntercepts) {
-    return FillFastHorizontalGlyphs(result_buffer, run_info.run);
+  if (CanUseFastPath(run_info.from, run_info.to, run_info.run.length(),
+                     result_buffer.HasVerticalOffsets())) {
+    return FillFastHorizontalGlyphs(result_buffer, run_info.run.Direction());
   }
 
   float advance = 0;
@@ -105,13 +103,15 @@
       const RefPtr<const ShapeResult>& word_result = results[resolved_index];
       word_offset -= word_result->NumCharacters();
       advance =
-          FillGlyphsForResult(*word_result, run_info, advance, word_offset);
+          FillGlyphsForResult(word_result.Get(), run_info.run, run_info.from,
+                              run_info.to, advance, word_offset);
     }
   } else {
     unsigned word_offset = 0;
     for (const auto& word_result : results) {
       advance =
-          FillGlyphsForResult(*word_result, run_info, advance, word_offset);
+          FillGlyphsForResult(word_result.Get(), run_info.run, run_info.from,
+                              run_info.to, advance, word_offset);
       word_offset += word_result->NumCharacters();
     }
   }
@@ -119,6 +119,20 @@
   return advance;
 }
 
+float ShapeResultBloberizer::FillGlyphs(const StringView& text,
+                                        unsigned from,
+                                        unsigned to,
+                                        const ShapeResult* result) {
+  DCHECK(result);
+  DCHECK(to <= text.length());
+  if (CanUseFastPath(from, to, text.length(), result->HasVerticalOffsets()))
+    return FillFastHorizontalGlyphs(result);
+
+  float advance = 0;
+  float word_offset = 0;
+  return FillGlyphsForResult(result, text, from, to, advance, word_offset);
+}
+
 void ShapeResultBloberizer::FillTextEmphasisGlyphs(
     const TextRunPaintInfo& run_info,
     const GlyphData& emphasis_data,
@@ -143,27 +157,29 @@
 
 namespace {
 
+template <typename TextContainerType>
 inline bool IsSkipInkException(const ShapeResultBloberizer& bloberizer,
-                               const TextRun& run,
+                               const TextContainerType& text,
                                unsigned character_index) {
   // We want to skip descenders in general, but it is undesirable renderings for
   // CJK characters.
   return bloberizer.GetType() == ShapeResultBloberizer::Type::kTextIntercepts &&
-         !run.Is8Bit() &&
-         Character::IsCJKIdeographOrSymbol(run.CodepointAt(character_index));
+         !text.Is8Bit() &&
+         Character::IsCJKIdeographOrSymbol(text.CodepointAt(character_index));
 }
 
+template <typename TextContainerType>
 inline void AddGlyphToBloberizer(ShapeResultBloberizer& bloberizer,
                                  float advance,
                                  hb_direction_t direction,
                                  const SimpleFontData* font_data,
                                  const HarfBuzzRunGlyphData& glyph_data,
-                                 const TextRun& run,
+                                 const TextContainerType& text,
                                  unsigned character_index) {
   FloatPoint start_offset = HB_DIRECTION_IS_HORIZONTAL(direction)
                                 ? FloatPoint(advance, 0)
                                 : FloatPoint(0, advance);
-  if (!IsSkipInkException(bloberizer, run, character_index)) {
+  if (!IsSkipInkException(bloberizer, text, character_index)) {
     bloberizer.Add(glyph_data.glyph, font_data,
                    start_offset + glyph_data.offset);
   }
@@ -215,21 +231,23 @@
 
 }  // namespace
 
-float ShapeResultBloberizer::FillGlyphsForResult(
-    const ShapeResult& result,
-    const TextRunPaintInfo& run_info,
-    float initial_advance,
-    unsigned run_offset) {
+template <typename TextContainerType>
+float ShapeResultBloberizer::FillGlyphsForResult(const ShapeResult* result,
+                                                 const TextContainerType& text,
+                                                 unsigned from,
+                                                 unsigned to,
+                                                 float initial_advance,
+                                                 unsigned run_offset) {
   auto total_advance = initial_advance;
 
-  for (const auto& run : result.runs_) {
+  for (const auto& run : result->runs_) {
     total_advance = run->ForEachGlyphInRange(
-        total_advance, run_info.from, run_info.to, run_offset,
+        total_advance, from, to, run_offset,
         [&](const HarfBuzzRunGlyphData& glyph_data, float total_advance,
             uint16_t character_index) -> bool {
 
           AddGlyphToBloberizer(*this, total_advance, run->direction_,
-                               run->font_data_.Get(), glyph_data, run_info.run,
+                               run->font_data_.Get(), glyph_data, text,
                                character_index);
           return true;
         });
@@ -238,9 +256,17 @@
   return total_advance;
 }
 
+bool ShapeResultBloberizer::CanUseFastPath(unsigned from,
+                                           unsigned to,
+                                           unsigned length,
+                                           bool has_vertical_offsets) {
+  return !from && to == length && !has_vertical_offsets &&
+         GetType() != ShapeResultBloberizer::Type::kTextIntercepts;
+}
+
 float ShapeResultBloberizer::FillFastHorizontalGlyphs(
     const ShapeResultBuffer& result_buffer,
-    const TextRun& text_run) {
+    TextDirection text_direction) {
   DCHECK(!result_buffer.HasVerticalOffsets());
   DCHECK_NE(GetType(), ShapeResultBloberizer::Type::kTextIntercepts);
 
@@ -248,25 +274,34 @@
   auto results = result_buffer.results_;
 
   for (unsigned i = 0; i < results.size(); ++i) {
-    const auto& word_result = IsLeftToRightDirection(text_run.Direction())
+    const auto& word_result = IsLeftToRightDirection(text_direction)
                                   ? results[i]
                                   : results[results.size() - 1 - i];
-    DCHECK(!word_result->HasVerticalOffsets());
+    advance = FillFastHorizontalGlyphs(word_result.Get(), advance);
+  }
 
-    for (const auto& run : word_result->runs_) {
-      DCHECK(run);
-      DCHECK(HB_DIRECTION_IS_HORIZONTAL(run->direction_));
+  return advance;
+}
 
-      advance =
-          run->ForEachGlyph(advance,
-                            [&](const HarfBuzzRunGlyphData& glyph_data,
-                                float total_advance) -> bool {
-                              DCHECK(!glyph_data.offset.Height());
-                              Add(glyph_data.glyph, run->font_data_.Get(),
-                                  total_advance + glyph_data.offset.Width());
-                              return true;
-                            });
-    }
+float ShapeResultBloberizer::FillFastHorizontalGlyphs(
+    const ShapeResult* shape_result,
+    float advance) {
+  DCHECK(!shape_result->HasVerticalOffsets());
+  DCHECK_NE(GetType(), ShapeResultBloberizer::Type::kTextIntercepts);
+
+  for (const auto& run : shape_result->runs_) {
+    DCHECK(run);
+    DCHECK(HB_DIRECTION_IS_HORIZONTAL(run->direction_));
+
+    advance =
+        run->ForEachGlyph(advance,
+                          [&](const HarfBuzzRunGlyphData& glyph_data,
+                              float total_advance) -> bool {
+                            DCHECK(!glyph_data.offset.Height());
+                            Add(glyph_data.glyph, run->font_data_.Get(),
+                                total_advance + glyph_data.offset.Width());
+                            return true;
+                          });
   }
 
   return advance;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.h b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.h
index 4302fa5..f86e2b73 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.h
+++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBloberizer.h
@@ -32,6 +32,10 @@
   Type GetType() const { return type_; }
 
   float FillGlyphs(const TextRunPaintInfo&, const ShapeResultBuffer&);
+  float FillGlyphs(const StringView&,
+                   unsigned from,
+                   unsigned to,
+                   const ShapeResult*);
   void FillTextEmphasisGlyphs(const TextRunPaintInfo&,
                               const GlyphData& emphasis_data,
                               const ShapeResultBuffer&);
@@ -87,11 +91,25 @@
  private:
   friend class ShapeResultBloberizerTestInfo;
 
-  float FillGlyphsForResult(const ShapeResult&,
-                            const TextRunPaintInfo&,
+  // Where TextContainerType can be either a TextRun or a StringView.
+  // For legacy layout and LayoutNG respectively.
+  template <typename TextContainerType>
+  float FillGlyphsForResult(const ShapeResult*,
+                            const TextContainerType&,
+                            unsigned from,
+                            unsigned to,
                             float initial_advance,
                             unsigned run_offset);
-  float FillFastHorizontalGlyphs(const ShapeResultBuffer&, const TextRun&);
+
+  // Whether the FillFastHorizontalGlyphs can be used. Only applies for full
+  // runs with no vertical offsets and no text intercepts.
+  bool CanUseFastPath(unsigned from,
+                      unsigned to,
+                      unsigned length,
+                      bool has_vertical_offsets);
+  float FillFastHorizontalGlyphs(const ShapeResultBuffer&, TextDirection);
+  float FillFastHorizontalGlyphs(const ShapeResult*, float advance = 0);
+
   float FillTextEmphasisGlyphsForRun(const ShapeResult::RunInfo*,
                                      const TextRunPaintInfo&,
                                      const GlyphData& emphasis_data,
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index 5e3da9d6..df468e2 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -897,11 +897,7 @@
     return kReload;
   }
 
-  // If resource was populated from a SubstituteData load or data: url, use it.
-  if (is_static_data)
-    return kUse;
-
-  if (!existing_resource->CanReuse(fetch_params))
+  if (!is_static_data && !existing_resource->CanReuse(fetch_params))
     return kReload;
 
   // Certain requests (e.g., XHRs) might have manually set headers that require
@@ -915,18 +911,25 @@
   // status code, but for a manual revalidation the response code remains 304.
   // In this case, the Resource likely has insufficient context to provide a
   // useful cache hit or revalidation. See http://crbug.com/643659
-  if (request.IsConditional() ||
-      existing_resource->GetResponse().HttpStatusCode() == 304) {
+  if (!is_static_data &&
+      (request.IsConditional() ||
+       existing_resource->GetResponse().HttpStatusCode() == 304)) {
     return kReload;
   }
 
-  if (!fetch_params.Options().CanReuseRequest(existing_resource->Options()))
+  if (!is_static_data &&
+      !fetch_params.Options().CanReuseRequest(existing_resource->Options())) {
     return kReload;
+  }
 
   // Always use preloads.
   if (existing_resource->IsPreloaded())
     return kUse;
 
+  // If resource was populated from a SubstituteData load or data: url, use it.
+  if (is_static_data)
+    return kUse;
+
   // Don't reload resources while pasting.
   if (allow_stale_resources_)
     return kUse;
diff --git a/third_party/WebKit/Source/platform/wtf/text/StringView.h b/third_party/WebKit/Source/platform/wtf/text/StringView.h
index 9c4876a..4a752e40 100644
--- a/third_party/WebKit/Source/platform/wtf/text/StringView.h
+++ b/third_party/WebKit/Source/platform/wtf/text/StringView.h
@@ -119,6 +119,15 @@
     return characters16_;
   }
 
+  UChar32 CodepointAt(unsigned i) const {
+    SECURITY_DCHECK(i < length());
+    if (Is8Bit())
+      return (*this)[i];
+    UChar32 codepoint;
+    U16_GET(Characters16(), 0, i, length(), codepoint);
+    return codepoint;
+  }
+
   const void* Bytes() const { return bytes_; }
 
   // This is not named impl() like String because it has different semantics.
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 8252799..5b71d940 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -524,6 +524,7 @@
       'base/trace_event/memory_dump_session_state.cc',
       'base/trace_event/memory_infra_background_whitelist.cc',
       'base/trace_event/memory_peak_detector.cc',
+      'base/trace_event/memory_tracing_observer.cc',
       'base/trace_event/process_memory_dump.cc',
       'base/trace_event/process_memory_maps.cc',
       'base/trace_event/process_memory_totals.cc',
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml
index be61786..cb16b84e 100644
--- a/tools/metrics/actions/actions.xml
+++ b/tools/metrics/actions/actions.xml
@@ -15806,6 +15806,65 @@
   <description>Please enter the description of this user action.</description>
 </action>
 
+<action name="Suggestions.ContextMenu.DownloadItem">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User used the context menu to download a suggested item.
+  </description>
+</action>
+
+<action name="Suggestions.ContextMenu.OpenItemInIncognitoTab">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User used the context menu to open a suggested item in an incognito
+    tab.
+  </description>
+</action>
+
+<action name="Suggestions.ContextMenu.OpenItemInNewTab">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User used the context menu to open a suggested item in a new tab.
+  </description>
+</action>
+
+<action name="Suggestions.ContextMenu.OpenItemInNewWindow">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User used the context menu to open a suggested item in a new
+    window.
+  </description>
+</action>
+
+<action name="Suggestions.ContextMenu.RemoveItem">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User used the context menu to remove a suggested item.
+  </description>
+</action>
+
+<action name="Suggestions.ContextMenu.Shown">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User opened the context menu on a suggested item.
+  </description>
+</action>
+
+<action name="Suggestions.Tile.RemovalUndone">
+  <owner>mvanouwerkerk@chromium.org</owner>
+  <owner>galinap@google.com</owner>
+  <description>
+    Android: User tapped the undo button in the snackbar after removing a
+    suggested item.
+  </description>
+</action>
+
 <action name="SuspiciousExtensionBubbleDismissed">
   <owner>finnur@chromium.org</owner>
   <description>Please enter the description of this user action.</description>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 08b0457..cb4d84f1 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -32618,7 +32618,7 @@
 </histogram>
 
 <histogram name="Net.AlternativeServiceServers.MoreOrEqualCacheEntries">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The difference between the size of alternative service mappings in cache and
     preferences. This tracks zero or negative values (when the difference
@@ -32629,7 +32629,7 @@
 </histogram>
 
 <histogram name="Net.AlternativeServiceServers.MorePrefsEntries">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The difference between the size of alternative service mappings in
     preferences and cache. This tracks positive values (when the difference
@@ -33490,7 +33490,6 @@
 <histogram name="Net.CountOfAlternateProtocolServers" units="servers">
   <owner>bnc@chromium.org</owner>
   <owner>rch@chromium.org</owner>
-  <owner>rtenneti@chromium.org</owner>
   <summary>
     The total number of servers (HostPortPairs) to which alternative protocol
     was used. This counts the number of servers persisted to prefs file.
@@ -33500,7 +33499,6 @@
 <histogram name="Net.CountOfAlternateProtocolServers.Memory" units="servers">
   <owner>bnc@chromium.org</owner>
   <owner>rch@chromium.org</owner>
-  <owner>rtenneti@chromium.org</owner>
   <summary>
     The total number of servers (HostPortPairs in memory) to which alternative
     protocol was used.
@@ -33528,7 +33526,6 @@
 <histogram name="Net.CountOfSpdyServers">
   <owner>bnc@chromium.org</owner>
   <owner>rch@chromium.org</owner>
-  <owner>rtenneti@chromium.org</owner>
   <summary>
     The total number of SPDY server names persisted to prefs file.
   </summary>
@@ -33540,7 +33537,6 @@
   </obsolete>
   <owner>bnc@chromium.org</owner>
   <owner>rch@chromium.org</owner>
-  <owner>rtenneti@chromium.org</owner>
   <summary>
     The total number of SPDY Settings properties persisted to prefs file.
   </summary>
@@ -35089,7 +35085,7 @@
 
 <histogram name="Net.HttpServerProperties.UpdatePrefs"
     enum="HttpServerPropertiesUpdatePrefsLocation">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The location in http_server_properties_manager.cc where UpdatePrefs was
     called.
@@ -36265,7 +36261,7 @@
 </histogram>
 
 <histogram name="Net.QuicActiveSessions">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of active QUIC sessions before we activate a new QUIC session.
   </summary>
@@ -36281,7 +36277,7 @@
 </histogram>
 
 <histogram name="Net.QuicClientHelloRejectReasons" enum="QuicRejectReasons">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The reject reasons for QUIC's CHLO (client hello) message from server
   </summary>
@@ -36292,14 +36288,14 @@
     Deprecated 08/2014, and replaced by
     Net.QuicClientHelloServerConfig.InvalidDuration.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     How expired server config is for sending inchoate ClientHello to the server.
   </summary>
 </histogram>
 
 <histogram name="Net.QuicClientHelloServerConfig.InvalidDuration" units="ms">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The time since expiration of server config when we sent inchoate ClientHello
     to the server.
@@ -36311,7 +36307,7 @@
   <obsolete>
     Deprecated as of 11/2014. Replaced by Net.QuicInchoateClientHelloReason.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The reason (the state of the server config) for sending inchoate ClientHello
     to the server.
@@ -36319,7 +36315,7 @@
 </histogram>
 
 <histogram name="Net.QuicCloseConnection.NullVisitor" enum="BooleanNullVisitor">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of times Connection's visitor is a nullptr when CloseConnection
     is called.
@@ -36328,7 +36324,7 @@
 
 <histogram name="Net.QuicCryptoClientConfig.PopulatedFromCanonicalConfig"
     enum="BooleanPopulated">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of times CryptoClientConfig's CachedState is populated from
     canonical config whenever we create a new CryptoClientConfig::CachedState.
@@ -36339,7 +36335,7 @@
   <obsolete>
     Deprecated as of 4/15/2017.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Tracks number of times data read/parse/write API calls of QuicServerInfo to
     and from disk cache is called.
@@ -36350,7 +36346,7 @@
   <obsolete>
     Deprecated as of 10/2014.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Tracks the opening and closing of disk cache entries. Recorded each time a
     disk cache entry is either opened or closed.
@@ -36359,7 +36355,7 @@
 
 <histogram name="Net.QuicDiskCache.FailureReason"
     enum="QuicDiskCacheFailureReason">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Tracks failure reasons to read/load/write of QuicServerInfo to and from disk
     cache.
@@ -36431,7 +36427,7 @@
   <obsolete>
     Deprecated 2016. No longer tracked.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of times QuicHttpStream's session_ is a nullptr before
     StartRequest() is called.
@@ -36440,7 +36436,7 @@
 
 <histogram name="Net.QuicInchoateClientHelloReason"
     enum="QuicServerConfigState">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The reason (the state of the server config) for sending inchoate ClientHello
     to the server.
@@ -36465,7 +36461,7 @@
 
 <histogram name="Net.QuicNumServerConfig.UpdateMessagesIgnored"
     enum="BooleanIgnored">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>The number of times ServerConfigUpdateMessages ignored.</summary>
 </histogram>
 
@@ -36484,7 +36480,7 @@
 </histogram>
 
 <histogram name="Net.QuicReadAvailableData.NullStream" enum="BooleanNullStream">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of times QuicHttpStream's stream_ is a nullptr before
     IsDoneReading() is called.
@@ -36495,7 +36491,7 @@
   <obsolete>
     Deprecated as of 4/15/2017.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>Time spent to load QUIC server information from disk cache.</summary>
 </histogram>
 
@@ -36509,7 +36505,7 @@
 
 <histogram name="Net.QuicServerInfo.DiskCacheState"
     enum="QuicServerConfigState">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The state of the QUIC server information when it's loaded from the disk
     cache.
@@ -36517,7 +36513,7 @@
 </histogram>
 
 <histogram name="Net.QuicServerInfo.DiskCacheWaitForDataReadyTime" units="ms">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Time spent waiting to load QUIC server information from disk cache.
   </summary>
@@ -36528,7 +36524,7 @@
   <obsolete>
     Deprecated as of 4/15/2017.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of times AlternateProtocolMap supports QUIC, but there is no QUIC
     server information in the disk cache. This is recorded whenever QUIC server
@@ -36538,7 +36534,7 @@
 
 <histogram name="Net.QuicServerInfo.WaitForDataReady.HandshakeConfirmedTime"
     units="Milliseconds">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The elapsed time between waiting for reading of QUIC server information from
     disk cache, and receiving crypto handshake confirmation from the server.
@@ -36551,7 +36547,7 @@
   <obsolete>
     Deprecated as of 4/15/2017.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The ratio of the time spent waiting to load QUIC server information from
     disk cache to the min rtt. Logged when session is closed.
@@ -36614,7 +36610,7 @@
 </histogram>
 
 <histogram name="Net.QuicSession.BlockedFrames.Received">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of BLOCKED frames recevied by a QuicSession when the session is
     closed.
@@ -36622,7 +36618,7 @@
 </histogram>
 
 <histogram name="Net.QuicSession.BlockedFrames.Sent">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The number of BLOCKED frames sent by a QuicSession when the session is
     closed.
@@ -36631,7 +36627,7 @@
 
 <histogram name="Net.QuicSession.CertVerifierJob.CompleteTime"
     units="Milliseconds">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Time spent verifying a certificate when racing cert veriifcation with host
     resolution.
@@ -36677,7 +36673,7 @@
 </histogram>
 
 <histogram name="Net.QuicSession.ConnectAfterBroken" enum="BooleanSuccess">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     True if a QUIC connection connected successfully after having been broken.
     Only emitted after a QUIC connection attempt to a server that was previous
@@ -36767,7 +36763,7 @@
 
 <histogram name="Net.QuicSession.ConnectionFlowControlBlocked"
     enum="BooleanBlocked">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Whether QUIC session's connection is flow control blocked when a PING
     message is sent to server.
@@ -36885,7 +36881,7 @@
 
 <histogram name="Net.QuicSession.HostResolution.HandshakeConfirmedTime"
     units="Milliseconds">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The elapsed time between the end of resolving the DNS name of the server for
     a QUIC connection, and receiving crypto handshake confirmation from the
@@ -37237,7 +37233,7 @@
 
 <histogram name="Net.QuicSession.StreamFlowControlBlocked"
     enum="BooleanBlocked">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Whether any of QUIC session's streams are flow control blocked when a PING
     message is sent to server.
@@ -37381,7 +37377,7 @@
 </histogram>
 
 <histogram name="Net.QuicSession.VerifyProofTime" units="ms">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Time spent verifying the signature and certificate chain. This is logged
     whenever QUIC verifies the certificate chain and signature during crypto
@@ -37408,7 +37404,7 @@
 
 <histogram name="Net.QuicStreamFactory.BadPacketLossEvents5"
     enum="QuicBadPacketLossEvents">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     A count of how often a user hits 1, 2, 3, 4 and 5 bad packet loss events for
     port 443. Recorded whenever QUIC has bad packet loss (high packet loss on
@@ -37439,7 +37435,7 @@
 </histogram>
 
 <histogram name="Net.QuicStreamFactory.QuicIsDisabled" enum="Ports">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Recorded whenever QUIC is disabled for a port due to repeated lossy
     connections (high packet loss on multiple consecutive connections). QUIC is
@@ -37462,7 +37458,7 @@
   <obsolete>
     Deprecated 06/2016. No longer tracked.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Whether TSVIPCli DLL is loaded or not on windows when the socket is
     configured.
@@ -37481,7 +37477,7 @@
 
 <histogram name="Net.QuicVerifyProofFailed.HandshakeConfirmed"
     enum="BooleanHandshakeConfirmed">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Logged whenever proof verification fails and if the failure occurred before
     or after the crypto handshake is confirmed.
@@ -70371,7 +70367,7 @@
   <obsolete>
     Deprecated as of 10/2014.
   </obsolete>
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     Time duration measured from the time the startup timebomb was started and
     when it went off.
@@ -74322,7 +74318,7 @@
 </histogram>
 
 <histogram name="ThreadWatcher.ResponseTime" units="ms">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     The time it takes indicated thread to respond with a pong message for a ping
     message from WatchDog thread.
@@ -74330,7 +74326,7 @@
 </histogram>
 
 <histogram name="ThreadWatcher.ResponsiveThreads">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     This is the total number of watched threads that are responding when we got
     no response from the watched thread.
@@ -74338,7 +74334,7 @@
 </histogram>
 
 <histogram name="ThreadWatcher.Unresponsive" units="ms">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     This is the total unresponsive time since last pong message for the
     indicated thread when we got no response from the watched thread.
@@ -74346,7 +74342,7 @@
 </histogram>
 
 <histogram name="ThreadWatcher.UnresponsiveThreads">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <summary>
     This is the total number of watched threads that are not responding when we
     got no response from the watched thread.
@@ -122432,7 +122428,7 @@
 
 <histogram_suffixes name="Net.QuicClientHelloRejectReasons.QuicIsSecureOrNot"
     separator=".">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <suffix name="Insecure" label="for insecure QUIC.">
     <obsolete>
       Deprecated and removed from code as of 10/2015.
@@ -123735,7 +123731,7 @@
 </histogram_suffixes>
 
 <histogram_suffixes name="NetQuicDiskCacheBackend" separator=".">
-  <owner>rtenneti@chromium.org</owner>
+  <owner>rch@chromium.org</owner>
   <suffix name="NoBackend" label="DiskCache didn't have a backend"/>
   <suffix name="DiskCache" label="DiskCache backend is using disk cache."/>
   <suffix name="MemoryCache" label="DiskCache backend is using memory cache."/>
diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_custom_notification_view.cc
index a09ecb3..0c8c2ea4 100644
--- a/ui/arc/notification/arc_custom_notification_view.cc
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -294,11 +294,12 @@
   control_buttons_view_->AddChildView(settings_button_);
 }
 
-void ArcCustomNotificationView::CreateFloatingControlButtons() {
+void ArcCustomNotificationView::MaybeCreateFloatingControlButtons() {
   // Floating close button is a transient child of |surface_| and also part
   // of the hosting widget's focus chain. It could only be created when both
-  // are present.
-  if (!surface_ || !GetWidget())
+  // are present. Further, if we are being destroyed (|item_| is null), don't
+  // create the control buttons.
+  if (!surface_ || !GetWidget() || !item_)
     return;
 
   // Creates the control_buttons_view_, which collects all control buttons into
@@ -307,9 +308,9 @@
   control_buttons_view_->SetLayoutManager(
       new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
 
-  if (item_ && item_->IsOpeningSettingsSupported())
+  if (item_->IsOpeningSettingsSupported())
     CreateSettingsButton();
-  if (item_ && !item_->pinned())
+  if (!item_->pinned())
     CreateCloseButton();
 
   views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
@@ -350,7 +351,7 @@
     surface_->window()->AddObserver(this);
     surface_->window()->AddPreTargetHandler(event_forwarder_.get());
 
-    CreateFloatingControlButtons();
+    MaybeCreateFloatingControlButtons();
 
     if (GetWidget())
       AttachSurface();
@@ -378,10 +379,16 @@
   if (!surface_)
     return;
 
+  // TODO(edcourtney, yhanada): Creating the floating control widget here is not
+  // correct. This function may be called during the destruction of
+  // |floating_control_buttons_widget_|. This can lead to memory corruption.
+  // Rather than creating it here, we should fix the behaviour of OnMouseExited
+  // and OnMouseEntered for ARC notifications in MessageCenterView. See
+  // crbug.com/714587 and crbug.com/709862.
   if (!floating_control_buttons_widget_) {
-    if (GetWidget())
-      CreateFloatingControlButtons();
-    else
+    // This may update |floating_control_buttons_widget_|.
+    MaybeCreateFloatingControlButtons();
+    if (!floating_control_buttons_widget_)
       return;
   }
 
@@ -398,7 +405,8 @@
 }
 
 void ArcCustomNotificationView::UpdatePinnedState() {
-  DCHECK(item_);
+  if (!item_)
+    return;
 
   if (item_->pinned() && close_button_) {
     control_buttons_view_->RemoveChildView(close_button_.get());
@@ -452,7 +460,9 @@
 }
 
 bool ArcCustomNotificationView::ShouldUpdateControlButtonsColor() const {
-  DCHECK(item_);
+  // Don't update the control button color when we are about to be destroyed.
+  if (!item_)
+    return false;
 
   if (settings_button_ &&
       settings_button_->background()->get_color() !=
diff --git a/ui/arc/notification/arc_custom_notification_view.h b/ui/arc/notification/arc_custom_notification_view.h
index 0e58d7e..6af56841 100644
--- a/ui/arc/notification/arc_custom_notification_view.h
+++ b/ui/arc/notification/arc_custom_notification_view.h
@@ -70,7 +70,7 @@
 
   void CreateCloseButton();
   void CreateSettingsButton();
-  void CreateFloatingControlButtons();
+  void MaybeCreateFloatingControlButtons();
   void SetSurface(exo::NotificationSurface* surface);
   void UpdatePreferredSize();
   void UpdateControlButtonsVisibility();
@@ -116,6 +116,8 @@
   void AnimationEnded(const gfx::Animation* animation) override;
   void AnimationProgressed(const gfx::Animation* animation) override;
 
+  // If |item_| is null, we may be about to be destroyed. In this case,
+  // we have to be careful about what we do.
   ArcCustomNotificationItem* item_ = nullptr;
   exo::NotificationSurface* surface_ = nullptr;
 
diff --git a/ui/file_manager/externs/css_rule.js b/ui/file_manager/externs/css_rule.js
index 4dfaacd..b147475 100644
--- a/ui/file_manager/externs/css_rule.js
+++ b/ui/file_manager/externs/css_rule.js
@@ -36,18 +36,9 @@
  */
 CSSRule.KEYFRAMES_RULE = 7;
 
-/**
- * @type {number}
- */
-CSSRule.WEBKIT_KEYFRAMES_RULE = 7;
 
 /**
  * @type {number}
  * @see http://dev.w3.org/csswg/css-animations/#interface-cssrule
  */
 CSSRule.KEYFRAME_RULE = 8;
-
-/**
- * @type {number}
- */
-CSSRule.WEBKIT_KEYFRAME_RULE = 8;
diff --git a/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js b/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
index 3d4bfab8..91a299e 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
@@ -277,7 +277,7 @@
     var styleSheet = document.styleSheets[i];
     for (var j = 0; j < styleSheet.cssRules.length; j++) {
       var rule = styleSheet.cssRules[j];
-      if (rule.type === CSSRule.WEBKIT_KEYFRAMES_RULE &&
+      if (rule.type === CSSRule.KEYFRAMES_RULE &&
           rule.name === 'progress-center-toggle') {
         return rule;
       }
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 05db825efb..e3327a5 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -407,6 +407,8 @@
 }
 
 void MessageCenterView::OnNotificationUpdated(const std::string& id) {
+  // TODO(edcourtney): We may be able to remove this, since |UpdateNotification|
+  // checks it anyway.
   NotificationViewsMap::const_iterator view_iter = notification_views_.find(id);
   if (view_iter == notification_views_.end())
     return;
@@ -416,30 +418,7 @@
   if (!SetRepositionTarget())
     message_list_view_->ResetRepositionSession();
 
-  // TODO(dimich): add MessageCenter::GetVisibleNotificationById(id)
-  MessageView* view = view_iter->second;
-  const NotificationList::Notifications& notifications =
-      message_center_->GetVisibleNotifications();
-  for (NotificationList::Notifications::const_iterator iter =
-           notifications.begin(); iter != notifications.end(); ++iter) {
-    if ((*iter)->id() == id) {
-      int old_width = view->width();
-      int old_height = view->height();
-      bool old_pinned = view->IsPinned();
-      message_list_view_->UpdateNotification(view, **iter);
-      if (view->GetHeightForWidth(old_width) != old_height) {
-        Update(true /* animate */);
-      } else if (view->IsPinned() != old_pinned) {
-        // Animate flag is false, since the pinned flag transition doesn't need
-        // animation.
-        Update(false /* animate */);
-      }
-      break;
-    }
-  }
-
-  // Notify accessibility that the contents have changed.
-  view->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false);
+  UpdateNotification(id);
 }
 
 void MessageCenterView::OnLockedStateChanged(bool locked) {
@@ -481,7 +460,14 @@
 
 void MessageCenterView::UpdateNotificationSize(
     const std::string& notification_id) {
-  OnNotificationUpdated(notification_id);
+  // TODO(edcourtney, yoshiki): We don't call OnNotificationUpdated directly
+  // because it resets the reposition session, which can end up deleting
+  // notification items when it cancels animations. This causes problems for
+  // ARC notifications. See crbug.com/714493. OnNotificationUpdated should not
+  // have to consider the reposition session, but OnMouseEntered and
+  // OnMouseExited don't work properly for ARC notifications at the moment.
+  // See crbug.com/714587.
+  UpdateNotification(notification_id);
 }
 
 void MessageCenterView::AnimationEnded(const gfx::Animation* animation) {
@@ -673,4 +659,38 @@
   message_list_view_->AddNotificationAt(view, 0);
 }
 
+void MessageCenterView::UpdateNotification(const std::string& id) {
+  // TODO(edcourtney, yoshiki): This check seems like it should not be needed.
+  // Investigate what circumstances (if any) trigger it.
+  NotificationViewsMap::const_iterator view_iter = notification_views_.find(id);
+  if (view_iter == notification_views_.end())
+    return;
+
+  // TODO(dimich): add MessageCenter::GetVisibleNotificationById(id)
+  MessageView* view = view_iter->second;
+  const NotificationList::Notifications& notifications =
+      message_center_->GetVisibleNotifications();
+  for (NotificationList::Notifications::const_iterator iter =
+           notifications.begin();
+       iter != notifications.end(); ++iter) {
+    if ((*iter)->id() == id) {
+      int old_width = view->width();
+      int old_height = view->height();
+      bool old_pinned = view->IsPinned();
+      message_list_view_->UpdateNotification(view, **iter);
+      if (view->GetHeightForWidth(old_width) != old_height) {
+        Update(true /* animate */);
+      } else if (view->IsPinned() != old_pinned) {
+        // Animate flag is false, since the pinned flag transition doesn't need
+        // animation.
+        Update(false /* animate */);
+      }
+      break;
+    }
+  }
+
+  // Notify accessibility that the contents have changed.
+  view->NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false);
+}
+
 }  // namespace message_center
diff --git a/ui/message_center/views/message_center_view.h b/ui/message_center/views/message_center_view.h
index 60f9d73..aebbc3f 100644
--- a/ui/message_center/views/message_center_view.h
+++ b/ui/message_center/views/message_center_view.h
@@ -122,6 +122,7 @@
   void UpdateButtonBarStatus();
   void EnableCloseAllIfAppropriate();
   void SetNotificationViewForTest(MessageView* view);
+  void UpdateNotification(const std::string& notification_id);
 
   MessageCenter* message_center_;  // Weak reference.
   MessageCenterTray* tray_;  // Weak reference.
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc
index 173194b..08bdacd 100644
--- a/ui/views/controls/button/menu_button.cc
+++ b/ui/views/controls/button/menu_button.cc
@@ -44,12 +44,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 MenuButton::PressedLock::PressedLock(MenuButton* menu_button)
-    : PressedLock(menu_button, false) {}
+    : PressedLock(menu_button, false, nullptr) {}
 
 MenuButton::PressedLock::PressedLock(MenuButton* menu_button,
-                                     bool is_sibling_menu_show)
+                                     bool is_sibling_menu_show,
+                                     const ui::LocatedEvent* event)
     : menu_button_(menu_button->weak_factory_.GetWeakPtr()) {
-  menu_button_->IncrementPressedLocked(is_sibling_menu_show);
+  menu_button_->IncrementPressedLocked(is_sibling_menu_show, event);
 }
 
 MenuButton::PressedLock::~PressedLock() {
@@ -366,7 +367,8 @@
   Activate(&event);
 }
 
-void MenuButton::IncrementPressedLocked(bool snap_ink_drop_to_activated) {
+void MenuButton::IncrementPressedLocked(bool snap_ink_drop_to_activated,
+                                        const ui::LocatedEvent* event) {
   ++pressed_lock_count_;
   if (increment_pressed_lock_called_)
     *increment_pressed_lock_called_ = true;
@@ -375,7 +377,7 @@
     if (snap_ink_drop_to_activated)
       GetInkDrop()->SnapToActivated();
     else
-      AnimateInkDrop(InkDropState::ACTIVATED, nullptr /* event */);
+      AnimateInkDrop(InkDropState::ACTIVATED, event);
   }
   SetState(STATE_PRESSED);
 }
diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h
index b0ddf331..0d87c31 100644
--- a/ui/views/controls/button/menu_button.h
+++ b/ui/views/controls/button/menu_button.h
@@ -32,7 +32,10 @@
   class VIEWS_EXPORT PressedLock {
    public:
     explicit PressedLock(MenuButton* menu_button);
-    PressedLock(MenuButton* menu_button, bool is_sibling_menu_show);
+    // |event| is the event that caused the button to be pressed. May be null.
+    PressedLock(MenuButton* menu_button,
+                bool is_sibling_menu_show,
+                const ui::LocatedEvent* event);
     ~PressedLock();
 
    private:
@@ -108,8 +111,10 @@
   // Increment/decrement the number of "pressed" locks this button has, and
   // set the state accordingly. The ink drop is snapped to the final ACTIVATED
   // state if |snap_ink_drop_to_activated| is true, otherwise the ink drop will
-  // be animated to the ACTIVATED node_data.
-  void IncrementPressedLocked(bool snap_ink_drop_to_activated);
+  // be animated to the ACTIVATED node_data. The ink drop is animated at the
+  // location of |event| if non-null, otherwise at the default location.
+  void IncrementPressedLocked(bool snap_ink_drop_to_activated,
+                              const ui::LocatedEvent* event);
   void DecrementPressedLocked();
 
   // Compute the maximum X coordinate for the current screen. MenuButtons
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc
index adb1a6d..4677853 100644
--- a/ui/views/controls/button/menu_button_unittest.cc
+++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -340,6 +340,37 @@
   EXPECT_EQ(Button::STATE_HOVERED, menu_button_listener.last_source_state());
 }
 
+// Tests that the ink drop center point is set from the mouse click point.
+TEST_F(MenuButtonTest, InkDropCenterSetFromClick) {
+  TestMenuButtonListener menu_button_listener;
+  CreateMenuButtonWithMenuButtonListener(&menu_button_listener);
+
+  gfx::Point click_point(6, 8);
+  generator()->MoveMouseTo(click_point);
+  generator()->ClickLeftButton();
+
+  EXPECT_EQ(button(), menu_button_listener.last_source());
+  EXPECT_EQ(
+      click_point,
+      InkDropHostViewTestApi(button()).GetInkDropCenterBasedOnLastEvent());
+}
+
+// Tests that the ink drop center point is set from the PressedLock constructor.
+TEST_F(MenuButtonTest, InkDropCenterSetFromClickWithPressedLock) {
+  TestMenuButtonListener menu_button_listener;
+  CreateMenuButtonWithMenuButtonListener(&menu_button_listener);
+
+  gfx::Point click_point(11, 7);
+  ui::MouseEvent click_event(ui::EventType::ET_MOUSE_PRESSED, click_point,
+                             click_point, base::TimeTicks(), 0, 0);
+  MenuButton::PressedLock pressed_lock(button(), false, &click_event);
+
+  EXPECT_EQ(Button::STATE_PRESSED, button()->state());
+  EXPECT_EQ(
+      click_point,
+      InkDropHostViewTestApi(button()).GetInkDropCenterBasedOnLastEvent());
+}
+
 // Test that the MenuButton stays pressed while there are any PressedLocks.
 TEST_F(MenuButtonTest, ButtonStateForMenuButtonsWithPressedLocks) {
   // Similarly for aura-mus-client the location of the cursor is not updated by
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 9569f67c..f9aac0a 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -1522,8 +1522,7 @@
 
   // There is a sibling menu, update the button state, hide the current menu
   // and show the new one.
-  pressed_lock_.reset(
-      new MenuButton::PressedLock(button, true /* is_sibling_menu_show */));
+  pressed_lock_.reset(new MenuButton::PressedLock(button, true, nullptr));
 
   // Need to reset capture when we show the menu again, otherwise we aren't
   // going to get any events.