0
Commit Graph

30 Commits

Author SHA1 Message Date
Hans Wennborg
0917de897c Remove/replace unnecessary logging.h includes in .cc files (content)
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}
2020-04-28 20:21:15 +00:00
Gabriel Charette
9f60dd1181 Reland "IWYU for bind/callback_helpers.h and ptr_util.h"
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}
2020-03-06 20:48:04 +00:00
Hans Wennborg
7a13e2645a 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}
2020-03-06 19:43:33 +00:00
Gabriel Charette
b8ffaf4cfc 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}
2020-03-06 14:08:36 +00:00
danakj
b8a784ea5b Convert base::Bind to base::Bind{Once,Repeating} in content/public/.
This converts single use callbacks for histograms, flash, quotas and
push messaging.

R=avi@chromium.org
TBR=halliwell

Bug: 1007763
Change-Id: I2ace97cfeba4d66294636cfe34d81b03ce332d56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1958691
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723350}
2019-12-10 14:51:44 +00:00
Makoto Shimazu
51176e6cdf Convert base::Bind to base::Bind{Once,Repeating} in content/browser
This CL converts base::Bind to BindOnce or BindRepeating, and also changes
relevant base::Callbacks or base::Closures to appropriate types.

This CL is split from https://crrev.com/c/1831621.

This CL was uploaded by git cl split.

R=boliu@chromium.org

Bug: 1007760
Change-Id: I235ac01f30acce3df1ce9f8a59d6d0a9da73449e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849476
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Auto-Submit: Makoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704626}
2019-10-10 14:43:17 +00:00
Sami Kyostila
8e4d5a915e content/browser: Always specify thread affinity when posting tasks
*** 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}
2019-08-02 12:45:05 +00:00
jdoerrie
55ec69dc51 [clang-tidy] Apply modernize-use-auto in /content/browser
This change applies clang-tidy's modernize-use-auto [1] in /content/browser.
This change does not rewrite new and cast expressions.

Reproduction steps:
- run clang-tidy's modernize-use-auto
- run git cl format
- manually remove unused typedefs due to -Wunused-local-typedef error

[1] https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html

This CL was uploaded by git cl split.

R=boliu@chromium.org, mkwst@chromium.org

Bug: 890902
Change-Id: I06146497aa7a8cba7516eb17497ca33454141b2a
Reviewed-on: https://chromium-review.googlesource.com/c/1257909
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597544}
2018-10-08 13:34:46 +00:00
Eric Seckler
8652dcd5d8 content: Replace uses of BrowserThread task posting with post_task.h API
This patch updates callsites of BrowserThread task posting methods to
use the post_task.h API instead.

Background: We're changing the way tasks are posted to a BrowserThread,
see PSA [1] and design doc [2]. This unifies the way tasks are posted
and paves the way for annotating tasks with task types and other
attributes that can be used to prioritize tasks in the future browser
UI thread scheduler (design doc [3]).

This CL changes callsites of the following forms:
(a) BrowserThread::Post*Task(BrowserThread::UI/IO, ..) to
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI/IO}, ..),
(b) BrowserThread::GetTaskRunnerForThread(BrowserThread::UI/IO) to
    base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI/IO}).

It also adds necessary includes. These mechanical changes were applied
by a script.

Tasks posted with the same BrowserThread::ID trait (via
PostTaskWithTraits or TaskRunners obtained from
Create*TaskRunnerWithTraits) will still execute in the order they
were posted, see [4].

[1] https://groups.google.com/a/chromium.org/d/topic/chromium-dev/A3_snMVXv8A/discussion
[2] https://docs.google.com/document/d/1SGy9VTXUwyXEX_yBZ0ukFAnS8B0hDeMUJD-1iALaE-Q/edit?usp=sharing
[3] https://docs.google.com/document/d/1z1BDq9vzcEpkhN9LSPF5XMnZ0kLJ8mWWkNAi4OI7cos/edit?usp=sharing
[4] https://cs.chromium.org/chromium/src/base/task/post_task.h?l=66

