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

Issue 191763002: Add a BrowserThread::DCheckCurrentlyOn function. (Closed)

Created:
6 years, 9 months ago by Jeffrey Yasskin
Modified:
6 years, 9 months ago
Reviewers:
jam, alecflett, Jói
CC:
chromium-reviews, michaeln, jsbell+serviceworker_chromium.org, tzik, serviceworker-reviews, nhiroki, joi+watch-content_chromium.org, darin-cc_chromium.org, horo+watch_chromium.org, kinuko+watch, alecflett+watch_chromium.org, scheib
Visibility:
Public.

Description

Add a DCHECK_CURRENTLY_ON(BrowserThread::ID) macro. I've often lost time when a DCHECK(BrowserThread::CurrentlyOn(id)) fails, because I needed to re-run the program in gdb to figure out which thread was actually running the function. This new wrapper macro should make that clearer. I've converted one file in service_worker to make sure everything works. It changes: [...:FATAL:service_worker_context_core.cc(75)] Check failed: BrowserThread::CurrentlyOn(BrowserThread::IO). into [...:FATAL:service_worker_context_core.cc(75)] Check failed: ::content::BrowserThread::CurrentlyOn(BrowserThread::IO). Must be called on Chrome_IOThread; actually called on Chrome_UIThread. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=256913

Patch Set 1 #

Patch Set 2 : Use a macro instead of a function #

Patch Set 3 : Use MessageLoop::thread_name when possible, and g_browser_thread_names otherwise #

Total comments: 2

Patch Set 4 : Fix Jói's nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -7 lines) Patch
M content/browser/browser_thread_impl.cc View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
M content/browser/service_worker/service_worker_context_core.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M content/public/browser/browser_thread.h View 1 2 3 4 chunks +12 lines, -5 lines 0 comments Download

Messages

Total messages: 25 (0 generated)
Jeffrey Yasskin
6 years, 9 months ago (2014-03-08 01:19:03 UTC) #1
Jeffrey Yasskin
Also note that I do still get the usual stack trace including the function containing ...
6 years, 9 months ago (2014-03-08 01:42:55 UTC) #2
Jói
I'd suggest a macro to preserve the functionality that logs show the right file and ...
6 years, 9 months ago (2014-03-10 13:54:09 UTC) #3
jam
On 2014/03/10 13:54:09, Jói wrote: > I'd suggest a macro to preserve the functionality that ...
6 years, 9 months ago (2014-03-10 16:39:19 UTC) #4
Jeffrey Yasskin
'k. Would DCHECK_CURRENTLY_ON(BrowserThread::IO) be a good spelling? On Mon, Mar 10, 2014 at 6:54 AM, ...
6 years, 9 months ago (2014-03-10 17:15:37 UTC) #5
Jói
Since it's a macro, and this will only ever deal with BrowserThread IDs, I would ...
6 years, 9 months ago (2014-03-10 17:17:05 UTC) #6
Jeffrey Yasskin
That's certainly implementable, but I'm worried that it'll be harder to read because it doesn't ...
6 years, 9 months ago (2014-03-10 17:21:37 UTC) #7
Jói
I'm fine with your original proposal DCHECK_CURRENTLY_ON(BrowserThread::IO) On Mon, Mar 10, 2014 at 5:21 PM, ...
6 years, 9 months ago (2014-03-10 17:30:09 UTC) #8
Jeffrey Yasskin
Ok, switched to a macro. PTAL. I'll send a bunch of update CLs once this ...
6 years, 9 months ago (2014-03-10 18:03:03 UTC) #9
Jói
LGTM
6 years, 9 months ago (2014-03-10 21:43:10 UTC) #10
Jeffrey Yasskin
Sorry for the extra round-trip: Vince noticed that I could use base::MessageLoop::current()->thread_name() to get better ...
6 years, 9 months ago (2014-03-10 22:07:20 UTC) #11
Jói
LGTM w/a nit. https://codereview.chromium.org/191763002/diff/40001/content/public/browser/browser_thread.h File content/public/browser/browser_thread.h (right): https://codereview.chromium.org/191763002/diff/40001/content/public/browser/browser_thread.h#newcode276 content/public/browser/browser_thread.h:276: #define DCHECK_CURRENTLY_ON(thread_identifier) \ nit: This would ...
6 years, 9 months ago (2014-03-11 08:41:24 UTC) #12
Jeffrey Yasskin
https://codereview.chromium.org/191763002/diff/40001/content/public/browser/browser_thread.h File content/public/browser/browser_thread.h (right): https://codereview.chromium.org/191763002/diff/40001/content/public/browser/browser_thread.h#newcode276 content/public/browser/browser_thread.h:276: #define DCHECK_CURRENTLY_ON(thread_identifier) \ On 2014/03/11 08:41:25, Jói wrote: > ...
6 years, 9 months ago (2014-03-11 19:11:22 UTC) #13
alecflett
lgtm for service_worker
6 years, 9 months ago (2014-03-11 19:26:54 UTC) #14
Jeffrey Yasskin
The CQ bit was checked by jyasskin@chromium.org
6 years, 9 months ago (2014-03-11 19:33:57 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/191763002/50001
6 years, 9 months ago (2014-03-11 19:53:53 UTC) #16
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-11 22:30:43 UTC) #17
commit-bot: I haz the power
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_presubmit&number=54753
6 years, 9 months ago (2014-03-11 22:30:44 UTC) #18
Jeffrey Yasskin
+sky for content/browser: sorry for leaving you off before
6 years, 9 months ago (2014-03-12 00:36:02 UTC) #19
sky
You have John on this review, and he knows the code better than I, so ...
6 years, 9 months ago (2014-03-12 02:32:12 UTC) #20
Jeffrey Yasskin
OK, then John, can I get an lgtm from you? On Mar 11, 2014 7:32 ...
6 years, 9 months ago (2014-03-12 15:48:11 UTC) #21
jam
lgtm
6 years, 9 months ago (2014-03-13 18:15:57 UTC) #22
Jeffrey Yasskin
The CQ bit was checked by jyasskin@chromium.org
6 years, 9 months ago (2014-03-13 18:18:38 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/191763002/50001
6 years, 9 months ago (2014-03-13 18:18:43 UTC) #24
commit-bot: I haz the power
6 years, 9 months ago (2014-03-13 20:24:55 UTC) #25
Message was sent while issue was closed.
Change committed as 256913

Powered by Google App Engine
This is Rietveld 408576698