Import Cobalt 25.master.0.1033734
diff --git a/components/client_update_protocol/METADATA b/components/client_update_protocol/METADATA
index 7c981e0..c79225f 100644
--- a/components/client_update_protocol/METADATA
+++ b/components/client_update_protocol/METADATA
@@ -1,7 +1,15 @@
 third_party {
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "ChromiumVersion"
+    value: "80.0.3987.162"  # from https://chromereleases.googleblog.com/2020/03/stable-channel-update-for-desktop_31.html
   }
-  version: "80.0.3987.162"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "f12b46f00f17488ad16cb242bf4f248bdde9618b"
+  }
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/client_update_protocol"
+  }
 }
diff --git a/components/crash/core/common/METADATA b/components/crash/core/common/METADATA
index 4c5905e..3a1fbac 100644
--- a/components/crash/core/common/METADATA
+++ b/components/crash/core/common/METADATA
@@ -3,15 +3,19 @@
   "Filtered subtree at components/crash/core/common."
 
 third_party {
-  url {
-    type: LOCAL_SOURCE
-    value: "https://cobalt.googlesource.com/components/crash/core/common_filtered_mirror"
+  identifier {
+    type: "ChromiumVersion"
+    value: "71.0.3578.127"  # from https://chromereleases.googleblog.com/2019/01/stable-channel-update-for-chrome-os.html
   }
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "3dd5e6c44af445fe7b7ef0f2fd70aadb7e406515"
   }
-  version: "71.0.3578.127"
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/crash/core/common"
+  }
   last_upgrade_date {
     year: 2018
     month: 03
diff --git a/components/metrics/METADATA b/components/metrics/METADATA
index c5ebad4..0d1d710 100644
--- a/components/metrics/METADATA
+++ b/components/metrics/METADATA
@@ -3,14 +3,22 @@
   "Subtree at components/metrics."
 
 third_party {
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "ChromiumVersion"
+    value: "70.0.3538.110"  # from https://chromereleases.googleblog.com/2018/11/stable-channel-update-for-desktop_19.html
   }
-  version: "70.0.3538.110"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "ec3092c8d21e20e39698f5272c8a7f71c3ee88a2"
+  }
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/metrics"
+  }
   last_upgrade_date {
     year: 2018
-    month: 08
+    month: 8
     day: 30
   }
 }
diff --git a/components/prefs/METADATA b/components/prefs/METADATA
index b491a91..d7757ae 100644
--- a/components/prefs/METADATA
+++ b/components/prefs/METADATA
@@ -1,7 +1,15 @@
 third_party {
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "ChromiumVersion"
+    value: "78.0.3904.106"  # from https://chromereleases.googleblog.com/2019/11/stable-channel-update-for-chrome-os_19.html
   }
-  version: "78.0.3904.106"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "5d069f92aa014ded86ab785b26971ac2dbe74b8e"
+  }
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/prefs"
+  }
 }
diff --git a/components/ukm/METADATA b/components/ukm/METADATA
index 3cbcf12..0262599 100644
--- a/components/ukm/METADATA
+++ b/components/ukm/METADATA
@@ -3,18 +3,22 @@
   "Filtered subtree at components/ukm."
 
 third_party {
-  url {
-    type: LOCAL_SOURCE
-    value: "https://cobalt.googlesource.com/components_ukm_filtered_mirror"
+  identifier {
+    type: "ChromiumVersion"
+    value: "70.0.3538.110"  # from https://chromereleases.googleblog.com/2018/11/stable-channel-update-for-desktop_19.html
   }
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "ec3092c8d21e20e39698f5272c8a7f71c3ee88a2"
   }
-  version: "70.0.3538.110"
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/ukm"
+  }
   last_upgrade_date {
     year: 2018
-    month: 08
+    month: 8
     day: 29
   }
 }
