0
Commit Graph

13 Commits

Author SHA1 Message Date
Chris Watkins
bb7211cd37 Run clang-tidy modernize-use-equals-{delete,default} on //base
See the bugs and cxx post for justification and details:
https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8

This change was done using clang-tidy as described here:
https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md

In some cases the the tool leaves behind a string of commas where it
replaced a member initializer list
(https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with:
  git diff --name-only | \
    xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/'

BUG=778959,778957

Change-Id: I95a3f3dae4796e4a7beb77793a6101f433a2c649
Reviewed-on: https://chromium-review.googlesource.com/789718
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Chris Watkins <watk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520033}
2017-11-29 07:16:38 +00:00
Brett Wilson
8e88b31585 Move Location to base namespace in base.
This removes the obsolete tracked_objects:: qualification on
uses of Location in //base.

TBR=dcheng@chromium.org

Bug: 763556
Change-Id: Iffdbf067f65f6dbfe309413294b8ace2e8917617
Reviewed-on: https://chromium-review.googlesource.com/662597
Reviewed-by: Brett Wilson <brettw@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501192}
2017-09-12 05:22:16 +00:00
tzik
92b7a42d1f Rewrite base::Bind into base::BindOnce on trivial cases in base
This CL is generated by a clang refactoring tool updated in
http://crrev.com/2789153002/, that rewrites base::Bind into base::BindOnce
where the resulting base::Callback is converted into base::OnceCallback
immediately after base::Bind call.

Review-Url: https://codereview.chromium.org/2791243002
Cr-Commit-Position: refs/heads/master@{#463631}
2017-04-11 15:00:44 +00:00
tzik
6e42784f92 Migrate base::TaskRunner from Closure to OnceClosure
After this CL, TaskRunner::PostTask and its family can take OnceClosure
in addition to Closure.

Most of the changes are mechanical replacement of Closure with OnceClosure
on TaskRunner family. Others are:
 - Limit CriticalClosure from Closure to OnceClosure as no caller call
   the resulting callback more than once
 - Add several PostTaskAndReplyWithResult overloads for old Callback
   version, for compatibility. (in base/task_scheduler/post_task.h)
 - Update SequencedWorkerPool implementation for OnceClosure.
 - Update task handling code in app_state.mm for OnceClosure, which is
   needed to bring OnceClosure into a ObjC block.

BUG=704027
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2637843002
Cr-Commit-Position: refs/heads/master@{#462023}
2017-04-05 10:13:21 +00:00
tzik
070c8ffb44 Pass Callback to TaskRunner by value and consume it on invocation
This is a preparation CL for http://crrev.com/2637843002, which replaces
the Callback parameter of TaskRunner::PostTask with OnceCallback.
This one replaces the passed-by-const-ref Callback parameter of
TaskRunner::PostTask() with pass-by-value.

With the pass-by-const-ref manner as the old code does, we can't avoid
leaving a reference to the callback object on the original thread. That
is, the callback object may be destroyed either on the target thread or
the original thread. That's problematic when a non-thread-safe object is
bound to the callback.

Pass-by-value and move() in this CL mitigate the nondeterminism: if the
caller of TaskRunner::PostTask() passes the callback object as rvalue,
TaskRunner::PostTask() leaves no reference on the original thread.
I.e. the reference is not left if the callback is passed directly from
Bind(), or passed with std::move() as below.

  task_runner->PostTask(FROM_HERE, base::Bind(&Foo));

  base::Closure cb = base::Bind(&Foo);
  task_runner->PostTask(FROM_HERE, std::move(cb));

Otherwise, if the caller passes the callback as lvalue, a reference to
the callback is left on the original thread as we do in the previous code.
I.e. a reference is left if the callback is passed from other non-temporary
variable.

  base::Closure cb = base::Bind(&Foo);
  task_runner->PostTask(FROM_HERE, cb);

This is less controversial part of http://crrev.com/2637843002. This CL
is mainly to land it incrementally.

TBR=shrike@chromium.org
BUG=704027
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2726523002
Cr-Commit-Position: refs/heads/master@{#460288}
2017-03-29 05:28:12 +00:00
tzik
b9dae93e67 Simplify SequencedTaskRunner::{Delete,Releaose}Soon impl
This CL removes SequencedTaskRunner-like type support from DeleteHelper.
There no longer exists such a class, and the removal simplify the
implementation.

TBR=kinuko@chromium.org, shess@chromium.org, asvitkine@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2686033002
Cr-Commit-Position: refs/heads/master@{#449544}
2017-02-10 03:57:30 +00:00
tzik
edbd386e6c Do not delete blink::WebRTCCertificateCallback on non-main thread
blink::WebRTCCertificateCallback has a blink::Persistent, which can not
be destroyed on the original thread. However, RTC implementation brings
it to a worker thread and occasionally deletes it on that thread, in
case the main thread is already gone.

This CL replaces the deleter of the std::unique_ptr that holds
WebRTCCertificateCallback with OnTaskRunnerDeleter, which ensures the
objects is deleted on the original thread.

BUG=627004

Review-Url: https://codereview.chromium.org/2164503002
Cr-Commit-Position: refs/heads/master@{#411965}
2016-08-15 15:14:07 +00:00
dbeam@chromium.org
fb441961d6 Revert 198844 "Move sequenced_task_runner to base/task"
Reverting revisions that rely on r198820 so to unbreak the build.

> Move sequenced_task_runner to base/task
> 
> BUG=
> R=akalin@chromium.org
> 
> Review URL: https://codereview.chromium.org/14927008

TBR=brettw@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198848 0039d316-1c4b-4281-b951-d872f2087c98
2013-05-08 05:35:24 +00:00
brettw@chromium.org
002c726a0d Move sequenced_task_runner to base/task
BUG=
R=akalin@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198844 0039d316-1c4b-4281-b951-d872f2087c98
2013-05-08 04:14:58 +00:00
tedvessenes@gmail.com
beea992443 Remove old Sleep and PostDelayedTask interfaces that use int ms instead of TimeDelta.
The previous version of this patch was reverted due to crashing cros_x86 and cros_tegra2 builds.  See: http://codereview.chromium.org/9703053/

BUG=108171

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143401 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-21 17:31:56 +00:00
asanka@chromium.org
ad5fb16613 Revert 140102 - Remove old PostDelayedTask interfaces that use int ms instead of TimeDelta.
Compile failed on ChromiumOS x86 and Tegra.

BUG=108171


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

TBR=tedvessenes@gmail.com
Review URL: https://chromiumcodereview.appspot.com/10496002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140109 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-01 22:05:10 +00:00
tedvessenes@gmail.com
bb8074e992 Remove old PostDelayedTask interfaces that use int ms instead of TimeDelta.
BUG=108171


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140102 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-01 21:33:00 +00:00
akalin@chromium.org
6b28d9469f Make new TaskRunner, SequencedTaskRunner, and SingleThreadTaskRunner interfaces
TaskRunner just has Post{,Delayed}Task(), SequencedTaskRunner
extends Executor to have ordering guarantees and PostNonNestable{,Delayed}Task(), and SingleThreadTaskRunner extends SequencedTaskRunner and guarantees execution on a single thread.

Move a bunch of methods from MessageLoopProxy into the TaskRunner classes and make it inherit from SingleThreadTaskRunner.

BUG=110973
TEST=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121999 0039d316-1c4b-4281-b951-d872f2087c98
2012-02-15 01:43:19 +00:00