0

Add a note to URLFetcher that it shouldn't be use in content embedders.

Also add a presubmit warning to trigger on new/modified uses of
URLFetcher.

Bug: 746977, 598073
Change-Id: I962a9f9bdb0c8c533f5cc4e7ca5a919f917a89ca
Reviewed-on: https://chromium-review.googlesource.com/984512
Reviewed-by: Helen Li <xunjieli@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546605}
This commit is contained in:
Matt Menke
2018-03-28 21:38:37 +00:00
committed by Commit Bot
parent e630584f33
commit 7f520a8495
2 changed files with 23 additions and 0 deletions

@@ -543,6 +543,24 @@ _BANNED_CPP_FUNCTIONS = (
r'^third_party/sqlite/.*\.(c|cc|h)$',
),
),
(
'net::URLFetcher',
(
'net::URLFetcher should no longer be used in content embedders. ',
'Instead, use network::SimpleURLLoader instead, which supports ',
'an out-of-process network stack. ',
'net::URLFetcher may still be used in binaries that do not embed',
'content.',
),
True,
(
r'^ios[\\\/].*\.(cc|h)$',
r'.*[\\\/]ios[\\\/].*\.(cc|h)$',
r'.*_ios\.(cc|h)$',
r'^net[\\\/].*\.(cc|h)$',
r'.*[\\\/]tools[\\\/].*\.(cc|h)$',
),
),
)

@@ -39,6 +39,11 @@ class URLFetcherResponseWriter;
class URLRequestContextGetter;
class URLRequestStatus;
// NOTE: This class should not be used by content embedders, as it requires an
// in-process network stack. Content embedders should use
// network::SimpleURLLoader instead, which works with both in-process and
// out-of-process network stacks.
//
// To use this class, create an instance with the desired URL and a pointer to
// the object to be notified when the URL has been loaded:
// std::unique_ptr<URLFetcher> fetcher =