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

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed)

Created:
9 years, 7 months ago by Peter Kasting
Modified:
9 years, 7 months ago
Reviewers:
Nico, sky
CC:
chromium-reviews, GeorgeY, Avi (use Gerrit), Erik does not do reviews, brettw-cc_chromium.org, jam, Aaron Boodman, pam+watch_chromium.org, rdsmith+dwatch_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org, Ilya Sherman, stuartmorgan+watch_chromium.org, dhollowa
Visibility:
Public.

Description

Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a step along the way to killing it entirely. This also adds a lot of OVERRIDE markers and does some other cleanup in a few places. The original (stupid) design for the delegate class left subclasses great flexibility in how they mapped infobars to delegates. In practice, no one ever wanted multiple infobars driven off a single delegate, so the mapping was always one-to-one. As a result, it was always correct for InfoBarClosed() to "delete this", but because the base class did not do so, every subclass needed to. Most did; the others leaked memory and failed to run their destructors. This change forces the base class to delete itself. This fixes the delegate leaks in the couple subclasses that failed to do this. It also eliminates a lot of copy-and-pasted "delete this" implementations. Ultimately, we'll be moving to a model where the InfoBar "view" class owns the delegate and deletes it directly, which will eliminate InfoBarClosed() completely. BUG=62154 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=84195

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 6

Patch Set 6 : '' #

Patch Set 7 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+485 lines, -544 lines) Patch
M chrome/browser/alternate_nav_url_fetcher.h View 1 2 3 4 5 2 chunks +7 lines, -8 lines 0 comments Download
M chrome/browser/alternate_nav_url_fetcher.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/autofill/autofill_cc_infobar_delegate.h View 1 2 3 4 5 1 chunk +10 lines, -11 lines 0 comments Download
M chrome/browser/autofill/autofill_cc_infobar_delegate.cc View 1 2 3 4 5 2 chunks +2 lines, -7 lines 0 comments Download
M chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/download/download_request_infobar_delegate.h View 1 2 3 4 5 1 chunk +4 lines, -5 lines 0 comments Download
M chrome/browser/download/download_request_infobar_delegate.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/extensions/extension_disabled_infobar_delegate.cc View 1 2 3 4 5 2 chunks +5 lines, -10 lines 0 comments Download
M chrome/browser/extensions/extension_infobar_delegate.h View 1 2 3 4 5 1 chunk +6 lines, -7 lines 0 comments Download
M chrome/browser/extensions/extension_infobar_delegate.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/extensions/theme_installed_infobar_delegate.h View 1 2 3 4 5 1 chunk +7 lines, -7 lines 0 comments Download
M chrome/browser/extensions/theme_installed_infobar_delegate.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/geolocation/geolocation_permission_context.cc View 1 2 3 4 5 2 chunks +8 lines, -13 lines 0 comments Download
M chrome/browser/google/google_url_tracker.h View 1 2 3 4 5 2 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/google/google_url_tracker.cc View 1 2 3 4 5 1 chunk +1 line, -5 lines 0 comments Download
M chrome/browser/notifications/desktop_notification_service.cc View 1 2 3 4 5 3 chunks +6 lines, -12 lines 0 comments Download
M chrome/browser/omnibox_search_hint.cc View 1 2 3 4 5 3 chunks +10 lines, -15 lines 0 comments Download
M chrome/browser/password_manager_delegate_impl.cc View 1 2 3 4 5 2 chunks +6 lines, -11 lines 0 comments Download
M chrome/browser/pdf_unsupported_feature.cc View 1 2 3 4 5 3 chunks +161 lines, -175 lines 0 comments Download
M chrome/browser/plugin_installer_infobar_delegate.h View 1 2 3 4 5 1 chunk +9 lines, -8 lines 0 comments Download
M chrome/browser/plugin_observer.cc View 1 2 3 4 5 8 chunks +18 lines, -33 lines 0 comments Download
M chrome/browser/tab_contents/infobar_delegate.h View 1 2 3 4 5 2 chunks +3 lines, -20 lines 0 comments Download
M chrome/browser/tab_contents/infobar_delegate.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/tab_contents/simple_alert_infobar_delegate.h View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/simple_alert_infobar_delegate.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents_ssl_helper.cc View 1 2 3 4 5 2 chunks +6 lines, -12 lines 0 comments Download
M chrome/browser/translate/translate_infobar_delegate.h View 1 2 3 4 5 1 chunk +5 lines, -6 lines 0 comments Download
M chrome/browser/translate/translate_infobar_delegate.cc View 1 2 3 4 5 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/ui/browser_init.cc View 1 2 3 4 5 7 chunks +37 lines, -34 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm View 1 2 3 4 5 2 chunks +24 lines, -13 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/infobar_controller.mm View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm View 1 2 3 4 5 6 2 chunks +98 lines, -55 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.h View 1 2 3 4 5 4 chunks +11 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/mock_confirm_infobar_delegate.cc View 1 2 3 4 5 1 chunk +5 lines, -7 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h View 1 2 3 4 5 2 chunks +11 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.cc View 1 2 3 4 5 1 chunk +5 lines, -7 lines 0 comments Download
M chrome/browser/ui/cocoa/keystone_infobar.mm View 1 2 3 4 5 2 chunks +6 lines, -11 lines 0 comments Download
M chrome/browser/ui/collected_cookies_infobar_delegate.h View 1 2 3 4 5 1 chunk +6 lines, -6 lines 0 comments Download
M chrome/browser/ui/collected_cookies_infobar_delegate.cc View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Peter Kasting
rohitrao: Cocoa stuff sky: Other
9 years, 7 months ago (2011-05-03 23:45:49 UTC) #1
sky
LGTM
9 years, 7 months ago (2011-05-04 00:03:45 UTC) #2
Peter Kasting
Rohit is OOO. Nico, could you review the Cocoa bits?
9 years, 7 months ago (2011-05-04 21:03:24 UTC) #3
Nico
LGTM for the changes in b/u/cocoa, I have only nits which you can ignore if ...
9 years, 7 months ago (2011-05-04 21:15:52 UTC) #4
Peter Kasting
Will land once Mac trybot passes. http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm File chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm (right): http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm#newcode57 chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm:57: // These infobars ...
9 years, 7 months ago (2011-05-04 22:54:55 UTC) #5
Nico
9 years, 7 months ago (2011-05-04 22:59:08 UTC) #6
Thanks!

