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

Issue 1918403004: Add Check and DCheck java classes to base (Closed)

Created:
4 years, 7 months ago by doloffd
Modified:
4 years ago
Reviewers:
Torne, Yaron, Nico, dgn, smaier
CC:
chromium-reviews, Bernhard Bauer
Base URL:
https://chromium.googlesource.com/chromium/src.git@lkgr
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add Check and DCheck java classes to base These classes expose CHECK and DCHECK like functionality for Chrome's Java code. They have static methods like those in org.junit.Assert to reduce code written by consumers and reduce code run in Release builds. All methods in DCheck.java are marked @RemoveableInRelase, which are treated as assumenosideeffects by proguard, removing the calls from the Release builds. The only code left over is the code passed into the calls. Methods called inside the argument list will still exist unless assumenosideeffect is placed on them. Callers can take advantage of methods like isEqual to prevent the equality check from occurring in Release builds. BUG=462676

Patch Set 1 #

Total comments: 3

Patch Set 2 : Addressed dgn's comments #

Patch Set 3 : Changed Debugger wait to use a flag instead #

Total comments: 1

Patch Set 4 : Removed DCheck and added error message formatting #

Patch Set 5 : Added use of formatted message to Check #

Total comments: 3

Patch Set 6 : Converted crashing mechanism to throw an AssertionError instead #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2005 lines, -6 lines) Patch
M base/BUILD.gn View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
A base/android/java/src/org/chromium/base/Check.java View 1 2 3 4 5 1 chunk +1400 lines, -0 lines 0 comments Download
M base/android/java/src/org/chromium/base/ThreadUtils.java View 1 2 3 4 2 chunks +4 lines, -6 lines 0 comments Download
A base/android/junit/src/org/chromium/base/CheckTest.java View 1 2 3 4 5 1 chunk +598 lines, -0 lines 0 comments Download

Messages

