Import Cobalt 25.master.0.1033342
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 509aa37..6835715 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -1561,7 +1561,7 @@
     public_configs = [ ":base_public_defines" ]
     deps += [
       "//starboard/common",
-      "//starboard",
+      "//starboard:starboard_group",
       "//starboard/client_porting/eztime",
     ]
     deps -= [
diff --git a/base/METADATA b/base/METADATA
index bc1bf40..6a30c57 100644
--- a/base/METADATA
+++ b/base/METADATA
@@ -9,12 +9,12 @@
   }
   url {
     type: GIT
-    value: "https://chromium.googlesource.com/chromium/src/base"
+    value: "https://chromium.googlesource.com/chromium/src"
   }
-  version: "2fb7110f70453ccb8951428611330d95c496f3cd"
+  version: "71.0.3578.141"
   last_upgrade_date {
-    year: 2018
-    month: 10
-    day: 8
+    year: 2023
+    month: 8
+    day: 23
   }
 }
diff --git a/base/allocator/allocator_shim_override_libc_symbols.h b/base/allocator/allocator_shim_override_libc_symbols.h
index 956a0e5..ce688d9 100644
--- a/base/allocator/allocator_shim_override_libc_symbols.h
+++ b/base/allocator/allocator_shim_override_libc_symbols.h
@@ -18,15 +18,15 @@
 
 extern "C" {
 
-SHIM_ALWAYS_EXPORT void* SbMemoryAllocate(size_t size) __THROW {
+SHIM_ALWAYS_EXPORT void* malloc(size_t size) __THROW {
   return ShimMalloc(size, nullptr);
 }
 
-SHIM_ALWAYS_EXPORT void SbMemoryDeallocate(void* ptr) __THROW {
+SHIM_ALWAYS_EXPORT void free(void* ptr) __THROW {
   ShimFree(ptr, nullptr);
 }
 
-SHIM_ALWAYS_EXPORT void* SbMemoryReallocate(void* ptr, size_t size) __THROW {
+SHIM_ALWAYS_EXPORT void* realloc(void* ptr, size_t size) __THROW {
   return ShimRealloc(ptr, size, nullptr);
 }
 
diff --git a/base/allocator/allocator_shim_override_ucrt_symbols_win.h b/base/allocator/allocator_shim_override_ucrt_symbols_win.h
index a29b9ee..ecd659c 100644
--- a/base/allocator/allocator_shim_override_ucrt_symbols_win.h
+++ b/base/allocator/allocator_shim_override_ucrt_symbols_win.h
@@ -52,15 +52,15 @@
 }
 
 // These symbols override the CRT's implementation of the same functions.
-__declspec(restrict) void* SbMemoryAllocate(size_t size) {
+__declspec(restrict) void* malloc(size_t size) {
   return ShimMalloc(size, nullptr);
 }
 
-void SbMemoryDeallocate(void* ptr) {
+void free(void* ptr) {
   ShimFree(ptr, nullptr);
 }
 
-__declspec(restrict) void* SbMemoryReallocate(void* ptr, size_t size) {
+__declspec(restrict) void* realloc(void* ptr, size_t size) {
   return ShimRealloc(ptr, size, nullptr);
 }
 
diff --git a/base/allocator/allocator_shim_unittest.cc b/base/allocator/allocator_shim_unittest.cc
index 8b82a0f..0ba3b0a 100644
--- a/base/allocator/allocator_shim_unittest.cc
+++ b/base/allocator/allocator_shim_unittest.cc
@@ -247,8 +247,8 @@
 
   void ThreadMain() override {
     event_->Wait();
-    void* temp = SbMemoryAllocate(1);
-    void* res = SbMemoryReallocate(temp, 0xFEED);
+    void* temp = malloc(1);
+    void* res = realloc(temp, 0xFEED);
     EXPECT_EQ(temp, res);
   }
 
@@ -274,7 +274,7 @@
 TEST_F(AllocatorShimTest, InterceptLibcSymbols) {
   InsertAllocatorDispatch(&g_mock_dispatch);
 
-  void* alloc_ptr = SbMemoryAllocate(19);
+  void* alloc_ptr = malloc(19);
   ASSERT_NE(nullptr, alloc_ptr);
   ASSERT_GE(allocs_intercepted_by_size[19], 1u);
 
@@ -314,46 +314,46 @@
   ASSERT_GE(aligned_allocs_intercepted_by_size[kPageSize], 1u);
 #endif  // !OS_WIN && !OS_MACOSX
 
-  char* realloc_ptr = static_cast<char*>(SbMemoryAllocate(10));
+  char* realloc_ptr = static_cast<char*>(malloc(10));
   strcpy(realloc_ptr, "foobar");
   void* old_realloc_ptr = realloc_ptr;
-  SbMemoryReallocate_ptr =
-      static_cast<char*>(SbMemoryReallocate(SbMemoryReallocate_ptr, 73));
+  realloc_ptr =
+      static_cast<char*>(realloc(realloc_ptr, 73));
   ASSERT_GE(reallocs_intercepted_by_size[73], 1u);
   ASSERT_GE(reallocs_intercepted_by_addr[Hash(old_realloc_ptr)], 1u);
   ASSERT_EQ(0, strcmp(realloc_ptr, "foobar"));
 
-  SbMemoryDeallocate(alloc_ptr);
+  free(alloc_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(alloc_ptr)], 1u);
 
-  SbMemoryDeallocate(zero_alloc_ptr);
+  free(zero_alloc_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(zero_alloc_ptr)], 1u);
 
 #if !defined(OS_WIN) && !defined(OS_MACOSX)
-  SbMemoryDeallocate(memalign_ptr);
+  free(memalign_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(memalign_ptr)], 1u);
 
-  SbMemoryDeallocate(pvalloc_ptr);
+  free(pvalloc_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(pvalloc_ptr)], 1u);
 #endif  // !OS_WIN && !OS_MACOSX
 
 #if !defined(OS_WIN)
-  SbMemoryDeallocate(posix_memalign_ptr);
+  free(posix_memalign_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(posix_memalign_ptr)], 1u);
 
-  SbMemoryDeallocate(valloc_ptr);
+  free(valloc_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(valloc_ptr)], 1u);
 #endif  // !OS_WIN
 
-  SbMemoryDeallocate(realloc_ptr);
+  free(realloc_ptr);
   ASSERT_GE(frees_intercepted_by_addr[Hash(realloc_ptr)], 1u);
 
   RemoveAllocatorDispatchForTesting(&g_mock_dispatch);
 
-  void* non_hooked_ptr = SbMemoryAllocate(4095);
+  void* non_hooked_ptr = malloc(4095);
   ASSERT_NE(nullptr, non_hooked_ptr);
   ASSERT_EQ(0u, allocs_intercepted_by_size[4095]);
-  SbMemoryDeallocate(non_hooked_ptr);
+  free(non_hooked_ptr);
 }
 
 #if defined(OS_MACOSX)
@@ -385,7 +385,7 @@
 TEST_F(AllocatorShimTest, InterceptLibcSymbolsFreeDefiniteSize) {
   InsertAllocatorDispatch(&g_mock_dispatch);
 
-  void* alloc_ptr = SbMemoryAllocate(19);
+  void* alloc_ptr = malloc(19);
   ASSERT_NE(nullptr, alloc_ptr);
   ASSERT_GE(allocs_intercepted_by_size[19], 1u);
 
diff --git a/base/allocator/partition_allocator/partition_alloc.cc b/base/allocator/partition_allocator/partition_alloc.cc
index c7343fc..5703931 100644
--- a/base/allocator/partition_allocator/partition_alloc.cc
+++ b/base/allocator/partition_allocator/partition_alloc.cc
@@ -262,7 +262,7 @@
                                    size_t new_size,
                                    const char* type_name) {
 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
-  void* result = SbMemoryReallocate(ptr, new_size);
+  void* result = realloc(ptr, new_size);
   CHECK(result || flags & PartitionAllocReturnNull);
   return result;
 #else
diff --git a/base/allocator/partition_allocator/partition_alloc.h b/base/allocator/partition_allocator/partition_alloc.h
index af49684..de6bbe3 100644
--- a/base/allocator/partition_allocator/partition_alloc.h
+++ b/base/allocator/partition_allocator/partition_alloc.h
@@ -274,7 +274,7 @@
                                               size_t size,
                                               const char* type_name) {
 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
-  void* result = SbMemoryAllocate(size);
+  void* result = malloc(size);
   CHECK(result);
   return result;
 #else
@@ -314,7 +314,7 @@
 
 ALWAYS_INLINE void PartitionFree(void* ptr) {
 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
-  SbMemoryDeallocate(ptr);
+  free(ptr);
 #else
   void* original_ptr = ptr;
   // TODO(palmer): Check ptr alignment before continuing. Shall we do the check
@@ -354,7 +354,7 @@
 
 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
   const bool zero_fill = flags & PartitionAllocZeroFill;
-  void* result = zero_fill ? calloc(1, size) : SbMemoryAllocate(size);
+  void* result = zero_fill ? calloc(1, size) : malloc(size);
   CHECK(result || flags & PartitionAllocReturnNull);
   return result;
 #else
@@ -386,7 +386,7 @@
 
 ALWAYS_INLINE void PartitionRootGeneric::Free(void* ptr) {
 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
-  SbMemoryDeallocate(ptr);
+  free(ptr);
 #else
   DCHECK(this->initialized);
 
diff --git a/base/allocator/tcmalloc_unittest.cc b/base/allocator/tcmalloc_unittest.cc
index 66f256f..b9bbbf8 100644
--- a/base/allocator/tcmalloc_unittest.cc
+++ b/base/allocator/tcmalloc_unittest.cc
@@ -23,11 +23,11 @@
 // implementation of the allocator. Otherwise, the compiler may specifically
 // recognize the calls to malloc and free in our tests and optimize them away.
 NOINLINE void* TCMallocDoMallocForTest(size_t size) {
-  return SbMemoryAllocate(size);
+  return malloc(size);
 }
 
 NOINLINE void TCMallocDoFreeForTest(void* ptr) {
-  SbMemoryDeallocate(ptr);
+  free(ptr);
 }
 #endif
 
@@ -83,7 +83,7 @@
     for (size_t i = 0; i < n * s; i++) {
       EXPECT_EQ('\0', p[i]);
     }
-    SbMemoryDeallocate(p);
+    free(p);
   }
 }
 
@@ -97,12 +97,12 @@
   // Try allocating data with a bunch of alignments and sizes
   for (int size = 1; size < 1048576; size *= 2) {
     unsigned char* ptr =
-        reinterpret_cast<unsigned char*>(SbMemoryAllocate(size));
+        reinterpret_cast<unsigned char*>(malloc(size));
     // Should be 2 byte aligned
     EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & 1);
     Fill(ptr, size);
     EXPECT_TRUE(Valid(ptr, size));
-    SbMemoryDeallocate(ptr);
+    free(ptr);
   }
 }
 
@@ -128,19 +128,19 @@
   int deltas[] = {1, -2, 4, -8, 16, -32, 64, -128};
 
   for (unsigned s = 0; s < sizeof(start_sizes) / sizeof(*start_sizes); ++s) {
-    void* p = SbMemoryAllocate(start_sizes[s]);
+    void* p = malloc(start_sizes[s]);
     ASSERT_TRUE(p);
     // The larger the start-size, the larger the non-reallocing delta.
     for (unsigned d = 0; d < s * 2; ++d) {
-      void* new_p = SbMemoryReallocate(p, start_sizes[s] + deltas[d]);
+      void* new_p = realloc(p, start_sizes[s] + deltas[d]);
       ASSERT_EQ(p, new_p);  // realloc should not allocate new memory
     }
     // Test again, but this time reallocing smaller first.
     for (unsigned d = 0; d < s * 2; ++d) {
-      void* new_p = SbMemoryReallocate(p, start_sizes[s] - deltas[d]);
+      void* new_p = realloc(p, start_sizes[s] - deltas[d]);
       ASSERT_EQ(p, new_p);  // realloc should not allocate new memory
     }
-    SbMemoryDeallocate(p);
+    free(p);
   }
 }
 #endif
@@ -149,15 +149,15 @@
   for (int src_size = 0; src_size >= 0; src_size = NextSize(src_size)) {
     for (int dst_size = 0; dst_size >= 0; dst_size = NextSize(dst_size)) {
       unsigned char* src =
-          reinterpret_cast<unsigned char*>(SbMemoryAllocate(src_size));
+          reinterpret_cast<unsigned char*>(malloc(src_size));
       Fill(src, src_size);
       unsigned char* dst =
-          reinterpret_cast<unsigned char*>(SbMemoryReallocate(src, dst_size));
+          reinterpret_cast<unsigned char*>(realloc(src, dst_size));
       EXPECT_TRUE(Valid(dst, min(src_size, dst_size)));
       Fill(dst, dst_size);
       EXPECT_TRUE(Valid(dst, dst_size));
       if (dst != nullptr)
-        SbMemoryDeallocate(dst);
+        free(dst);
     }
   }
 
@@ -171,22 +171,22 @@
   // packed cache, so some entries are evicted from the cache.
   // The cache has 2^12 entries, keyed by page number.
   const int kNumEntries = 1 << 14;
-  int** p = reinterpret_cast<int**>(SbMemoryAllocate(sizeof(*p) * kNumEntries));
+  int** p = reinterpret_cast<int**>(malloc(sizeof(*p) * kNumEntries));
   int sum = 0;
   for (int i = 0; i < kNumEntries; i++) {
     // no page size is likely to be bigger than 8192?
-    p[i] = reinterpret_cast<int*>(SbMemoryAllocate(8192));
+    p[i] = reinterpret_cast<int*>(malloc(8192));
     p[i][1000] = i;  // use memory deep in the heart of p
   }
   for (int i = 0; i < kNumEntries; i++) {
-    p[i] = reinterpret_cast<int*>(SbMemoryReallocate(p[i], 9000));
+    p[i] = reinterpret_cast<int*>(realloc(p[i], 9000));
   }
   for (int i = 0; i < kNumEntries; i++) {
     sum += p[i][1000];
-    SbMemoryDeallocate(p[i]);
+    free(p[i]);
   }
   EXPECT_EQ(kNumEntries / 2 * (kNumEntries - 1), sum);  // assume kNE is even
