summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlink Reformat <blink-reformat@chromium.org>2017-04-10 01:34:54 +0900
committerQijiang Fan <fqj@google.com>2020-06-05 05:47:22 +0900
commitd659737448303cbdf61e3d23274b14ddd63ec5cf (patch)
tree4be82e637182687a47752bf8229e28744a787a9d
parent24c654d2400f5a484c84c5cf8a0a9a7fc4bb3ed4 (diff)
downloadlibchrome-d659737448303cbdf61e3d23274b14ddd63ec5cf.tar.gz
The Blink Rename
Identifiers in Blink now largely follow the standard Chrome style conventions, with several additional rules: - web-exposed methods remain namedLikeThis() for consistency with Javascript bindings. - method names are never named_in_hacker_case() - enumerator names are kNamedLikeThis. This commit was generated by the following process. 1. Running //tools/clang/rewrite_to_chrome_style across the codebase. 2. Apply manual fixes. 3. git cl format BUG=578344 R=lukasza@chromium.org TBR=darin@chromium.org Change-Id: Ide5d397d3c6a5d973fd0a6f81dccf82561d4bb71 Reviewed-on: https://chromium-review.googlesource.com/472192 Reviewed-by: Blink Reformat <blink-reformat@chromium.org> Cr-Commit-Position: refs/heads/master@{#463139} CrOS-Libchrome-Original-Commit: 1c4d759e44259650dfb2c426a7f997d2d0bc73dc
-rw-r--r--mojo/public/cpp/bindings/array_traits_wtf_vector.h8
-rw-r--r--mojo/public/cpp/bindings/lib/string_traits_wtf.cc14
-rw-r--r--mojo/public/cpp/bindings/lib/wtf_hash_util.h30
-rw-r--r--mojo/public/cpp/bindings/map_traits_wtf_hash_map.h6
-rw-r--r--mojo/public/cpp/bindings/string_traits_wtf.h2
-rw-r--r--mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc12
-rw-r--r--mojo/public/cpp/bindings/tests/wtf_map_unittest.cc8
-rw-r--r--mojo/public/cpp/bindings/tests/wtf_types_unittest.cc4
-rw-r--r--mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl14
9 files changed, 49 insertions, 49 deletions
diff --git a/mojo/public/cpp/bindings/array_traits_wtf_vector.h b/mojo/public/cpp/bindings/array_traits_wtf_vector.h
index 6e207351fd..2aea2c47e8 100644
--- a/mojo/public/cpp/bindings/array_traits_wtf_vector.h
+++ b/mojo/public/cpp/bindings/array_traits_wtf_vector.h
@@ -21,14 +21,14 @@ struct ArrayTraits<WTF::Vector<U>> {
static void SetToNull(WTF::Vector<U>* output) {
// WTF::Vector<> doesn't support null state. Set it to empty instead.
- output->clear();
+ output->Clear();
}
static size_t GetSize(const WTF::Vector<U>& input) { return input.size(); }
- static U* GetData(WTF::Vector<U>& input) { return input.data(); }
+ static U* GetData(WTF::Vector<U>& input) { return input.Data(); }
- static const U* GetData(const WTF::Vector<U>& input) { return input.data(); }
+ static const U* GetData(const WTF::Vector<U>& input) { return input.Data(); }
static U& GetAt(WTF::Vector<U>& input, size_t index) { return input[index]; }
@@ -37,7 +37,7 @@ struct ArrayTraits<WTF::Vector<U>> {
}
static bool Resize(WTF::Vector<U>& input, size_t size) {
- input.resize(size);
+ input.Resize(size);
return true;
}
};
diff --git a/mojo/public/cpp/bindings/lib/string_traits_wtf.cc b/mojo/public/cpp/bindings/lib/string_traits_wtf.cc
index 203f6f5903..3bda50f18e 100644
--- a/mojo/public/cpp/bindings/lib/string_traits_wtf.cc
+++ b/mojo/public/cpp/bindings/lib/string_traits_wtf.cc
@@ -16,7 +16,7 @@ namespace {
struct UTF8AdaptorInfo {
explicit UTF8AdaptorInfo(const WTF::String& input) : utf8_adaptor(input) {
#if DCHECK_IS_ON()
- original_size_in_bytes = input.charactersSizeInBytes();
+ original_size_in_bytes = input.CharactersSizeInBytes();
#endif
}
@@ -34,7 +34,7 @@ UTF8AdaptorInfo* ToAdaptor(const WTF::String& input, void* context) {
UTF8AdaptorInfo* adaptor = static_cast<UTF8AdaptorInfo*>(context);
#if DCHECK_IS_ON()
- DCHECK_EQ(adaptor->original_size_in_bytes, input.charactersSizeInBytes());
+ DCHECK_EQ(adaptor->original_size_in_bytes, input.CharactersSizeInBytes());
#endif
return adaptor;
}
@@ -43,11 +43,11 @@ UTF8AdaptorInfo* ToAdaptor(const WTF::String& input, void* context) {
// static
void StringTraits<WTF::String>::SetToNull(WTF::String* output) {
- if (output->isNull())
+ if (output->IsNull())
return;
WTF::String result;
- output->swap(result);
+ output->Swap(result);
}
// static
@@ -70,14 +70,14 @@ size_t StringTraits<WTF::String>::GetSize(const WTF::String& input,
// static
const char* StringTraits<WTF::String>::GetData(const WTF::String& input,
void* context) {
- return ToAdaptor(input, context)->utf8_adaptor.data();
+ return ToAdaptor(input, context)->utf8_adaptor.Data();
}
// static
bool StringTraits<WTF::String>::Read(StringDataView input,
WTF::String* output) {
- WTF::String result = WTF::String::fromUTF8(input.storage(), input.size());
- output->swap(result);
+ WTF::String result = WTF::String::FromUTF8(input.storage(), input.size());
+ output->Swap(result);
return true;
}
diff --git a/mojo/public/cpp/bindings/lib/wtf_hash_util.h b/mojo/public/cpp/bindings/lib/wtf_hash_util.h
index cc590da67a..d4cd505c71 100644
--- a/mojo/public/cpp/bindings/lib/wtf_hash_util.h
+++ b/mojo/public/cpp/bindings/lib/wtf_hash_util.h
@@ -48,7 +48,7 @@ struct WTFHashTraits<T, false> {
template <>
struct WTFHashTraits<WTF::String, false> {
static size_t Hash(size_t seed, const WTF::String& value) {
- return HashCombine(seed, WTF::StringHash::hash(value));
+ return HashCombine(seed, WTF::StringHash::GetHash(value));
}
};
@@ -59,25 +59,25 @@ size_t WTFHash(size_t seed, const T& value) {
template <typename T>
struct StructPtrHashFn {
- static unsigned hash(const StructPtr<T>& value) {
+ static unsigned GetHash(const StructPtr<T>& value) {
return value.Hash(kHashSeed);
}
- static bool equal(const StructPtr<T>& left, const StructPtr<T>& right) {
+ static bool Equal(const StructPtr<T>& left, const StructPtr<T>& right) {
return left.Equals(right);
}
- static const bool safeToCompareToEmptyOrDeleted = false;
+ static const bool safe_to_compare_to_empty_or_deleted = false;
};
template <typename T>
struct InlinedStructPtrHashFn {
- static unsigned hash(const InlinedStructPtr<T>& value) {
+ static unsigned GetHash(const InlinedStructPtr<T>& value) {
return value.Hash(kHashSeed);
}
- static bool equal(const InlinedStructPtr<T>& left,
+ static bool Equal(const InlinedStructPtr<T>& left,
const InlinedStructPtr<T>& right) {
return left.Equals(right);
}
- static const bool safeToCompareToEmptyOrDeleted = false;
+ static const bool safe_to_compare_to_empty_or_deleted = false;
};
} // namespace internal
@@ -93,14 +93,14 @@ struct DefaultHash<mojo::StructPtr<T>> {
template <typename T>
struct HashTraits<mojo::StructPtr<T>>
: public GenericHashTraits<mojo::StructPtr<T>> {
- static const bool hasIsEmptyValueFunction = true;
- static bool isEmptyValue(const mojo::StructPtr<T>& value) {
+ static const bool kHasIsEmptyValueFunction = true;
+ static bool IsEmptyValue(const mojo::StructPtr<T>& value) {
return value.is_null();
}
- static void constructDeletedValue(mojo::StructPtr<T>& slot, bool) {
+ static void ConstructDeletedValue(mojo::StructPtr<T>& slot, bool) {
mojo::internal::StructPtrWTFHelper<T>::ConstructDeletedValue(slot);
}
- static bool isDeletedValue(const mojo::StructPtr<T>& value) {
+ static bool IsDeletedValue(const mojo::StructPtr<T>& value) {
return mojo::internal::StructPtrWTFHelper<T>::IsHashTableDeletedValue(
value);
}
@@ -114,14 +114,14 @@ struct DefaultHash<mojo::InlinedStructPtr<T>> {
template <typename T>
struct HashTraits<mojo::InlinedStructPtr<T>>
: public GenericHashTraits<mojo::InlinedStructPtr<T>> {
- static const bool hasIsEmptyValueFunction = true;
- static bool isEmptyValue(const mojo::InlinedStructPtr<T>& value) {
+ static const bool kHasIsEmptyValueFunction = true;
+ static bool IsEmptyValue(const mojo::InlinedStructPtr<T>& value) {
return value.is_null();
}
- static void constructDeletedValue(mojo::InlinedStructPtr<T>& slot, bool) {
+ static void ConstructDeletedValue(mojo::InlinedStructPtr<T>& slot, bool) {
mojo::internal::InlinedStructPtrWTFHelper<T>::ConstructDeletedValue(slot);
}
- static bool isDeletedValue(const mojo::InlinedStructPtr<T>& value) {
+ static bool IsDeletedValue(const mojo::InlinedStructPtr<T>& value) {
return mojo::internal::InlinedStructPtrWTFHelper<
T>::IsHashTableDeletedValue(value);
}
diff --git a/mojo/public/cpp/bindings/map_traits_wtf_hash_map.h b/mojo/public/cpp/bindings/map_traits_wtf_hash_map.h
index dd68b3686a..ef01466be3 100644
--- a/mojo/public/cpp/bindings/map_traits_wtf_hash_map.h
+++ b/mojo/public/cpp/bindings/map_traits_wtf_hash_map.h
@@ -25,7 +25,7 @@ struct MapTraits<WTF::HashMap<K, V>> {
static void SetToNull(WTF::HashMap<K, V>* output) {
// WTF::HashMap<> doesn't support null state. Set it to empty instead.
- output->clear();
+ output->Clear();
}
static size_t GetSize(const WTF::HashMap<K, V>& input) {
@@ -48,7 +48,7 @@ struct MapTraits<WTF::HashMap<K, V>> {
template <typename IK, typename IV>
static bool Insert(WTF::HashMap<K, V>& input, IK&& key, IV&& value) {
- if (!WTF::HashMap<K, V>::isValidKey(key)) {
+ if (!WTF::HashMap<K, V>::IsValidKey(key)) {
LOG(ERROR) << "The key value is disallowed by WTF::HashMap";
return false;
}
@@ -56,7 +56,7 @@ struct MapTraits<WTF::HashMap<K, V>> {
return true;
}
- static void SetToEmpty(WTF::HashMap<K, V>* output) { output->clear(); }
+ static void SetToEmpty(WTF::HashMap<K, V>* output) { output->Clear(); }
};
} // namespace mojo
diff --git a/mojo/public/cpp/bindings/string_traits_wtf.h b/mojo/public/cpp/bindings/string_traits_wtf.h
index 238c2eb119..8a9dc888b0 100644
--- a/mojo/public/cpp/bindings/string_traits_wtf.h
+++ b/mojo/public/cpp/bindings/string_traits_wtf.h
@@ -13,7 +13,7 @@ namespace mojo {
template <>
struct StringTraits<WTF::String> {
- static bool IsNull(const WTF::String& input) { return input.isNull(); }
+ static bool IsNull(const WTF::String& input) { return input.IsNull(); }
static void SetToNull(WTF::String* output);
static void* SetUpContext(const WTF::String& input);
diff --git a/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc
index 959d25b368..04f14b5cef 100644
--- a/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc
@@ -37,21 +37,21 @@ TEST_F(WTFHashTest, Enum) {
// Just check that this template instantiation compiles.
// Top-level.
- ASSERT_EQ(WTF::DefaultHash<blink::TopLevelEnum>::Hash().hash(
+ ASSERT_EQ(WTF::DefaultHash<blink::TopLevelEnum>::Hash().GetHash(
blink::TopLevelEnum::E0),
- WTF::DefaultHash<blink::TopLevelEnum>::Hash().hash(
+ WTF::DefaultHash<blink::TopLevelEnum>::Hash().GetHash(
blink::TopLevelEnum::E0));
// Nested in struct.
- ASSERT_EQ(WTF::DefaultHash<blink::TestWTFStruct::NestedEnum>::Hash().hash(
+ ASSERT_EQ(WTF::DefaultHash<blink::TestWTFStruct::NestedEnum>::Hash().GetHash(
blink::TestWTFStruct::NestedEnum::E0),
- WTF::DefaultHash<blink::TestWTFStruct::NestedEnum>::Hash().hash(
+ WTF::DefaultHash<blink::TestWTFStruct::NestedEnum>::Hash().GetHash(
blink::TestWTFStruct::NestedEnum::E0));
// Nested in interface.
- ASSERT_EQ(WTF::DefaultHash<blink::TestWTF::NestedEnum>::Hash().hash(
+ ASSERT_EQ(WTF::DefaultHash<blink::TestWTF::NestedEnum>::Hash().GetHash(
blink::TestWTF::NestedEnum::E0),
- WTF::DefaultHash<blink::TestWTF::NestedEnum>::Hash().hash(
+ WTF::DefaultHash<blink::TestWTF::NestedEnum>::Hash().GetHash(
blink::TestWTF::NestedEnum::E0));
}
diff --git a/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc
index dc40143168..4784af2921 100644
--- a/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc
@@ -16,8 +16,8 @@ TEST(WTFMapTest, StructKey) {
map.insert(blink::Rect::New(1, 2, 3, 4), 123);
blink::RectPtr key = blink::Rect::New(1, 2, 3, 4);
- ASSERT_NE(map.end(), map.find(key));
- ASSERT_EQ(123, map.find(key)->value);
+ ASSERT_NE(map.end(), map.Find(key));
+ ASSERT_EQ(123, map.Find(key)->value);
map.erase(key);
ASSERT_EQ(0u, map.size());
@@ -29,8 +29,8 @@ TEST(WTFMapTest, TypemappedStructKey) {
blink::ContainsHashablePtr key =
blink::ContainsHashable::New(RectBlink(1, 2, 3, 4));
- ASSERT_NE(map.end(), map.find(key));
- ASSERT_EQ(123, map.find(key)->value);
+ ASSERT_NE(map.end(), map.Find(key));
+ ASSERT_EQ(123, map.Find(key)->value);
map.erase(key);
ASSERT_EQ(0u, map.size());
diff --git a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
index 363ef7cdab..4c4819550c 100644
--- a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
@@ -68,7 +68,7 @@ WTF::Vector<WTF::String> ConstructStringArray() {
// strs[1] is empty.
strs[1] = "";
strs[2] = kHelloWorld;
- strs[3] = WTF::String::fromUTF8(kUTF8HelloWorld);
+ strs[3] = WTF::String::FromUTF8(kUTF8HelloWorld);
return strs;
}
@@ -78,7 +78,7 @@ WTF::HashMap<WTF::String, WTF::String> ConstructStringMap() {
// A null string as value.
str_map.insert("0", WTF::String());
str_map.insert("1", kHelloWorld);
- str_map.insert("2", WTF::String::fromUTF8(kUTF8HelloWorld));
+ str_map.insert("2", WTF::String::FromUTF8(kUTF8HelloWorld));
return str_map;
}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
index aecb32e10b..c334a52f98 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
@@ -94,14 +94,14 @@ struct hash<{{enum_name}}>
{%- set deleted_value_unused = "false" if empty_value in enum|all_enum_values else "true" %}
namespace WTF {
struct {{hash_fn_name}} {
- static unsigned hash(const {{enum_name}}& value) {
+ static unsigned GetHash(const {{enum_name}}& value) {
using utype = std::underlying_type<{{enum_name}}>::type;
- return DefaultHash<utype>::Hash().hash(static_cast<utype>(value));
+ return DefaultHash<utype>::Hash().GetHash(static_cast<utype>(value));
}
- static bool equal(const {{enum_name}}& left, const {{enum_name}}& right) {
+ static bool Equal(const {{enum_name}}& left, const {{enum_name}}& right) {
return left == right;
}
- static const bool safeToCompareToEmptyOrDeleted = true;
+ static const bool safe_to_compare_to_empty_or_deleted = true;
};
template <>
@@ -117,13 +117,13 @@ struct HashTraits<{{enum_name}}>
static_assert({{deleted_value_unused}},
"{{deleted_value}} is a reserved enum value");
static const bool hasIsEmptyValueFunction = true;
- static bool isEmptyValue(const {{enum_name}}& value) {
+ static bool IsEmptyValue(const {{enum_name}}& value) {
return value == static_cast<{{enum_name}}>({{empty_value}});
}
- static void constructDeletedValue({{enum_name}}& slot, bool) {
+ static void ConstructDeletedValue({{enum_name}}& slot, bool) {
slot = static_cast<{{enum_name}}>({{deleted_value}});
}
- static bool isDeletedValue(const {{enum_name}}& value) {
+ static bool IsDeletedValue(const {{enum_name}}& value) {
return value == static_cast<{{enum_name}}>({{deleted_value}});
}
};