Total messages: 62 (10 generated)
doloffd
PTAL
4 years, 7 months ago (2016-04-27 22:28:16 UTC) #7
dgn
There is an issue with @RemovableInRelease. Proguard optimizations are disable in WebView builds, and maybe ...
4 years, 7 months ago (2016-04-28 08:44:10 UTC) #9
doloffd
I don't have access to that bug, could you give me access to it? If ...
4 years, 7 months ago (2016-04-28 17:51:35 UTC) #10
agrieve
On 2016/04/28 17:51:35, doloffd wrote: > I don't have access to that bug, could you ...
4 years, 7 months ago (2016-04-29 00:57:57 UTC) #11
doloffd
Jack doesn't seem like it will solve the problem entirely, even once it is used. ...
4 years, 7 months ago (2016-05-02 21:14:25 UTC) #12
Nico
adding a base/android/OWNER
4 years, 7 months ago (2016-05-02 23:14:55 UTC) #14
dgn
Sure, having this class is a good idea to standardize the checks across the native ...
4 years, 7 months ago (2016-05-03 09:02:52 UTC) #15
doloffd
> But so far, we know that DCHECKs would stay enabled at least in WebView, ...
4 years, 7 months ago (2016-05-03 14:59:46 UTC) #16
dgn
Oh my bad, you're right. I should have looked better. Please disregard my earlier comments. ...
4 years, 7 months ago (2016-05-04 00:26:27 UTC) #17
doloffd
> https://codereview.chromium.org/1918403004/diff/1/base/android/java/src/org/chromium/base/Check.java#newcode1227 > base/android/java/src/org/chromium/base/Check.java:1227: System.err.flush(); > nit: System.err seems unused in Android: > "By default, ...
4 years, 7 months ago (2016-05-04 17:55:18 UTC) #18
dgn
> > https://codereview.chromium.org/1918403004/diff/1/base/android/junit/src/org/chromium/base/CheckTest.java#newcode393 > > base/android/junit/src/org/chromium/base/CheckTest.java:393: } catch (final > > MockitoAssertionError e) { > ...
4 years, 7 months ago (2016-05-05 09:46:13 UTC) #19
doloffd
On 2016/05/05 09:46:13, dgn wrote: > > > > https://codereview.chromium.org/1918403004/diff/1/base/android/junit/src/org/chromium/base/CheckTest.java#newcode393 > > > base/android/junit/src/org/chromium/base/CheckTest.java:393: } ...
4 years, 7 months ago (2016-05-05 14:28:53 UTC) #20
dgn
> > > I have an implementation question for you. I currently call > > ...
4 years, 7 months ago (2016-05-09 10:37:10 UTC) #21
doloffd
I didn't realize I hadn't published my latest drafts. Sorry about the delay
4 years, 7 months ago (2016-05-12 16:07:57 UTC) #22
dgn
On 2016/05/12 16:07:57, doloffd wrote: > I didn't realize I hadn't published my latest drafts. ...
4 years, 7 months ago (2016-05-17 17:18:57 UTC) #23
doloffd
> How about using a GN flag to make a build wait for the debugger, ...
4 years, 7 months ago (2016-05-17 21:49:57 UTC) #24
Yaron
sorry for the delay. +torne as I shouldn't approve this on behalf of webview. First ...
4 years, 7 months ago (2016-05-25 15:39:39 UTC) #25
Yaron
+torne for real
4 years, 7 months ago (2016-05-25 15:39:55 UTC) #27
Yaron
On 2016/05/25 15:39:55, Yaron wrote: > +torne for real Hmm. I suppose that adding Check ...
4 years, 7 months ago (2016-05-25 15:46:20 UTC) #28
Torne
On 2016/05/25 15:39:39, Yaron wrote: > sorry for the delay. > +torne as I shouldn't ...
4 years, 7 months ago (2016-05-25 17:29:11 UTC) #29
Yaron
On 2016/05/25 17:29:11, Torne wrote: > On 2016/05/25 15:39:39, Yaron wrote: > > sorry for ...
4 years, 7 months ago (2016-05-25 18:19:42 UTC) #30
doloffd
> > but the main issue I think is the one that's been discussed ad ...
4 years, 7 months ago (2016-05-26 21:16:02 UTC) #31
doloffd
> These costs are very low with ~3ms per DCheck, while a simple log statement ...
4 years, 6 months ago (2016-05-27 23:57:32 UTC) #32
Torne
On 2016/05/26 21:16:02, doloffd wrote: > > > but the main issue I think is ...
4 years, 6 months ago (2016-05-31 11:22:28 UTC) #33
doloffd
On 2016/05/31 11:22:28, Torne wrote: > > 2) Developers will make expensive calls inside DCheck ...
4 years, 6 months ago (2016-06-04 20:57:23 UTC) #34
Torne
On 2016/06/04 20:57:23, doloffd wrote: > Is it not possible for the Jack team to ...
4 years, 6 months ago (2016-06-06 10:45:39 UTC) #35
doloffd
4 years, 6 months ago (2016-06-15 23:13:24 UTC) #36
Torne
OK, sorry for the delay, have been really busy with things. Proguard for webview is ...
4 years, 5 months ago (2016-07-25 15:19:20 UTC) #37
doloffd
On 2016/07/25 15:19:20, Torne wrote: > Proguard for webview is now fixed and we can ...
4 years, 4 months ago (2016-07-26 17:10:39 UTC) #38
Torne
On 2016/07/26 17:10:39, doloffd wrote: > On 2016/07/25 15:19:20, Torne wrote: > > Proguard for ...
4 years, 4 months ago (2016-07-26 18:01:09 UTC) #39
doloffd
> I'm not sure which is nicer, to be honest. We should probably start by ...
4 years, 4 months ago (2016-08-03 22:45:42 UTC) #40
Torne
On 2016/08/03 22:45:42, doloffd wrote: > > > > General question: for a given case, ...
4 years, 4 months ago (2016-08-04 10:33:18 UTC) #41
doloffd
Okay, I will convert the crashing to just throwing a Throwable to minimize the catchability ...
4 years, 4 months ago (2016-08-12 00:31:17 UTC) #42
doloffd
4 years, 4 months ago (2016-08-12 19:33:29 UTC) #43
Torne
On 2016/08/12 00:31:17, doloffd wrote: > Okay, I will convert the crashing to just throwing ...
4 years, 4 months ago (2016-08-16 12:15:24 UTC) #44
Torne
Also +smaier who has been working on proguard config, debug/release differences, and general size optimisation; ...
4 years, 4 months ago (2016-08-16 12:50:15 UTC) #46
smaier
On 2016/08/16 12:50:15, Torne wrote: > Also +smaier who has been working on proguard config, ...
4 years, 4 months ago (2016-08-16 16:03:07 UTC) #47
Torne
On 2016/08/16 16:03:07, smaier wrote: > On 2016/08/16 12:50:15, Torne wrote: > > Also +smaier ...
4 years, 4 months ago (2016-08-16 16:06:01 UTC) #48
Yaron
On 2016/08/16 16:06:01, Torne wrote: > On 2016/08/16 16:03:07, smaier wrote: > > On 2016/08/16 ...
4 years, 4 months ago (2016-08-16 17:04:01 UTC) #49
doloffd
> - I think DCheck is a more valuable addition than Check (and a potential ...
4 years, 4 months ago (2016-08-16 18:34:18 UTC) #50
smaier
On 2016/08/16 18:34:18, doloffd wrote: > > - I think DCheck is a more valuable ...
4 years, 4 months ago (2016-08-16 18:55:49 UTC) #51
smaier
On 2016/08/16 18:55:49, smaier wrote: > On 2016/08/16 18:34:18, doloffd wrote: > > > - ...
4 years, 4 months ago (2016-08-16 20:08:02 UTC) #52
Yaron
On 2016/08/16 18:55:49, smaier wrote: > On 2016/08/16 18:34:18, doloffd wrote: > > > - ...
4 years, 4 months ago (2016-08-17 17:09:01 UTC) #53
Torne
On 2016/08/17 17:09:01, Yaron (limited availability) wrote: > On 2016/08/16 18:55:49, smaier wrote: > > ...
4 years, 4 months ago (2016-08-17 17:11:40 UTC) #54
doloffd
> The thread ID stuff looks like it's intended as a way to verify that ...
4 years, 4 months ago (2016-08-17 19:44:00 UTC) #55
Yaron
On 2016/08/17 19:44:00, doloffd wrote: > > The thread ID stuff looks like it's intended ...
4 years, 4 months ago (2016-08-17 19:51:54 UTC) #56
doloffd
On 2016/08/17 19:51:54, Yaron (limited availability) wrote: > On 2016/08/17 19:44:00, doloffd wrote: > > ...
4 years, 4 months ago (2016-08-17 21:55:02 UTC) #57
Yaron
On 2016/08/17 21:55:02, doloffd wrote: > On 2016/08/17 19:51:54, Yaron (limited availability) wrote: > > ...
4 years, 4 months ago (2016-08-18 17:10:18 UTC) #58
doloffd
On 2016/08/18 17:10:18, Yaron (limited availability) wrote: > On 2016/08/17 21:55:02, doloffd wrote: > > ...
4 years, 4 months ago (2016-08-18 17:46:30 UTC) #59
agrieve
On 2016/08/18 17:46:30, doloffd wrote: > On 2016/08/18 17:10:18, Yaron (limited availability) wrote: > > ...
4 years, 4 months ago (2016-08-24 15:09:14 UTC) #60
Torne
See recent comment on crbug.com/462676 for yet another option for debug assertions. We should probably ...
4 years, 4 months ago (2016-08-24 15:10:24 UTC) #61
Torne
4 years, 1 month ago (2016-11-07 17:08:59 UTC) #62
Since we're going ahead in crbug.com/462676 with an assert-statement based
approach for debug only checks, I'm not sure whether proceeding with this CL is
worthwhile - we wouldn't use DCheck, and given the asymmetry I'm not sure if
Check is particularly valuable versus the current approach of just throwing
exceptions. Is anyone still interested in pursuing this, or should it be closed?

Powered by Google App Engine
This is Rietveld 408576698