diff --git a/components/update_client/BUILD.gn b/components/update_client/BUILD.gn
index df6b5ed..f8c5653 100644
--- a/components/update_client/BUILD.gn
+++ b/components/update_client/BUILD.gn
@@ -240,6 +240,7 @@
     "//net:test_support",
     "//starboard/loader_app:app_key_files",
     "//starboard/loader_app:drain_file",
+    "//starboard/loader_app:drain_file_helper",
     "//starboard/loader_app:installation_manager",
     "//testing/gmock",
     "//testing/gtest",
diff --git a/components/update_client/METADATA b/components/update_client/METADATA
index b491a91..a61e644 100644
--- a/components/update_client/METADATA
+++ b/components/update_client/METADATA
@@ -1,7 +1,15 @@
 third_party {
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "ChromiumVersion"
+    value: "78.0.3904.106"  # from https://chromereleases.googleblog.com/2019/11/stable-channel-update-for-chrome-os_19.html
   }
-  version: "78.0.3904.106"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "5d069f92aa014ded86ab785b26971ac2dbe74b8e"
+  }
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/update_client"
+  }
 }
diff --git a/components/update_client/cobalt_slot_management.cc b/components/update_client/cobalt_slot_management.cc
index 6abee58..0014e67 100644
--- a/components/update_client/cobalt_slot_management.cc
+++ b/components/update_client/cobalt_slot_management.cc
@@ -299,8 +299,8 @@
   base::Version slot_candidate_version("1.0.1");
   int slot_candidate = -1;
 
-  // Iterate over all writeable slots - index >= 1.
-  for (int i = 1; i < max_slots; i++) {
+  // Iterate over all slots - index >= 0.
+  for (int i = 0; i < max_slots; i++) {
     LOG(INFO) << "CobaltQuickInstallation: iterating slot=" << i;
     // Get the path to new installation.
     std::vector<char> installation_path(kSbFileMaxPath);
@@ -329,13 +329,15 @@
       continue;
     } else if (slot_candidate_version < installed_version &&
                current_version < installed_version &&
-               !DrainFileIsAnotherAppDraining(installation_dir.value().c_str(),
-                                              app_key) &&
-               !CheckBadFileExists(installation_dir.value().c_str(), app_key) &&
-               !SbFileExists(good_app_key_file_path.c_str()) &&
-               starboard::loader_app::AnyGoodAppKeyFile(
-                   installation_dir.value().c_str())) {
-      // Found a slot with newer version than the current version that's not
+               (i == 0 || !DrainFileIsAnotherAppDraining(
+                              installation_dir.value().c_str(), app_key) &&
+                              !CheckBadFileExists(
+                                  installation_dir.value().c_str(), app_key) &&
+                              !SbFileExists(good_app_key_file_path.c_str()) &&
+                              starboard::loader_app::AnyGoodAppKeyFile(
+                                  installation_dir.value().c_str()))) {
+      // Found a slot with newer version than the current version. It's either
+      // the system image slot, or a writeable installation slot that's not
       // draining, and no bad file of current app exists, and a good file
       // exists from a another app, but not from the current app.
       // The final candidate is the newest version of the valid
diff --git a/components/update_client/cobalt_slot_management_test.cc b/components/update_client/cobalt_slot_management_test.cc
index 21ebfd3..5eac116 100644
--- a/components/update_client/cobalt_slot_management_test.cc
+++ b/components/update_client/cobalt_slot_management_test.cc
@@ -19,9 +19,11 @@
 
 #include "base/strings/string_util.h"
 #include "starboard/common/file.h"
+#include "starboard/common/time.h"
 #include "starboard/extension/free_space.h"
 #include "starboard/loader_app/app_key_files.h"
 #include "starboard/loader_app/drain_file.h"
+#include "starboard/loader_app/drain_file_helper.h"
 #include "starboard/loader_app/installation_manager.h"
 #include "starboard/loader_app/system_get_extension_shim.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -117,7 +119,7 @@
                              base::CompareCase::SENSITIVE));
 }
 
