CHECK, CHECK_EQ etc., and NOTREACHED/NOTIMPLEMENTED have moved
to the much smaller headers check.h, check_op.h, and notreached.h,
respectively.
This CL updates .cc files to use those headers instead when
possible, with the purpose of saving compile time.
(Split out from https://crrev.com/c/2164525 which also has
notes on how the change was generated.)
Bug: 1031540
Change-Id: I643818242b92e19a1048fac89dd8aae323e8b1ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164510
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763511}
This reverts commit 7a13e2645a.
Reason for revert: same as original % tools/clang
Original change's description:
> Revert "IWYU for bind/callback_helpers.h and ptr_util.h"
>
> This reverts commit b8ffaf4cfc.
>
> Reason for revert:
> This broke the build of the blink_gc_plugin, which does not use base/
> (see bug). Please don't commit to tools/clang/ without review.
>
> Original change's description:
> > IWYU for bind/callback_helpers.h and ptr_util.h
> >
> > These missing includes are preventing removal of unused headers from
> > task_runner_util.h and consequently migration from task_runner_util.h to
> > task_runner.h's new PostTaskAndReplyWithResult member method.
> >
> > The following script was run on every file in the codebase, prioritizing
> > .h over matching .cc to best enforce the rule of not include a header
> > included by your .h :
> >
> > def Fix(file_path):
> > content = refactor_lib.ReadFile(file_path)
> >
> > # Assume fwd-decls are correct in first pass.
> > fwd_decls_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*class (NullCallback|DoNothing|ScopedClosureRunner);', re.DOTALL).findall(content)
> > if fwd_decls_match:
> > print 'fwd_decls_match in %s' % (file_path)
> > return False
> >
> > bind_helpers_match = re.compile(
> > # Doesn't begin with a comment.
> > r'\n *[^/\n][^/\n]'
> > # Anything else after a non-comment start (and don't allow this to capture a comment start either)
> > r'[^/\n]*'
> > # Anything before but an open angle-bracket to avoid cases like unique_ptr<Foo> where you don't need the full definition of Foo.
> > r'[^<]'
> > # Only match with base:: prefix; more precise, can manually fix missing includes in //base proper in a follow-up pass if needed.
> > r'base::(NullCallback|DoNothing|DeletePointer)\b[^*]', re.DOTALL).findall(content)
> >
> > callback_helpers_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*[^<]base::(IsBaseCallback|EnableIfIsBaseCallback|AdaptCallbackForRepeating|ScopedClosureRunner)\b[^*]', re.DOTALL).findall(content)
> >
> > ptr_util_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*[^<]base::WrapUnique\b[^*]', re.DOTALL).findall(content)
> >
> > if not bind_helpers_match and not callback_helpers_match and not ptr_util_match:
> > return False
> >
> > updated_content = content
> > if bind_helpers_match:
> > updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/bind_helpers.h")
> > if callback_helpers_match:
> > updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/callback_helpers.h")
> > if ptr_util_match:
> > updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/memory/ptr_util.h")
> >
> > if updated_content == content:
> > return False
> >
> > # Write updated file
> > refactor_lib.WriteFile(file_path, updated_content)
> >
> > return True
> >
> > TBR=danakj@chromium.org
> > (mechanical change for //base API)
> >
> > Bug: 1026641
> > Change-Id: Ic88585c62dd2f74d34c59c708faeddb231aee47f
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087971
> > Reviewed-by: Gabriel Charette <gab@chromium.org>
> > Reviewed-by: danakj <danakj@chromium.org>
> > Commit-Queue: Gabriel Charette <gab@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#747685}
>
> TBR=danakj@chromium.org,gab@chromium.org
>
> Change-Id: I59d6cd69bd898e9f6d10922c67d8c24ba582bf7f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 1026641, 1059359
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091356
> Reviewed-by: Hans Wennborg <hans@chromium.org>
> Commit-Queue: Hans Wennborg <hans@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#747804}
TBR=danakj@chromium.org,gab@chromium.org,hans@chromium.org
Change-Id: I721391eba68ea55830dca4f1ac34ff633f714f72
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1026641, 1059359
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090509
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747844}
This reverts commit b8ffaf4cfc.
Reason for revert:
This broke the build of the blink_gc_plugin, which does not use base/
(see bug). Please don't commit to tools/clang/ without review.
Original change's description:
> IWYU for bind/callback_helpers.h and ptr_util.h
>
> These missing includes are preventing removal of unused headers from
> task_runner_util.h and consequently migration from task_runner_util.h to
> task_runner.h's new PostTaskAndReplyWithResult member method.
>
> The following script was run on every file in the codebase, prioritizing
> .h over matching .cc to best enforce the rule of not include a header
> included by your .h :
>
> def Fix(file_path):
> content = refactor_lib.ReadFile(file_path)
>
> # Assume fwd-decls are correct in first pass.
> fwd_decls_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*class (NullCallback|DoNothing|ScopedClosureRunner);', re.DOTALL).findall(content)
> if fwd_decls_match:
> print 'fwd_decls_match in %s' % (file_path)
> return False
>
> bind_helpers_match = re.compile(
> # Doesn't begin with a comment.
> r'\n *[^/\n][^/\n]'
> # Anything else after a non-comment start (and don't allow this to capture a comment start either)
> r'[^/\n]*'
> # Anything before but an open angle-bracket to avoid cases like unique_ptr<Foo> where you don't need the full definition of Foo.
> r'[^<]'
> # Only match with base:: prefix; more precise, can manually fix missing includes in //base proper in a follow-up pass if needed.
> r'base::(NullCallback|DoNothing|DeletePointer)\b[^*]', re.DOTALL).findall(content)
>
> callback_helpers_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*[^<]base::(IsBaseCallback|EnableIfIsBaseCallback|AdaptCallbackForRepeating|ScopedClosureRunner)\b[^*]', re.DOTALL).findall(content)
>
> ptr_util_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*[^<]base::WrapUnique\b[^*]', re.DOTALL).findall(content)
>
> if not bind_helpers_match and not callback_helpers_match and not ptr_util_match:
> return False
>
> updated_content = content
> if bind_helpers_match:
> updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/bind_helpers.h")
> if callback_helpers_match:
> updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/callback_helpers.h")
> if ptr_util_match:
> updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/memory/ptr_util.h")
>
> if updated_content == content:
> return False
>
> # Write updated file
> refactor_lib.WriteFile(file_path, updated_content)
>
> return True
>
> TBR=danakj@chromium.org
> (mechanical change for //base API)
>
> Bug: 1026641
> Change-Id: Ic88585c62dd2f74d34c59c708faeddb231aee47f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087971
> Reviewed-by: Gabriel Charette <gab@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#747685}
TBR=danakj@chromium.org,gab@chromium.org
Change-Id: I59d6cd69bd898e9f6d10922c67d8c24ba582bf7f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1026641, 1059359
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091356
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747804}
These missing includes are preventing removal of unused headers from
task_runner_util.h and consequently migration from task_runner_util.h to
task_runner.h's new PostTaskAndReplyWithResult member method.
The following script was run on every file in the codebase, prioritizing
.h over matching .cc to best enforce the rule of not include a header
included by your .h :
def Fix(file_path):
content = refactor_lib.ReadFile(file_path)
# Assume fwd-decls are correct in first pass.
fwd_decls_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*class (NullCallback|DoNothing|ScopedClosureRunner);', re.DOTALL).findall(content)
if fwd_decls_match:
print 'fwd_decls_match in %s' % (file_path)
return False
bind_helpers_match = re.compile(
# Doesn't begin with a comment.
r'\n *[^/\n][^/\n]'
# Anything else after a non-comment start (and don't allow this to capture a comment start either)
r'[^/\n]*'
# Anything before but an open angle-bracket to avoid cases like unique_ptr<Foo> where you don't need the full definition of Foo.
r'[^<]'
# Only match with base:: prefix; more precise, can manually fix missing includes in //base proper in a follow-up pass if needed.
r'base::(NullCallback|DoNothing|DeletePointer)\b[^*]', re.DOTALL).findall(content)
callback_helpers_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*[^<]base::(IsBaseCallback|EnableIfIsBaseCallback|AdaptCallbackForRepeating|ScopedClosureRunner)\b[^*]', re.DOTALL).findall(content)
ptr_util_match = re.compile(r'\n *[^/\n][^/\n][^/\n]*[^<]base::WrapUnique\b[^*]', re.DOTALL).findall(content)
if not bind_helpers_match and not callback_helpers_match and not ptr_util_match:
return False
updated_content = content
if bind_helpers_match:
updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/bind_helpers.h")
if callback_helpers_match:
updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/callback_helpers.h")
if ptr_util_match:
updated_content = refactor_lib.AddInclude(file_path, updated_content, "base/memory/ptr_util.h")
if updated_content == content:
return False
# Write updated file
refactor_lib.WriteFile(file_path, updated_content)
return True
TBR=danakj@chromium.org
(mechanical change for //base API)
Bug: 1026641
Change-Id: Ic88585c62dd2f74d34c59c708faeddb231aee47f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087971
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747685}
*** Note: There is no behavior change from this patch. ***
The PostTask APIs will shortly be changed to require all tasks to explicitly
specify their thread affinity, i.e., whether the task should run on the thread
pool or a specific named thread such as a BrowserThread. This patch updates all
call sites with thread affinity annotation. We also remove the "WithTraits"
suffix to make the call sites more readable.
Before:
// Thread pool task.
base::PostTaskWithTraits(FROM_HERE, {...}, ...);
// UI thread task.
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI, ...}, ...);
After:
// Thread pool task.
base::PostTask(FROM_HERE, {base::ThreadPool(), ...}, ...);
// UI thread task.
base::PostTask(FROM_HERE, {BrowserThread::UI, ...}, ...);
This patch was semi-automatically prepared with these steps:
1. Patch in https://chromium-review.googlesource.com/c/chromium/src/+/1635827
to make thread affinity a build-time requirement.
2. Run an initial pass with a clang rewriter:
https://chromium-review.googlesource.com/c/chromium/src/+/1635623
3. ninja -C out/Debug | grep 'requested here' | cut -d: -f1-3 | sort | \
uniq > errors.txt
4. while read line; do
f=$(echo $line | cut -d: -f 1)
r=$(echo $line | cut -d: -f 2)
c=$(echo $line | cut -d: -f 3)
sed -i "${r}s/./&base::ThreadPool(),/$c" $f
done < errors.txt
5. GOTO 3 until build succeeds.
6. Remove the "WithTraits" suffix from task API call sites:
$ tools/git/mffr.py -i <(cat <<EOF
[
["PostTaskWithTraits", "PostTask"],
["PostDelayedTaskWithTraits", "PostDelayedTask"],
["PostTaskWithTraitsAndReply", "PostTaskAndReply"],
["CreateTaskRunnerWithTraits", "CreateTaskRunner"],
["CreateSequencedTaskRunnerWithTraits", "CreateSequencedTaskRunner"],
["CreateUpdateableSequencedTaskRunnerWithTraits", "CreateUpdateableSequencedTaskRunner"],
["CreateSingleThreadTaskRunnerWithTraits", "CreateSingleThreadTaskRunner"],
["CreateCOMSTATaskRunnerWithTraits", "CreateCOMSTATaskRunner"]
]
EOF
)
This CL was uploaded by git cl split.
R=boliu@chromium.org, tsepez@chromium.org
Bug: 968047
Change-Id: I346372d16a3856186ea74d14e0dd8a12f7cacae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729589
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683554}
This is a simple macro rename, with no functional changes.
The old name was deprecated, this is just cleaning up usage.
TBR=creis
Bug: 737689
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs;luci.chromium.try:linux_mojo;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I2b985990eb3c4fd13b4af6aa832c99834790ef78
Reviewed-on: https://chromium-review.googlesource.com/1173327
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591443}
base::Time in the global scope collides with X11 headers which
have a global typedef of Time to int. This patch moves the code so
that the symbols are imported into the local namespace (content)
instead.
X11 headers appear in some non-standard jumbo configurations
(extremely large jumbo chunks) but could happen at any time
otherwise as well.
Bug: 746953
Change-Id: Iadc929ca4eb7d556490d58c791bbe8b2ef119726
Reviewed-on: https://chromium-review.googlesource.com/848916
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526731}
This CL applies //tools/clang/base_bind_rewriters to //content/browser.
It rewrites base::Bind to base::BindOnce where the resulting base::Callback
is immediately converted to base::OnceCallback, which is considered safe
to use base::BindOnce.
E.g.:
base::PostTask(FROM_HERE, base::Bind([]{}));
base::OnceClosure cb = base::Bind([]{});
are converted to:
base::PostTask(FROM_HERE, base::BindOnce([]{}));
base::OnceClosure cb = base::BindOnce([]{});
Bug:
Change-Id: I601295ba4640f73bcbed14e93359227a8fb6eeb6
Reviewed-on: https://chromium-review.googlesource.com/644657
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499585}
Whenever possible, use Thread/SequencedTaskRunnerHandle::Get() instead
of MessageLoop::current(). Thread/SequencedTaskRunnerHandle::Get() work
within TaskScheduler while MessageLoop::current() doesn't.
Good reasons to use MessageLoop::current():
- Add destruction, nesting or task observers.
- Run nested loops.
Bad reasons to use MessageLoop::current():
- Post tasks. Use Thread/SequencedTaskRunnerHandle::Get() instead.
- Watch a file descriptor. Use FileDescriptorWatcher instead.
- Verify that it is possible to post tasks to the current thread.
Use Thread/SequencedTaskRunnerHandle::IsSet() instead.
- Verify that code runs on a specific thread. Use
SingleThreadTaskRunner::BelongsToCurrentThread() instead.
BUG=650723
Review-Url: https://chromiumcodereview.appspot.com/2412903002
Cr-Commit-Position: refs/heads/master@{#426200}
This is another pass of migration of includes for users of histogram
macros. This doesn't fully complete the migration, but gets us closer
to the end result.
A few files needed to include both headers as they use both
macros and the raw API.
BUG=416479
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
TBR=jam@chromium.org
Review-Url: https://codereview.chromium.org/2293583002
Cr-Commit-Position: refs/heads/master@{#415067}
Public APIs from base should live inside base:: so moved Singleton class
and structs to base{} and fixed consumers.
also fixed:
** Presubmit ERRORS **
Found Singleton<T> in the following header files.
Please move them to an appropriate source file so that the template
gets instantiated in a single compilation unit.
chrome/browser/plugins/plugin_finder.h \
chromecast/media/base/media_message_loop.h \
content/browser/media/android/media_drm_credential_manager.h
Presubmit warnings:
src/chrome/browser/extensions/warning_badge_service_factory.h:5:
#ifndef header guard has wrong style, please use:
CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_FACTORY_H_
[build/header_guard] [5]
src/chrome/browser/extensions/warning_badge_service_factory.h:39:
#endif line should be "#endif //
CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_FACTORY_H_"
[build/header_guard] [5]
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/1308823002
Cr-Commit-Position: refs/heads/master@{#348136}
and all child processes. Renderer processes also
use this new method to send histograms to browser.
This code is similar to the code that gets profiler
data from all processes.
R=jar@chromium.org,jam@chromium.org
TEST=browser unit tests, interactive UI tests
BUG=114013
Review URL: https://chromiumcodereview.appspot.com/10454086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146394 0039d316-1c4b-4281-b951-d872f2087c98