[go: nahoru, domu]

Downgrade NOTREACHEDs that still hit frequently

This turns topmost NOTREACHEDs, especially on ChromeOS, into
DUMP_WILL_BE_NOTREACHED_NORETURNs to exclude them from the
kNotReachedIsFatal experiment.

These were found by looking at the topmost crashes with [NOTREACHED] on
a ~2-week-old Dev release for all platforms.

Bug: 40580068
Change-Id: Id7a0db94226cfb91c8955bb45bca6a7d5ffc1502
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5289195
Owners-Override: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1259978}
diff --git a/ash/clipboard/clipboard_history_controller_impl.cc b/ash/clipboard/clipboard_history_controller_impl.cc
index f86eef4..f103ba59 100644
--- a/ash/clipboard/clipboard_history_controller_impl.cc
+++ b/ash/clipboard/clipboard_history_controller_impl.cc
@@ -919,7 +919,7 @@
       context_menu_->SelectMenuItemHoveredByMouse();
       return;
     case Action::kEmpty:
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
       return;
   }
 }
diff --git a/ash/clipboard/views/clipboard_history_item_view.cc b/ash/clipboard/views/clipboard_history_item_view.cc
index 3d3b9da..23f9aa4e 100644
--- a/ash/clipboard/views/clipboard_history_item_view.cc
+++ b/ash/clipboard/views/clipboard_history_item_view.cc
@@ -463,7 +463,7 @@
       return Action::kDelete;
     case PseudoFocus::kEmpty:
     case PseudoFocus::kMaxValue:
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
       return Action::kEmpty;
   }
 }
diff --git a/ash/components/arc/metrics/arc_metrics_service.cc b/ash/components/arc/metrics/arc_metrics_service.cc
index 500d181..9e9994a 100644
--- a/ash/components/arc/metrics/arc_metrics_service.cc
+++ b/ash/components/arc/metrics/arc_metrics_service.cc
@@ -87,7 +87,7 @@
     case mojom::BootType::REGULAR_BOOT:
       return ".RegularBoot";
   }
-  NOTREACHED();
+  DUMP_WILL_BE_NOTREACHED_NORETURN();
   return "";
 }
 
