Disentangle pdfium::span<> from unowned_ptr<>.

We need only have the raw_ptr<> or T* variations now that the code
has been consolidated against base::raw_ptr<>. Hence, UnownedPtr can
once again be part of fxcrt, rather than its own component. Then
remove UNOWNED_PTR_IS_BASE_RAW_PTR which is now the same as
PDF_USE_PARTITION_ALLOC.

-- remove pre-existing unused include_dirs while at it.
-- use inline initialization and `= default` while at it.

Change-Id: Ib852cca35cd6de9294efda1c1baaf16e89aa330e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112531
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 27a06b8..bf12e49 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -572,9 +572,12 @@
   ]
   public_deps = [
     ":pdfium_compiler_specific",
-    "../core/fxcrt:unowned_ptr",
     "//third_party/abseil-cpp:absl",
   ]
+  if (pdf_use_partition_alloc) {
+    public_deps +=
+        [ "//base/allocator/partition_allocator/src/partition_alloc:raw_ptr" ]
+  }
   if (is_win) {
     sources += [
       "base/win/scoped_select_object.h",
diff --git a/third_party/DEPS b/third_party/DEPS
index dfd263b..6ffb470 100644
--- a/third_party/DEPS
+++ b/third_party/DEPS
@@ -3,5 +3,5 @@
   '+core/fxcrt/fx_coordinates.h',
   '+core/fxcrt/fx_memory.h',
   '+core/fxcrt/fx_system.h',
-  '+core/fxcrt/unowned_ptr.h',
+  '+partition_alloc/pointers',
 ]
diff --git a/third_party/base/containers/span.h b/third_party/base/containers/span.h
index 435fafa..0d600c3 100644
--- a/third_party/base/containers/span.h
+++ b/third_party/base/containers/span.h
@@ -13,10 +13,13 @@
 #include <type_traits>
 #include <utility>
 
-#include "core/fxcrt/unowned_ptr.h"
 #include "third_party/base/check.h"
 #include "third_party/base/compiler_specific.h"
 
+#if defined(PDF_USE_PARTITION_ALLOC)
+#include "partition_alloc/pointers/raw_ptr.h"
+#endif
+
 namespace pdfium {
 
 constexpr size_t dynamic_extent = static_cast<size_t>(-1);
@@ -187,7 +190,7 @@
   using const_reverse_iterator = std::reverse_iterator<const_iterator>;
 
   // [span.cons], span constructors, copy, assignment, and destructor
-  constexpr span() noexcept : data_(nullptr), size_(0) {}
+  constexpr span() noexcept = default;
   constexpr span(T* data, size_t size) noexcept : data_(data), size_(size) {
     DCHECK(data_ || size_ == 0);
   }
@@ -202,8 +205,8 @@
   // Conversion from a container that provides |T* data()| and |integral_type
   // size()|. Note that |data()| may not return nullptr for some empty
   // containers, which can lead to container overflow errors when probing
-  // unowned ptrs.
-#if defined(ADDRESS_SANITIZER) && defined(UNOWNED_PTR_IS_BASE_RAW_PTR)
+  // raw ptrs.
+#if defined(ADDRESS_SANITIZER) && defined(PDF_USE_PARTITION_ALLOC)
   template <typename Container,
             typename = internal::EnableIfSpanCompatibleContainer<Container, T>>
   constexpr span(Container& container)
@@ -298,12 +301,12 @@
   }
 
  private:
-#if defined(UNOWNED_PTR_IS_BASE_RAW_PTR)
+#if defined(PDF_USE_PARTITION_ALLOC)
   raw_ptr<T, AllowPtrArithmetic> data_ = nullptr;
 #else
-  UnownedPtr<T> data_;
+  T* data_ = nullptr;
 #endif
-  size_t size_;
+  size_t size_ = 0;
 };
 
 // [span.comparison], span comparison operators