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

Issue 1150193004: Straighten up life cycle of native InfoBar pointers (Closed)

Created:
5 years, 6 months ago by Changwan Ryu
Modified:
5 years, 6 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Straighten up life cycle of native InfoBar pointers Currently, there are two issues for potential crashes. 1. There is a chance that Java InfoBars can access native counterparts even after they are destroyed. mNativeInfoBarPtr is never reset even after native InfoBar is destroyed. We do not accept touch inputs after closing infobars, but there may be corner cases where mNativeInfoBarPtr is accessed afterwards. 2. Infobars aren't setting "base" native pointers correctly. InfoBar_jni.h has the following code: InfoBarAndroid* native = reinterpret_cast<InfoBarAndroid*>(nativeInfoBarAndroid); Here, nativeInfoBarAndroid refers to the subclass, so we implicitly upcast the pointer using reinterpret_cast<>, which may result in pointing to an incorrect pointer depending on the architecture. In order to prevent any such occurrence in the future, this also prevents InfoBar Java subclasses from accessing the native base pointer and functions. BUG=492777, 481758 Committed: https://crrev.com/6e63752fcab8553a3b84c5ecf6a356240dacb6e4 Cr-Commit-Position: refs/heads/master@{#333015}

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : removed setNativeInfoBarPtr calls from child classes #

Total comments: 12

Patch Set 4 : addressed david's comments #

Total comments: 16

Patch Set 5 : fixed onNativeDestroyed call hierarchy #

Total comments: 4

Patch Set 6 : updated comment and javadoc #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : removed unrelated file #