diff --git a/ash/public/cpp/app_list/app_list_metrics.cc b/ash/public/cpp/app_list/app_list_metrics.cc
index db48213..64c5859a5 100644
--- a/ash/public/cpp/app_list/app_list_metrics.cc
+++ b/ash/public/cpp/app_list/app_list_metrics.cc
@@ -106,7 +106,7 @@
                                          SearchResultType type,
                                          bool is_tablet_mode) {
   if (type == SEARCH_RESULT_TYPE_BOUNDARY) {
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return;
   }
 
@@ -146,7 +146,7 @@
 
 void RecordDefaultSearchResultOpenTypeHistogram(SearchResultType type) {
   if (type == SEARCH_RESULT_TYPE_BOUNDARY) {
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return;
   }
   UMA_HISTOGRAM_ENUMERATION(kAppListDefaultSearchResultOpenTypeHistogram, type,
diff --git a/ash/system/time/calendar_month_view.cc b/ash/system/time/calendar_month_view.cc
index c2b353b1..d6e9a14 100644
--- a/ash/system/time/calendar_month_view.cc
+++ b/ash/system/time/calendar_month_view.cc
@@ -449,7 +449,7 @@
                   current_date_exploded);
     ++safe_index;
     if (safe_index == calendar_utils::kDateInOneWeek) {
-      NOTREACHED()
+      DUMP_WILL_BE_NOTREACHED_NORETURN()
           << "Should not render more than 7 days as the grayed out cells.";
       break;
     }
diff --git a/base/observer_list.h b/base/observer_list.h
index f4aad8c..b775118 100644
--- a/base/observer_list.h
+++ b/base/observer_list.h
@@ -283,7 +283,7 @@
     // TODO(crbug.com/1423093): Turn this into a CHECK once very prevalent
     // failures are weeded out.
     if (HasObserver(obs)) {
-      NOTREACHED() << "Observers can only be added once!";
+      DUMP_WILL_BE_NOTREACHED_NORETURN() << "Observers can only be added once!";
       return;
     }
     observers_count_++;
diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc
index 35fe6f67..ff22d52 100644
--- a/base/process/process_metrics_win.cc
+++ b/base/process/process_metrics_win.cc
@@ -180,7 +180,7 @@
 
   ULONG64 process_cycle_time = 0;
   if (!QueryProcessCycleTime(process_.get(), &process_cycle_time)) {
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return TimeDelta();
   }
 
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 9f4a671..6a87889 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -1017,8 +1017,9 @@
       if (consecutive_cant_draw_count_++ < 3u) {
         needs_redraw_ = true;
       } else {
-        NOTREACHED() << consecutive_cant_draw_count_ << " consecutve draws"
-                     << " with DrawResult::kAbortedCantDraw result";
+        DUMP_WILL_BE_NOTREACHED_NORETURN()
+            << consecutive_cant_draw_count_ << " consecutve draws"
+            << " with DrawResult::kAbortedCantDraw result";
       }
       break;
     case DrawResult::kAbortedDrainingPipeline:
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc
index 111296b..00f216cc 100644
--- a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc
+++ b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc
@@ -416,7 +416,7 @@
 
   if (!is_valid) {
     LOG(ERROR) << "`OnMediaStoreUriAdded()` called with invalid payload.";
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return;
   }
 
diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc
index a6991c23..2d3eaaca 100644
--- a/chrome/browser/ash/crostini/crostini_manager.cc
+++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -474,7 +474,7 @@
       result = CrostiniResult::CONFIGURE_CONTAINER_TIMED_OUT;
       break;
     case mojom::InstallerState::kStart:
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
   }
   // Note: FinishRestart deletes |this|.
   FinishRestart(result);
diff --git a/chrome/browser/ash/login/ui/login_display_host_webui.cc b/chrome/browser/ash/login/ui/login_display_host_webui.cc
index 33b1473..d0493bc1 100644
--- a/chrome/browser/ash/login/ui/login_display_host_webui.cc
+++ b/chrome/browser/ash/login/ui/login_display_host_webui.cc
@@ -1051,7 +1051,7 @@
 }
 
 void LoginDisplayHostWebUI::HideOobeDialog(bool saml_page_closed) {
-  NOTREACHED();
+  DUMP_WILL_BE_NOTREACHED_NORETURN();
 }
 
 void LoginDisplayHostWebUI::SetShelfButtonsEnabled(bool enabled) {
diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browser/bookmarks/android/bookmark_bridge.cc
index 1725bef..20170cf 100644
--- a/chrome/browser/bookmarks/android/bookmark_bridge.cc
+++ b/chrome/browser/bookmarks/android/bookmark_bridge.cc
@@ -927,7 +927,7 @@
   // this is called with a nullptr.
   if (!node) {
     LOG(ERROR) << "Deleting null bookmark, type:" << type;
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return;
   }
 
diff --git a/chrome/browser/download/offline_item_utils.cc b/chrome/browser/download/offline_item_utils.cc
index 2f084d04..4d5c01b9 100644
--- a/chrome/browser/download/offline_item_utils.cc
+++ b/chrome/browser/download/offline_item_utils.cc
@@ -317,7 +317,7 @@
       break;
 
     case FailState::NO_FAILURE:
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
       [[fallthrough]];
     case FailState::CANNOT_DOWNLOAD:
       [[fallthrough]];
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 838241f..3e5136b 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -3463,7 +3463,7 @@
       break;
 
     default:
-      NOTREACHED() << "Unhandled id: " << id;
+      DUMP_WILL_BE_NOTREACHED_NORETURN() << "Unhandled id: " << id;
       break;
   }
 }
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc
index 435851d..ca46291 100644
--- a/chrome/browser/ui/browser_tabstrip.cc
+++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -102,7 +102,8 @@
                       bool add_to_history) {
   int index = browser->tab_strip_model()->GetIndexOfWebContents(contents);
   if (index == TabStripModel::kNoTab) {
-    NOTREACHED() << "CloseWebContents called for tab not in our strip";
+    DUMP_WILL_BE_NOTREACHED_NORETURN()
+        << "CloseWebContents called for tab not in our strip";
     return;
   }
 
diff --git a/chromeos/ash/components/network/network_connect.cc b/chromeos/ash/components/network/network_connect.cc
index c5cc829..564dd3b 100644
--- a/chromeos/ash/components/network/network_connect.cc
+++ b/chromeos/ash/components/network/network_connect.cc
@@ -182,7 +182,7 @@
     return;
   }
 
