Skip to content

Commit

Permalink
Migrate most remaining NOTREACHED()
Browse files Browse the repository at this point in the history
This s/NOTREACHED()/NOTREACHED_IN_MIGRATION() for most of remaining
src/. Then I went through all changes and made sure that we didn't do
this for comments or "NOTREACHED(): " log strings.

Rolling in the corresponding change for remaining third_party/crashpad
is separately up for review.

Bug: 40580068
Low-Coverage-Reason: TRIVIAL_CHANGE Unreachable code is not reachable.
Change-Id: I707e582b710bf65474db2e3477fa06f5b8d8ea06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545807
Owners-Override: Lei Zhang <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Commit-Queue: Peter Boström <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1302866}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed May 17, 2024
1 parent 78842eb commit 188188d
Show file tree
Hide file tree
Showing 178 changed files with 513 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ void RegisterComponentsForUpdate(
std::make_unique<component_updater::
TrustTokenKeyCommitmentsComponentInstallerPolicy>(
/* on_commitments_ready= */ base::BindRepeating(
[](const std::string& raw_commitments) { NOTREACHED(); })));
[](const std::string& raw_commitments) {
NOTREACHED_IN_MIGRATION();
})));
}

base::RepeatingClosure barrier_closure = base::BarrierClosure(
Expand Down
2 changes: 1 addition & 1 deletion android_webview/test/shell/src/draw_fn/context_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ class FunctorDrawable : public SkDrawable {

protected:
SkRect onGetBounds() override { return SkRect::MakeWH(width_, height_); }
void onDraw(SkCanvas*) override { NOTREACHED(); }
void onDraw(SkCanvas*) override { NOTREACHED_IN_MIGRATION(); }

std::unique_ptr<GpuDrawHandler> onSnapGpuDrawHandler(
GrBackendApi backend_api,
Expand Down
2 changes: 1 addition & 1 deletion ash/display/display_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3842,7 +3842,7 @@ class FontTestHelper : public AshTestBase {
~FontTestHelper() override { TearDown(); }

// AshTestBase:
void TestBody() override { NOTREACHED(); }
void TestBody() override { NOTREACHED_IN_MIGRATION(); }
};

bool IsTextSubpixelPositioningEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ TEST_F(SessionLogHandlerTest, NoUseAfterFree) {
base::RunLoop run_loop;

session_log_handler_->SetLogCreatedClosureForTest(
base::BindLambdaForTesting([]() { NOTREACHED(); }));
base::BindLambdaForTesting([]() { NOTREACHED_IN_MIGRATION(); }));
EXPECT_EQ(0u, task_runner_->NumPendingTasks());
web_ui_.HandleReceivedMessage("saveSessionLog", args);
EXPECT_EQ(1u, task_runner_->NumPendingTasks());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2826,8 +2826,8 @@ TEST_F(ShimlessRmaServiceTest, StartCalibrationFromWrongStateFails) {
const std::vector<rmad::GetStateReply> fake_states = {CreateStateReply(
rmad::RmadState::kDeviceDestination, rmad::RMAD_ERROR_OK)};
fake_rmad_client_()->SetFakeStateReplies(std::move(fake_states));
fake_rmad_client_()->check_state_callback =
base::BindRepeating([](const rmad::RmadState& state) { NOTREACHED(); });
fake_rmad_client_()->check_state_callback = base::BindRepeating(
[](const rmad::RmadState& state) { NOTREACHED_IN_MIGRATION(); });
base::RunLoop run_loop;
shimless_rma_provider_->GetCurrentState(
base::BindLambdaForTesting([&](mojom::StateResultPtr state_result_ptr) {
Expand Down
2 changes: 1 addition & 1 deletion build/config/logging.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import("//build/config/compiler/compiler.gni")
import("//build/config/dcheck_always_on.gni")

declare_args() {
# Use LogErrorNotReached() for NOTREACHED().
# Use LogErrorNotReached() for NOTREACHED_IN_MIGRATION().
enable_log_error_not_reached =
is_chromeos_ash && !(is_debug || dcheck_always_on)

Expand Down
8 changes: 6 additions & 2 deletions cc/trees/layer_tree_host_unittest_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,9 @@ class LayerTreeHostProxyTestImplFrameCausesAnimatePending
EndTest();
break;
}
default: { NOTREACHED(); }
default: {
NOTREACHED_IN_MIGRATION();
}
}
}
};
Expand Down Expand Up @@ -531,7 +533,9 @@ class LayerTreeHostProxyTestNeedsCommitFromImpl
base::Unretained(this)));
break;
}
default: { NOTREACHED(); }
default: {
NOTREACHED_IN_MIGRATION();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AppShimTerminationManagerImpl : public AppShimTerminationManager,
AppShimTerminationManagerImpl(const AppShimTerminationManagerImpl&) = delete;
AppShimTerminationManagerImpl& operator=(
const AppShimTerminationManagerImpl&) = delete;
~AppShimTerminationManagerImpl() override { NOTREACHED(); }
~AppShimTerminationManagerImpl() override { NOTREACHED_IN_MIGRATION(); }

// AppShimTerminationManager:
void MaybeTerminate() override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ IN_PROC_BROWSER_TEST_P(AppServiceSystemWebAppItemBrowserTest, Activate) {
// Verify that a launch no longer occurs.
web_app::WebAppLaunchProcess::SetOpenApplicationCallbackForTesting(
base::BindLambdaForTesting(
[](apps::AppLaunchParams params) { NOTREACHED(); }));
[](apps::AppLaunchParams params) { NOTREACHED_IN_MIGRATION(); }));

app_item.PerformActivate(ui::EF_NONE);
}
Expand Down
12 changes: 8 additions & 4 deletions chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,21 @@ class FailingVideoDecodeAccelerator : public mojom::VideoDecodeAccelerator {
void Decode(mojom::BitstreamBufferPtr bitstream_buffer) override {
NOTREACHED_IN_MIGRATION();
}
void AssignPictureBuffers(uint32_t count) override { NOTREACHED(); }
void AssignPictureBuffers(uint32_t count) override {
NOTREACHED_IN_MIGRATION();
}
void ImportBufferForPicture(int32_t picture_buffer_id,
mojom::HalPixelFormat format,
mojo::ScopedHandle handle,
std::vector<VideoFramePlane> planes,
mojom::BufferModifierPtr modifier) override {
NOTREACHED_IN_MIGRATION();
}
void ReusePictureBuffer(int32_t picture_buffer_id) override { NOTREACHED(); }
void Flush(FlushCallback callback) override { NOTREACHED(); }
void Reset(ResetCallback callback) override { NOTREACHED(); }
void ReusePictureBuffer(int32_t picture_buffer_id) override {
NOTREACHED_IN_MIGRATION();
}
void Flush(FlushCallback callback) override { NOTREACHED_IN_MIGRATION(); }
void Reset(ResetCallback callback) override { NOTREACHED_IN_MIGRATION(); }

private:
mojo::RemoteSet<mojom::VideoDecodeClient> clients_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,10 @@ TEST_F(DriveFsEventRouterTest, DisplayConfirmDialog_UnmountBeforeResult) {
reason.type = drivefs::mojom::DialogReason::Type::kEnableDocsOffline;
reason.path = base::FilePath("a");
event_router_.DisplayConfirmDialog(
reason, base::BindLambdaForTesting(
[&](drivefs::mojom::DialogResult result) { NOTREACHED(); }));
reason,
base::BindLambdaForTesting([&](drivefs::mojom::DialogResult result) {
NOTREACHED_IN_MIGRATION();
}));
Unmount();
event_router_.OnDialogResult(drivefs::mojom::DialogResult::kAccept);

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ash/login/oobe_interactive_ui_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class FakeRecommendAppsFetcher : public apps::RecommendAppsFetcher {
delegate_->OnLoadSuccess(base::Value(std::move(response_dict)));
}

void Retry() override { NOTREACHED(); }
void Retry() override { NOTREACHED_IN_MIGRATION(); }

private:
const raw_ptr<apps::RecommendAppsFetcherDelegate> delegate_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class StubRecommendAppsFetcher : public apps::RecommendAppsFetcher {
EXPECT_FALSE(started_);
started_ = true;
}
void Retry() override { NOTREACHED(); }
void Retry() override { NOTREACHED_IN_MIGRATION(); }

protected:
const raw_ptr<apps::RecommendAppsFetcherDelegate> delegate_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ TEST_F(PersonalizationAppSeaPenProviderImplTest, QueryLengthExceeded) {
base::BindLambdaForTesting(
[](std::optional<std::vector<
ash::personalization_app::mojom::SeaPenThumbnailPtr>>,
manta::MantaStatusCode) { NOTREACHED(); }));
manta::MantaStatusCode) { NOTREACHED_IN_MIGRATION(); }));