Unified diffs Side-by-side diffs Delta from patch set Stats (+190 lines, -260 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java View 1 2 3 4 5 chunks +19 lines, -19 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/AppBannerInfoBarAndroid.java View 1 2 3 chunks +8 lines, -11 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java View 1 2 3 2 chunks +5 lines, -17 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBarDelegate.java View 1 2 3 1 chunk +5 lines, -6 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBar.java View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java View 1 2 3 1 chunk +3 lines, -5 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadOverwriteInfoBar.java View 1 2 3 4 5 1 chunk +4 lines, -13 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/GeneratedPasswordSavedInfoBar.java View 1 2 3 2 chunks +2 lines, -13 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/GeneratedPasswordSavedInfoBarDelegate.java View 1 2 2 chunks +4 lines, -6 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java View 1 2 3 4 5 6 chunks +33 lines, -33 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/MessageInfoBar.java View 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java View 1 2 1 chunk +9 lines, -10 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateInfoBar.java View 1 2 3 4 5 6 chunks +35 lines, -21 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateInfoBarDelegate.java View 1 2 3 1 chunk +0 lines, -52 lines 0 comments Download
M chrome/android/java_staging/src/org/chromium/chrome/browser/omaha/OmahaUpdateInfobar.java View 1 2 2 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/ui/android/infobars/account_chooser_infobar.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/android/infobars/account_chooser_infobar.cc View 1 2 3 4 2 chunks +9 lines, -2 lines 0 comments Download
M chrome/browser/ui/android/infobars/app_banner_infobar_android.cc View 1 2 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/ui/android/infobars/confirm_infobar.cc View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.cc View 1 2 1 chunk +1 line, -4 lines 0 comments Download
M chrome/browser/ui/android/infobars/download_overwrite_infobar.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/ui/android/infobars/generated_password_saved_infobar.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/android/infobars/infobar_android.h View 1 2 3 4 2 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/ui/android/infobars/infobar_android.cc View 1 2 3 4 1 chunk +13 lines, -2 lines 0 comments Download
M chrome/browser/ui/android/infobars/infobar_container_android.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/android/infobars/save_password_infobar.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/android/infobars/translate_infobar.h View 1 2 3 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/ui/android/infobars/translate_infobar.cc View 1 2 3 4 5 chunks +15 lines, -17 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 2 chunks +1 line, -1 line 0 comments Download

Messages

Total messages: 26 (5 generated)
Changwan Ryu
5 years, 6 months ago (2015-06-01 03:10:05 UTC) #2
Peter Kasting
Based on the CL description, why is the code using reinterpret_cast<> instead of static_cast<>, which ...
5 years, 6 months ago (2015-06-01 06:43:16 UTC) #3
Changwan Ryu
On 2015/06/01 06:43:16, Peter Kasting wrote: > Based on the CL description, why is the ...
5 years, 6 months ago (2015-06-01 07:06:34 UTC) #4
Peter Kasting
On 2015/06/01 07:06:34, Changwan Ryu wrote: > On 2015/06/01 06:43:16, Peter Kasting wrote: > > ...
5 years, 6 months ago (2015-06-01 07:18:24 UTC) #5
Changwan Ryu
On 2015/06/01 07:18:24, Peter Kasting wrote: > On 2015/06/01 07:06:34, Changwan Ryu wrote: > > ...
5 years, 6 months ago (2015-06-01 08:32:47 UTC) #6
David Trainor- moved to gerrit
On 2015/06/01 08:32:47, Changwan Ryu wrote: > On 2015/06/01 07:18:24, Peter Kasting wrote: > > ...
5 years, 6 months ago (2015-06-01 17:29:58 UTC) #7
Changwan Ryu
On 2015/06/01 17:29:58, David Trainor wrote: > On 2015/06/01 08:32:47, Changwan Ryu wrote: > > ...
5 years, 6 months ago (2015-06-02 08:52:59 UTC) #8
David Trainor- moved to gerrit
https://codereview.chromium.org/1150193004/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java File chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java (right): https://codereview.chromium.org/1150193004/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java#newcode50 chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java:50: super.onButtonClicked(action, ""); Don't need super? Same with all others ...
5 years, 6 months ago (2015-06-02 17:51:56 UTC) #9
Changwan Ryu
https://codereview.chromium.org/1150193004/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java File chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java (right): https://codereview.chromium.org/1150193004/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java#newcode49 chrome/android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBar.java:49: super.onButtonClicked(action, ""); On 2015/06/02 17:51:55, David Trainor wrote: > ...
5 years, 6 months ago (2015-06-03 04:55:41 UTC) #10
David Trainor- moved to gerrit
https://chromiumcodereview.appspot.com/1150193004/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java File chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java (right): https://chromiumcodereview.appspot.com/1150193004/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java#newcode158 chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java:158: protected void finalize() throws Throwable { Overriding finalize causes ...
5 years, 6 months ago (2015-06-03 19:38:46 UTC) #11
Changwan Ryu
PTAL https://chromiumcodereview.appspot.com/1150193004/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java File chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java (right): https://chromiumcodereview.appspot.com/1150193004/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java#newcode158 chrome/android/java/src/org/chromium/chrome/browser/infobar/AccountChooserInfoBar.java:158: protected void finalize() throws Throwable { On 2015/06/03 ...
5 years, 6 months ago (2015-06-04 01:42:27 UTC) #12
David Trainor- moved to gerrit
lgtm
5 years, 6 months ago (2015-06-04 17:55:49 UTC) #13
cjhopman
lgtm
5 years, 6 months ago (2015-06-04 20:47:51 UTC) #14
Changwan Ryu
On 2015/06/04 20:47:51, cjhopman wrote: > lgtm Ted / Miguel, could you take a look ...
5 years, 6 months ago (2015-06-04 23:28:30 UTC) #15
Ted C
lgtm https://chromiumcodereview.appspot.com/1150193004/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java File chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java (right): https://chromiumcodereview.appspot.com/1150193004/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java#newcode226 chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java:226: protected void onButtonClicked(int action, String actionValue) { javadoc ...
5 years, 6 months ago (2015-06-05 00:39:08 UTC) #16
Changwan Ryu
https://chromiumcodereview.appspot.com/1150193004/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java File chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java (right): https://chromiumcodereview.appspot.com/1150193004/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java#newcode226 chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java:226: protected void onButtonClicked(int action, String actionValue) { On 2015/06/05 ...
5 years, 6 months ago (2015-06-05 01:04:05 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1150193004/190001
5 years, 6 months ago (2015-06-05 01:22:15 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/60328)
5 years, 6 months ago (2015-06-05 03:33:51 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1150193004/190001
5 years, 6 months ago (2015-06-05 05:20:45 UTC) #24
commit-bot: I haz the power
Committed patchset #11 (id:190001)
5 years, 6 months ago (2015-06-05 06:07:12 UTC) #25
commit-bot: I haz the power
5 years, 6 months ago (2015-06-05 06:09:15 UTC) #26
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/6e63752fcab8553a3b84c5ecf6a356240dacb6e4
Cr-Commit-Position: refs/heads/master@{#333015}

Powered by Google App Engine
This is Rietveld 408576698