Adds WebRTC.DesktopCapture.Win.DirectXCapturerResult UMA

This records high level errors, or success, encountered across the entire capture flow in the DXGI based capturer.

Using the same style as for WebRTC.DesktopCapture.Win.WgcCapturerResult

Bug: chromium:1400204
Change-Id: I7096d1790d7c2a23bbe29761b7dbf40426ce1e6a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291707
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39259}
diff --git a/modules/desktop_capture/win/dxgi_duplicator_controller.h b/modules/desktop_capture/win/dxgi_duplicator_controller.h
index 88c2939..97ed2d8 100644
--- a/modules/desktop_capture/win/dxgi_duplicator_controller.h
+++ b/modules/desktop_capture/win/dxgi_duplicator_controller.h
@@ -64,13 +64,17 @@
     // version.
   };
 
+  // These values are persisted to logs. Entries should not be renumbered or
+  // reordered and numeric values should never be reused. This enum corresponds
+  // to WebRtcDirectXCapturerResult in tools/metrics/histograms/enums.xml.
   enum class Result {
-    SUCCEEDED,
-    UNSUPPORTED_SESSION,
-    FRAME_PREPARE_FAILED,
-    INITIALIZATION_FAILED,
-    DUPLICATION_FAILED,
-    INVALID_MONITOR_ID,
+    SUCCEEDED = 0,
+    UNSUPPORTED_SESSION = 1,
+    FRAME_PREPARE_FAILED = 2,
+    INITIALIZATION_FAILED = 3,
+    DUPLICATION_FAILED = 4,
+    INVALID_MONITOR_ID = 5,
+    MAX_VALUE = INVALID_MONITOR_ID
   };
 
   // Converts `result` into user-friendly string representation. The return
diff --git a/modules/desktop_capture/win/screen_capturer_win_directx.cc b/modules/desktop_capture/win/screen_capturer_win_directx.cc
index efa7639..3aaac03 100644
--- a/modules/desktop_capture/win/screen_capturer_win_directx.cc
+++ b/modules/desktop_capture/win/screen_capturer_win_directx.cc
@@ -151,6 +151,10 @@
                          "error code "
                       << DxgiDuplicatorController::ResultName(result);
   }
+  RTC_HISTOGRAM_ENUMERATION(
+      "WebRTC.DesktopCapture.Win.DirectXCapturerResult",
+      static_cast<int>(result),
+      static_cast<int>(DxgiDuplicatorController::Result::MAX_VALUE));
   switch (result) {
     case DuplicateResult::UNSUPPORTED_SESSION: {
       RTC_LOG(LS_ERROR)