Re-order RetainPtr/UnownedPtr operator=() methods

Make closer to what the style guide suggests, and reduce the diffs
in the subsequent CL. Pure cut/paste, no functional changes.

Change-Id: I496acded78c7a5c2ef6d6070d575ebb6e9ecce1b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98450
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/retain_ptr.h b/core/fxcrt/retain_ptr.h
index fb1c95b..99d73fd 100644
--- a/core/fxcrt/retain_ptr.h
+++ b/core/fxcrt/retain_ptr.h
@@ -27,13 +27,17 @@
 template <class T>
 class RetainPtr {
  public:
+  RetainPtr() = default;
+
+  // Deliberately implicit to allow returning nullptrs.
+  // NOLINTNEXTLINE(runtime/explicit)
+  RetainPtr(std::nullptr_t ptr) {}
+
   explicit RetainPtr(T* pObj) : m_pObj(pObj) {
     if (m_pObj)
       m_pObj->Retain();
   }
 
-  RetainPtr() = default;
-
   // Copy-construct a RetainPtr.
   // Required in addition to copy conversion constructor below.
   RetainPtr(const RetainPtr& that) : RetainPtr(that.Get()) {}
@@ -42,10 +46,6 @@
   // Required in addition to move conversion constructor below.
   RetainPtr(RetainPtr&& that) noexcept { Unleak(that.Leak()); }
 
-  // Deliberately implicit to allow returning nullptrs.
-  // NOLINTNEXTLINE(runtime/explicit)
-  RetainPtr(std::nullptr_t ptr) {}
-
   // Copy conversion constructor.
   template <class U,
             typename = typename std::enable_if<
@@ -60,6 +60,18 @@
     Unleak(that.Leak());
   }
 
+  RetainPtr& operator=(const RetainPtr& that) {
+    if (*this != that)
+      Reset(that.Get());
+    return *this;
+  }
+
+  // Move-assign a RetainPtr. After assignment, |that| will be NULL.
+  RetainPtr& operator=(RetainPtr&& that) noexcept {
+    Unleak(that.Leak());
+    return *this;
+  }
+
   template <class U>
   RetainPtr<U> As() const {
     return RetainPtr<U>(static_cast<U*>(Get()));
@@ -81,18 +93,6 @@
   T* Leak() { return m_pObj.release(); }
   void Unleak(T* ptr) { m_pObj.reset(ptr); }
 
-  RetainPtr& operator=(const RetainPtr& that) {
-    if (*this != that)
-      Reset(that.Get());
-    return *this;
-  }
-
-  // Move-assign a RetainPtr. After assignment, |that| will be NULL.
-  RetainPtr& operator=(RetainPtr&& that) noexcept {
-    Unleak(that.Leak());
-    return *this;
-  }
-
   bool operator==(const RetainPtr& that) const { return Get() == that.Get(); }
   bool operator!=(const RetainPtr& that) const { return !(*this == that); }
 
diff --git a/core/fxcrt/unowned_ptr.h b/core/fxcrt/unowned_ptr.h
index 76ebac1..6eca3c8 100644
--- a/core/fxcrt/unowned_ptr.h
+++ b/core/fxcrt/unowned_ptr.h
@@ -48,27 +48,18 @@
 class UnownedPtr {
  public:
   constexpr UnownedPtr() noexcept = default;
-  constexpr UnownedPtr(const UnownedPtr& that) noexcept = default;
-
-  // Move-construct an UnownedPtr. After construction, |that| will be NULL.
-  constexpr UnownedPtr(UnownedPtr&& that) noexcept : m_pObj(that.Release()) {}
-
-  template <typename U>
-  explicit constexpr UnownedPtr(U* pObj) noexcept : m_pObj(pObj) {}
 
   // Deliberately implicit to allow returning nullptrs.
   // NOLINTNEXTLINE(runtime/explicit)
   constexpr UnownedPtr(std::nullptr_t ptr) noexcept {}
 
-  ~UnownedPtr() {
-    ProbeForLowSeverityLifetimeIssue();
-    m_pObj = nullptr;
-  }
+  template <typename U>
+  explicit constexpr UnownedPtr(U* pObj) noexcept : m_pObj(pObj) {}
 
-  void Reset(T* obj = nullptr) {
-    ProbeForLowSeverityLifetimeIssue();
-    m_pObj = obj;
-  }
+  constexpr UnownedPtr(const UnownedPtr& that) noexcept = default;
+
+  // Move-construct an UnownedPtr. After construction, |that| will be NULL.
+  constexpr UnownedPtr(UnownedPtr&& that) noexcept : m_pObj(that.Release()) {}
 
   UnownedPtr& operator=(T* that) noexcept {
     Reset(that);
@@ -88,6 +79,16 @@
     return *this;
   }
 
+  ~UnownedPtr() {
+    ProbeForLowSeverityLifetimeIssue();
+    m_pObj = nullptr;
+  }
+
+  void Reset(T* obj = nullptr) {
+    ProbeForLowSeverityLifetimeIssue();
+    m_pObj = obj;
+  }
+
   bool operator==(std::nullptr_t ptr) const { return Get() == nullptr; }
   bool operator==(const UnownedPtr& that) const { return Get() == that.Get(); }
   bool operator<(const UnownedPtr& that) const {