Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: chrome/browser/background/background_mode_manager.cc

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/background/background_mode_manager.cc
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 853ba7105c3734027b8d3e744860a5ac8a806a03..8f1f807880e05111200a67c7cd8dda70f7a20f46 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -463,24 +463,19 @@ void BackgroundModeManager::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_APP_TERMINATING:
- // Make sure we aren't still keeping the app alive (only happens if we
- // don't receive an EXTENSIONS_READY notification for some reason).
- ReleaseStartupKeepAlive();
- // Performing an explicit shutdown, so exit background mode (does nothing
- // if we aren't in background mode currently).
- EndBackgroundMode();
- // Shutting down, so don't listen for any more notifications so we don't
- // try to re-enter/exit background mode again.
- registrar_.RemoveAll();
- for (const auto& it : background_mode_data_)
- it.second->applications_->RemoveObserver(this);
- break;
- default:
- NOTREACHED();
- break;
- }
+ DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
+
+ // Make sure we aren't still keeping the app alive (only happens if we
+ // don't receive an EXTENSIONS_READY notification for some reason).
+ ReleaseStartupKeepAlive();
+ // Performing an explicit shutdown, so exit background mode (does nothing
+ // if we aren't in background mode currently).
+ EndBackgroundMode();
+ // Shutting down, so don't listen for any more notifications so we don't
+ // try to re-enter/exit background mode again.
+ registrar_.RemoveAll();
+ for (const auto& it : background_mode_data_)
+ it.second->applications_->RemoveObserver(this);
}
void BackgroundModeManager::OnExtensionsReady(Profile* profile) {
« no previous file with comments | « chrome/browser/android/tab_web_contents_delegate_android.cc ('k') | chrome/browser/bookmarks/bookmark_html_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698