-  NOTREACHED();
+  DUMP_WILL_BE_NOTREACHED_NORETURN();
 }
 
 // If |shared| is true, sets |profile_path| to the shared profile path.
diff --git a/chromeos/ash/components/phonehub/multidevice_feature_access_manager_impl.cc b/chromeos/ash/components/phonehub/multidevice_feature_access_manager_impl.cc
index 16ad5c50..888e619 100644
--- a/chromeos/ash/components/phonehub/multidevice_feature_access_manager_impl.cc
+++ b/chromeos/ash/components/phonehub/multidevice_feature_access_manager_impl.cc
@@ -320,7 +320,7 @@
           DiscoveryEntryPoint::kMultiDeviceFeatureSetup);
       break;
     default:
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
       break;
   }
 }
diff --git a/chromeos/ash/components/phonehub/phone_hub_ui_readiness_recorder.cc b/chromeos/ash/components/phonehub/phone_hub_ui_readiness_recorder.cc
index eb642b5..774d0ba 100644
--- a/chromeos/ash/components/phonehub/phone_hub_ui_readiness_recorder.cc
+++ b/chromeos/ash/components/phonehub/phone_hub_ui_readiness_recorder.cc
@@ -119,7 +119,7 @@
       ConnectionFlowState::kPhoneSnapShotReceivedButNoPhoneModelSet) {
     // The method should not be invoked when connection_flow_state_ is neither
     // kPhoneSnapShotReceivedButNoPhoneModelSet nor kUiConnected.
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return;
   }
 