On Wed, May 4, 2011 at 3:54 PM,  <pkasting@chromium.org> wrote:
> Will land once Mac trybot passes.
>
>
>
http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/info...
> File
> chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm
> (right):
>
>
http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/info...
> chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm:57:
> // These infobars own themselves.
> On 2011/05/04 21:15:52, Nico wrote:
>>
>> This would be more informative if it was "These infobars delete
>
> themselves when
>>
>> XXX happens"
>
> Changed to "These delegates delete themselves when they're told their
> infobars have closed."
>
>> Who owns the delegate?
>
> Do you ask this because the old comment said "these infobars" rather
> than "these delegates"?  Hopefully now things are clear?

Yes, and yes.

>
>
http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/info...
> File chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm
> (right):
>
>
http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/info...
> chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm:171:
> ASSERT_TRUE(delegate_ == NULL);
> On 2011/05/04 21:15:52, Nico wrote:
>>
>> These would read better if there's a method on the test class named
>> WasDelegateClosed() that returned delegate == NULL
>
> Added "delegate_closed()".
>
>
http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/info...
> File chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h
> (right):
>
>
http://codereview.chromium.org/6926001/diff/2019/chrome/browser/ui/cocoa/info...
> chrome/browser/ui/cocoa/infobars/mock_link_infobar_delegate.h:16: class
> MockLinkInfoBarDelegate : public LinkInfoBarDelegate {
> On 2011/05/04 21:15:52, Nico wrote:
>>
>> (btw, why are all these mocks mac-specific? that seems like something
>
> that can
>>
>> and should be shared across platforms)
>
> Dunno.  TBH I don't really find infobar_controller_unittest.mm that
> valuable, though.
>
> http://codereview.chromium.org/6926001/
>

Powered by Google App Engine
This is Rietveld 408576698