TBR=achuith@chromium.org, afakhry@chromium.org, agl@chromium.org, avi@chromium.org, bbudge@chromium.org, bengr@chromium.org, benwells@chromium.org, bnc@chromium.org, calamity@chromium.org, ccameron@chromium.org, chiniforooshan@chromium.org, cjgrant@chromium.org, cmumford@chromium.org, csharrison@chromium.org, dalecurtis@chromium.org, delphick@chromium.org, dgozman@chromium.org, dmazzoni@chromium.org, droger@chromium.org, dschuff@chromium.org, dullweber@chromium.org, erikchen@chromium.org, felt@chromium.org, fgorski@chromium.org, gogerald@chromium.org, groby@chromium.org, horo@chromium.org, imcheng@chromium.org, jcivelli@chromium.org, jianli@chromium.org, jinho.bang@samsung.com, jkarlin@chromium.org, jochen@chromium.org, kinuko@chromium.org, lazyboy@chromium.org, lpy@chromium.org, markusheintz@chromium.org, mattcary@chromium.org, maxmorin@chromium.org, miu@chromium.org, mkwst@chromium.org, mmenke@chromium.org, mpearson@chromium.org, msramek@chromium.org, nick@chromium.org, nparker@chromium.org, nyquist@chromium.org, peter@chromium.org, pwnall@chromium.org, qinmin@chromium.org, rbpotter@chromium.org, rdevlin.cronin@chromium.org, rouslan@chromium.org, scottmg@chromium.org, servolk@chromium.org, skuhne@chromium.org, sky@chromium.org, tapted@chromium.org, tbansal@chromium.org, thestig@chromium.org, tommi@chromium.org, tommycli@chromium.org, torne@chromium.org, tschumann@chromium.org, vabr@chromium.org, vakh@chromium.org, waffles@chromium.org, yfriedman@chromium.org, zmo@chromium.org, bartfab@chromium.org

Bug: 878356
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I37526c8e75630ee7bec29421276094a30e903894
Reviewed-on: https://chromium-review.googlesource.com/1186623
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592750}
2018-09-20 10:42:28 +00:00
Steven Holte
9592222b61 Replace UMA_HISTOGRAM_COUNTS with UMA_HISTOGRAM_COUNTS_1M.
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}
2018-09-14 20:06:23 +00:00
Tommy Nyquist
4b749d0e31 Reland "Add std::move() to local base::Callback instances in //content"
This reverts commit 9b4af06d02.

Reason for revert: This does not seem like the root cause.

Original change's description:
> Revert "Add std::move() to local base::Callback instances in //content"
> 
> This reverts commit c55a5a47ee.
> 
> Reason for revert: Speculative revert because of renderer crashes across
> the board on Android with:
> [FATAL:weak_ptr.cc(26)] Check failed: sequence_checker_.CalledOnValidSequence(). WeakPtrs must be checked on the same sequenced thread
> 
> Original change's description:
> > Add std::move() to local base::Callback instances in //content
> > 
> > This adds std::move() around base::Callback instances where it looks
> > relevant, by applying `base_bind_rewriters -rewriter=add_std_move`.
> > https://crrev.com/c/970143, plus manual fixes.
> > 
> > Example:
> >   // Before:
> >   void set_callback(base::Closure cb) { g_cb = cb; }
> >   void RunCallback(base::Callback<void(int)> cb) { cb.Run(42); }
> >   void Post() {
> >     base::Closure task = base::Bind(&Foo);
> >     PostTask(FROM_HERE, task);
> >   }
> > 
> >   // After:
> >   void set_callback(base::Closure cb) { g_cb = std::move(cb); }
> >   void RunCallback(base::Callback<void(int)> cb) { std::move(cb).Run(42); }
> >   void Post() {
> >     base::Closure task = base::Bind(&Foo);
> >     PostTask(FROM_HERE, std::move(task));
> >   }
> > 
> > Specifically, it inserts std::move() if:
> >  - it's a pass-by-value parameter or non-const local variable.
> >  - the occurrence is the latest in its control flow.
> >  - no pointer is taken for the variable.
> >  - no capturing lambda exists for the variable.
> > 
> > Change-Id: I53853f9b9c8604994e2065af66ed4607af9c12ed
> > Reviewed-on: https://chromium-review.googlesource.com/970056
> > Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> > Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#544356}
> 
> TBR=kinuko@chromium.org,tzik@chromium.org
> 
> Change-Id: Ie7392a2229e1ef0f740d8958f8fe43d99b0460e9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/972321
> Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
> Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#544527}