diff --git a/chromeos/ash/components/proximity_auth/messenger_impl.cc b/chromeos/ash/components/proximity_auth/messenger_impl.cc
index 9a60440..a126d91 100644
--- a/chromeos/ash/components/proximity_auth/messenger_impl.cc
+++ b/chromeos/ash/components/proximity_auth/messenger_impl.cc
@@ -178,7 +178,8 @@
   if (pending_message_->type == kMessageTypeUnlockRequest) {
     expected_type = kMessageTypeUnlockResponse;
   } else {
-    NOTREACHED();  // There are no other message types that expect a response.
+    DUMP_WILL_BE_NOTREACHED_NORETURN();  // There are no other message types
+                                         // that expect a response.
   }
 
   if (*type != expected_type) {
diff --git a/components/browsing_data/core/counters/browsing_data_counter.cc b/components/browsing_data/core/counters/browsing_data_counter.cc
index d4dd971..379109e 100644
--- a/components/browsing_data/core/counters/browsing_data_counter.cc
+++ b/components/browsing_data/core/counters/browsing_data_counter.cc
@@ -114,7 +114,7 @@
       staged_result_ = std::move(result);
       return;
     case State::IDLE:
-      NOTREACHED() << "State::IDLE";
+      DUMP_WILL_BE_NOTREACHED_NORETURN() << "State::IDLE";
       return;
     case State::REPORT_STAGED_RESULT:
       NOTREACHED() << "State::REPORT_STAGED_RESULT";
diff --git a/content/browser/browser_context_impl.cc b/content/browser/browser_context_impl.cc
index 9141246..da337368 100644
--- a/content/browser/browser_context_impl.cc
+++ b/content/browser/browser_context_impl.cc
@@ -93,7 +93,8 @@
   if (!rph_crash_key_value.empty()) {
     SCOPED_CRASH_KEY_STRING256("BrowserContext", "dangling_rph",
                                rph_crash_key_value);
-    NOTREACHED() << "rph_with_bc_reference : " << rph_crash_key_value;
+    DUMP_WILL_BE_NOTREACHED_NORETURN()
+        << "rph_with_bc_reference : " << rph_crash_key_value;
   }
 
   // Clean up any isolated origins and other security state associated with this
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc
index 298580e9..4e5c5708 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.cc
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -263,7 +263,7 @@
     case PinchState::EXISTING_BUBBLING_TO_ROOT:
     case PinchState::PINCH_WITH_ROOT_GESTURE_TARGET:
     case PinchState::PINCH_WHILE_BUBBLING_TO_ROOT:
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
   }
 }
 
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 1231e60..74d28b69 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -624,7 +624,7 @@
     // created).
     // https://crbug.com/1260773.
     if (!result->IsFunction()) {
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
       return;
     }
     main_function = result.As<v8::Function>();
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
index e3404eb..dfdc4c3 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -530,7 +530,7 @@
       "extensions::%s", *v8::String::Utf8Value(isolate(), name));
 
   if (internal_name.size() >= v8::String::kMaxLength) {
-    NOTREACHED() << "internal_name is too long.";
+    DUMP_WILL_BE_NOTREACHED_NORETURN() << "internal_name is too long.";
     return v8::Undefined(isolate());
   }
 
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 9866f21c..87ffdf6 100644
--- a/printing/printing_context.cc
+++ b/printing/printing_context.cc
@@ -159,7 +159,7 @@
     std::unique_ptr<PrintSettings> settings =
         PrintSettingsFromJobSettings(job_settings);
     if (!settings) {
-      NOTREACHED();
+      DUMP_WILL_BE_NOTREACHED_NORETURN();
       return OnError();
     }
     settings_ = std::move(settings);
diff --git a/services/device/media_transfer_protocol/mtp_device_manager.cc b/services/device/media_transfer_protocol/mtp_device_manager.cc
index cf641785..df6820a 100644
--- a/services/device/media_transfer_protocol/mtp_device_manager.cc
+++ b/services/device/media_transfer_protocol/mtp_device_manager.cc
@@ -319,7 +319,7 @@
     // attachments, which should not be in |storage_info_map_|, or for
     // storage detachments, which do not add to |storage_info_map_|.
     // Return to avoid giving client phantom detach events.
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return;
   }
 
diff --git a/services/network/public/cpp/not_implemented_url_loader_factory.cc b/services/network/public/cpp/not_implemented_url_loader_factory.cc
index fcc27bf..38afe540 100644
--- a/services/network/public/cpp/not_implemented_url_loader_factory.cc
+++ b/services/network/public/cpp/not_implemented_url_loader_factory.cc
@@ -23,7 +23,7 @@
     const network::ResourceRequest& url_request,
     mojo::PendingRemote<network::mojom::URLLoaderClient> client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
-  NOTREACHED();
+  DUMP_WILL_BE_NOTREACHED_NORETURN();
   network::URLLoaderCompletionStatus status;
   status.error_code = net::ERR_NOT_IMPLEMENTED;
   mojo::Remote<network::mojom::URLLoaderClient>(std::move(client))
diff --git a/third_party/blink/renderer/core/dom/shadow_root.h b/third_party/blink/renderer/core/dom/shadow_root.h
index 0ec804e6..c2c3b68 100644
--- a/third_party/blink/renderer/core/dom/shadow_root.h
+++ b/third_party/blink/renderer/core/dom/shadow_root.h
@@ -80,7 +80,7 @@
     switch (GetType()) {
       case ShadowRootType::kUserAgent:
         // UA ShadowRoot should not be exposed to the Web.
-        NOTREACHED();
+        DUMP_WILL_BE_NOTREACHED_NORETURN();
         return "";
       case ShadowRootType::kOpen:
         return "open";
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc
index 9a1c2ef..145f0e13 100644
--- a/third_party/blink/renderer/core/layout/layout_object.cc
+++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -1170,7 +1170,7 @@
     curr = curr->Parent();
   }
 