EXPECT_EQ("SearchWallpaper exceeded maximum text length",
bad_message_observer.WaitForBadMessage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ TEST_F(PersonalizationAppWallpaperProviderImplTest, SelectWallpaperWhenBanned) {

wallpaper_provider_remote()->SelectWallpaper(
image_info.asset_id, /*preview_mode=*/false,
base::BindLambdaForTesting([](bool success) { NOTREACHED(); }));
base::BindLambdaForTesting(
[](bool success) { NOTREACHED_IN_MIGRATION(); }));

EXPECT_EQ("Invalid request to set wallpaper",
bad_message_observer.WaitForBadMessage());
Expand Down Expand Up @@ -562,8 +563,8 @@ TEST_F(PersonalizationAppWallpaperProviderImplTest, SetDailyRefreshBanned) {
test_wallpaper_controller()->set_can_set_user_wallpaper(false);
mojo::test::BadMessageObserver bad_message_observer;
wallpaper_provider_remote()->SetDailyRefreshCollectionId(
collection_id,
base::BindLambdaForTesting([](bool success) { NOTREACHED(); }));
collection_id, base::BindLambdaForTesting(
[](bool success) { NOTREACHED_IN_MIGRATION(); }));
EXPECT_EQ("Invalid request to set wallpaper",
bad_message_observer.WaitForBadMessage());
}
Expand Down Expand Up @@ -817,8 +818,9 @@ TEST_F(PersonalizationAppWallpaperProviderImplGooglePhotosTest,
// Test selecting a wallpaper before fetching the enterprise setting.
wallpaper_provider_remote()->SelectGooglePhotosPhoto(
"OmnisVirLupus", ash::WallpaperLayout::WALLPAPER_LAYOUT_CENTER_CROPPED,
/*preview_mode=*/false,
base::BindLambdaForTesting([](bool success) { NOTREACHED(); }));
/*preview_mode=*/false, base::BindLambdaForTesting([](bool success) {
NOTREACHED_IN_MIGRATION();
}));
EXPECT_EQ(
"Cannot call `SelectGooglePhotosPhoto()` without confirming that the "
"Google Photos enterprise setting is enabled.",
Expand All @@ -835,8 +837,9 @@ TEST_F(PersonalizationAppWallpaperProviderImplGooglePhotosTest,
mojo::test::BadMessageObserver bad_message_observer;
wallpaper_provider_remote()->SelectGooglePhotosPhoto(
"OmnisVirLupus", ash::WallpaperLayout::WALLPAPER_LAYOUT_CENTER_CROPPED,
/*preview_mode=*/false,
base::BindLambdaForTesting([](bool success) { NOTREACHED(); }));
/*preview_mode=*/false, base::BindLambdaForTesting([](bool success) {
NOTREACHED_IN_MIGRATION();
}));
EXPECT_EQ(
"Cannot call `SelectGooglePhotosPhoto()` without confirming that the "
"Google Photos enterprise setting is enabled.",
Expand All @@ -848,8 +851,8 @@ TEST_F(PersonalizationAppWallpaperProviderImplGooglePhotosTest,
// Test selecting an album before fetching the enterprise setting.
mojo::test::BadMessageObserver bad_message_observer;
wallpaper_provider_remote()->SelectGooglePhotosAlbum(
"OmnisVirLupus",
base::BindLambdaForTesting([](bool success) { NOTREACHED(); }));
"OmnisVirLupus", base::BindLambdaForTesting(
[](bool success) { NOTREACHED_IN_MIGRATION(); }));
EXPECT_EQ(
"Rejected attempt to set Google Photos wallpaper while disabled via "
"enterprise setting.",
Expand Down Expand Up @@ -884,8 +887,8 @@ TEST_F(PersonalizationAppWallpaperProviderImplGooglePhotosTest,
FetchGooglePhotosEnabled();
mojo::test::BadMessageObserver bad_message_observer;
wallpaper_provider_remote()->SelectGooglePhotosAlbum(
"OmnisVirLupus",
base::BindLambdaForTesting([](bool success) { NOTREACHED(); }));
"OmnisVirLupus", base::BindLambdaForTesting(
[](bool success) { NOTREACHED_IN_MIGRATION(); }));
EXPECT_EQ("Invalid request to select google photos album",
bad_message_observer.WaitForBadMessage());
}
Expand Down
4 changes: 3 additions & 1 deletion chrome/browser/devtools/devtools_ui_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,9 @@ class DevToolsUIBindings::NetworkResourceLoader
bindings_->loaders_.erase(bindings_->loaders_.find(this));
}

void OnRetry(base::OnceClosure start_retry) override { NOTREACHED(); }
void OnRetry(base::OnceClosure start_retry) override {
NOTREACHED_IN_MIGRATION();
}

const int stream_id_;
const raw_ptr<DevToolsUIBindings> bindings_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GetFileURLsDelegate : public storage::RecursiveOperationDelegate {
~GetFileURLsDelegate() override = default;

// RecursiveOperationDelegate:
void Run() override { NOTREACHED(); }
void Run() override { NOTREACHED_IN_MIGRATION(); }
void RunRecursively() override {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
StartRecursiveOperation(root_,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/extension_error_ui_default.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ExtensionGlobalError : public GlobalErrorWithStandardBubble {
return {};
}

void ExecuteMenuItem(Browser* browser) override { NOTREACHED(); }
void ExecuteMenuItem(Browser* browser) override { NOTREACHED_IN_MIGRATION(); }

std::u16string GetBubbleViewTitle() override {
return GenerateTitle(delegate_->GetBlocklistedExtensions(),
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/extensions/extension_sync_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ void ExtensionSyncService::ApplySyncData(
case -1: state = INSTALLED_OUTDATED; break;
case 0: state = INSTALLED_MATCHING; break;
case 1: state = INSTALLED_NEWER; break;
default: NOTREACHED();
default:
NOTREACHED_IN_MIGRATION();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ TEST_F(NativeDesktopMediaListTest, EmptyThumbnail) {
&run_loop)));
// Called upon webrtc::DesktopCapturer::CaptureFrame() call.
ON_CALL(observer_, OnSourceThumbnailChanged(_))
.WillByDefault(testing::InvokeWithoutArgs([]() { NOTREACHED(); }));
.WillByDefault(
testing::InvokeWithoutArgs([]() { NOTREACHED_IN_MIGRATION(); }));

model_->StartUpdating(&observer_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ class LogFileWriterTest
EXPECT_EQ(uncompressed, expected_contents);
break;
}
default: { NOTREACHED(); }
default: {
NOTREACHED_IN_MIGRATION();
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/net/external_protocol_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class FakeProtocolHandlerDelegate : public ExternalProtocolHandler::Delegate {
return ExternalProtocolHandler::BlockState::DONT_BLOCK;
}

void BlockRequest() override { NOTREACHED(); }
void BlockRequest() override { NOTREACHED_IN_MIGRATION(); }

void RunExternalProtocolDialog(
const GURL& url,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/net/websocket_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class ExpectInvalidUtf8Client : public network::mojom::WebSocketClient {
NOTREACHED_IN_MIGRATION();
}

void OnClosingHandshake() override { NOTREACHED(); }
void OnClosingHandshake() override { NOTREACHED_IN_MIGRATION(); }

private:
void OnDisconnect(uint32_t reason, const std::string& message) {
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/notifications/notification_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ NonPersistentNotificationMetadata::From(const Metadata* metadata) {
// static
void NotificationCommon::OpenNotificationSettings(Profile* profile,
const GURL& origin) {
// TODO(peter): Use the |origin| to direct the user to a more appropriate
// settings page to toggle permission.
// TODO(peter): Use the |origin| to direct the user to a more appropriate
// settings page to toggle permission.

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH)
// Android settings are handled through Java. Chrome OS settings are handled
// through the tray's setting panel.
NOTREACHED();
// Android settings are handled through Java. Chrome OS settings are handled
// through the tray's setting panel.
NOTREACHED_IN_MIGRATION();
#else
chrome::ScopedTabbedBrowserDisplayer browser_displayer(profile);
chrome::ShowContentSettingsExceptions(browser_displayer.browser(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class NeverRunsExternalProtocolHandlerDelegate
NOTREACHED_IN_MIGRATION();
}

void FinishedProcessingCheck() override { NOTREACHED(); }
void FinishedProcessingCheck() override { NOTREACHED_IN_MIGRATION(); }
};

} // namespace
Expand Down
4 changes: 3 additions & 1 deletion chrome/browser/printing/print_view_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ class TestPrintViewManagerWin : public PrintViewManagerBase {
SetupScriptedPrintPreviewCallback callback) override {
NOTREACHED_IN_MIGRATION();
}
void ShowScriptedPrintPreview(bool is_modifiable) override { NOTREACHED(); }
void ShowScriptedPrintPreview(bool is_modifiable) override {
NOTREACHED_IN_MIGRATION();
}
void RequestPrintPreview(
mojom::RequestPrintPreviewParamsPtr params) override {
NOTREACHED_IN_MIGRATION();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ class FakeChooserView : public permissions::ChooserController::View {
delete this;
}

void OnOptionAdded(size_t index) override { NOTREACHED(); }
void OnOptionRemoved(size_t index) override { NOTREACHED(); }
void OnOptionUpdated(size_t index) override { NOTREACHED(); }
void OnAdapterEnabledChanged(bool enabled) override { NOTREACHED(); }
void OnRefreshStateChanged(bool refreshing) override { NOTREACHED(); }
void OnOptionAdded(size_t index) override { NOTREACHED_IN_MIGRATION(); }
void OnOptionRemoved(size_t index) override { NOTREACHED_IN_MIGRATION(); }
void OnOptionUpdated(size_t index) override { NOTREACHED_IN_MIGRATION(); }
void OnAdapterEnabledChanged(bool enabled) override {
NOTREACHED_IN_MIGRATION();
}
void OnRefreshStateChanged(bool refreshing) override {
NOTREACHED_IN_MIGRATION();
}

private:
std::unique_ptr<permissions::ChooserController> controller_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DisplayModeChangeWaiter : public WebAppRegistrarObserver {

void Wait() { run_loop_.Run(); }

void OnAppRegistrarDestroyed() override { NOTREACHED(); }
void OnAppRegistrarDestroyed() override { NOTREACHED_IN_MIGRATION(); }

private:
base::RunLoop run_loop_;
Expand Down
Loading

0 comments on commit 188188d

Please sign in to comment.