|
|
Chromium Code Reviews|
Created:
4 years, 3 months ago by Łukasz Anforowicz Modified:
4 years, 3 months ago CC:
chromium-reviews, dcheng Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptions/Value/value/g for type trait value field in WebGLImageConversion.cpp
Lowercase |value| is desirable:
- For consistency with other type traits:
- in WTF - e.g. WTF::IsAssignable<T>::value
- in standard library - e.g. std::is_base_of<T1, T2>::value
- in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value
- To help |rewrite_to_chrome_style| tool.
BUG=640749
Committed: https://crrev.com/1c4e7baae394ba46842f177de2829face052faa5
Cr-Commit-Position: refs/heads/master@{#418134}
Patch Set 1 #
Total comments: 3
Patch Set 2 : s/Value/value/g for type trait value field in WebGLImageConversion.cpp #Messages
Total messages: 22 (11 generated)
lukasza@chromium.org changed reviewers: + danakj@chromium.org
Dana, can you take a look please?
https://codereview.chromium.org/2325563005/diff/1/tools/clang/rewrite_to_chro... File tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc (right): https://codereview.chromium.org/2325563005/diff/1/tools/clang/rewrite_to_chro... tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc:100: static const bool Value = true; shouldn't it be |value| ?
https://codereview.chromium.org/2325563005/diff/1/tools/clang/rewrite_to_chro... File tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc (right): https://codereview.chromium.org/2325563005/diff/1/tools/clang/rewrite_to_chro... tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc:100: static const bool Value = true; On 2016/09/09 00:07:40, danakj wrote: > shouldn't it be |value| ? Maybe we should just change these to lowercase up front and then it works? I think that matches most other type traits?
Description was changed from
==========
Avoid rewriting type traits where the field is spelled |Value|.
third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
contains multiple type traits where the value field is named |Value|
(with uppercase V). We should stop renaming this field, just
as we don't rename the fields in other type traits (i.e. in
WTF::IsCopyAssignable<T>).
After the fix, the tool won't anymore rename Value -> kValue in type
traits. Without this fix, Value -> kValue happens in some places:
template<int Format>
struct Is16bppFormat {
STATIC_ONLY(Is16bppFormat);
static const bool kValue =
Format == WebGLImageConversion::kDataFormatRGBA5551
|| Format == WebGLImageConversion::kDataFormatRGBA4444
|| Format == WebGLImageConversion::kDataFormatRGB565;
};
but not in other places (because heuristics in
https://crrev.com/2274653002 and https://crrev.com/2256913002
are not currently capable of recognizing [based solely on the name
and expression] whether they are dealing with a static field that
should have "k" prefix prepended):
template<int Format,
bool IsInt8Format = IsInt8Format<Format>::Value, // <- no rewrite.
...>
struct DataTypeForFormat {
BUG=640749
==========
to
==========
s/Value/value/g for type trait value field in WebGLImageConversion.cpp
Lowercase |value| is desirable:
- For consistency with other type traits:
- in WTF - e.g. WTF::IsAssignable<T>::value
- in standard library - e.g. std::is_base_of<T1, T2>::value
- in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value
- To help |rewrite_to_chrome_style| tool.
BUG=640749
==========
Description was changed from ========== s/Value/value/g for type trait value field in WebGLImageConversion.cpp Lowercase |value| is desirable: - For consistency with other type traits: - in WTF - e.g. WTF::IsAssignable<T>::value - in standard library - e.g. std::is_base_of<T1, T2>::value - in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value - To help |rewrite_to_chrome_style| tool. BUG=640749 ========== to ========== s/Value/value/g for type trait value field in WebGLImageConversion.cpp Lowercase |value| is desirable: - For consistency with other type traits: - in WTF - e.g. WTF::IsAssignable<T>::value - in standard library - e.g. std::is_base_of<T1, T2>::value - in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value - To help |rewrite_to_chrome_style| tool. BUG=640749 ==========
Thanks for the review - I've switched this CL to be just a manual rename of |Value| into |value|. https://codereview.chromium.org/2325563005/diff/1/tools/clang/rewrite_to_chro... File tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc (right): https://codereview.chromium.org/2325563005/diff/1/tools/clang/rewrite_to_chro... tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc:100: static const bool Value = true; On 2016/09/09 00:08:31, danakj wrote: > On 2016/09/09 00:07:40, danakj wrote: > > shouldn't it be |value| ? > > Maybe we should just change these to lowercase up front and then it works? I > think that matches most other type traits? Good point. I've tried to look for other cases of |Value| static field under blink and is seems that platform/graphics/gpu/WebGLImageConversion.cpp is the only case.
lukasza@chromium.org changed reviewers: + chrishtr@chromium.org
chrishtr@, could you please take a look?
Is this compatible with the chromium style guide? Deferring to danakj on that question..
It's common practice to make type traits like this. Examples: https://cs.chromium.org/chromium/src/base/template_util.h?rcl=0&l=112 https://cs.chromium.org/chromium/src/third_party/WebKit/Source/wtf/TypeTraits... I think technically the style guide would say kValue but we super don't do that anywhere for type traits, so this lgtm
The CQ bit was checked by lukasza@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm
The CQ bit was checked by lukasza@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== s/Value/value/g for type trait value field in WebGLImageConversion.cpp Lowercase |value| is desirable: - For consistency with other type traits: - in WTF - e.g. WTF::IsAssignable<T>::value - in standard library - e.g. std::is_base_of<T1, T2>::value - in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value - To help |rewrite_to_chrome_style| tool. BUG=640749 ========== to ========== s/Value/value/g for type trait value field in WebGLImageConversion.cpp Lowercase |value| is desirable: - For consistency with other type traits: - in WTF - e.g. WTF::IsAssignable<T>::value - in standard library - e.g. std::is_base_of<T1, T2>::value - in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value - To help |rewrite_to_chrome_style| tool. BUG=640749 ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001)
Message was sent while issue was closed.
Description was changed from ========== s/Value/value/g for type trait value field in WebGLImageConversion.cpp Lowercase |value| is desirable: - For consistency with other type traits: - in WTF - e.g. WTF::IsAssignable<T>::value - in standard library - e.g. std::is_base_of<T1, T2>::value - in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value - To help |rewrite_to_chrome_style| tool. BUG=640749 ========== to ========== s/Value/value/g for type trait value field in WebGLImageConversion.cpp Lowercase |value| is desirable: - For consistency with other type traits: - in WTF - e.g. WTF::IsAssignable<T>::value - in standard library - e.g. std::is_base_of<T1, T2>::value - in v8 - e.g. IsIntegerArithmeticSafe<T, Lhs, Rhs>::value - To help |rewrite_to_chrome_style| tool. BUG=640749 Committed: https://crrev.com/1c4e7baae394ba46842f177de2829face052faa5 Cr-Commit-Position: refs/heads/master@{#418134} ==========
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/1c4e7baae394ba46842f177de2829face052faa5 Cr-Commit-Position: refs/heads/master@{#418134} |