-  NOTREACHED();
+  DUMP_WILL_BE_NOTREACHED_NORETURN();
   return nullptr;
 }
 
diff --git a/third_party/blink/renderer/modules/accessibility/ax_position.cc b/third_party/blink/renderer/modules/accessibility/ax_position.cc
index ac61f0d..91a06f4 100644
--- a/third_party/blink/renderer/modules/accessibility/ax_position.cc
+++ b/third_party/blink/renderer/modules/accessibility/ax_position.cc
@@ -410,7 +410,7 @@
 int AXPosition::ChildIndex() const {
   if (!IsTextPosition())
     return text_offset_or_child_index_;
-  NOTREACHED() << *this << " should be a tree position.";
+  DUMP_WILL_BE_NOTREACHED_NORETURN() << *this << " should be a tree position.";
   return 0;
 }
 
diff --git a/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc b/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc
index 9b8fd8a..692c179 100644
--- a/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc
+++ b/third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc
@@ -183,7 +183,8 @@
       break;
     default:
       invalid_data_pipe_read_result_ = result;
-      NOTREACHED() << "Invalid data pipe read result: " << result;
+      DUMP_WILL_BE_NOTREACHED_NORETURN()
+          << "Invalid data pipe read result: " << result;
       break;
   }
 }
diff --git a/third_party/blink/renderer/platform/audio/reverb.cc b/third_party/blink/renderer/platform/audio/reverb.cc
index d8ae4e9..a134304 100644
--- a/third_party/blink/renderer/platform/audio/reverb.cc
+++ b/third_party/blink/renderer/platform/audio/reverb.cc
@@ -267,7 +267,7 @@
 
     destination_bus->SumFrom(*temp_buffer_);
   } else {
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     destination_bus->Zero();
   }
 }
diff --git a/ui/events/blink/blink_event_util.cc b/ui/events/blink/blink_event_util.cc
index d873aaa..1f11201 100644
--- a/ui/events/blink/blink_event_util.cc
+++ b/ui/events/blink/blink_event_util.cc
@@ -655,7 +655,8 @@
     case MotionEvent::Action::POINTER_UP:
       break;
   }
-  NOTREACHED() << "Invalid MotionEvent::Action = " << action;
+  DUMP_WILL_BE_NOTREACHED_NORETURN()
+      << "Invalid MotionEvent::Action = " << action;
   return WebInputEvent::Type::kUndefined;
 }
 
diff --git a/ui/ozone/platform/wayland/host/wayland_screen.cc b/ui/ozone/platform/wayland/host/wayland_screen.cc
index 7fad33c..1ecb95d 100644
--- a/ui/ozone/platform/wayland/host/wayland_screen.cc
+++ b/ui/ozone/platform/wayland/host/wayland_screen.cc
@@ -361,7 +361,7 @@
 
   if (display_id_map_.find(entered_output_id.value()) ==
       display_id_map_.end()) {
-    NOTREACHED();
+    DUMP_WILL_BE_NOTREACHED_NORETURN();
     return GetPrimaryDisplay();
   }
 
diff --git a/url/gurl.cc b/url/gurl.cc
index 018ae11..3e639dfb 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -161,7 +161,8 @@
 
   // TODO(crbug.com/851128): Make sure this no longer hits before making
   // NOTREACHED_NORETURN();
-  NOTREACHED() << "Trying to get the spec of an invalid URL!";
+  DUMP_WILL_BE_NOTREACHED_NORETURN()
+      << "Trying to get the spec of an invalid URL!";
   return base::EmptyString();
 }