TBR=kinuko@chromium.org,nyquist@chromium.org,tzik@chromium.org

Change-Id: I0aabd6032a070a28d0e5a4f796f37fe18f1e5cd4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/972302
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544536}
2018-03-20 21:46:29 +00:00
Tommy Nyquist
9b4af06d02 Revert "Add std::move() to local base::Callback instances in //content"
This reverts commit c55a5a47ee.

Reason for revert: Speculative revert because of renderer crashes across
the board on Android with:
[FATAL:weak_ptr.cc(26)] Check failed: sequence_checker_.CalledOnValidSequence(). WeakPtrs must be checked on the same sequenced thread

Original change's description:
> Add std::move() to local base::Callback instances in //content
> 
> This adds std::move() around base::Callback instances where it looks
> relevant, by applying `base_bind_rewriters -rewriter=add_std_move`.
> https://crrev.com/c/970143, plus manual fixes.
> 
> Example:
>   // Before:
>   void set_callback(base::Closure cb) { g_cb = cb; }
>   void RunCallback(base::Callback<void(int)> cb) { cb.Run(42); }
>   void Post() {
>     base::Closure task = base::Bind(&Foo);
>     PostTask(FROM_HERE, task);
>   }
> 
>   // After:
>   void set_callback(base::Closure cb) { g_cb = std::move(cb); }
>   void RunCallback(base::Callback<void(int)> cb) { std::move(cb).Run(42); }
>   void Post() {
>     base::Closure task = base::Bind(&Foo);
>     PostTask(FROM_HERE, std::move(task));
>   }
> 
> Specifically, it inserts std::move() if:
>  - it's a pass-by-value parameter or non-const local variable.
>  - the occurrence is the latest in its control flow.
>  - no pointer is taken for the variable.
>  - no capturing lambda exists for the variable.
> 
> Change-Id: I53853f9b9c8604994e2065af66ed4607af9c12ed
> Reviewed-on: https://chromium-review.googlesource.com/970056
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#544356}

TBR=kinuko@chromium.org,tzik@chromium.org

Change-Id: Ie7392a2229e1ef0f740d8958f8fe43d99b0460e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/972321
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Commit-Queue: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544527}
2018-03-20 21:37:17 +00:00
tzik
c55a5a47ee Add std::move() to local base::Callback instances in //content
This adds std::move() around base::Callback instances where it looks
relevant, by applying `base_bind_rewriters -rewriter=add_std_move`.
https://crrev.com/c/970143, plus manual fixes.

Example:
  // Before:
  void set_callback(base::Closure cb) { g_cb = cb; }
  void RunCallback(base::Callback<void(int)> cb) { cb.Run(42); }
  void Post() {
    base::Closure task = base::Bind(&Foo);
    PostTask(FROM_HERE, task);
  }

  // After:
  void set_callback(base::Closure cb) { g_cb = std::move(cb); }
  void RunCallback(base::Callback<void(int)> cb) { std::move(cb).Run(42); }
  void Post() {
    base::Closure task = base::Bind(&Foo);
    PostTask(FROM_HERE, std::move(task));
  }

Specifically, it inserts std::move() if:
 - it's a pass-by-value parameter or non-const local variable.
 - the occurrence is the latest in its control flow.
 - no pointer is taken for the variable.
 - no capturing lambda exists for the variable.

