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

Unified Diff: chrome/browser/file_select_helper.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/file_select_helper.cc
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
index 04d9caec86556c3bc78d2489f38d356bc6f82e55..c9059e0f6cce84f82d10965ae39240c0ac9cbc27 100644
--- a/chrome/browser/file_select_helper.cc
+++ b/chrome/browser/file_select_helper.cc
@@ -628,7 +628,6 @@ void FileSelectHelper::RunFileChooserEnd() {
void FileSelectHelper::EnumerateDirectory(int request_id,
RenderViewHost* render_view_host,
const base::FilePath& path) {
-
// Because this class returns notifications to the RenderViewHost, it is
// difficult for callers to know how long to keep a reference to this
// instance. We AddRef() here to keep the instance alive after we return
@@ -648,16 +647,10 @@ void FileSelectHelper::EnumerateDirectoryEnd() {
void FileSelectHelper::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- switch (type) {
- case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: {
- DCHECK(content::Source<RenderWidgetHost>(source).ptr() ==
- render_frame_host_->GetRenderViewHost()->GetWidget());
- render_frame_host_ = NULL;
- break;
- }
- default:
- NOTREACHED();
- }
+ DCHECK_EQ(content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, type);
+ DCHECK_EQ(content::Source<RenderWidgetHost>(source).ptr(),
+ render_frame_host_->GetRenderViewHost()->GetWidget());
+ render_frame_host_ = nullptr;
}
void FileSelectHelper::RenderViewHostChanged(RenderViewHost* old_host,

Powered by Google App Engine
This is Rietveld 408576698