-  SbMemoryDeallocate(p);
+  free(p);
 }
 
 #ifdef NDEBUG
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index e9dd36d..197bdeb 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -24,6 +24,7 @@
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
+import android.graphics.drawable.TransitionDrawable;
 import android.graphics.drawable.VectorDrawable;
 import android.net.Uri;
 import android.os.Build;
@@ -45,6 +46,7 @@
 import android.view.inputmethod.InputMethodSubtype;
 import android.view.textclassifier.TextClassifier;
 import android.widget.ImageView;
+import android.widget.PopupWindow;
 import android.widget.TextView;
 
 import java.io.File;
@@ -325,6 +327,17 @@
     }
 
     /**
+     * Set elevation if supported.
+     */
+    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+    public static boolean setElevation(PopupWindow window, float elevationValue) {
+        if (!isElevationSupported()) return false;
+
+        window.setElevation(elevationValue);
+        return true;
+    }
+
+    /**
      *  Gets an intent to start the Android system notification settings activity for an app.
      *
      *  @param context Context of the app whose settings intent should be returned.
@@ -732,6 +745,7 @@
     /**
      * Creates regular LayerDrawable on Android L+. On older versions creates a helper class that
      * fixes issues around {@link LayerDrawable#mutate()}. See https://crbug.com/890317 for details.
+     * See also {@link #createTransitionDrawable}.
      * @param layers A list of drawables to use as layers in this new drawable.
      */
     public static LayerDrawable createLayerDrawable(@NonNull Drawable[] layers) {
@@ -741,6 +755,19 @@
         return new LayerDrawable(layers);
     }
 
+    /**
+     * Creates regular TransitionDrawable on Android L+. On older versions creates a helper class
+     * that fixes issues around {@link TransitionDrawable#mutate()}. See https://crbug.com/892061
+     * for details. See also {@link #createLayerDrawable}.
+     * @param layers A list of drawables to use as layers in this new drawable.
+     */
+    public static TransitionDrawable createTransitionDrawable(@NonNull Drawable[] layers) {
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
+            return new TransitionDrawableCompat(layers);
+        }
+        return new TransitionDrawable(layers);
+    }
+
     private static class LayerDrawableCompat extends LayerDrawable {
         private boolean mMutated;
 
@@ -748,6 +775,7 @@
             super(layers);
         }
 
+        @NonNull
         @Override
         public Drawable mutate() {
             // LayerDrawable in Android K loses bounds of layers, so this method works around that.
@@ -756,24 +784,61 @@
                 return this;
             }
 
-            // Save bounds before mutation.
-            Rect[] oldBounds = new Rect[getNumberOfLayers()];
-            for (int i = 0; i < getNumberOfLayers(); i++) {
-                oldBounds[i] = getDrawable(i).getBounds();
-            }
-
+            Rect[] oldBounds = getLayersBounds(this);
             Drawable superResult = super.mutate();
-            if (superResult != this) {
-                // Unexpected, LayerDrawable.mutate() always returns this.
-                return superResult;
-            }
-
-            // Restore the saved bounds.
-            for (int i = 0; i < getNumberOfLayers(); i++) {
-                getDrawable(i).setBounds(oldBounds[i]);
-            }
+            // LayerDrawable.mutate() always returns this, bail out if this isn't the case.
+            if (superResult != this) return superResult;
+            restoreLayersBounds(this, oldBounds);
             mMutated = true;
             return this;
         }
     }
+
+    private static class TransitionDrawableCompat extends TransitionDrawable {
+        private boolean mMutated;
+
+        TransitionDrawableCompat(@NonNull Drawable[] layers) {
+            super(layers);
+        }
+
+        @NonNull
+        @Override
+        public Drawable mutate() {
+            // LayerDrawable in Android K loses bounds of layers, so this method works around that.
+            if (mMutated) {
+                // This object has already been mutated and shouldn't have any shared state.
+                return this;
+            }
+            Rect[] oldBounds = getLayersBounds(this);
+            Drawable superResult = super.mutate();
+            // TransitionDrawable.mutate() always returns this, bail out if this isn't the case.
+            if (superResult != this) return superResult;
+            restoreLayersBounds(this, oldBounds);
+            mMutated = true;
+            return this;
+        }
+    }
+
+    /**
+     * Helper for {@link LayerDrawableCompat#mutate} and {@link TransitionDrawableCompat#mutate}.
+     * Obtains the bounds of layers so they can be restored after a mutation.
+     */
+    private static Rect[] getLayersBounds(LayerDrawable layerDrawable) {
+        Rect[] result = new Rect[layerDrawable.getNumberOfLayers()];
+        for (int i = 0; i < layerDrawable.getNumberOfLayers(); i++) {
+            result[i] = layerDrawable.getDrawable(i).getBounds();
+        }
+        return result;
+    }
+
+    /**
+     * Helper for {@link LayerDrawableCompat#mutate} and {@link TransitionDrawableCompat#mutate}.
+     * Restores the bounds of layers after a mutation.
+     */
+    private static void restoreLayersBounds(LayerDrawable layerDrawable, Rect[] oldBounds) {
+        assert layerDrawable.getNumberOfLayers() == oldBounds.length;
+        for (int i = 0; i < layerDrawable.getNumberOfLayers(); i++) {
+            layerDrawable.getDrawable(i).setBounds(oldBounds[i]);
+        }
+    }
 }
diff --git a/base/android/jni_generator/AndroidManifest.xml b/base/android/jni_generator/AndroidManifest.xml
index 1555a81..aa0b7c5 100644
--- a/base/android/jni_generator/AndroidManifest.xml
+++ b/base/android/jni_generator/AndroidManifest.xml
@@ -7,7 +7,7 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.jni.generator">
 
-    <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="33" />
+    <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="34" />
     <application></application>
 
 </manifest>
diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h
index 9e596a8..4bf5a61 100644
--- a/base/android/scoped_java_ref.h
+++ b/base/android/scoped_java_ref.h
@@ -36,42 +36,51 @@
 };
 
 // Forward declare the generic java reference template class.
-template<typename T> class JavaRef;
+template <typename T>
+class JavaRef;
 
 // Template specialization of JavaRef, which acts as the base class for all
 // other JavaRef<> template types. This allows you to e.g. pass
 // ScopedJavaLocalRef<jstring> into a function taking const JavaRef<jobject>&
-template<>
+template <>
 class BASE_EXPORT JavaRef<jobject> {
  public:
-  // Initializes a null reference. Don't add anything else here; it's inlined.
-  constexpr JavaRef() : obj_(nullptr) {}
+  // Initializes a null reference.
+  constexpr JavaRef() {}
 
   // Allow nullptr to be converted to JavaRef. This avoids having to declare an
   // empty JavaRef just to pass null to a function, and makes C++ "nullptr" and
   // Java "null" equivalent.
-  constexpr JavaRef(std::nullptr_t) : JavaRef() {}
+  constexpr JavaRef(std::nullptr_t) {}
 
   // Public to allow destruction of null JavaRef objects.
-  // Don't add anything else here; it's inlined.
   ~JavaRef() {}
 
+  // TODO(torne): maybe rename this to get() for consistency with unique_ptr
+  // once there's fewer unnecessary uses of it in the codebase.
   jobject obj() const { return obj_; }
 
+  explicit operator bool() const { return obj_ != nullptr; }
+
+  // Deprecated. Just use bool conversion.
+  // TODO(torne): replace usage and remove this.
   bool is_null() const { return obj_ == nullptr; }
 
  protected:
-  // Takes ownership of the |obj| reference passed; requires it to be a local
-  // reference type.
+// Takes ownership of the |obj| reference passed; requires it to be a local
+// reference type.
 #if DCHECK_IS_ON()
   // Implementation contains a DCHECK; implement out-of-line when DCHECK_IS_ON.
   JavaRef(JNIEnv* env, jobject obj);
 #else
-  // Don't add anything else here; it's inlined.
   JavaRef(JNIEnv* env, jobject obj) : obj_(obj) {}
 #endif
 
-  void swap(JavaRef& other) { std::swap(obj_, other.obj_); }
+  // Used for move semantics. obj_ must have been released first if non-null.
+  void steal(JavaRef&& other) {
+    obj_ = other.obj_;
+    other.obj_ = nullptr;
+  }
 
   // The following are implementation detail convenience methods, for
   // use by the sub-classes.
@@ -82,7 +91,7 @@
   jobject ReleaseInternal();
 
  private:
-  jobject obj_;
+  jobject obj_ = nullptr;
 
   DISALLOW_COPY_AND_ASSIGN(JavaRef);
 };
@@ -90,11 +99,11 @@
 // Generic base class for ScopedJavaLocalRef and ScopedJavaGlobalRef. Useful
 // for allowing functions to accept a reference without having to mandate
 // whether it is a local or global type.