Change-Id: I53853f9b9c8604994e2065af66ed4607af9c12ed
Reviewed-on: https://chromium-review.googlesource.com/970056
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544356}
2018-03-20 14:35:44 +00:00
Daniel Bratell
b8d076c100 Avoid importing base::Time into the global scope because X11
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}
2018-01-03 17:55:59 +00:00
Ivan Kotenkov
2c0d2bb3fe Convert 0 to nullptr in content using clang-tidy.
Bug: 778942
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: Iee6be84c23149c745b3afd6e6158764f92ccd17f
Reviewed-on: https://chromium-review.googlesource.com/732305
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Ivan Kotenkov <kotenkov@yandex-team.ru>
Cr-Commit-Position: refs/heads/master@{#513138}
2017-11-01 15:41:28 +00:00
tzik
e2aca9904e Apply base_bind_rewriters to //content/browser
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}
2017-09-05 08:50:54 +00:00
fdoray
0c755de5d0 Remove MessageLoop::current() from chrome_metrics_service_client.cc
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}
2016-10-19 15:32:24 +00:00
asvitkine
3033081a92 Change includes of histogram.h to histogram_macros.h.
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}
2016-08-30 04:04:19 +00:00
olli.raula
36aa8be4eb Move Singleton and related structs to namespace base
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}
2015-09-10 11:15:10 +00:00
skyostil
95082a6a47 content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with
https://codereview.chromium.org/1010073002/.

BUG=465354
TBR=nick@chromium.org

Committed: https://crrev.com/422456f9d53f0bf936a64f21a1463fd0abd3df84
Cr-Commit-Position: refs/heads/master@{#333081}

Review URL: https://codereview.chromium.org/1159623009

Cr-Commit-Position: refs/heads/master@{#333112}
2015-06-05 19:53:37 +00:00
skyostil
d4104aab63 Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs"
This reverts commit 422456f9d5.

TBR=zea@chromium.org
BUG=465354
NOTRY=true
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/1170623003

Cr-Commit-Position: refs/heads/master@{#333086}
2015-06-05 17:49:39 +00:00
skyostil
422456f9d5 content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with
https://codereview.chromium.org/1010073002/.

BUG=465354
TBR=nick@chromium.org

Review URL: https://codereview.chromium.org/1159623009

Cr-Commit-Position: refs/heads/master@{#333081}
2015-06-05 17:24:40 +00:00
skyostil
74f13dc2b6 Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs"
This reverts commit 5d18b2493a.

Reason: Broke iOS build: http://build.chromium.org/p/chromium.mac/builders/iOS_Simulator_%28dbg%29/builds/27843

NOTRY=true
NOTREECHECKS=true
BUG=465354
TBR=sievers@chromium.org,nick@chromium.org

Review URL: https://codereview.chromium.org/1153503009

Cr-Commit-Position: refs/heads/master@{#333047}
2015-06-05 15:26:51 +00:00
skyostil
5d18b2493a content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with
https://codereview.chromium.org/1010073002/.

BUG=465354
TBR=nick@chromium.org

Review URL: https://codereview.chromium.org/1159623009

Cr-Commit-Position: refs/heads/master@{#333043}
2015-06-05 14:21:03 +00:00
mostynb
4c27d0473b favor DCHECK_CURRENTLY_ON for better logs in content/browser/[f-p]*
BUG=466848

Review URL: https://codereview.chromium.org/1000373002

Cr-Commit-Position: refs/heads/master@{#321215}
2015-03-18 21:48:38 +00:00
vitalybuka@chromium.org
6afa90f099 Consolidate serialization code in base::HistogramDeltasSerializer
Before patch code lived partially in base/ and content/

BUG=305019

Review URL: https://codereview.chromium.org/27460003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230268 0039d316-1c4b-4281-b951-d872f2087c98
2013-10-23 01:16:04 +00:00
xhwang@chromium.org
dd32b127ce content: Use base::MessageLoop.
BUG=236029
R=avi@chromium.org

Review URL: https://chromiumcodereview.appspot.com/14335017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198316 0039d316-1c4b-4281-b951-d872f2087c98
2013-05-04 14:17:11 +00:00
kaiwang@chromium.org
c50c21d07c Serialize/Deserialize support in HistogramBase
BUG=139612,167343


Review URL: https://chromiumcodereview.appspot.com/11682003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176449 0039d316-1c4b-4281-b951-d872f2087c98
2013-01-11 21:52:44 +00:00
jam@chromium.org
464883218e Move remaining files in content\browser to the content namespace.
Review URL: https://codereview.chromium.org/11340029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164828 0039d316-1c4b-4281-b951-d872f2087c98
2012-10-30 03:22:20 +00:00
rtenneti@google.com
83ab4a2858 Histograms - Support histograms for Plugins, GPU
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
2012-07-12 18:19:45 +00:00