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

Issue 2469323002: Document TaskRunners/TaskTraits/FROM_HERE as implicitly included from post_task.h (Closed)

Created:
4 years, 1 month ago by gab
Modified:
4 years, 1 month ago
Reviewers:
robliao, danakj, fdoray
CC:
chromium-reviews, gab+watch_chromium.org, robliao+watch_chromium.org, fdoray+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Document TaskRunners/TaskTraits/FROM_HERE as implicitly included from post_task.h This avoids the majority of simple callsites to have to include task_traits.h + location.h + one of the task_runner.h headers merely to use post_task.h. BUG=633389

Patch Set 1 #

Total comments: 2

Patch Set 2 : Keep header ordering, add comment after #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -0 lines) Patch
M base/task_scheduler/post_task.h View 1 1 chunk +4 lines, -0 lines 3 comments Download

Messages

Total messages: 13 (3 generated)
gab
PTAL
4 years, 1 month ago (2016-11-02 14:52:45 UTC) #3
robliao
https://codereview.chromium.org/2469323002/diff/1/base/task_scheduler/post_task.h File base/task_scheduler/post_task.h (right): https://codereview.chromium.org/2469323002/diff/1/base/task_scheduler/post_task.h#newcode12 base/task_scheduler/post_task.h:12: // To avoid redundant includes: users may omit including ...
4 years, 1 month ago (2016-11-02 17:06:25 UTC) #4
gab
https://codereview.chromium.org/2469323002/diff/1/base/task_scheduler/post_task.h File base/task_scheduler/post_task.h (right): https://codereview.chromium.org/2469323002/diff/1/base/task_scheduler/post_task.h#newcode12 base/task_scheduler/post_task.h:12: // To avoid redundant includes: users may omit including ...
4 years, 1 month ago (2016-11-02 18:18:33 UTC) #5
fdoray
lgtm Maybe add ref_counted.h to the list? // It would be weird if I had ...
4 years, 1 month ago (2016-11-02 20:08:14 UTC) #6
robliao
lgtm https://codereview.chromium.org/2469323002/diff/20001/base/task_scheduler/post_task.h File base/task_scheduler/post_task.h (right): https://codereview.chromium.org/2469323002/diff/20001/base/task_scheduler/post_task.h#newcode19 base/task_scheduler/post_task.h:19: // with this API: location.h, task_traits.h, and *task_runner.h. ...
4 years, 1 month ago (2016-11-02 20:13:55 UTC) #7
gab
On 2016/11/02 20:08:14, fdoray wrote: > lgtm > > Maybe add ref_counted.h to the list? ...
4 years, 1 month ago (2016-11-02 20:24:43 UTC) #8
gab
https://codereview.chromium.org/2469323002/diff/20001/base/task_scheduler/post_task.h File base/task_scheduler/post_task.h (right): https://codereview.chromium.org/2469323002/diff/20001/base/task_scheduler/post_task.h#newcode19 base/task_scheduler/post_task.h:19: // with this API: location.h, task_traits.h, and *task_runner.h. On ...
4 years, 1 month ago (2016-11-02 20:25:21 UTC) #9
gab
+danakj, in particular WDYT of the discussion below? On 2016/11/02 20:24:43, gab wrote: > On ...
4 years, 1 month ago (2016-11-02 20:25:59 UTC) #11
danakj
On 2016/11/02 20:25:59, gab wrote: > +danakj, in particular WDYT of the discussion below? > ...
4 years, 1 month ago (2016-11-02 22:58:01 UTC) #12
gab
4 years, 1 month ago (2016-11-03 13:10:51 UTC) #13
On 2016/11/02 22:58:01, danakj_OOO_back_11_9 wrote:
> On 2016/11/02 20:25:59, gab wrote:
> > +danakj, in particular WDYT of the discussion below?
> > 
> > On 2016/11/02 20:24:43, gab wrote:
> > > On 2016/11/02 20:08:14, fdoray wrote:
> > > > lgtm
> > > > 
> > > > Maybe add ref_counted.h to the list?
> > > > 
> > > > // It would be weird if I had to include ref_counted.h but not
> > task_runner.h.
> > > > 
> > > > scoped_refptr<TaskRunner> task_runner =
> > > > CreateTaskRunnerWithTraits(TaskTraits());
> > > 
> > > My thinking is I want to allow simple inline calls (e.g. either inline
> > PostTask
> > > calls or inline GetTaskRunner and implicitly move it to another owner). If
> you
> > > want to keep ownership, then I guess it makes sense that you would include
> > > ref_counted.h?
> > > 
> > > But then I guess that by my latest discovery about ref_counted.h means you
> > > should also include the matching task_runner.h header...
> > > 
> > > I guess you're right but I find it weird to say that it comes with
> > ref_counted.h
> > > -- e.g. what if TaskRunner is one day no longer refcounted?
> 
> I think it's more or less impossible to get it right when it's not automated
and
> you shouldn't lose too much sleep over it, and you should just drop the
comment
> and let people include what they will.
> 
>
https://codereview.chromium.org/2469323002/diff/20001/base/task_scheduler/pos...
> File base/task_scheduler/post_task.h (right):
> 
>
https://codereview.chromium.org/2469323002/diff/20001/base/task_scheduler/pos...
> base/task_scheduler/post_task.h:19: // with this API: location.h,
task_traits.h,
> and *task_runner.h.
> On 2016/11/02 20:25:21, gab wrote:
> > On 2016/11/02 20:13:55, robliao wrote:
> > > Is the asterisk in task_runner.h intentional?
> > 
> > Yes, it applies to all 3 TaskRunner headers.
> 
> I think this comment is overprescribing things, just use the right includes
and
> let users do as they will.

Ok, I guess what I'm trying to prevent is someone making a simple call and being
told to IWYU 4 different headers... IMO it's fine to only include post_task.h
when using TaskTraits/FROM_HERE/TaskRunner in its context only.

Closing this for now.

Powered by Google App Engine
This is Rietveld 408576698