0

Add PRESUBMIT check for set_owned_by_client().

Bug: 1044687
Change-Id: I698ba7bba434d30c6f2ed0928cc9c2059eb6a586
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097834
Reviewed-by: Robert Liao <robliao@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749738}
This commit is contained in:
Allen Bauer
2020-03-12 17:21:47 +00:00
committed by Commit Bot
parent 938fda4307
commit 53b43fb19e
2 changed files with 14 additions and 0 deletions

@ -1108,6 +1108,17 @@ _BANNED_CPP_FUNCTIONS = (
False,
[_THIRD_PARTY_EXCEPT_BLINK], # Not an error in third_party folders.
),
(
'set_owned_by_client',
(
'set_owned_by_client is deprecated.',
'views::View already owns the child views by default. This introduces ',
'a competing ownership model which makes the code difficult to reason ',
'about. See http://crbug.com/1044687 for more details.'
),
False,
(),
),
)
# Format: Sequence of tuples containing:

@ -1983,6 +1983,8 @@ class BannedTypeCheckTest(unittest.TestCase):
['GetInterfaceProvider()']),
MockFile('some/cpp/ok/file.cc',
['using std::string;']),
MockFile('some/cpp/problematic/file2.cc',
['set_owned_by_client()']),
]
results = PRESUBMIT._CheckNoBannedFunctions(input_api, MockOutputApi())
@ -1993,6 +1995,7 @@ class BannedTypeCheckTest(unittest.TestCase):
self.assertTrue(
'third_party/blink/problematic/file.cc' in results[0].message)
self.assertTrue('some/cpp/ok/file.cc' not in results[1].message)
self.assertTrue('some/cpp/problematic/file2.cc' in results[0].message)
def testBannedBlinkDowncastHelpers(self):
input_api = MockInputApi()