-template<typename T>
+template <typename T>
 class JavaRef : public JavaRef<jobject> {
  public:
-  JavaRef() {}
-  JavaRef(std::nullptr_t) : JavaRef<jobject>(nullptr) {}
+  constexpr JavaRef() {}
+  constexpr JavaRef(std::nullptr_t) {}
   ~JavaRef() {}
 
   T obj() const { return static_cast<T>(JavaRef<jobject>::obj()); }
@@ -110,7 +119,7 @@
 // Method parameters should not be deleted, and so this class exists purely to
 // wrap them as a JavaRef<T> in the JNI binding generator. Do not create
 // instances manually.
-template<typename T>
+template <typename T>
 class JavaParamRef : public JavaRef<T> {
  public:
   // Assumes that |obj| is a parameter passed to a JNI method from Java.
@@ -121,7 +130,7 @@
   // methods directly from C++ and pass null for objects which are not actually
   // used by the implementation (e.g. the caller object); allow this to keep
   // working.
-  JavaParamRef(std::nullptr_t) : JavaRef<T>(nullptr) {}
+  JavaParamRef(std::nullptr_t) {}
 
   ~JavaParamRef() {}
 
@@ -143,81 +152,126 @@
 // single thread. If you wish to have the reference outlive the current
 // callstack (e.g. as a class member) or you wish to pass it across threads,
 // use a ScopedJavaGlobalRef instead.
-template<typename T>
+template <typename T>
 class ScopedJavaLocalRef : public JavaRef<T> {
  public:
-  constexpr ScopedJavaLocalRef() : env_(nullptr) {}
-  constexpr ScopedJavaLocalRef(std::nullptr_t) : env_(nullptr) {}
-
-  // Non-explicit copy constructor, to allow ScopedJavaLocalRef to be returned
-  // by value as this is the normal usage pattern.
-  ScopedJavaLocalRef(const ScopedJavaLocalRef<T>& other)
-      : env_(other.env_) {
-    this->SetNewLocalRef(env_, other.obj());
+  // Take ownership of a bare jobject. This does not create a new reference.
+  // This should only be used by JNI helper functions, or in cases where code
+  // must call JNIEnv methods directly.
+  static ScopedJavaLocalRef Adopt(JNIEnv* env, T obj) {
+    return ScopedJavaLocalRef(env, obj);
   }
 
-  ScopedJavaLocalRef(ScopedJavaLocalRef<T>&& other) : env_(other.env_) {
-    this->swap(other);
+  constexpr ScopedJavaLocalRef() {}
+  constexpr ScopedJavaLocalRef(std::nullptr_t) {}
+
+  // Copy constructor. This is required in addition to the copy conversion
+  // constructor below.
+  ScopedJavaLocalRef(const ScopedJavaLocalRef& other) : env_(other.env_) {
+    JavaRef<T>::SetNewLocalRef(env_, other.obj());
   }
 
-  explicit ScopedJavaLocalRef(const JavaRef<T>& other) : env_(nullptr) {
-    this->Reset(other);
+  // Copy conversion constructor.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaLocalRef(const ScopedJavaLocalRef<U>& other) : env_(other.env_) {
+    JavaRef<T>::SetNewLocalRef(env_, other.obj());
   }
 
+  // Move constructor. This is required in addition to the move conversion
+  // constructor below.
+  ScopedJavaLocalRef(ScopedJavaLocalRef&& other) : env_(other.env_) {
+    JavaRef<T>::steal(std::move(other));
+  }
+
+  // Move conversion constructor.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaLocalRef(ScopedJavaLocalRef<U>&& other) : env_(other.env_) {
+    JavaRef<T>::steal(std::move(other));
+  }
+
+  // Constructor for other JavaRef types.
+  explicit ScopedJavaLocalRef(const JavaRef<T>& other) { Reset(other); }
+
   // Assumes that |obj| is a local reference to a Java object and takes
-  // ownership  of this local reference.
-  // TODO(torne): this shouldn't be used outside of JNI helper functions but
-  // there are currently some cases where there aren't helpers for things.
+  // ownership of this local reference.
+  // TODO(torne): make legitimate uses call Adopt() instead, and make this
+  // private.
   ScopedJavaLocalRef(JNIEnv* env, T obj) : JavaRef<T>(env, obj), env_(env) {}
 
-  ~ScopedJavaLocalRef() {
-    this->Reset();
+  ~ScopedJavaLocalRef() { Reset(); }
+
+  // Null assignment, for disambiguation.
+  ScopedJavaLocalRef& operator=(std::nullptr_t) {
+    Reset();
+    return *this;
   }
 
-  // Overloaded assignment operator defined for consistency with the implicit
-  // copy constructor.
-  void operator=(const ScopedJavaLocalRef<T>& other) {
-    this->Reset(other);
+  // Copy assignment.
+  ScopedJavaLocalRef& operator=(const ScopedJavaLocalRef& other) {
+    Reset(other);
+    return *this;
   }
 
-  void operator=(ScopedJavaLocalRef<T>&& other) {
+  // Copy conversion assignment.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaLocalRef& operator=(const ScopedJavaLocalRef<U>& other) {
+    Reset(other);
+    return *this;
+  }
+
+  // Move assignment.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaLocalRef& operator=(ScopedJavaLocalRef<U>&& other) {
     env_ = other.env_;
-    this->swap(other);
+    Reset();
+    JavaRef<T>::steal(std::move(other));
+    return *this;
   }
 
-  void Reset() {
-    this->ResetLocalRef(env_);
+  // Assignment for other JavaRef types.
+  ScopedJavaLocalRef& operator=(const JavaRef<T>& other) {
+    Reset(other);
+    return *this;
   }
 
-  void Reset(const ScopedJavaLocalRef<T>& other) {
+  void Reset() { JavaRef<T>::ResetLocalRef(env_); }
+
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  void Reset(const ScopedJavaLocalRef<U>& other) {
     // We can copy over env_ here as |other| instance must be from the same
     // thread as |this| local ref. (See class comment for multi-threading
     // limitations, and alternatives).
-    this->Reset(other.env_, other.obj());
+    Reset(other.env_, other.obj());
   }
 
   void Reset(const JavaRef<T>& other) {
     // If |env_| was not yet set (is still null) it will be attached to the
     // current thread in SetNewLocalRef().
-    this->Reset(env_, other.obj());
+    Reset(env_, other.obj());
   }
 
   // Creates a new local reference to the Java object, unlike the constructor
   // with the same parameters that takes ownership of the existing reference.
-  // TODO(torne): these should match as this is confusing.
-  void Reset(JNIEnv* env, T obj) { env_ = this->SetNewLocalRef(env, obj); }
+  // Deprecated. Don't use bare jobjects; use a JavaRef as the input.
+  // TODO(torne): fix existing usage and remove this.
+  void Reset(JNIEnv* env, T obj) {
+    env_ = JavaRef<T>::SetNewLocalRef(env, obj);
+  }
 
   // Releases the local reference to the caller. The caller *must* delete the
   // local reference when it is done with it. Note that calling a Java method
   // is *not* a transfer of ownership and Release() should not be used.
-  T Release() {
-    return static_cast<T>(this->ReleaseInternal());
-  }
+  T Release() { return static_cast<T>(JavaRef<T>::ReleaseInternal()); }
 
  private:
   // This class is only good for use on the thread it was created on so
   // it's safe to cache the non-threadsafe JNIEnv* inside this object.
-  JNIEnv* env_;
+  JNIEnv* env_ = nullptr;
 
   // Prevent ScopedJavaLocalRef(JNIEnv*, T obj) from being used to take
   // ownership of a JavaParamRef's underlying object - parameters are not
@@ -225,58 +279,112 @@
   // TODO(torne): this can be removed once JavaParamRef no longer has an
   // implicit conversion back to T.
   ScopedJavaLocalRef(JNIEnv* env, const JavaParamRef<T>& other);
+
+  // Friend required to get env_ from conversions.
+  template <typename U>
+  friend class ScopedJavaLocalRef;
 };
 
 // Holds a global reference to a Java object. The global reference is scoped
 // to the lifetime of this object. This class does not hold onto any JNIEnv*
 // passed to it, hence it is safe to use across threads (within the constraints
 // imposed by the underlying Java object that it references).
-template<typename T>
+template <typename T>
 class ScopedJavaGlobalRef : public JavaRef<T> {
  public:
   constexpr ScopedJavaGlobalRef() {}
   constexpr ScopedJavaGlobalRef(std::nullptr_t) {}
 
-  ScopedJavaGlobalRef(const ScopedJavaGlobalRef<T>& other) {
-    this->Reset(other);
+  // Copy constructor. This is required in addition to the copy conversion
+  // constructor below.
+  ScopedJavaGlobalRef(const ScopedJavaGlobalRef& other) { Reset(other); }
+
+  // Copy conversion constructor.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaGlobalRef(const ScopedJavaGlobalRef<U>& other) {
+    Reset(other);
   }
 
-  ScopedJavaGlobalRef(ScopedJavaGlobalRef<T>&& other) { this->swap(other); }
-
-  ScopedJavaGlobalRef(JNIEnv* env, T obj) { this->Reset(env, obj); }
-
-  explicit ScopedJavaGlobalRef(const JavaRef<T>& other) { this->Reset(other); }
-
-  ~ScopedJavaGlobalRef() {
-    this->Reset();
+  // Move constructor. This is required in addition to the move conversion
+  // constructor below.
+  ScopedJavaGlobalRef(ScopedJavaGlobalRef&& other) {
+    JavaRef<T>::steal(std::move(other));
   }
 
-  // Overloaded assignment operator defined for consistency with the implicit
-  // copy constructor.
-  void operator=(const ScopedJavaGlobalRef<T>& other) {
-    this->Reset(other);
+  // Move conversion constructor.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaGlobalRef(ScopedJavaGlobalRef<U>&& other) {
+    JavaRef<T>::steal(std::move(other));
   }
 
-  void operator=(ScopedJavaGlobalRef<T>&& other) { this->swap(other); }
+  // Conversion constructor for other JavaRef types.
+  explicit ScopedJavaGlobalRef(const JavaRef<T>& other) { Reset(other); }
 
-  void Reset() {
-    this->ResetGlobalRef();
+  // Create a new global reference to the object.
+  // Deprecated. Don't use bare jobjects; use a JavaRef as the input.
+  ScopedJavaGlobalRef(JNIEnv* env, T obj) { Reset(env, obj); }
+
+  ~ScopedJavaGlobalRef() { Reset(); }
+
+  // Null assignment, for disambiguation.
+  ScopedJavaGlobalRef& operator=(std::nullptr_t) {
+    Reset();
+    return *this;
   }
 
-  void Reset(const JavaRef<T>& other) { this->Reset(nullptr, other.obj()); }
+  // Copy assignment.
+  ScopedJavaGlobalRef& operator=(const ScopedJavaGlobalRef& other) {
+    Reset(other);
+    return *this;
+  }
 
+  // Copy conversion assignment.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaGlobalRef& operator=(const ScopedJavaGlobalRef<U>& other) {
+    Reset(other);
+    return *this;
+  }
+
+  // Move assignment.
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  ScopedJavaGlobalRef& operator=(ScopedJavaGlobalRef<U>&& other) {
+    Reset();
+    JavaRef<T>::steal(std::move(other));
+    return *this;
+  }
+
+  // Assignment for other JavaRef types.
+  ScopedJavaGlobalRef& operator=(const JavaRef<T>& other) {
+    Reset(other);
+    return *this;
+  }
+
+  void Reset() { JavaRef<T>::ResetGlobalRef(); }
+
+  template <typename U,
+            typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+  void Reset(const ScopedJavaGlobalRef<U>& other) {
+    Reset(nullptr, other.obj());
+  }
+
+  void Reset(const JavaRef<T>& other) { Reset(nullptr, other.obj()); }
+
+  // Deprecated. You can just use Reset(const JavaRef&).
   void Reset(JNIEnv* env, const JavaParamRef<T>& other) {
-    this->Reset(env, other.obj());
+    Reset(env, other.obj());
   }
 
-  void Reset(JNIEnv* env, T obj) { this->SetNewGlobalRef(env, obj); }
+  // Deprecated. Don't use bare jobjects; use a JavaRef as the input.
+  void Reset(JNIEnv* env, T obj) { JavaRef<T>::SetNewGlobalRef(env, obj); }
 
   // Releases the global reference to the caller. The caller *must* delete the
   // global reference when it is done with it. Note that calling a Java method
   // is *not* a transfer of ownership and Release() should not be used.
-  T Release() {
-    return static_cast<T>(this->ReleaseInternal());
-  }
+  T Release() { return static_cast<T>(JavaRef<T>::ReleaseInternal()); }
 };
 
 }  // namespace android
diff --git a/base/android/scoped_java_ref_unittest.cc b/base/android/scoped_java_ref_unittest.cc
index 99d035b..d46c5ac 100644
--- a/base/android/scoped_java_ref_unittest.cc
+++ b/base/android/scoped_java_ref_unittest.cc
@@ -8,6 +8,9 @@
 #include "base/android/jni_string.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+#define EXPECT_SAME_OBJECT(a, b) \
+  EXPECT_TRUE(env->IsSameObject(a.obj(), b.obj()))
+
 namespace base {
 namespace android {
 
@@ -69,13 +72,110 @@
   JNIEnv* env = AttachCurrentThread();
   ScopedJavaLocalRef<jstring> str = ConvertUTF8ToJavaString(env, "string");
   ScopedJavaGlobalRef<jstring> global(str);
+
+  // Contextual conversions to bool should be allowed.
+  EXPECT_TRUE(str);
+  EXPECT_FALSE(JavaRef<jobject>());
+
+  // All the types should convert from nullptr, even JavaRef.
+  {
+    JavaRef<jstring> null_ref(nullptr);
+    EXPECT_FALSE(null_ref);
+    ScopedJavaLocalRef<jobject> null_local(nullptr);
+    EXPECT_FALSE(null_local);
+    ScopedJavaGlobalRef<jarray> null_global(nullptr);
+    EXPECT_FALSE(null_global);
+  }
+
+  // Local and global refs should {copy,move}-{construct,assign}.
+  // Moves should leave the source as null.
+  {
+    ScopedJavaLocalRef<jstring> str2(str);
+    EXPECT_SAME_OBJECT(str2, str);
+    ScopedJavaLocalRef<jstring> str3(std::move(str2));
+    EXPECT_SAME_OBJECT(str3, str);
+    EXPECT_FALSE(str2);
+    ScopedJavaLocalRef<jstring> str4;
+    str4 = str;
+    EXPECT_SAME_OBJECT(str4, str);
+    ScopedJavaLocalRef<jstring> str5;
+    str5 = std::move(str4);
+    EXPECT_SAME_OBJECT(str5, str);
+    EXPECT_FALSE(str4);
+  }
+  {
+    ScopedJavaGlobalRef<jstring> str2(global);
+    EXPECT_SAME_OBJECT(str2, str);
+    ScopedJavaGlobalRef<jstring> str3(std::move(str2));
+    EXPECT_SAME_OBJECT(str3, str);
+    EXPECT_FALSE(str2);
+    ScopedJavaGlobalRef<jstring> str4;
+    str4 = global;
+    EXPECT_SAME_OBJECT(str4, str);
+    ScopedJavaGlobalRef<jstring> str5;
+    str5 = std::move(str4);
+    EXPECT_SAME_OBJECT(str5, str);
+    EXPECT_FALSE(str4);
+  }
+
+  // As above but going from jstring to jobject.
+  {
+    ScopedJavaLocalRef<jobject> obj2(str);
+    EXPECT_SAME_OBJECT(obj2, str);
+    ScopedJavaLocalRef<jobject> obj3(std::move(obj2));
+    EXPECT_SAME_OBJECT(obj3, str);
+    EXPECT_FALSE(obj2);
+    ScopedJavaLocalRef<jobject> obj4;
+    obj4 = str;
+    EXPECT_SAME_OBJECT(obj4, str);
+    ScopedJavaLocalRef<jobject> obj5;
+    obj5 = std::move(obj4);
+    EXPECT_SAME_OBJECT(obj5, str);
+    EXPECT_FALSE(obj4);
+  }
+  {
+    ScopedJavaGlobalRef<jobject> obj2(global);
+    EXPECT_SAME_OBJECT(obj2, str);
+    ScopedJavaGlobalRef<jobject> obj3(std::move(obj2));
+    EXPECT_SAME_OBJECT(obj3, str);
+    EXPECT_FALSE(obj2);
+    ScopedJavaGlobalRef<jobject> obj4;
+    obj4 = global;
+    EXPECT_SAME_OBJECT(obj4, str);
+    ScopedJavaGlobalRef<jobject> obj5;
+    obj5 = std::move(obj4);
+    EXPECT_SAME_OBJECT(obj5, str);
+    EXPECT_FALSE(obj4);
+  }
+
+  // Explicit copy construction or assignment between global<->local is allowed,
+  // but not implicit conversions.
+  {
+    ScopedJavaLocalRef<jstring> new_local(global);
+    EXPECT_SAME_OBJECT(new_local, str);
+    new_local = global;
+    EXPECT_SAME_OBJECT(new_local, str);
+    ScopedJavaGlobalRef<jstring> new_global(str);
+    EXPECT_SAME_OBJECT(new_global, str);
+    new_global = str;
+    EXPECT_SAME_OBJECT(new_local, str);
+    static_assert(!std::is_convertible<ScopedJavaLocalRef<jobject>,
+                                       ScopedJavaGlobalRef<jobject>>::value,
+                  "");
+    static_assert(!std::is_convertible<ScopedJavaGlobalRef<jobject>,
+                                       ScopedJavaLocalRef<jobject>>::value,
+                  "");
+  }
+
+  // Converting between local/global while also converting to jobject also works
+  // because JavaRef<jobject> is the base class.
   {
     ScopedJavaGlobalRef<jobject> global_obj(str);
     ScopedJavaLocalRef<jobject> local_obj(global);
     const JavaRef<jobject>& obj_ref1(str);
     const JavaRef<jobject>& obj_ref2(global);
-    EXPECT_TRUE(env->IsSameObject(obj_ref1.obj(), obj_ref2.obj()));
-    EXPECT_TRUE(env->IsSameObject(global_obj.obj(), obj_ref2.obj()));
+    EXPECT_SAME_OBJECT(obj_ref1, obj_ref2);
+    EXPECT_SAME_OBJECT(global_obj, obj_ref2);
   }
   global.Reset(str);
   const JavaRef<jstring>& str_ref = str;
@@ -99,7 +199,7 @@
     EXPECT_EQ(1, g_local_refs);
     EXPECT_EQ(2, g_global_refs);
 
-    ScopedJavaLocalRef<jstring> str2(env, str.Release());
+    auto str2 = ScopedJavaLocalRef<jstring>::Adopt(env, str.Release());
     EXPECT_EQ(1, g_local_refs);
     {
       ScopedJavaLocalRef<jstring> str3(str2);
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc
index 36b45f7..3aec7aa 100644
--- a/base/bind_unittest.cc
+++ b/base/bind_unittest.cc
@@ -1091,7 +1091,7 @@
   using MoveOnlyVector = std::vector<std::unique_ptr<int>>;
 
   MoveOnlyVector v;
-  v.push_back(WrapUnique(new int(12345)));
+  v.push_back(std::make_unique<int>(12345));
 
   // Early binding should work:
   base::Callback<MoveOnlyVector()> bound_cb =
diff --git a/base/cancelable_callback_unittest.cc b/base/cancelable_callback_unittest.cc
index 373498c..42e753f 100644
--- a/base/cancelable_callback_unittest.cc
+++ b/base/cancelable_callback_unittest.cc
@@ -9,7 +9,6 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/location.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -198,7 +197,7 @@
   int result = 0;
   CancelableCallback<void(std::unique_ptr<int>)> cb(
       base::Bind(&OnMoveOnlyReceived, base::Unretained(&result)));
-  cb.callback().Run(base::WrapUnique(new int(kExpectedResult)));
+  cb.callback().Run(std::make_unique<int>(kExpectedResult));
 
   EXPECT_EQ(kExpectedResult, result);
 }
diff --git a/base/containers/README.md b/base/containers/README.md
index e521881..e788262 100644
--- a/base/containers/README.md
+++ b/base/containers/README.md
@@ -65,7 +65,7 @@
 | `base::flat_map`, `base::flat_set`         | 24 bytes              | 0 (see notes)     | No                |
 | `base::small_map`                          | 24 bytes (see notes)  | 32 bytes          | No                |
 
-**Takeaways:** `std::unordered_map` and `std::unordered_map` have high
+**Takeaways:** `std::unordered_map` and `std::unordered_set` have high
 overhead for small container sizes, so prefer these only for larger workloads.
 
 Code size comparisons for a block of code (see appendix) on Windows using
diff --git a/base/containers/mru_cache_unittest.cc b/base/containers/mru_cache_unittest.cc
index 8de235a..30ebc2c 100644
--- a/base/containers/mru_cache_unittest.cc
+++ b/base/containers/mru_cache_unittest.cc
@@ -7,7 +7,6 @@
 #include <cstddef>
 #include <memory>
 
-#include "base/memory/ptr_util.h"
 #include "base/trace_event/memory_usage_estimator.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -200,8 +199,8 @@
 
   // First insert and item and then overwrite it.
   static const int kItem1Key = 1;
-  cache.Put(kItem1Key, WrapUnique(new CachedItem(20)));
-  cache.Put(kItem1Key, WrapUnique(new CachedItem(22)));
+  cache.Put(kItem1Key, std::make_unique<CachedItem>(20));
+  cache.Put(kItem1Key, std::make_unique<CachedItem>(22));
 
   // There should still be one item, and one extra live item.
   auto iter = cache.Get(kItem1Key);
@@ -217,8 +216,8 @@
   // go away.
   {
     Cache cache2(Cache::NO_AUTO_EVICT);
-    cache2.Put(1, WrapUnique(new CachedItem(20)));
-    cache2.Put(2, WrapUnique(new CachedItem(20)));
+    cache2.Put(1, std::make_unique<CachedItem>(20));
+    cache2.Put(2, std::make_unique<CachedItem>(20));
   }
 
   // There should be no objects leaked.
@@ -227,8 +226,8 @@
   // Check that Clear() also frees things correctly.
   {
     Cache cache2(Cache::NO_AUTO_EVICT);
-    cache2.Put(1, WrapUnique(new CachedItem(20)));
-    cache2.Put(2, WrapUnique(new CachedItem(20)));
+    cache2.Put(1, std::make_unique<CachedItem>(20));
+    cache2.Put(2, std::make_unique<CachedItem>(20));
     EXPECT_EQ(initial_count + 2, cached_item_live_count);
     cache2.Clear();
     EXPECT_EQ(initial_count, cached_item_live_count);
diff --git a/base/containers/vector_buffer.h b/base/containers/vector_buffer.h
index ea1caa3..7710ecb 100644
--- a/base/containers/vector_buffer.h
+++ b/base/containers/vector_buffer.h
@@ -50,7 +50,7 @@
 #endif
   VectorBuffer(size_t count)
       : buffer_(reinterpret_cast<T*>(
-            SbMemoryAllocate(CheckMul(sizeof(T), count).ValueOrDie()))),
+            malloc(CheckMul(sizeof(T), count).ValueOrDie()))),
         capacity_(count) {
   }
   VectorBuffer(VectorBuffer&& other) noexcept
@@ -59,10 +59,10 @@
     other.capacity_ = 0;
   }
 
-  ~VectorBuffer() { SbMemoryDeallocate(buffer_); }
+  ~VectorBuffer() { free(buffer_); }
 
   VectorBuffer& operator=(VectorBuffer&& other) {
-    SbMemoryDeallocate(buffer_);
+    free(buffer_);
     buffer_ = other.buffer_;
     capacity_ = other.capacity_;
 
diff --git a/base/debug/activity_analyzer.cc b/base/debug/activity_analyzer.cc
index b3bb730..b383790 100644
--- a/base/debug/activity_analyzer.cc
+++ b/base/debug/activity_analyzer.cc
@@ -12,7 +12,6 @@
 #include "base/files/memory_mapped_file.h"
 #include "base/lazy_instance.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/stl_util.h"
 #include "base/strings/string_util.h"
@@ -108,7 +107,7 @@
     return nullptr;
   }
 
-  return WrapUnique(new GlobalActivityAnalyzer(std::move(allocator)));
+  return std::make_unique<GlobalActivityAnalyzer>(std::move(allocator));
 }
 
 #if !defined(OS_NACL)
diff --git a/base/debug/thread_heap_usage_tracker_unittest.cc b/base/debug/thread_heap_usage_tracker_unittest.cc
index baed91e..5fa9c3d 100644
--- a/base/debug/thread_heap_usage_tracker_unittest.cc
+++ b/base/debug/thread_heap_usage_tracker_unittest.cc
@@ -137,7 +137,7 @@
                          void* context) {
     EXPECT_EQ(&g_mock_dispatch, self);
 
-    void* ret = SbMemoryAllocate(size);
+    void* ret = malloc(size);
     g_self->RecordAlloc(ret, size);
     return ret;
   }
@@ -161,7 +161,7 @@
 
     // This is a cheat as it doesn't return aligned allocations. This has the
     // advantage of working for all platforms for this test.
-    void* ret = SbMemoryAllocate(size);
+    void* ret = malloc(size);
     g_self->RecordAlloc(ret, size);
     return ret;
   }
@@ -173,7 +173,7 @@
     EXPECT_EQ(&g_mock_dispatch, self);
 
     g_self->DeleteAlloc(address);
-    void* ret = SbMemoryReallocate(address, size);
+    void* ret = realloc(address, size);
     g_self->RecordAlloc(ret, size);
     return ret;
   }
@@ -184,7 +184,7 @@
     EXPECT_EQ(&g_mock_dispatch, self);
 
     g_self->DeleteAlloc(address);
-    SbMemoryDeallocate(address);
+    free(address);
   }
 
   static size_t OnGetSizeEstimateFn(const AllocatorDispatch* self,
@@ -576,12 +576,12 @@
   usage_tracker.Start();
 
   ThreadHeapUsage u1 = ThreadHeapUsageTracker::GetUsageSnapshot();
-  void* ptr = SbMemoryAllocate(kAllocSize);
+  void* ptr = malloc(kAllocSize);
   // Prevent the compiler from optimizing out the malloc/free pair.
   ASSERT_NE(nullptr, ptr);
 
   ThreadHeapUsage u2 = ThreadHeapUsageTracker::GetUsageSnapshot();
-  SbMemoryDeallocate(ptr);
+  free(ptr);
 
   usage_tracker.Stop(false);
   ThreadHeapUsage u3 = usage_tracker.usage();
diff --git a/base/feature_list_unittest.cc b/base/feature_list_unittest.cc
index aae1bc6..79f52ca 100644
--- a/base/feature_list_unittest.cc
+++ b/base/feature_list_unittest.cc
@@ -9,7 +9,6 @@
 
 #include "base/format_macros.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial.h"
 #include "base/metrics/persistent_memory_allocator.h"
 #include "base/strings/string_piece.h"
@@ -44,7 +43,7 @@
 class FeatureListTest : public testing::Test {
  public:
   FeatureListTest() : feature_list_(nullptr) {
-    RegisterFeatureListInstance(WrapUnique(new FeatureList));
+    RegisterFeatureListInstance(std::make_unique<FeatureList>());
   }
   ~FeatureListTest() override { ClearFeatureListInstance(); }
 
diff --git a/base/files/file_util.cc b/base/files/file_util.cc
index befe725..7ba55fe 100644
--- a/base/files/file_util.cc
+++ b/base/files/file_util.cc
@@ -94,7 +94,7 @@
     file2.read(buffer2, BUFFER_SIZE);
 
     if ((file1.eof() != file2.eof()) || (file1.gcount() != file2.gcount()) ||
-        (SbMemoryCompare(buffer1, buffer2,
+        (memcmp(buffer1, buffer2,
                          static_cast<size_t>(file1.gcount())))) {
       file1.close();
       file2.close();
diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc
index 44570e2..293d4ee 100644
--- a/base/files/file_util_unittest.cc
+++ b/base/files/file_util_unittest.cc
@@ -2396,7 +2396,7 @@
   // Restore the original $TMP.
   if (original_tmp) {
     ::_tputenv_s(kTmpKey, original_tmp);
-    SbMemoryDeallocate(original_tmp);
+    free(original_tmp);
   } else {
     ::_tputenv_s(kTmpKey, _T(""));
   }
diff --git a/base/i18n/base_i18n_export.h b/base/i18n/base_i18n_export.h
index e8a2add..ef498e9 100644
--- a/base/i18n/base_i18n_export.h
+++ b/base/i18n/base_i18n_export.h
@@ -5,7 +5,11 @@
 #ifndef BASE_I18N_BASE_I18N_EXPORT_H_
 #define BASE_I18N_BASE_I18N_EXPORT_H_
 
-#if defined(COMPONENT_BUILD)
+#ifdef USE_COBALT_CUSTOMIZATIONS
+#include "starboard/configuration.h"
+#endif // USE_COBALT_CUSTOMIZATIONS
+
+#if defined(COMPONENT_BUILD) || SB_IS(MODULAR) && !SB_IS(EVERGREEN)
 #if defined(WIN32)
 
 #if defined(BASE_I18N_IMPLEMENTATION)
@@ -22,7 +26,7 @@
 #endif
 #endif
 
-#else  // defined(COMPONENT_BUILD)
+#else  // defined(COMPONENT_BUILD) || SB_IS(MODULAR) && !SB_IS(EVERGREEN)
 #define BASE_I18N_EXPORT
 #endif
 
diff --git a/base/logging.cc b/base/logging.cc
index 809e141..5a159ff 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -478,9 +478,15 @@
     case LOG_ERROR:
       return kSbLogPriorityError;
     case LOG_FATAL:
-    case LOG_VERBOSE:
       return kSbLogPriorityFatal;
+    case LOG_VERBOSE:
     default:
+      if (level <= LOG_VERBOSE) {
+        // Verbose level can be any negative integer, sanity check its range to
+        // filter out potential errors.
+        DCHECK_GE(level, -256);
+        return kSbLogPriorityInfo;
+      }
       NOTREACHED() << "Unrecognized log level.";
       return kSbLogPriorityInfo;
   }
diff --git a/base/mac/sdk_forward_declarations.h b/base/mac/sdk_forward_declarations.h
index eebf55c..c5b52c5 100644
--- a/base/mac/sdk_forward_declarations.h
+++ b/base/mac/sdk_forward_declarations.h
@@ -360,10 +360,4 @@
 // ----------------------------------------------------------------------------
 BASE_EXPORT extern "C" NSString* const kCWSSIDDidChangeNotification;
 
-// Once Chrome is built with at least the macOS 10.13 SDK, everything within
-// this preprocessor block can be removed.
-#if !defined(MAC_OS_X_VERSION_10_13)
-typedef NSString* NSTextCheckingOptionKey;
-#endif
-
 #endif  // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
diff --git a/base/macros.h b/base/macros.h
index 93d3fc3..a3edaa6 100644
--- a/base/macros.h
+++ b/base/macros.h
@@ -81,6 +81,9 @@
 //   static base::NoDestructor<Factory> instance;
 //   return *instance;
 // }
+//
+// Removal of this macro is tracked in https://crbug.com/893317.
+//
 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \
   static type& name = *new type arguments
diff --git a/base/memory/aligned_memory.cc b/base/memory/aligned_memory.cc
index 9a6d88f..6cf239f 100644
--- a/base/memory/aligned_memory.cc
+++ b/base/memory/aligned_memory.cc
@@ -20,9 +20,7 @@
   DCHECK_EQ(alignment & (alignment - 1), 0U);
   DCHECK_EQ(alignment % sizeof(void*), 0U);
   void* ptr = nullptr;
-#if defined(STARBOARD)
-  ptr = SbMemoryAllocateAligned(alignment, size);
-#elif defined(COMPILER_MSVC)
+#if defined(COMPILER_MSVC)
   ptr = _aligned_malloc(size, alignment);
 // Android technically supports posix_memalign(), but does not expose it in
 // the current version of the library headers used by Chrome.  Luckily,
diff --git a/base/memory/aligned_memory.h b/base/memory/aligned_memory.h
index 943692c..224f1fb 100644
--- a/base/memory/aligned_memory.h
+++ b/base/memory/aligned_memory.h
@@ -119,15 +119,11 @@
 BASE_EXPORT void* AlignedAlloc(size_t size, size_t alignment);
 
 inline void AlignedFree(void* ptr) {
-#if defined(STARBOARD)
-  SbMemoryDeallocateAligned(ptr);
-#else
 #if defined(COMPILER_MSVC)
   _aligned_free(ptr);
 #else
   free(ptr);
 #endif
-#endif  // defined(STARBOARD)
 }
 
 // Deleter for use with unique_ptr. E.g., use as
diff --git a/base/memory/free_deleter.h b/base/memory/free_deleter.h
index 0378c0c..91649a4 100644
--- a/base/memory/free_deleter.h
+++ b/base/memory/free_deleter.h
@@ -18,7 +18,7 @@
 // std::unique_ptr<int, base::FreeDeleter> foo_ptr(
 //     static_cast<int*>(malloc(sizeof(int))));
 struct FreeDeleter {
-  inline void operator()(void* ptr) const { SbMemoryDeallocate(ptr); }
+  inline void operator()(void* ptr) const { free(ptr); }
 };
 
 }  // namespace base
diff --git a/base/memory/platform_shared_memory_region_fuchsia.cc b/base/memory/platform_shared_memory_region_fuchsia.cc
index 6e72d5e..378877f 100644
--- a/base/memory/platform_shared_memory_region_fuchsia.cc
+++ b/base/memory/platform_shared_memory_region_fuchsia.cc
@@ -142,7 +142,8 @@
                                      "lead to this region being non-modifiable";
 
   zx::vmo vmo;
-  zx_status_t status = zx::vmo::create(rounded_size, 0, &vmo);
+  zx_status_t status =
+      zx::vmo::create(rounded_size, ZX_VMO_NON_RESIZABLE, &vmo);
   if (status != ZX_OK) {
     ZX_DLOG(ERROR, status) << "zx_vmo_create";
     return {};
diff --git a/base/memory/shared_memory_fuchsia.cc b/base/memory/shared_memory_fuchsia.cc
index a79d937..ffad5b2 100644
--- a/base/memory/shared_memory_fuchsia.cc
+++ b/base/memory/shared_memory_fuchsia.cc
@@ -54,7 +54,8 @@
   requested_size_ = options.size;
   mapped_size_ = bits::Align(requested_size_, GetPageSize());
   zx::vmo vmo;
-  zx_status_t status = zx::vmo::create(mapped_size_, 0, &vmo);
+  zx_status_t status =
+      zx::vmo::create(mapped_size_, ZX_VMO_NON_RESIZABLE, &vmo);
   if (status != ZX_OK) {
     ZX_DLOG(ERROR, status) << "zx_vmo_create";
     return false;
diff --git a/base/memory/shared_memory_region_unittest.cc b/base/memory/shared_memory_region_unittest.cc
index 1098360..d68177e 100644
--- a/base/memory/shared_memory_region_unittest.cc
+++ b/base/memory/shared_memory_region_unittest.cc
@@ -133,7 +133,7 @@
 
   // Verify that the second mapping reflects changes in the first.
   memset(this->rw_mapping_.memory(), '#', kRegionSize);
-  EXPECT_EQ(SbMemoryCompare(this->rw_mapping_.memory(), mapping.memory(),
+  EXPECT_EQ(memcmp(this->rw_mapping_.memory(), mapping.memory(),
                             kRegionSize),
             0);
 }
diff --git a/base/memory/shared_memory_win_unittest.cc b/base/memory/shared_memory_win_unittest.cc
index 6c869ac..0857284 100644
--- a/base/memory/shared_memory_win_unittest.cc
+++ b/base/memory/shared_memory_win_unittest.cc
@@ -92,7 +92,7 @@
   uint32_t handle_as_int = base::win::HandleToUint32(handle);
 
   std::unique_ptr<char, base::FreeDeleter> buffer(
-      static_cast<char*>(SbMemoryAllocate(1000)));
+      static_cast<char*>(malloc(1000)));
   size_t index = 0;
   while (handle_as_int > 0) {
     buffer.get()[index] = handle_as_int % 10;
diff --git a/base/metrics/bucket_ranges.cc b/base/metrics/bucket_ranges.cc
index 2723c3e..39b3793 100644
--- a/base/metrics/bucket_ranges.cc
+++ b/base/metrics/bucket_ranges.cc
@@ -74,8 +74,7 @@
 // the CRC correct for big-endian vs little-ending calculations.  All we need is
 // a nice hash, that tends to depend on all the bits of the sample, with very
 // little chance of changes in one place impacting changes in another place.
-// Temporary non-static for https://crbug.com/836238
-/*static*/ uint32_t Crc32(uint32_t sum, HistogramBase::Sample value) {
+static uint32_t Crc32(uint32_t sum, HistogramBase::Sample value) {
   union {
     HistogramBase::Sample range;
     unsigned char bytes[sizeof(HistogramBase::Sample)];
diff --git a/base/metrics/bucket_ranges.h b/base/metrics/bucket_ranges.h
index 837cc93..e1dc09d 100644
--- a/base/metrics/bucket_ranges.h
+++ b/base/metrics/bucket_ranges.h
@@ -97,7 +97,6 @@
 //////////////////////////////////////////////////////////////////////////////
 // Expose only for test.
 BASE_EXPORT extern const uint32_t kCrcTable[256];
-uint32_t Crc32(uint32_t sum, HistogramBase::Sample value);
 
 }  // namespace base
 
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 82a3c86..ef56619 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -158,8 +158,6 @@
 
 HistogramBase* Histogram::Factory::Build() {
   HistogramBase* histogram = StatisticsRecorder::FindHistogram(name_);
-  const bool found = (histogram != nullptr);
-  debug::Alias(&found);
   if (!histogram) {
     // TODO(gayane): |HashMetricName()| is called again in Histogram
     // constructor. Refactor code to avoid the additional call.
@@ -169,99 +167,10 @@
       return DummyHistogram::GetInstance();
     // To avoid racy destruction at shutdown, the following will be leaked.
     const BucketRanges* created_ranges = CreateRanges();
-    CHECK(created_ranges->HasValidChecksum()) << name_;
-
-// Temporary check for https://crbug.com/836238
-#if defined(OS_WIN)  // Only Windows has a debugger that makes this useful.
-    if (bucket_count_ > 0 &&
-        maximum_ != created_ranges->range(bucket_count_ - 1)) {
-      // Create local copies of the parameters to be sure they'll be available
-      // in the crash dump for the debugger to see.
-      DEBUG_ALIAS_FOR_CSTR(h_name, name_.c_str(), 100);
-      HistogramType h_type = histogram_type_;
-      Sample h_min = minimum_;
-      Sample h_max = maximum_;
-      uint32_t h_count = bucket_count_;
-      debug::Alias(&h_type);
-      debug::Alias(&h_min);
-      debug::Alias(&h_max);
-      debug::Alias(&h_count);
-      uint32_t ranges_min = created_ranges->range(1);
-      uint32_t ranges_max = created_ranges->range(bucket_count_ - 1);
-      debug::Alias(&ranges_min);
-      debug::Alias(&ranges_max);
-      CHECK(false) << name_;
-    }
-#endif
-
-// Temporary check for https://crbug.com/836238
-#if defined(OS_WIN)  // Only Windows has a debugger that makes this useful.
-    std::unique_ptr<const BucketRanges> recreated_ranges(CreateRanges());
-    for (uint32_t i = 0; i < bucket_count_; ++i) {
-      uint32_t created_range = created_ranges->range(i);
-      uint32_t recreated_range = recreated_ranges->range(i);
-      debug::Alias(&created_range);
-      debug::Alias(&recreated_range);
-      if (created_range != recreated_range) {
-        // Create local copies of the parameters to be sure they'll be available
-        // in the crash dump for the debugger to see.
-        DEBUG_ALIAS_FOR_CSTR(h_name, name_.c_str(), 100);
-        HistogramType h_type = histogram_type_;
-        uint32_t b_count = bucket_count_;
-        size_t c_count = created_ranges->size() - 1;
-        size_t r_count = recreated_ranges->size() - 1;
-        bool c_valid = created_ranges->HasValidChecksum();
-        bool r_valid = recreated_ranges->HasValidChecksum();
-        CHECK(recreated_ranges->Equals(created_ranges)) << name_;
-        debug::Alias(&h_type);
-        debug::Alias(&b_count);
-        debug::Alias(&c_count);
-        debug::Alias(&r_count);
-        debug::Alias(&c_valid);
-        debug::Alias(&r_valid);
-        CHECK(false) << name_;
-      }
-    }
-    CHECK(recreated_ranges->Equals(created_ranges));
-#endif
 
     const BucketRanges* registered_ranges =
         StatisticsRecorder::RegisterOrDeleteDuplicateRanges(created_ranges);
 
-// Temporary check for https://crbug.com/836238
-#if defined(OS_WIN)  // Only Windows has a debugger that makes this useful.
-    bool using_created_ranges = (registered_ranges == created_ranges);
-    bool equal_ranges = registered_ranges->Equals(recreated_ranges.get());
-    debug::Alias(&using_created_ranges);
-    debug::Alias(&equal_ranges);
-    for (uint32_t i = 0; i < bucket_count_; ++i) {
-      uint32_t created_range = recreated_ranges->range(i);
-      uint32_t registered_range = registered_ranges->range(i);
-      debug::Alias(&created_range);
-      debug::Alias(&registered_range);
-      if (created_range != registered_range) {
-        // Create local copies of the parameters to be sure they'll be available
-        // in the crash dump for the debugger to see.
-        DEBUG_ALIAS_FOR_CSTR(h_name, name_.c_str(), 100);
-        HistogramType h_type = histogram_type_;
-        uint32_t b_count = bucket_count_;
-        size_t c_count = recreated_ranges->size() - 1;
-        size_t r_count = registered_ranges->size() - 1;
-        bool c_valid = recreated_ranges->HasValidChecksum();
-        bool r_valid = registered_ranges->HasValidChecksum();
-        CHECK(recreated_ranges->Equals(registered_ranges)) << name_;
-        debug::Alias(&h_type);
-        debug::Alias(&b_count);
-        debug::Alias(&c_count);
-        debug::Alias(&r_count);
-        debug::Alias(&c_valid);
-        debug::Alias(&r_valid);
-        CHECK(false) << name_;
-      }
-    }
-    CHECK(recreated_ranges->Equals(registered_ranges));
-#endif
-
     // In most cases, the bucket-count, minimum, and maximum values are known
     // when the code is written and so are passed in explicitly. In other
     // cases (such as with a CustomHistogram), they are calculated dynamically
@@ -333,43 +242,6 @@
                        static_cast<Sample>(HashMetricName(name_)));
     DLOG(ERROR) << "Histogram " << name_
                 << " has mismatched construction arguments";
-
-// crbug.com/836238: Temporarily create crashes for this condition in order
-// to find out why it is happening for many metrics that are hard-coded and
-// thus should never have a mismatch.
-// TODO(bcwhite): Revert this once some crashes have been collected.
-#if defined(OS_WIN)  // Only Windows has a debugger that makes this useful.
-    // Don't crash for linear histograms as these have never shown an error
-    // but mismitches still occur because of extensions that have different
-    // enumeration lists than what is inside Chrome. Continue to return the
-    // "dummy" histogram (below) instead.
-    if (histogram_type_ != LINEAR_HISTOGRAM) {
-      // Create local copies of the parameters to be sure they'll be available
-      // in the crash dump for the debugger to see.
-      const Histogram* h = static_cast<Histogram*>(histogram);
-      Sample hash_32 = static_cast<Sample>(HashMetricName(name_));
-      debug::Alias(&hash_32);
-      DEBUG_ALIAS_FOR_CSTR(new_name, name_.c_str(), 100);
-      HistogramType new_type = histogram_type_;
-      Sample new_min = minimum_;
-      Sample new_max = maximum_;
-      uint32_t new_count = bucket_count_;
-      debug::Alias(&new_type);
-      debug::Alias(&new_min);
-      debug::Alias(&new_max);
-      debug::Alias(&new_count);
-      DEBUG_ALIAS_FOR_CSTR(old_name, h->histogram_name(), 100);
-      HistogramType old_type = h->GetHistogramType();
-      Sample old_min = h->declared_min();
-      Sample old_max = h->declared_max();
-      uint32_t old_count = h->bucket_count();
-      debug::Alias(&old_type);
-      debug::Alias(&old_min);
-      debug::Alias(&old_max);
-      debug::Alias(&old_count);
-      CHECK(false) << name_;
-    }
-#endif
     return DummyHistogram::GetInstance();
   }
   return histogram;
@@ -467,15 +339,6 @@
   ranges->set_range(bucket_index, current);
   size_t bucket_count = ranges->bucket_count();
 
-  // Temporary for https://crbug.com/836238
-  uint32_t checksum = static_cast<uint32_t>(bucket_count + 1);
-  checksum = Crc32(checksum, 0);
-  checksum = Crc32(checksum, current);
-  debug::Alias(&minimum);
-  debug::Alias(&maximum);
-  debug::Alias(&bucket_count);
-  debug::Alias(&checksum);
-
   while (bucket_count > ++bucket_index) {
     double log_current;
     log_current = log(static_cast<double>(current));
@@ -490,12 +353,9 @@
     else
       ++current;  // Just do a narrow bucket, and keep trying.
     ranges->set_range(bucket_index, current);
-    checksum = Crc32(checksum, current);
   }
   ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX);
   ranges->ResetChecksum();
-  checksum = Crc32(checksum, HistogramBase::kSampleType_MAX);
-  CHECK_EQ(checksum, ranges->checksum());
 }
 
 // static
@@ -1126,32 +986,14 @@
   double max = maximum;
   size_t bucket_count = ranges->bucket_count();
 
-  // Temporary for https://crbug.com/836238
-  bool is_enum = (minimum == 1 &&
-                  static_cast<Sample>(bucket_count) == maximum - minimum + 2);
-  uint32_t checksum = static_cast<uint32_t>(bucket_count + 1);
-  checksum = Crc32(checksum, 0);
-  debug::Alias(&minimum);
-  debug::Alias(&maximum);
-  debug::Alias(&min);
-  debug::Alias(&max);
-  debug::Alias(&bucket_count);
-  debug::Alias(&checksum);
-  debug::Alias(&is_enum);
-
   for (size_t i = 1; i < bucket_count; ++i) {
     double linear_range =
         (min * (bucket_count - 1 - i) + max * (i - 1)) / (bucket_count - 2);
     uint32_t range = static_cast<Sample>(linear_range + 0.5);
-    if (is_enum)
-      CHECK_EQ(static_cast<uint32_t>(i), range);
     ranges->set_range(i, range);
-    checksum = Crc32(checksum, range);
   }
   ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX);
   ranges->ResetChecksum();
-  checksum = Crc32(checksum, HistogramBase::kSampleType_MAX);
-  CHECK_EQ(checksum, ranges->checksum());
 }
 
 // static
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc
index 7c95fac..a976d0a 100644
--- a/base/metrics/histogram_unittest.cc
+++ b/base/metrics/histogram_unittest.cc
@@ -640,7 +640,6 @@
   EXPECT_FALSE(iter.SkipBytes(1));
 }
 
-#if 0  // TODO(crbug.com/836238): Temporarily disabled for field crash test.
 TEST_P(HistogramTest, BadConstruction) {
   HistogramBase* histogram = Histogram::FactoryGet(
       "BadConstruction", 0, 100, 8, HistogramBase::kNoFlags);
@@ -666,7 +665,6 @@
       "BadConstructionLinear", 10, 100, 8, HistogramBase::kNoFlags);
   EXPECT_EQ(DummyHistogram::GetInstance(), bad_histogram);
 }
-#endif
 
 TEST_P(HistogramTest, FactoryTime) {
   const int kTestCreateCount = 1 << 14;  // Must be power-of-2.
diff --git a/base/metrics/persistent_memory_allocator.cc b/base/metrics/persistent_memory_allocator.cc
index 24ac0c0..831a5e7 100644
--- a/base/metrics/persistent_memory_allocator.cc
+++ b/base/metrics/persistent_memory_allocator.cc
@@ -995,7 +995,7 @@
   // achieve the same basic result but the acquired memory has to be
   // explicitly zeroed and thus realized immediately (i.e. all pages are
   // added to the process now istead of only when first accessed).
-  address = SbMemoryAllocate(size);
+  address = malloc(size);
   DPCHECK(address);
   memset(address, 0, size);
   return Memory(address, MEM_MALLOC);
@@ -1006,7 +1006,7 @@
                                                            size_t size,
                                                            MemoryType type) {
   if (type == MEM_MALLOC) {
-    SbMemoryDeallocate(memory);
+    free(memory);
     return;
   }
 
diff --git a/base/metrics/persistent_sample_map.cc b/base/metrics/persistent_sample_map.cc
index f38b9d1..e07b716 100644
--- a/base/metrics/persistent_sample_map.cc
+++ b/base/metrics/persistent_sample_map.cc
@@ -5,7 +5,6 @@
 #include "base/metrics/persistent_sample_map.h"
 
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/metrics/persistent_histogram_allocator.h"
 #include "base/numerics/safe_conversions.h"
@@ -154,7 +153,7 @@
   // Have to override "const" in order to make sure all samples have been
   // loaded before trying to iterate over the map.
   const_cast<PersistentSampleMap*>(this)->ImportSamples(-1, true);
-  return WrapUnique(new PersistentSampleMapIterator(sample_counts_));
+  return std::make_unique<PersistentSampleMapIterator>(sample_counts_);
 }
 
 // static
diff --git a/base/metrics/sample_map.cc b/base/metrics/sample_map.cc
index b441afa..f925238 100644
--- a/base/metrics/sample_map.cc
+++ b/base/metrics/sample_map.cc
@@ -5,7 +5,6 @@
 #include "base/metrics/sample_map.h"
 
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/stl_util.h"
 
@@ -106,7 +105,7 @@
 }
 
 std::unique_ptr<SampleCountIterator> SampleMap::Iterator() const {
-  return WrapUnique(new SampleMapIterator(sample_counts_));
+  return std::make_unique<SampleMapIterator>(sample_counts_);
 }
 
 bool SampleMap::AddSubtractImpl(SampleCountIterator* iter, Operator op) {
diff --git a/base/metrics/single_sample_metrics_unittest.cc b/base/metrics/single_sample_metrics_unittest.cc
index cca7514..974ba7e 100644
--- a/base/metrics/single_sample_metrics_unittest.cc
+++ b/base/metrics/single_sample_metrics_unittest.cc
@@ -4,7 +4,6 @@
 
 #include "base/metrics/single_sample_metrics.h"
 
-#include "base/memory/ptr_util.h"
 #include "base/metrics/dummy_histogram.h"
 #include "base/test/gtest_util.h"
 #include "base/test/metrics/histogram_tester.h"
@@ -42,14 +41,14 @@
   EXPECT_EQ(factory, SingleSampleMetricsFactory::Get());
 
   // Setting a factory after the default has been instantiated should fail.
-  EXPECT_DCHECK_DEATH(SingleSampleMetricsFactory::SetFactory(
-      WrapUnique<SingleSampleMetricsFactory>(nullptr)));
+  EXPECT_DCHECK_DEATH(SingleSampleMetricsFactory::SetFactory(nullptr));
 }
 
 TEST_F(SingleSampleMetricsTest, CustomFactoryGetSet) {
-  SingleSampleMetricsFactory* factory = new DefaultSingleSampleMetricsFactory();
-  SingleSampleMetricsFactory::SetFactory(WrapUnique(factory));
-  EXPECT_EQ(factory, SingleSampleMetricsFactory::Get());
+  auto factory = std::make_unique<DefaultSingleSampleMetricsFactory>();
+  SingleSampleMetricsFactory* factory_raw = factory.get();
+  SingleSampleMetricsFactory::SetFactory(std::move(factory));
+  EXPECT_EQ(factory_raw, SingleSampleMetricsFactory::Get());
 }
 
 TEST_F(SingleSampleMetricsTest, DefaultSingleSampleMetricNoValue) {
@@ -81,7 +80,6 @@
   // Verify only the last sample sent to SetSample() is recorded.
   tester.ExpectUniqueSample(kMetricName, kLastSample, 1);
 
-#if 0  // TODO(crbug.com/836238): Temporarily disabled for field crash test.
   // Verify construction implicitly by requesting a histogram with the same
   // parameters; this test relies on the fact that histogram objects are unique
   // per name. Different parameters will result in a Dummy histogram returned.
@@ -91,7 +89,6 @@
   EXPECT_NE(DummyHistogram::GetInstance(),
             Histogram::FactoryGet(kMetricName, kMin, kMax, kBucketCount,
                                   HistogramBase::kUmaTargetedHistogramFlag));
-#endif
 }
 
 TEST_F(SingleSampleMetricsTest, MultipleMetricsAreDistinct) {
diff --git a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc
index 890a7c8..591a4c6 100644
--- a/base/nix/xdg_util.cc
+++ b/base/nix/xdg_util.cc
@@ -46,7 +46,7 @@
   char* xdg_dir = xdg_user_dir_lookup(dir_name);
   if (xdg_dir) {
     path = FilePath(xdg_dir);
-    SbMemoryDeallocate(xdg_dir);
+    free(xdg_dir);
   } else {
     PathService::Get(DIR_HOME, &path);
     path = path.Append(fallback_dir);
diff --git a/base/pickle.cc b/base/pickle.cc
index 5f01ea8..6dc126f 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -268,7 +268,7 @@
 
 Pickle::~Pickle() {
   if (capacity_after_header_ != kCapacityReadOnly)
-    SbMemoryDeallocate(header_);
+    free(header_);
 }
 
 Pickle& Pickle::operator=(const Pickle& other) {
@@ -280,7 +280,7 @@
     capacity_after_header_ = 0;
   }
   if (header_size_ != other.header_size_) {
-    SbMemoryDeallocate(header_);
+    free(header_);
     header_ = nullptr;
     header_size_ = other.header_size_;
   }
@@ -339,7 +339,7 @@
 void Pickle::Resize(size_t new_capacity) {
   CHECK_NE(capacity_after_header_, kCapacityReadOnly);
   capacity_after_header_ = bits::Align(new_capacity, kPayloadUnit);
-  void* p = SbMemoryReallocate(header_, GetTotalAllocatedSize());
+  void* p = realloc(header_, GetTotalAllocatedSize());
   CHECK(p);
   header_ = reinterpret_cast<Header*>(p);
 }
diff --git a/base/process/memory_fuchsia.cc b/base/process/memory_fuchsia.cc
index 0a13e55..ac570d1 100644
--- a/base/process/memory_fuchsia.cc
+++ b/base/process/memory_fuchsia.cc
@@ -20,7 +20,7 @@
 }
 
 bool UncheckedMalloc(size_t size, void** result) {
-  *result = SbMemoryAllocate(size);
+  *result = malloc(size);
   return *result != nullptr;
 }
 
diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc
index 6e68602..4f58f41 100644
--- a/base/process/memory_linux.cc
+++ b/base/process/memory_linux.cc
@@ -130,7 +130,7 @@
   *result = allocator::UncheckedAlloc(size);
 #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || \
     (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
-  *result = SbMemoryAllocate(size);
+  *result = malloc(size);
 #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
   *result = __libc_malloc(size);
 #elif defined(USE_TCMALLOC)
diff --git a/base/process/memory_starboard.cc b/base/process/memory_starboard.cc
index 809267c..0167758 100644
--- a/base/process/memory_starboard.cc
+++ b/base/process/memory_starboard.cc
@@ -27,7 +27,7 @@
 }
 
 bool UncheckedMalloc(size_t size, void** result) {
-  *result = SbMemoryAllocate(size);
+  *result = malloc(size);
   return *result != nullptr;
 }
 
diff --git a/base/process/memory_stubs.cc b/base/process/memory_stubs.cc
index 56291ee..e56f72c 100644
--- a/base/process/memory_stubs.cc
+++ b/base/process/memory_stubs.cc
@@ -34,7 +34,7 @@
 // failure to allocate.
 
 bool UncheckedMalloc(size_t size, void** result) {
-  *result = SbMemoryAllocate(size);
+  *result = malloc(size);
   return *result != nullptr;
 }
 
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc
index 7c34d73..4aef5b3 100644
--- a/base/process/memory_unittest.cc
+++ b/base/process/memory_unittest.cc
@@ -70,12 +70,12 @@
 #if ARCH_CPU_64_BITS
   // On 64 bit Macs, the malloc system automatically abort()s on heap corruption
   // but does not output anything.
-  ASSERT_DEATH(SbMemoryDeallocate(buf), "");
+  ASSERT_DEATH(free(buf), "");
 #elif defined(ADDRESS_SANITIZER)
   // AddressSanitizer replaces malloc() and prints a different error message on
   // heap corruption.
-  ASSERT_DEATH(SbMemoryDeallocate(buf),
-               "attempting SbMemoryDeallocate on address which "
+  ASSERT_DEATH(free(buf),
+               "attempting free on address which "
                "was not malloc\\(\\)-ed");
 #else
   ADD_FAILURE() << "This test is not supported in this build configuration.";
@@ -179,14 +179,14 @@
 TEST_F(OutOfMemoryDeathTest, Malloc) {
   ASSERT_EXIT({
       SetUpInDeathAssert();
-      value_ = SbMemoryAllocate(test_size_);
+      value_ = malloc(test_size_);
     }, testing::ExitedWithCode(kExitCode), kOomRegex);
 }
 
 TEST_F(OutOfMemoryDeathTest, Realloc) {
   ASSERT_EXIT({
       SetUpInDeathAssert();
-      value_ = SbMemoryReallocate(nullptr, test_size_);
+      value_ = realloc(nullptr, test_size_);
     }, testing::ExitedWithCode(kExitCode), kOomRegex);
 }
 
@@ -258,14 +258,14 @@
 TEST_F(OutOfMemoryDeathTest, SecurityMalloc) {
   ASSERT_EXIT({
       SetUpInDeathAssert();
-      value_ = SbMemoryAllocate(insecure_test_size_);
+      value_ = malloc(insecure_test_size_);
     }, testing::ExitedWithCode(kExitCode), kOomRegex);
 }
 
 TEST_F(OutOfMemoryDeathTest, SecurityRealloc) {
   ASSERT_EXIT({
       SetUpInDeathAssert();
-      value_ = SbMemoryReallocate(nullptr, insecure_test_size_);
+      value_ = realloc(nullptr, insecure_test_size_);
     }, testing::ExitedWithCode(kExitCode), kOomRegex);
 }
 
@@ -507,7 +507,7 @@
 TEST_F(OutOfMemoryHandledTest, UncheckedMalloc) {
   EXPECT_TRUE(base::UncheckedMalloc(kSafeMallocSize, &value_));
   EXPECT_TRUE(value_ != nullptr);
-  SbMemoryDeallocate(value_);
+  free(value_);
 
   EXPECT_FALSE(base::UncheckedMalloc(test_size_, &value_));
   EXPECT_TRUE(value_ == nullptr);
@@ -519,7 +519,7 @@
   const char* bytes = static_cast<const char*>(value_);
   for (size_t i = 0; i < kSafeMallocSize; ++i)
     EXPECT_EQ(0, bytes[i]);
-  SbMemoryDeallocate(value_);
+  free(value_);
 
   EXPECT_TRUE(
       base::UncheckedCalloc(kSafeCallocItems, kSafeCallocSize, &value_));
@@ -527,7 +527,7 @@
   bytes = static_cast<const char*>(value_);
   for (size_t i = 0; i < (kSafeCallocItems * kSafeCallocSize); ++i)
     EXPECT_EQ(0, bytes[i]);
-  SbMemoryDeallocate(value_);
+  free(value_);
 
   EXPECT_FALSE(base::UncheckedCalloc(1, test_size_, &value_));
   EXPECT_TRUE(value_ == nullptr);
diff --git a/base/process/process_info_mac.cc b/base/process/process_info_mac.cc
index a1cfa00..17c936c 100644
--- a/base/process/process_info_mac.cc
+++ b/base/process/process_info_mac.cc
@@ -26,7 +26,7 @@
     return Time();
 
   std::unique_ptr<struct kinfo_proc, base::FreeDeleter> proc(
-      static_cast<struct kinfo_proc*>(SbMemoryAllocate(len)));
+      static_cast<struct kinfo_proc*>(malloc(len)));
   if (sysctl(mib, arraysize(mib), proc.get(), &len, NULL, 0) < 0)
     return Time();
   return Time::FromTimeVal(proc->kp_proc.p_un.__p_starttime);
diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc
index acb8135..4cd53bc 100644
--- a/base/process/process_metrics_win.cc
+++ b/base/process/process_metrics_win.cc
@@ -203,7 +203,7 @@
 
  private:
   void Clear() {
-    SbMemoryDeallocate(buffer_);
+    free(buffer_);
     buffer_ = nullptr;
   }
 
diff --git a/base/profiler/win32_stack_frame_unwinder.cc b/base/profiler/win32_stack_frame_unwinder.cc
index 9d610e1..51b9ffe 100644
--- a/base/profiler/win32_stack_frame_unwinder.cc
+++ b/base/profiler/win32_stack_frame_unwinder.cc
@@ -9,7 +9,6 @@
 #include <utility>
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "starboard/types.h"
 
 namespace base {
@@ -113,7 +112,7 @@
 Win32StackFrameUnwinder::UnwindFunctions::UnwindFunctions() {}
 
 Win32StackFrameUnwinder::Win32StackFrameUnwinder()
-    : Win32StackFrameUnwinder(WrapUnique(new Win32UnwindFunctions)) {}
+    : Win32StackFrameUnwinder(std::make_unique<Win32UnwindFunctions>()) {}
 
 Win32StackFrameUnwinder::~Win32StackFrameUnwinder() {}
 
diff --git a/base/sampling_heap_profiler/sampling_heap_profiler_unittest.cc b/base/sampling_heap_profiler/sampling_heap_profiler_unittest.cc
index 70e481e..630a3cc 100644
--- a/base/sampling_heap_profiler/sampling_heap_profiler_unittest.cc
+++ b/base/sampling_heap_profiler/sampling_heap_profiler_unittest.cc
@@ -66,8 +66,8 @@
   sampler->SetSamplingInterval(1024);
   sampler->Start();
   sampler->AddSamplesObserver(&collector);
-  void* volatile p = SbMemoryAllocate(10000);
-  SbMemoryDeallocate(p);
+  void* volatile p = malloc(10000);
+  free(p);
   sampler->Stop();
   sampler->RemoveSamplesObserver(&collector);
   EXPECT_TRUE(collector.sample_added);
@@ -83,8 +83,8 @@
   sampler->AddSamplesObserver(&collector);
   {
     PoissonAllocationSampler::ScopedMuteThreadSamples muted_scope;
-    void* volatile p = SbMemoryAllocate(10000);
-    SbMemoryDeallocate(p);
+    void* volatile p = malloc(10000);
+    free(p);
   }
   sampler->Stop();
   sampler->RemoveSamplesObserver(&collector);
@@ -111,17 +111,17 @@
 const int kNumberOfAllocations = 10000;
 
 NOINLINE void Allocate1() {
-  void* p = SbMemoryAllocate(400);
+  void* p = malloc(400);
   base::debug::Alias(&p);
 }
 
 NOINLINE void Allocate2() {
-  void* p = SbMemoryAllocate(700);
+  void* p = malloc(700);
   base::debug::Alias(&p);
 }
 
 NOINLINE void Allocate3() {
-  void* p = SbMemoryAllocate(20480);
+  void* p = malloc(20480);
   base::debug::Alias(&p);
 }
 
diff --git a/base/security_unittest.cc b/base/security_unittest.cc
index f1ad48b..efb19fd 100644
--- a/base/security_unittest.cc
+++ b/base/security_unittest.cc
@@ -150,7 +150,7 @@
   // the sophisticated allocators.
   size_t kAllocSize = 1<<20;
   std::unique_ptr<char, base::FreeDeleter> ptr(
-      static_cast<char*>(SbMemoryAllocate(kAllocSize)));
+      static_cast<char*>(malloc(kAllocSize)));
   ASSERT_TRUE(ptr != nullptr);
   // If two pointers are separated by less than 512MB, they are considered
   // to be in the same area.
diff --git a/base/strings/string_util_starboard.h b/base/strings/string_util_starboard.h
index 9de5572..c162395 100644
--- a/base/strings/string_util_starboard.h
+++ b/base/strings/string_util_starboard.h
@@ -25,18 +25,6 @@
 
 namespace base {
 
-inline char* strdup(const char* str) {
-  return SbStringDuplicate(str);
-}
-
-inline int strcasecmp(const char* string1, const char* string2) {
-  return SbStringCompareNoCase(string1, string2);
-}
-
-inline int strncasecmp(const char* string1, const char* string2, size_t count) {
-  return SbStringCompareNoCaseN(string1, string2, count);
-}
-
 #if defined(vsnprintf)
 #undef vsnprintf
 #endif
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
index 276ba1e..ffdf84d 100644
--- a/base/sys_info_posix.cc
+++ b/base/sys_info_posix.cc
@@ -178,7 +178,7 @@
 }
 #endif
 
-#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !(OS_CHROMEOS)
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
 // static
 std::string SysInfo::OperatingSystemVersion() {
   struct utsname info;
diff --git a/base/syslog_logging.cc b/base/syslog_logging.cc
index 6fce9ca..568bf6a 100644
--- a/base/syslog_logging.cc
+++ b/base/syslog_logging.cc
@@ -43,6 +43,11 @@
   g_event_id = event_id;
 }
 
+void ResetEventSourceForTesting() {
+  delete g_event_source_name;
+  g_event_source_name = nullptr;
+}
+
 #endif  // defined(OS_WIN)
 
 EventLogMessage::EventLogMessage(const char* file,
diff --git a/base/syslog_logging.h b/base/syslog_logging.h
index 736a5b2..b67aeff 100644
--- a/base/syslog_logging.h
+++ b/base/syslog_logging.h
@@ -27,6 +27,10 @@
 void BASE_EXPORT SetEventSource(const std::string& name,
                                 uint16_t category,
                                 uint32_t event_id);
+
+// The event source may get set more than once in tests.  This function allows
+// a test to reset the source when needed.
+void BASE_EXPORT ResetEventSourceForTesting();
 #endif  // defined(OS_WIN)
 
 // Creates a formatted message on the system event log. That would be the
diff --git a/base/task/task_scheduler/scheduler_worker_stack_unittest.cc b/base/task/task_scheduler/scheduler_worker_stack_unittest.cc
index ab18123..1b4276c 100644
--- a/base/task/task_scheduler/scheduler_worker_stack_unittest.cc
+++ b/base/task/task_scheduler/scheduler_worker_stack_unittest.cc
@@ -5,7 +5,6 @@
 #include "base/task/task_scheduler/scheduler_worker_stack.h"
 
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/metrics/statistics_recorder.h"
 #include "base/task/task_scheduler/scheduler_worker.h"
@@ -49,15 +48,15 @@
   }
   void SetUp() override {
     worker_a_ = MakeRefCounted<SchedulerWorker>(
-        ThreadPriority::NORMAL, WrapUnique(new MockSchedulerWorkerDelegate),
+        ThreadPriority::NORMAL, std::make_unique<MockSchedulerWorkerDelegate>(),
         task_tracker_.GetTrackedRef());
     ASSERT_TRUE(worker_a_);
     worker_b_ = MakeRefCounted<SchedulerWorker>(
-        ThreadPriority::NORMAL, WrapUnique(new MockSchedulerWorkerDelegate),
+        ThreadPriority::NORMAL, std::make_unique<MockSchedulerWorkerDelegate>(),
         task_tracker_.GetTrackedRef());
     ASSERT_TRUE(worker_b_);
     worker_c_ = MakeRefCounted<SchedulerWorker>(
-        ThreadPriority::NORMAL, WrapUnique(new MockSchedulerWorkerDelegate),
+        ThreadPriority::NORMAL, std::make_unique<MockSchedulerWorkerDelegate>(),
         task_tracker_.GetTrackedRef());
     ASSERT_TRUE(worker_c_);
   }
diff --git a/base/task/task_scheduler/task_scheduler_impl_unittest.cc b/base/task/task_scheduler/task_scheduler_impl_unittest.cc
index a516894..74434ae 100644
--- a/base/task/task_scheduler/task_scheduler_impl_unittest.cc
+++ b/base/task/task_scheduler/task_scheduler_impl_unittest.cc
@@ -14,7 +14,6 @@
 #include "base/cfi_buildflags.h"
 #include "base/debug/stack_trace.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial.h"
 #include "base/metrics/field_trial_params.h"
 #include "base/metrics/statistics_recorder.h"
@@ -465,9 +464,9 @@
   StartTaskScheduler();
   std::vector<std::unique_ptr<ThreadPostingTasks>> threads_posting_tasks;
   for (const auto& traits_execution_mode_pair : GetTraitsExecutionModePairs()) {
-    threads_posting_tasks.push_back(WrapUnique(
-        new ThreadPostingTasks(&scheduler_, traits_execution_mode_pair.traits,
-                               traits_execution_mode_pair.execution_mode)));
+    threads_posting_tasks.push_back(std::make_unique<ThreadPostingTasks>(
+        &scheduler_, traits_execution_mode_pair.traits,
+        traits_execution_mode_pair.execution_mode));
     threads_posting_tasks.back()->Start();
   }
 
diff --git a/base/test/malloc_wrapper.cc b/base/test/malloc_wrapper.cc
index 0880266..09ac637 100644
--- a/base/test/malloc_wrapper.cc
+++ b/base/test/malloc_wrapper.cc
@@ -10,5 +10,5 @@
 #include "starboard/types.h"
 
 void* MallocWrapper(size_t size) {
-  return SbMemoryAllocate(size);
+  return malloc(size);
 }
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc
index 43e758d..ac37e5e 100644
--- a/base/test/trace_event_analyzer_unittest.cc
+++ b/base/test/trace_event_analyzer_unittest.cc
@@ -5,7 +5,6 @@
 #include "base/test/trace_event_analyzer.h"
 
 #include "base/bind.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted_memory.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/platform_thread.h"
@@ -101,7 +100,7 @@
   event.arg_numbers["int"] = static_cast<double>(int_num);
   event.arg_numbers["double"] = double_num;
   event.arg_strings["string"] = str;
-  event.arg_values["dict"] = WrapUnique(new base::DictionaryValue());
+  event.arg_values["dict"] = std::make_unique<base::DictionaryValue>();
 
   ASSERT_TRUE(event.HasNumberArg("false"));
   ASSERT_TRUE(event.HasNumberArg("true"));
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
index a32694d..c5aedfd 100644
--- a/base/third_party/dmg_fp/dtoa.cc
+++ b/base/third_party/dmg_fp/dtoa.cc
@@ -111,7 +111,7 @@
  *	if memory is available and otherwise does something you deem
  *	appropriate.  If MALLOC is undefined, malloc will be invoked
  *	directly -- and assumed always to succeed.  Similarly, if you
- *	want something other than the system's SbMemoryDeallocate() to be called to
+ *	want something other than the system's free() to be called to
  *	recycle memory acquired from MALLOC, #define FREE to be the
  *	name of the alternate routine.  (FREE or free is only called in
  *	pathological cases, e.g., in a dtoa call after a dtoa return in
@@ -230,7 +230,7 @@
 #endif
 #else
 #ifdef STARBOARD
-#define MALLOC SbMemoryAllocate
+#define MALLOC malloc
 #else
 #define MALLOC malloc
 #endif  // STARBOARD
@@ -610,7 +610,7 @@
 #ifdef FREE
 			FREE((void*)v);
 #else
-                  SbMemoryDeallocate((void*)v);
+                  free((void*)v);
 #endif
 		else {
 			ACQUIRE_DTOA_LOCK(0);
diff --git a/base/third_party/libevent/evrpc.h b/base/third_party/libevent/evrpc.h
index 64e6d35..583d616 100644
--- a/base/third_party/libevent/evrpc.h
+++ b/base/third_party/libevent/evrpc.h
@@ -186,7 +186,7 @@
       void* cbarg) {                                                          \
     struct evrpc_status status;                                               \
     struct evrpc_request_wrapper* ctx;                                        \
-    ctx = (struct evrpc_request_wrapper*)SbMemoryAllocate(                    \
+    ctx = (struct evrpc_request_wrapper*)malloc(                              \
         sizeof(struct evrpc_request_wrapper));                                \
     if (ctx == NULL)                                                          \
       goto error;                                                             \
@@ -194,7 +194,7 @@
     ctx->evcon = NULL;                                                        \
     ctx->name = strdup(#rpcname);                                             \
     if (ctx->name == NULL) {                                                  \
-      SbMemoryDeallocate(ctx);                                                      \
+      free(ctx);                                                              \
       goto error;                                                             \
     }                                                                         \
     ctx->cb = (void (*)(struct evrpc_status*, void*, void*, void*))cb;        \
diff --git a/base/third_party/libevent/min_heap.h b/base/third_party/libevent/min_heap.h
index 79fbc70..61e265c 100644
--- a/base/third_party/libevent/min_heap.h
+++ b/base/third_party/libevent/min_heap.h
@@ -59,7 +59,7 @@
 void min_heap_ctor(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
 void min_heap_dtor(min_heap_t* s) {
   if (s->p)
-    SbMemoryDeallocate(s->p);
+    free(s->p);
 }
 void min_heap_elem_init(struct event* e) { e->min_heap_idx = -1; }
 int min_heap_empty(min_heap_t* s) { return 0u == s->n; }
@@ -115,7 +115,7 @@
         unsigned a = s->a ? s->a * 2 : 8;
         if(a < n)
             a = n;
-        if (!(p = (struct event**)SbMemoryReallocate(s->p, a * sizeof *p)))
+        if (!(p = (struct event**)realloc(s->p, a * sizeof *p)))
           return -1;
         s->p = p;
         s->a = a;
diff --git a/base/third_party/valgrind/valgrind.h b/base/third_party/valgrind/valgrind.h
index 3f2c7fa..1b24528 100644
--- a/base/third_party/valgrind/valgrind.h
+++ b/base/third_party/valgrind/valgrind.h
@@ -4296,7 +4296,7 @@
   VG_USERREQ__COUNT_ERRORS = 0x1201,
 
   /* These are useful and can be interpreted by any tool that
-     tracks SbMemoryAllocate() et al, by using vg_replace_SbMemoryAllocate.c. */
+     tracks malloc() et al, by using vg_replace_malloc.c. */
   VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
   VG_USERREQ__FREELIKE_BLOCK = 0x1302,
   /* Memory pool support. */
@@ -4570,8 +4570,8 @@
 /* Several Valgrind tools (Memcheck, Massif, Helgrind, DRD) rely on knowing
    when heap blocks are allocated in order to give accurate results.  This
    happens automatically for the standard allocator functions such as
-   SbMemoryAllocate(), calloc(), SbMemoryReallocate(), memalign(), new, new[],
-   SbMemoryDeallocate(), delete, delete[], etc.
+   malloc(), calloc(), realloc(), memalign(), new, new[],
+   free(), delete, delete[], etc.
 
    But if your program uses a custom allocator, this doesn't automatically
    happen, and Valgrind will not do as well.  For example, if you allocate
@@ -4586,7 +4586,7 @@
    that it can be handled accurately by Valgrind.
 
    VALGRIND_MALLOCLIKE_BLOCK marks a region of memory as having been allocated
-   by a SbMemoryAllocate()-like function.  For Memcheck (an illustrative case),
+   by a malloc()-like function.  For Memcheck (an illustrative case),
    this does two things:
 
    - It records that the block has been allocated.  This means any addresses
diff --git a/base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc b/base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc
index 598659c..9eb8a66 100644
--- a/base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc
+++ b/base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc
@@ -47,7 +47,7 @@
  * type the value returned is @fallback.
  *
  * The return value is newly allocated and must be freed with
- * SbMemoryDeallocate(). The return value is never NULL if @fallback != NULL, unless
+ * free(). The return value is never NULL if @fallback != NULL, unless
  * out of memory.
  **/
 static char *
@@ -190,7 +190,7 @@
  * to ~/Desktop.
  *
  * The return value is newly allocated and must be freed with
- * SbMemoryDeallocate().
+ * free().
  **/
 char *
 xdg_user_dir_lookup (const char *type)
diff --git a/base/time/time_exploded_posix.cc b/base/time/time_exploded_posix.cc
index eecdf8d..ad7ab41 100644
--- a/base/time/time_exploded_posix.cc
+++ b/base/time/time_exploded_posix.cc
@@ -76,7 +76,7 @@
   ret = mktime(tm);
   if (tz) {
     setenv("TZ", tz, 1);
-    SbMemoryDeallocate(tz);
+    free(tz);
   } else {
     unsetenv("TZ");
   }
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc
index 467e443..9834d0d 100644
--- a/base/tools_sanity_unittest.cc
+++ b/base/tools_sanity_unittest.cc
@@ -140,9 +140,9 @@
 }
 
 TEST(ToolsSanityTest, MAYBE_AccessesToMallocMemory) {
-  char* foo = reinterpret_cast<char*>(SbMemoryAllocate(10));
+  char* foo = reinterpret_cast<char*>(malloc(10));
   MakeSomeErrors(foo, 10);
-  SbMemoryDeallocate(foo);
+  free(foo);
   // Use after free.
   HARMFUL_ACCESS(foo[5] = 0, "heap-use-after-free");
 }
diff --git a/base/trace_event/category_registry.cc b/base/trace_event/category_registry.cc
index 6b5abd9..230aa75 100644
--- a/base/trace_event/category_registry.cc
+++ b/base/trace_event/category_registry.cc
@@ -116,7 +116,7 @@
   // TODO(primiano): this strdup should be removed. The only documented reason
   // for it was TraceWatchEvent, which is gone. However, something might have
   // ended up relying on this. Needs some auditing before removal.
-  const char* category_name_copy = SbStringDuplicate(category_name);
+  const char* category_name_copy = strdup(category_name);
   ANNOTATE_LEAKING_OBJECT_PTR(category_name_copy);
 
   *category = &g_categories[category_index];
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.cc b/base/trace_event/heap_profiler_allocation_context_tracker.cc
index 45ee149..a2725dc 100644
--- a/base/trace_event/heap_profiler_allocation_context_tracker.cc
+++ b/base/trace_event/heap_profiler_allocation_context_tracker.cc
@@ -73,7 +73,7 @@
   // Use tid if we don't have a thread name.
   SbStringFormatF(name, sizeof(name), "%lu",
                   static_cast<unsigned long>(PlatformThread::CurrentId()));
-  return SbStringDuplicate(name);
+  return strdup(name);
 }
 
 }  // namespace
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index be9d3fe..63b658b 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -14,7 +14,6 @@
 #include "base/command_line.h"
 #include "base/debug/thread_heap_usage_tracker.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "base/synchronization/waitable_event.h"
@@ -424,11 +423,11 @@
   // we will pop out one thread/MemoryDumpProvider, each MDP is supposed to be
   // invoked a number of times equal to its index.
   for (uint32_t i = kNumInitialThreads; i > 0; --i) {
-    threads.push_back(WrapUnique(new Thread("test thread")));
+    threads.push_back(std::make_unique<Thread>("test thread"));
     auto* thread = threads.back().get();
     thread->Start();
     scoped_refptr<SingleThreadTaskRunner> task_runner = thread->task_runner();
-    mdps.push_back(WrapUnique(new MockMemoryDumpProvider()));
+    mdps.push_back(std::make_unique<MockMemoryDumpProvider>());
     auto* mdp = mdps.back().get();
     RegisterDumpProvider(mdp, task_runner, kDefaultOptions);
     EXPECT_CALL(*mdp, OnMemoryDump(_, _))
@@ -601,9 +600,8 @@
   std::vector<std::unique_ptr<MockMemoryDumpProvider>> mdps;
 
   for (int i = 0; i < 2; i++) {
-    threads.push_back(
-        WrapUnique(new TestIOThread(TestIOThread::kAutoStart)));
-    mdps.push_back(WrapUnique(new MockMemoryDumpProvider()));
+    threads.push_back(std::make_unique<TestIOThread>(TestIOThread::kAutoStart));
+    mdps.push_back(std::make_unique<MockMemoryDumpProvider>());
     RegisterDumpProvider(mdps.back().get(), threads.back()->task_runner(),
                          kDefaultOptions);
   }
@@ -650,9 +648,8 @@
   std::vector<std::unique_ptr<MockMemoryDumpProvider>> mdps;
 
   for (int i = 0; i < 2; i++) {
-    threads.push_back(
-        WrapUnique(new TestIOThread(TestIOThread::kAutoStart)));
-    mdps.push_back(WrapUnique(new MockMemoryDumpProvider()));
+    threads.push_back(std::make_unique<TestIOThread>(TestIOThread::kAutoStart));
+    mdps.push_back(std::make_unique<MockMemoryDumpProvider>());
     RegisterDumpProvider(mdps.back().get(), threads.back()->task_runner(),
                          kDefaultOptions);
   }
diff --git a/base/trace_event/trace_event_argument_unittest.cc b/base/trace_event/trace_event_argument_unittest.cc
index e08f782..a658503 100644
--- a/base/trace_event/trace_event_argument_unittest.cc
+++ b/base/trace_event/trace_event_argument_unittest.cc
@@ -6,7 +6,6 @@
 
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/values.h"
 #include "starboard/types.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -100,14 +99,14 @@
   Value bool_value(true);
   Value double_value(42.0f);
 
-  auto dict_value = WrapUnique(new DictionaryValue);
+  auto dict_value = std::make_unique<DictionaryValue>();
   dict_value->SetBoolean("bool", true);
   dict_value->SetInteger("int", 42);
   dict_value->SetDouble("double", 42.0f);
   dict_value->SetString("string", std::string("a") + "b");
   dict_value->SetString("string", std::string("a") + "b");
 
-  auto list_value = WrapUnique(new ListValue);
+  auto list_value = std::make_unique<ListValue>();
   list_value->AppendBoolean(false);
   list_value->AppendInteger(1);
   list_value->AppendString("in_list");
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc
index 67e8fb3..9c2d476 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -160,7 +160,7 @@
     if (TraceLog::GetInstance())
       EXPECT_FALSE(TraceLog::GetInstance()->IsEnabled());
     PlatformThread::SetName(old_thread_name_ ? old_thread_name_ : "");
-    SbMemoryDeallocate(old_thread_name_);
+    free(old_thread_name_);
     old_thread_name_ = nullptr;
     // We want our singleton torn down after each test.
     TraceLog::ResetForTesting();
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 784dd02..420dd37 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -13,7 +13,6 @@
 #include <vector>
 
 #include "base/containers/adapters.h"
-#include "base/memory/ptr_util.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_piece.h"
 #include "base/strings/utf_string_conversions.h"
@@ -1235,7 +1234,7 @@
 
   std::unique_ptr<ListValue> list(new ListValue);
   list->Append(std::make_unique<Value>());
-  list->Append(WrapUnique(new DictionaryValue));
+  list->Append(std::make_unique<DictionaryValue>());
   auto list_copy = std::make_unique<Value>(list->Clone());
 
   ListValue* list_weak = dv.SetList("f", std::move(list));
diff --git a/base/win/windows_types.h b/base/win/windows_types.h
index 9fb5e30..13067d5 100644
--- a/base/win/windows_types.h
+++ b/base/win/windows_types.h
@@ -74,16 +74,20 @@
 #define CHROME_DECLARE_HANDLE(name) \
   struct name##__;                  \
   typedef struct name##__* name
+CHROME_DECLARE_HANDLE(HDESK);
 CHROME_DECLARE_HANDLE(HGLRC);
 CHROME_DECLARE_HANDLE(HICON);
 CHROME_DECLARE_HANDLE(HINSTANCE);
 CHROME_DECLARE_HANDLE(HKEY);
 CHROME_DECLARE_HANDLE(HKL);
 CHROME_DECLARE_HANDLE(HMENU);
+CHROME_DECLARE_HANDLE(HWINSTA);
 CHROME_DECLARE_HANDLE(HWND);
-typedef HINSTANCE HMODULE;
 #undef CHROME_DECLARE_HANDLE
 
+typedef LPVOID HINTERNET;
+typedef HINSTANCE HMODULE;
+typedef PVOID LSA_HANDLE;
 
 // Forward declare some Windows struct/typedef sets.
 
@@ -105,6 +109,8 @@
 
 typedef struct tagNMHDR NMHDR;
 
+typedef PVOID PSID;
+
 // Declare Chrome versions of some Windows structures. These are needed for
 // when we need a concrete type but don't want to pull in Windows.h. We can't
 // declare the Windows types so we declare our types and cast to the Windows
diff --git a/base/win/windows_version.cc b/base/win/windows_version.cc
index 6fc3185..bb41a07 100644
--- a/base/win/windows_version.cc
+++ b/base/win/windows_version.cc
@@ -11,6 +11,7 @@
 #include "base/file_version_info_win.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
+#include "base/no_destructor.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/registry.h"
 
@@ -74,28 +75,6 @@
   return VERSION_PRE_XP;
 }
 
-// Retrieve a version from kernel32. This is useful because when running in
-// compatibility mode for a down-level version of the OS, the file version of
-// kernel32 will still be the "real" version.
-Version GetVersionFromKernel32() {
-  std::unique_ptr<FileVersionInfoWin> file_version_info(
-      static_cast<FileVersionInfoWin*>(
-          FileVersionInfoWin::CreateFileVersionInfo(
-              base::FilePath(FILE_PATH_LITERAL("kernel32.dll")))));
-  if (file_version_info) {
-    const int major =
-        HIWORD(file_version_info->fixed_file_info()->dwFileVersionMS);
-    const int minor =
-        LOWORD(file_version_info->fixed_file_info()->dwFileVersionMS);
-    const int build =
-        HIWORD(file_version_info->fixed_file_info()->dwFileVersionLS);
-    return MajorMinorBuildToVersion(major, minor, build);
-  }
-
-  NOTREACHED();
-  return VERSION_WIN_LAST;
-}
-
 // Returns the the "UBR" value from the registry. Introduced in Windows 10,
 // this undocumented value appears to be similar to a patch number.
 // Returns 0 if the value does not exist or it could not be read.
@@ -155,8 +134,6 @@
                const _SYSTEM_INFO& system_info,
                int os_type)
     : version_(VERSION_PRE_XP),
-      kernel32_version_(VERSION_PRE_XP),
-      got_kernel32_version_(false),
       architecture_(OTHER_ARCHITECTURE),
       wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) {
   version_number_.major = version_info.dwMajorVersion;
@@ -247,11 +224,34 @@
 }
 
 Version OSInfo::Kernel32Version() const {
-  if (!got_kernel32_version_) {
-    kernel32_version_ = GetVersionFromKernel32();
-    got_kernel32_version_ = true;
-  }
-  return kernel32_version_;
+  static const Version kernel32_version =
+      MajorMinorBuildToVersion(Kernel32BaseVersion().components()[0],
+                               Kernel32BaseVersion().components()[1],
+                               Kernel32BaseVersion().components()[2]);
+  return kernel32_version;
+}
+
+// Retrieve a version from kernel32. This is useful because when running in
+// compatibility mode for a down-level version of the OS, the file version of
+// kernel32 will still be the "real" version.
+base::Version OSInfo::Kernel32BaseVersion() const {
+  static const base::NoDestructor<base::Version> version([] {
+    std::unique_ptr<FileVersionInfoWin> file_version_info(
+        static_cast<FileVersionInfoWin*>(
+            FileVersionInfoWin::CreateFileVersionInfo(
+                base::FilePath(FILE_PATH_LITERAL("kernel32.dll")))));
+    DCHECK(file_version_info);
+    const int major =
+        HIWORD(file_version_info->fixed_file_info()->dwFileVersionMS);
+    const int minor =
+        LOWORD(file_version_info->fixed_file_info()->dwFileVersionMS);
+    const int build =
+        HIWORD(file_version_info->fixed_file_info()->dwFileVersionLS);
+    const int patch =
+        LOWORD(file_version_info->fixed_file_info()->dwFileVersionLS);
+    return base::Version(std::vector<uint32_t>{major, minor, build, patch});
+  }());
+  return *version;
 }
 
 std::string OSInfo::processor_model_name() {
diff --git a/base/win/windows_version.h b/base/win/windows_version.h
index 22b9d00..64f8041 100644
--- a/base/win/windows_version.h
+++ b/base/win/windows_version.h
@@ -11,6 +11,7 @@
 
 #include "base/base_export.h"
 #include "base/macros.h"
+#include "base/version.h"
 
 typedef void* HANDLE;
 struct _OSVERSIONINFOEXW;
@@ -108,6 +109,7 @@
 
   Version version() const { return version_; }
   Version Kernel32Version() const;
+  base::Version Kernel32BaseVersion() const;
   // The next two functions return arrays of values, [major, minor(, build)].
   VersionNumber version_number() const { return version_number_; }
   VersionType version_type() const { return version_type_; }
@@ -133,8 +135,6 @@
   ~OSInfo();
 
   Version version_;
-  mutable Version kernel32_version_;
-  mutable bool got_kernel32_version_;
   VersionNumber version_number_;
   VersionType version_type_;
   ServicePack service_pack_;