Modified: trunk/Tools/ChangeLog (200912 => 200913)
--- trunk/Tools/ChangeLog 2016-05-14 02:40:57 UTC (rev 200912)
+++ trunk/Tools/ChangeLog 2016-05-14 04:45:42 UTC (rev 200913)
@@ -1,3 +1,15 @@
+2016-05-13 Brady Eidson <[email protected]>
+
+ Extend protector naming code style guideline to cover operator= assignment.
+ https://bugs.webkit.org/show_bug.cgi?id=157693
+
+ Reviewed by Darin Adler.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_identifier_name_in_declaration):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (WebKitStyleTest.test_names):
+
2016-05-13 Aakash Jain <[email protected]>
Dashboard code restructuring
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (200912 => 200913)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2016-05-14 02:40:57 UTC (rev 200912)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2016-05-14 04:45:42 UTC (rev 200913)
@@ -3292,7 +3292,7 @@
return
# Make sure Ref/RefPtrs used as protectors are named correctly, and do this before we start stripping things off the input.
- ref_regexp = r'^\s*Ref(Ptr)?<([\w_]|::)+> (?P<protector_name>[\w_]+)\((\*|&)*(m_)?(?P<protected_name>[\w_]+)\);'
+ ref_regexp = r'^\s*Ref(Ptr)?<([\w_]|::)+> (?P<protector_name>[\w_]+)(\(| = )(\*|&)*(m_)?(?P<protected_name>[\w_]+)\)?;'
ref_check = match(ref_regexp, line)
if ref_check:
protector_name = ref_check.group('protector_name')
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (200912 => 200913)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2016-05-14 02:40:57 UTC (rev 200912)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2016-05-14 04:45:42 UTC (rev 200913)
@@ -5204,10 +5204,23 @@
self.assert_lint('Ref<Widget> protector(*m_widget);', '')
self.assert_lint('RefPtr<SomeNamespace::Node> protectedThis(this);', '')
self.assert_lint('RefPtr<SomeClass::InternalClass::Node> protectedThis(this);', '')
+ self.assert_lint('RefPtr<Node> protectedThis = this;', '')
+ self.assert_lint('Ref<Node> protectedThis = *this;', '')
+ self.assert_lint('RefPtr<Node> protectedNode = node;', '')
+ self.assert_lint('RefPtr<Node> protectedNode = &node;', '')
+ self.assert_lint('RefPtr<Node> protector = node;', '')
+ self.assert_lint('RefPtr<Node> protector = &node;', '')
+ self.assert_lint('Ref<Node> protectedNode = node;', '')
+ self.assert_lint('Ref<Node> protectedNode =*node;', '')
+ self.assert_lint('Ref<Node> protector = node;', '')
+ self.assert_lint('Ref<Node> protector = *node;', '')
+
# Invalid protector RefPtr/Ref variable names.
self.assert_lint('RefPtr<Node> protector(this);', "'protector' is incorrectly named. It should be named 'protectedThis'. [readability/naming/protected] [4]")
self.assert_lint('Ref<Node> protector(*this);', "'protector' is incorrectly named. It should be named 'protectedThis'. [readability/naming/protected] [4]")
+ self.assert_lint('RefPtr<Node> protector = this;', "'protector' is incorrectly named. It should be named 'protectedThis'. [readability/naming/protected] [4]")
+ self.assert_lint('Ref<Node> protector = *this;', "'protector' is incorrectly named. It should be named 'protectedThis'. [readability/naming/protected] [4]")
self.assert_lint('RefPtr<Node> self(this);', "'self' is incorrectly named. It should be named 'protectedThis'. [readability/naming/protected] [4]")
self.assert_lint('Ref<Node> self(*this);', "'self' is incorrectly named. It should be named 'protectedThis'. [readability/naming/protected] [4]")
self.assert_lint('RefPtr<Node> protectedThis(node);', "'protectedThis' is incorrectly named. It should be named 'protector' or 'protectedNode'. [readability/naming/protected] [4]")
@@ -5218,6 +5231,10 @@
self.assert_lint('RefPtr<Node> protectedNode(&otherNode);', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
self.assert_lint('Ref<Node> protectedNode(otherNode);', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
self.assert_lint('Ref<Node> protectedNode(*otherNode);', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
+ self.assert_lint('RefPtr<Node> protectedNode = otherNode;', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
+ self.assert_lint('RefPtr<Node> protectedNode = &otherNode;', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
+ self.assert_lint('Ref<Node> protectedNode = otherNode;', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
+ self.assert_lint('Ref<Node> protectedNode = *otherNode;', "'protectedNode' is incorrectly named. It should be named 'protector' or 'protectedOtherNode'. [readability/naming/protected] [4]")
self.assert_lint('RefPtr<Node> nodeRef(node);', "'nodeRef' is incorrectly named. It should be named 'protector' or 'protectedNode'. [readability/naming/protected] [4]")
self.assert_lint('Ref<Node> nodeRef(*node);', "'nodeRef' is incorrectly named. It should be named 'protector' or 'protectedNode'. [readability/naming/protected] [4]")
Modified: trunk/Websites/webkit.org/ChangeLog (200912 => 200913)
--- trunk/Websites/webkit.org/ChangeLog 2016-05-14 02:40:57 UTC (rev 200912)
+++ trunk/Websites/webkit.org/ChangeLog 2016-05-14 04:45:42 UTC (rev 200913)
@@ -1,5 +1,14 @@
2016-05-13 Brady Eidson <[email protected]>
+ Extend protector naming code style guideline to cover operator= assignment.
+ https://bugs.webkit.org/show_bug.cgi?id=157693
+
+ Reviewed by Darin Adler.
+
+ * code-style.md:
+
+2016-05-13 Brady Eidson <[email protected]>
+
Protector Ref/RefPtrs should have a specified naming style.
https://bugs.webkit.org/show_bug.cgi?id=157591
Modified: trunk/Websites/webkit.org/code-style.md (200912 => 200913)
--- trunk/Websites/webkit.org/code-style.md 2016-05-14 02:40:57 UTC (rev 200912)
+++ trunk/Websites/webkit.org/code-style.md 2016-05-14 04:45:42 UTC (rev 200913)
@@ -720,12 +720,14 @@
```cpp
RefPtr<Node> protectedThis(this);
Ref<Element> protectedThis(*this);
+RefPtr<Widget> protectedThis = this;
```
###### Wrong:
```cpp
RefPtr<Node> protector(this);
+Ref<Node> protector = *this;
RefPtr<Widget> self(this);
Ref<Element> elementRef(*this);
```
@@ -736,8 +738,10 @@
```cpp
RefPtr<Element> protector(&element);
+RefPtr<Element> protector = &element;
RefPtr<Node> protectedNode(node);
RefPtr<Widget> protectedMainWidget(m_mainWidget);
+RefPtr<Loader> protectedFontLoader = m_fontLoader;
```
###### Wrong:
@@ -745,8 +749,8 @@
```cpp
RefPtr<Node> nodeRef(&rootNode);
Ref<Element> protect(*element);
-RefPtr<Widget> protected(widget);
RefPtr<Node> protectorNode(node);
+RefPtr<Widget> protected = widget;
```
### Other Punctuation