TabStripModel should use size_t to represent tab indexes / count. |
||
Issue description... Or maybe not, in which case a comment in the code will be helpful (I might have missed it). Looking at tab_strip_model.h it looks like we're mostly using signed integers (a.k.a. int) to represent values that shouldn't be signed: - The indexes are represented as int but are always assumed to be > 0 (by calling TabStripModel::ContainsIndex) - The number of WebContents is returned as an int (casted from a size_t, https://cs.chromium.org/chromium/src/chrome/browser/ui/tabs/tab_strip_model.h?sq=package:chromium&l=132) Is there any particular reason for this? If not it's probably not worth fixing this (or the priority of this is pretty low) but it'd be good to add a comment to explain the reasons for this.
,
Aug 8 2017
Given views is int based converting TabStripModel to be size_t would mean we need a bunch of casts for the code that interacts with the two. This would rapidly spiral into the need to touch a bunch of other related ui code (such as ListSelectionModel). While views is int based (which I stand behind) I see little value in doing this.
,
Aug 8 2017
I consider it a bug that views uses ints for things our style guide says should be size_t, but I don't think it's a bug worth trying to fix. Tons of labor for very little benefit if any.
,
Aug 8 2017
Yeah, I agree that this isn't something worth to fix, the risk of breaking something largely outweigh the benefits. The fact that the "count" method returns an int still bothers me but I can live with this. Thanks for the quick response anyway, I'm not familiar with the views so I was lacking some context here. |
||
►
Sign in to add a comment |
||
Comment 1 by pkasting@chromium.org
, Aug 8 2017Summary: TabStripModel should use size_t to represent tab indexes / count. (was: TabStripModel should use unsigned values to represent tab indexes / count.)