-TEST_F(CobaltSlotManagementTest, SelectSlotBailOnDraining) {
+TEST_F(CobaltSlotManagementTest, SelectSlotBailsIfOtherAppIsDraining) {
   if (!storage_path_implemented_) {
     return;
   }
@@ -185,6 +187,31 @@
   ASSERT_EQ(IM_MAX_NUM_TRIES, ImGetInstallationNumTriesLeft(1));
 }
 
+// Tests the "racing updaters" scenario.
+TEST_F(CobaltSlotManagementTest, ConfirmSlotBailsIfOtherAppStartedDrainFirst) {
+  if (!storage_path_implemented_) {
+    return;
+  }
+
+  CobaltSlotManagement cobalt_slot_management;
+  std::string slot_path = storage_path_;
+  slot_path += kSbFileSepString;
+  slot_path += "installation_1";
+  ASSERT_TRUE(cobalt_slot_management.Init(api_));
+  base::FilePath dir;
+  ASSERT_TRUE(cobalt_slot_management.SelectSlot(&dir));
+
+  // In order to be higher ranked, the other app's drain file needs to be older
+  // but not expired.
+  int64_t current_time_us =
+      starboard::PosixTimeToWindowsTime(starboard::CurrentPosixTime());
+  starboard::loader_app::ScopedDrainFile racing_drain_file(
+      slot_path, kTestAppKey2,
+      current_time_us - (kDrainFileMaximumAgeUsec / 2));
+
+  ASSERT_FALSE(cobalt_slot_management.ConfirmSlot(dir));
+}
+
 TEST_F(CobaltSlotManagementTest, CleanupAllDrainFiles) {
   if (!storage_path_implemented_) {
     return;
diff --git a/components/update_client/unzip/unzip_impl_cobalt.cc b/components/update_client/unzip/unzip_impl_cobalt.cc
index 9b7b82b..9a4bfe3 100644
--- a/components/update_client/unzip/unzip_impl_cobalt.cc
+++ b/components/update_client/unzip/unzip_impl_cobalt.cc
@@ -9,7 +9,6 @@
 
 #include "base/callback.h"
 #include "base/files/file_path.h"
-#include "starboard/time.h"
 #include "third_party/zlib/google/zip.h"
 
 namespace update_client {
diff --git a/components/variations/METADATA b/components/variations/METADATA
index 51e3f64..db2ce06 100644
--- a/components/variations/METADATA
+++ b/components/variations/METADATA
@@ -3,18 +3,22 @@
   "Filtered subtree at components/variations."
 
 third_party {
-  url {
-    type: LOCAL_SOURCE
-    value: "https://cobalt.googlesource.com/components/variations_filtered_mirror"
+  identifier {
+    type: "ChromiumVersion"
+    value: "70.0.3538.110"  # from https://chromereleases.googleblog.com/2018/11/stable-channel-update-for-desktop_19.html
   }
-  url {
-    type: GIT
-    value: "https://chromium.googlesource.com/chromium/src"
+  identifier {
+    type: "Git"
+    value: "https://chromium.googlesource.com/chromium/src.git"
+    version: "ec3092c8d21e20e39698f5272c8a7f71c3ee88a2"
   }
-  version: "70.0.3538.110"
+  identifier {
+    type: "UpstreamSubdir"
+    value: "components/variations"
+  }
   last_upgrade_date {
     year: 2018
-    month: 08
+    month: 8
     day: 30
   }
 }
diff --git a/components/version_info/METADATA b/components/version_info/METADATA
index 8a4b945..8f3531e 100644
--- a/components/version_info/METADATA
+++ b/components/version_info/METADATA
@@ -14,7 +14,7 @@
   version: "71.0.3578.127"
   last_upgrade_date {
     year: 2018
-    month: 08
+    month: 8
     day: 01
   }
 }