0
Commit Graph

46 Commits

Author SHA1 Message Date
Alexander Timin
4f9c35c363 [message_loop] Remove message_loop_forward.h
As a final step, replace all includes back:
- mv message_loop_current.h message_loop.h
- s/message_loop_forward.h/message_loop.h/ in all includes.
- s/message_loop_forward.h/message_loop.h/ in base/BUILD.gn
- Remove message_loop_forward.h from third_party/DEPS.

TBR=gab@chromium.org
R=gab@chromium.org
BUG=891670

Change-Id: I623077025701459ddb7045cbcfdad138aa90a9e4
Reviewed-on: https://chromium-review.googlesource.com/c/1313110
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604690}
2018-11-01 20:15:20 +00:00
Alexander Timin
c643d0e146 [message_loop] Temporary introduce message_loop_forward.h.
To facilitate splitting MessageLoop into MessageLoop and MessageLoopImpl
introduce message_loop_forward.h and use it everywhere.

- s/message_loop.h/message_loop_forward.h/ in all includes.
- Add message_loop_forward.h to base/BUILD.gn.
- Add message_loop_forward.h to third_party/DEPS.

TBR=gab@chromium.org
BUG=891670

Change-Id: Ibac3a24f5bd4291c9d57dd32c627477e4e6ef324
Reviewed-on: https://chromium-review.googlesource.com/c/1313108
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604672}
2018-11-01 19:43:28 +00:00
Eric Seckler
4d89f64d9c content: Remove BrowserThread::Post*Task / GetTaskRunnerForThread.
This removes BrowserThread::Post(NonNestable|)(Delayed|)Task and moves
GetTaskRunnerForThread into the impl (it's still used to vend
TaskRunners in BrowserTaskExecutor).

These methods have been replaced by base/post_task.h in conjunction
with content/public/browser/browser_task_traits.h

Bug: 878356
Change-Id: Ia122dc0921769f43da9271ddd6e1ce2f402df779
Reviewed-on: https://chromium-review.googlesource.com/1235728
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592879}
2018-09-20 18:16:16 +00:00
Alex Clarke
7dc412de2b Introduce content::BrowserTaskExecutor
This class's job is to map base::TaskTraits to actual task queues
for the browser process.  This was split off from
https://chromium-review.googlesource.com/c/chromium/src/+/1214223
and is a pre-requisite for the BrowserUIThreadScheduler.

Design doc: https://docs.google.com/document/d/1z1BDq9vzcEpkhN9LSPF5XMnZ0kLJ8mWWkNAi4OI7cos/edit#

BUG=863341, 872372

Change-Id: Ic80e8f66cf245cca136c29387031d111e57fa713
Reviewed-on: https://chromium-review.googlesource.com/1224115
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591316}
2018-09-14 10:02:31 +00:00
Eric Seckler
e329cb9df7 content: Add a TaskTraits extension and TaskExecutor for BrowserThreads.
This allows using //base/task/post_task.h for posting tasks to a
BrowserThread by specifying a BrowserThread::ID as a task trait.

Also adds a content::NonNestable task trait to support non-nestable
tasks in base::PostTaskWithTraits.

In the future, we will add further traits to facilitate scheduling
tasks onto different SequenceManager queues on the UI thread, see:
https://docs.google.com/document/d/1z1BDq9vzcEpkhN9LSPF5XMnZ0kLJ8mWWkNAi4OI7cos/edit?usp=sharing

Bug: 867421, 863341, 878356
Change-Id: Id8b7bc2e374917ceb421c7f6139790e6f1457511
Reviewed-on: https://chromium-review.googlesource.com/1181364
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586728}
2018-08-28 16:09:40 +00:00
Gabriel Charette
697593400d Remove MessageLoop::current() usage in /content/browser/browser_thread_unittest.cc
(and modernize usage of RunLoop)

Bug: 825327
Change-Id: I4a453384ea9f9735824c1259bd82c590571ff038
Reviewed-on: https://chromium-review.googlesource.com/1024798
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554880}
2018-04-30 21:23:40 +00:00
Gabriel Charette
8eb4dff991 Reland "Refactor BrowserThreadImpl, BrowserProcessSubThread, and BrowserMainLoop"
This is a reland of d260e9cf66

It was reverted because of crbug.com/824716, these weren't new crashes
but known crashes mislabeled as a fallout of this change.
http://cl/190471699 fixes the crash backend to not rely on
"content::BrowserThreadImpl::IOThreadRun" being in the signature.

Only diff in this CL is to use base::debug::Alias() in methods that we
don't want optimized (i.e. IOThreadRun) out as CHECK_GT was seen as
optimized out in some of the reported crashes (even though the same
pattern as before was used by this CL..?)

Original change's description:
> Refactor BrowserThreadImpl, BrowserProcessSubThread, and BrowserMainLoop
>
> This brings back the invariant that BrowserThread::IO isn't available
> before BrowserMainLoop::CreateThreads(). This was broken to fix issue
> 729596 to bring up the thread earlier for ServiceManager but it is
> important that code that posts to BrowserThread::IO statically have an
> happens-after relationship to BrowserMainLoop::CreateThreads(). Exposing
> it statically earlier put that invariant at risk.
>
> Thankfully fixing issue 815225 resulted in finally reaching the long
> sought goal of only having BrowserThread::UI/IO. Now that the IO thread
> is also kicked off before it's named statically, BrowserThreadImpl no
> longer needs to be a base::Thread, hence this refactoring.
>
> Before this CL:
>  * BrowserThreadImpl was a base::Thread
>    (could be a fake thread if SetMessageLoop was used)
>  * BrowserProcessSubThread was a BrowserThreadImpl
>    (performed a bit more initialization)
>  * BrowserProcessSubThread was only used in production (in
>    BrowserMainLoop)
>  * BrowserThreadImpl was used for fake threads (BrowserMainLoop for
>    BrowserThread::UI) and for testing (TestBrowserThread(Impl)).
>  * BrowserThreadImpl overrode Init/Run/CleanUp() from base::Thread to
>    perform some sanity checks as well as drive IOThread's Delegate (ref.
>    BrowserThread::SetIOThreadDelegate())
>  * BrowserProcessSubThread re-overrode Init/Run/CleanUp() to perform
>    per-thread //content initialization (tests missed out on that per
>    TestBrowserThread bypassing BrowserProcessSubThread by directly
>    subclassing BrowserThreadImpl).
>
> With this CL:
>  * BrowserThreadImpl is merely a scoped object that binds a provided
>    SingleThreadTaskRunner to a BrowserThread::ID.
>  * BrowserProcessSubThread is a base::Thread and performs all of the
>    initialization and cleanup specific to //content (this means it now
>    also manages BrowserThread::SetIOThreadDelegate())
>  * BrowserProcessSubThread can be brought up early before being bound to
>    a BrowserThread::ID (BrowserMainLoop handles that through
>    BrowserProcessSubThread ::RegisterAsBrowserThread())
>
> Unfortunate exceptions required for this CL:
>  * IOThread::Init() (invoked through BrowserThreadDelegate) perfoms
>    blocking operations this was previously performed before installed
>    the ThreadRestrictions on BrowserThread::IO. But now that //content
>    is initialized after bringing up the thread, a
>    base::ScopedAllowBlocking is required in scope of IOThread::Init().
>  * TestBrowserThread previously bypassing BrowserProcessSubThread by
>    directly subclassing BrowserThreadImpl meant it wasn't subject to
>    ThreadRestrictions (unfortunate becomes it denies allowance
>    verification to product code running in unit tests). Adding it back
>    causes DCHECKs, as such
>    BrowserProcessSubThread::AllowBlockingForTesting was added to allow
>    this CL to pass CQ.
>
> Of note:
>  * BrowserProcessSubThread is still written as though it supports many
>    BrowserThread::IDs but in practice it's mostly always
>    BrowserThread::IO (except in ThreadWatcherTest I think). This change
>    was big enough that I didn't bother also breaking that
>    generalization.
>  * BrowserThreadImpl's constructor was made private to ensure only
>    BrowserProcessSubThread and a few select callers get to drive it (to
>    avoid previous missed initialization issues)
>  * Atomics to manage BrowserThread::SetIOThreadDelegate were removed.
>    Restriction was instead added that this only be called before
>    initialization and after shutdown (this was already the case).
>
> Follow-ups to this CL:
>  * //ios duplicates this logic and will need to undergo the same change
>    as a follow-up
>  * Fixing ios will allow removal of base::Thread::SetMessageLoop hack :)
>  * Removing BrowserThreadGlobals::lock_ to address crbug.com/821034 will
>    be much easier
>  * BrowserThread post APIs should DCHECK rather than no-op if using a
>    BrowserThread::ID before it's registered.
>
> Bug: 815225, 821034, 729596
> Change-Id: If1038f23079df72203b1e95c7d26647f8824a726
> Reviewed-on: https://chromium-review.googlesource.com/969104
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#544440}

TBR=jam@chromium.org

Bug: 815225, 821034, 729596, 824716
Change-Id: I9a180975c69a008f8519d1d3d44663aa58a74a92
Reviewed-on: https://chromium-review.googlesource.com/980793
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546104}
2018-03-27 14:22:54 +00:00
Matt Falkenhagen
fa239c8c41 Revert "Refactor BrowserThreadImpl, BrowserProcessSubThread, and BrowserMainLoop"
This reverts commit d260e9cf66.

Reason for revert: In Windows Canary versions since 67.0.3377.0, where this commit landed, IO thread hang reports have spiked dramatically. It is now the  browser crash report on Windows Canary at 33% of reports. I'm speculatively reverting this to see if the crash rate heals.

Original change's description:
> Refactor BrowserThreadImpl, BrowserProcessSubThread, and BrowserMainLoop
>
> This brings back the invariant that BrowserThread::IO isn't available
> before BrowserMainLoop::CreateThreads(). This was broken to fix issue
> 729596 to bring up the thread earlier for ServiceManager but it is
> important that code that posts to BrowserThread::IO statically have an
> happens-after relationship to BrowserMainLoop::CreateThreads(). Exposing
> it statically earlier put that invariant at risk.
>
> Thankfully fixing issue 815225 resulted in finally reaching the long
> sought goal of only having BrowserThread::UI/IO. Now that the IO thread
> is also kicked off before it's named statically, BrowserThreadImpl no
> longer needs to be a base::Thread, hence this refactoring.
>
> Before this CL:
>  * BrowserThreadImpl was a base::Thread
>    (could be a fake thread if SetMessageLoop was used)
>  * BrowserProcessSubThread was a BrowserThreadImpl
>    (performed a bit more initialization)
>  * BrowserProcessSubThread was only used in production (in
>    BrowserMainLoop)
>  * BrowserThreadImpl was used for fake threads (BrowserMainLoop for
>    BrowserThread::UI) and for testing (TestBrowserThread(Impl)).
>  * BrowserThreadImpl overrode Init/Run/CleanUp() from base::Thread to
>    perform some sanity checks as well as drive IOThread's Delegate (ref.
>    BrowserThread::SetIOThreadDelegate())
>  * BrowserProcessSubThread re-overrode Init/Run/CleanUp() to perform
>    per-thread //content initialization (tests missed out on that per
>    TestBrowserThread bypassing BrowserProcessSubThread by directly
>    subclassing BrowserThreadImpl).
>
> With this CL:
>  * BrowserThreadImpl is merely a scoped object that binds a provided
>    SingleThreadTaskRunner to a BrowserThread::ID.
>  * BrowserProcessSubThread is a base::Thread and performs all of the
>    initialization and cleanup specific to //content (this means it now
>    also manages BrowserThread::SetIOThreadDelegate())
>  * BrowserProcessSubThread can be brought up early before being bound to
>    a BrowserThread::ID (BrowserMainLoop handles that through
>    BrowserProcessSubThread ::RegisterAsBrowserThread())
>
> Unfortunate exceptions required for this CL:
>  * IOThread::Init() (invoked through BrowserThreadDelegate) perfoms
>    blocking operations this was previously performed before installed
>    the ThreadRestrictions on BrowserThread::IO. But now that //content
>    is initialized after bringing up the thread, a
>    base::ScopedAllowBlocking is required in scope of IOThread::Init().
>  * TestBrowserThread previously bypassing BrowserProcessSubThread by
>    directly subclassing BrowserThreadImpl meant it wasn't subject to
>    ThreadRestrictions (unfortunate becomes it denies allowance
>    verification to product code running in unit tests). Adding it back
>    causes DCHECKs, as such
>    BrowserProcessSubThread::AllowBlockingForTesting was added to allow
>    this CL to pass CQ.
>
> Of note:
>  * BrowserProcessSubThread is still written as though it supports many
>    BrowserThread::IDs but in practice it's mostly always
>    BrowserThread::IO (except in ThreadWatcherTest I think). This change
>    was big enough that I didn't bother also breaking that
>    generalization.
>  * BrowserThreadImpl's constructor was made private to ensure only
>    BrowserProcessSubThread and a few select callers get to drive it (to
>    avoid previous missed initialization issues)
>  * Atomics to manage BrowserThread::SetIOThreadDelegate were removed.
>    Restriction was instead added that this only be called before
>    initialization and after shutdown (this was already the case).
>
> Follow-ups to this CL:
>  * //ios duplicates this logic and will need to undergo the same change
>    as a follow-up
>  * Fixing ios will allow removal of base::Thread::SetMessageLoop hack :)
>  * Removing BrowserThreadGlobals::lock_ to address crbug.com/821034 will
>    be much easier
>  * BrowserThread post APIs should DCHECK rather than no-op if using a
>    BrowserThread::ID before it's registered.
>
> Bug: 815225, 821034, 729596
> Change-Id: If1038f23079df72203b1e95c7d26647f8824a726
> Reviewed-on: https://chromium-review.googlesource.com/969104
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#544440}

TBR=gab@chromium.org,jam@chromium.org
NOPRESUBMIT=true

# Not skipping CQ checks because original CL landed > 1 day ago.
# falken: Skipping presubmit to use deprecated ThreadResrictions::DisallowWaiting().

Bug: 815225, 821034, 729596
Change-Id: I2be97c5d8183497c005ab397c871f625b034d850
Reviewed-on: https://chromium-review.googlesource.com/979752
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545725}
2018-03-26 04:21:19 +00:00
Gabriel Charette
d260e9cf66 Refactor BrowserThreadImpl, BrowserProcessSubThread, and BrowserMainLoop
This brings back the invariant that BrowserThread::IO isn't available
before BrowserMainLoop::CreateThreads(). This was broken to fix issue
729596 to bring up the thread earlier for ServiceManager but it is
important that code that posts to BrowserThread::IO statically have an
happens-after relationship to BrowserMainLoop::CreateThreads(). Exposing
it statically earlier put that invariant at risk.

Thankfully fixing issue 815225 resulted in finally reaching the long
sought goal of only having BrowserThread::UI/IO. Now that the IO thread
is also kicked off before it's named statically, BrowserThreadImpl no
longer needs to be a base::Thread, hence this refactoring.

Before this CL:
 * BrowserThreadImpl was a base::Thread
   (could be a fake thread if SetMessageLoop was used)
 * BrowserProcessSubThread was a BrowserThreadImpl
   (performed a bit more initialization)
 * BrowserProcessSubThread was only used in production (in
   BrowserMainLoop)
 * BrowserThreadImpl was used for fake threads (BrowserMainLoop for
   BrowserThread::UI) and for testing (TestBrowserThread(Impl)).
 * BrowserThreadImpl overrode Init/Run/CleanUp() from base::Thread to
   perform some sanity checks as well as drive IOThread's Delegate (ref.
   BrowserThread::SetIOThreadDelegate())
 * BrowserProcessSubThread re-overrode Init/Run/CleanUp() to perform
   per-thread //content initialization (tests missed out on that per
   TestBrowserThread bypassing BrowserProcessSubThread by directly
   subclassing BrowserThreadImpl).

With this CL:
 * BrowserThreadImpl is merely a scoped object that binds a provided
   SingleThreadTaskRunner to a BrowserThread::ID.
 * BrowserProcessSubThread is a base::Thread and performs all of the
   initialization and cleanup specific to //content (this means it now
   also manages BrowserThread::SetIOThreadDelegate())
 * BrowserProcessSubThread can be brought up early before being bound to
   a BrowserThread::ID (BrowserMainLoop handles that through
   BrowserProcessSubThread ::RegisterAsBrowserThread())

Unfortunate exceptions required for this CL:
 * IOThread::Init() (invoked through BrowserThreadDelegate) perfoms
   blocking operations this was previously performed before installed
   the ThreadRestrictions on BrowserThread::IO. But now that //content
   is initialized after bringing up the thread, a
   base::ScopedAllowBlocking is required in scope of IOThread::Init().
 * TestBrowserThread previously bypassing BrowserProcessSubThread by
   directly subclassing BrowserThreadImpl meant it wasn't subject to
   ThreadRestrictions (unfortunate becomes it denies allowance
   verification to product code running in unit tests). Adding it back
   causes DCHECKs, as such
   BrowserProcessSubThread::AllowBlockingForTesting was added to allow
   this CL to pass CQ.

Of note:
 * BrowserProcessSubThread is still written as though it supports many
   BrowserThread::IDs but in practice it's mostly always
   BrowserThread::IO (except in ThreadWatcherTest I think). This change
   was big enough that I didn't bother also breaking that
   generalization.
 * BrowserThreadImpl's constructor was made private to ensure only
   BrowserProcessSubThread and a few select callers get to drive it (to
   avoid previous missed initialization issues)
 * Atomics to manage BrowserThread::SetIOThreadDelegate were removed.
   Restriction was instead added that this only be called before
   initialization and after shutdown (this was already the case).

Follow-ups to this CL:
 * //ios duplicates this logic and will need to undergo the same change
   as a follow-up
 * Fixing ios will allow removal of base::Thread::SetMessageLoop hack :)
 * Removing BrowserThreadGlobals::lock_ to address crbug.com/821034 will
   be much easier
 * BrowserThread post APIs should DCHECK rather than no-op if using a
   BrowserThread::ID before it's registered.

Bug: 815225, 821034, 729596
Change-Id: If1038f23079df72203b1e95c7d26647f8824a726
Reviewed-on: https://chromium-review.googlesource.com/969104
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544440}
2018-03-20 18:10:45 +00:00
Peter Kasting
341e1fbe2d Allow base::DoNothing() to handle any argument list.
This changes the form of DoNothing() from a simple no-arg function to a class
that produces callbacks via templated operator().  This allows callers to
replace base::Bind(&base::DoNothing) with base::DoNothing() for a small
boilerplate reduction; more importantly, it allows using DoNothing() to replace
existing no-op functions/lambdas that took more than zero args, and thus had to
be manually declared.  This removes dozens of such functions and around 600 LOC
total.

In a few places, DoNothing() can't be used directly, and this change also adds
explicit callback-generating Once<>() and Repeatedly<>() members that will
produce a callback with a specific signature.

BUG=811554
TEST=none

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_mojo;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I37f87b35c6c079a6a8c03ff18ec3a54e1237f126
Reviewed-on: https://chromium-review.googlesource.com/903416
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538953}
2018-02-24 00:03:01 +00:00
Gabriel Charette
e9748f27c3 Uncontroversial and easy to carve out bits of deprecated BrowserThreads cleanup.
Overall reland is at https://chromium-review.googlesource.com/c/chromium/src/+/705775,
these are the easy bits that can land first (and wrap up contributions to issues
365909 and 752144 as well as to the ios/ side of 689520).

NOPRESUBMIT=TRUE (for BrowserThread presubmit triggered by touching related code)
TBR=jam@chromium.org, jsbell@chromium.org, sdefresne@chromium.org, asvitkine@chromium.org

Bug: 689520, 365909, 752144
Change-Id: I9b2b5326a12de5f7ffa22f8ac3332c8e57a6e14f
Reviewed-on: https://chromium-review.googlesource.com/738469
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511551}
2017-10-25 19:31:15 +00:00
tzik
4fea24afdc Apply base_bind_rewriters to //content/browser/{a,b,c,d,f,g}*
This CL applies //tools/clang/base_bind_rewriters to //content/browser/{a,b,c,d,f,g}*
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([]{});
Change-Id: I11ae9ac169c8e0ff9d9b95452fec22a8b7c91df7

NOPRESUBMIT=true

Change-Id: I11ae9ac169c8e0ff9d9b95452fec22a8b7c91df7
Reviewed-on: https://chromium-review.googlesource.com/628003
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496656}
2017-08-23 11:41:47 +00:00
Gabriel Charette
53a9ef8107 Mass replace MessageLoop::Quit*() with RunLoop::QuitCurrent*Deprecated().
And added runloop.h alongside message_loop.h in allowed //base dependencies
in Blink platform code as RunLoop is effectively an extension of
MessageLoop and I don't see a reason not to allow it.

TBR: danakj@chromium.org (for the scripted change)
TBR: kinuko@chromium.org (for third_party\Webkit\Source\platform\DEPS tweak)
Bug: 748715
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I36c934a0f22e3ee7ff44d3efb80c6a1fe710b7b5
Reviewed-on: https://chromium-review.googlesource.com/585732
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489617}
2017-07-26 12:36:23 +00:00
Yeol
0349534f91 Rename TaskRunner::RunsTasksOnCurrentThread() in //chrome, //content
Renamed TaskRunner::RunsTasksOnCurrentThread() to

TaskRunner: :RunsTasksInCurrentSequence() in //chrome, //content
Bug: 665062
Change-Id: I2d6a309bb5f116e521da91a7f66b4fe8b756a386
Reviewed-on: https://chromium-review.googlesource.com/558326
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488670}
2017-07-21 16:03:50 +00:00
dimaa
61c9b8f29a Most of BrowserThreadTest tests always fail (crash) the first time, and need to be retried separately (each test isolated).
BrowserThreadImpl states need to be cleaned up between tests,
otherwise the subsequent tests will crash trying to reinitialize BrowserThreadImpl.

This CL make sure that this is done correctly.
BUG=697560

Review-Url: https://codereview.chromium.org/2721223004
Cr-Commit-Position: refs/heads/master@{#454321}
2017-03-02 18:51:50 +00:00
fdoray
f854c91353 Run BrowserThreadTest.RunsTasksOnCurrentThreadDuringShutdown on UI thread.
In preparation for the migration of the FILE thread to TaskScheduler,
we want to disable destruction observers on it.
BrowserThreadTest.RunsTasksOnCurrentThreadDuringShutdown is the only
test that fails when destruction observers are disabled on the FILE
thread. This CL changes this test to use the UI thread instead.

BUG=653916

Review-Url: https://codereview.chromium.org/2399413003
Cr-Commit-Position: refs/heads/master@{#424151}
2016-10-10 14:53:46 +00:00
rockot
48a6aacd38 Ensure BrowserThread::CurrentlyOn is correct through MessageLoop teardown
Changes BrowserThread::CurrentlyOn (and thus
BrowserThreadTaskRunner::RunsTasksOnCurrentThread()) to correctly report
a BrowserThread's association during MessageLoop destruction notification.

Also adds an explicit Start() to BrowserThreadImpl as there are tests which
call it and which incorrectly assumed base::Thread's implementation would
call BrowserThreadImpl::StartWithOptions (which it wouldn't since the latter
is not a virtual function.)

This change provokes many tests to delete ExtensionFunction instances that
were otherwise being leaked because UIThreadExtensionFunction::Destroy was
incorrectly deferring destruction when run on the UI thread during shutdown.
This in turn revealed a few small bugs which have also been fixed here.

BUG=631093
R=jam@chromium.org

Committed: https://crrev.com/b02da29fb9116d1a1fb4fd0476628f333ff6bd1a
Review-Url: https://codereview.chromium.org/2180253003
Cr-Original-Commit-Position: refs/heads/master@{#408295}
Cr-Commit-Position: refs/heads/master@{#408411}
2016-07-28 17:25:20 +00:00
rockot
dd05854bb5 Revert of Ensure BrowserThread::CurrentlyOn is correct through MessageLoop teardown (patchset id:160001 of https://codereview.chromium.org/2180253003/ )
Reason for revert:
Test failures in the changes to the ComponentCloudPolicyTest. Doh.

Original issue's description:
> Ensure BrowserThread::CurrentlyOn is correct through MessageLoop teardown
>
> Changes BrowserThread::CurrentlyOn (and thus
> BrowserThreadTaskRunner::RunsTasksOnCurrentThread()) to correctly report
> a BrowserThread's association during MessageLoop destruction notification.
>
> Also adds an explicit Start() to BrowserThreadImpl as there are tests which
> call it and which incorrectly assumed base::Thread's implementation would
> call BrowserThreadImpl::StartWithOptions (which it wouldn't since the latter
> is not a virtual function.)
>
> This change provokes many tests to delete ExtensionFunction instances that
> were otherwise being leaked because UIThreadExtensionFunction::Destroy was
> incorrectly deferring destruction when run on the UI thread during shutdown.
> This in turn revealed a few small bugs which have also been fixed here.
>
> BUG=631093
> R=jam@chromium.org
>
> Committed: https://crrev.com/b02da29fb9116d1a1fb4fd0476628f333ff6bd1a
> Cr-Commit-Position: refs/heads/master@{#408295}

TBR=jam@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=631093

Review-Url: https://codereview.chromium.org/2186213002
Cr-Commit-Position: refs/heads/master@{#408311}
2016-07-28 02:06:31 +00:00
rockot
b02da29fb9 Ensure BrowserThread::CurrentlyOn is correct through MessageLoop teardown
Changes BrowserThread::CurrentlyOn (and thus
BrowserThreadTaskRunner::RunsTasksOnCurrentThread()) to correctly report
a BrowserThread's association during MessageLoop destruction notification.

Also adds an explicit Start() to BrowserThreadImpl as there are tests which
call it and which incorrectly assumed base::Thread's implementation would
call BrowserThreadImpl::StartWithOptions (which it wouldn't since the latter
is not a virtual function.)

This change provokes many tests to delete ExtensionFunction instances that
were otherwise being leaked because UIThreadExtensionFunction::Destroy was
incorrectly deferring destruction when run on the UI thread during shutdown.
This in turn revealed a few small bugs which have also been fixed here.

BUG=631093
R=jam@chromium.org

Review-Url: https://codereview.chromium.org/2180253003
Cr-Commit-Position: refs/heads/master@{#408295}
2016-07-28 00:44:34 +00:00
thestig
529ad8ace3 Remove all remaining traces of MessageLoopProxy.
TBR=brettw@chromium.org

Review-Url: https://codereview.chromium.org/2133083002
Cr-Commit-Position: refs/heads/master@{#404480}
2016-07-08 20:32:17 +00:00
fdoray
e716a9021e Remove calls to deprecated MessageLoop methods in content.
This CL makes the following replacements in
content:

Before               After
----------------------------------------------------------
 x.PostTask()          x.task_runner()->PostTask()
   PostDelayedTask()                    PostDelayedTask()
   ReleaseSoon()                        ReleaseSoon()
   DeleteSoon()                         DeleteSoon()
x->PostTask()         y->task_runner()->PostTask()
   PostDelayedTask()                    PostDelayedTask()
   ReleaseSoon()                        ReleaseSoon()
   DeleteSoon()                         DeleteSoon()

 x.Run()              RunLoop().Run()
 x.RunUntilIdle()     RunLoop().RunUntilIdle()

x->Run()              RunLoop().Run()
x->RunUntilIdle()     RunLoop().RunUntilIdle()
    If |y| isn't MessageLoopForUI::current() or
    MessageLoopForIO::current()

 y.message_loop()->task_runner()
                      y.task_runner()
y->message_loop()->task_runner()
                      y->task_runner()
----------------------------------------------------------

|x| is a base::MessageLoop(ForUI|ForIO) or a pointer to
a base::MessageLoop(ForUI|ForIO). |y| is a base::Thread
or a pointer to a base::Thread.

This CL was generated using the MessageLoopDeprecatedMethods
clang-tidy fix available on the associated bug. Only files
that compile on Mac are affected. Follow-up CLs will make
these replacements for other platforms.

This CL doesn't change code behavior.

BUG=616447
R=jam@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2082343002
Cr-Commit-Position: refs/heads/master@{#403787}
2016-07-05 16:08:03 +00:00
dcheng
5971627d34 Convert //content/browser from scoped_ptr to std::unique_ptr
BUG=554298
R=avi@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#386285}
2016-04-09 05:20:41 +00:00
ki.stfu
8007792478 Don't use base::MessageLoop::{Quit,QuitClosure} in content/
This patch renames base::MessageLoop::{Quit,QuitClosure} to
base::MessageLoop::{QuitWhenIdle,QuitWhenIdleClosure}.

BUG=131220
R=nick@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#353616}
2015-10-12 22:47:55 +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
dcheng
fa85b15991 Standardize usage of virtual/override/final specifiers.
The Google C++ style guide states:

  Explicitly annotate overrides of virtual functions or virtual
  destructors with an override or (less frequently) final specifier.
  Older (pre-C++11) code will use the virtual keyword as an inferior
  alternative annotation. For clarity, use exactly one of override,
  final, or virtual when declaring an override.

To better conform to these guidelines, the following constructs have
been rewritten:

- if a base class has a virtual destructor, then:
    virtual ~Foo();                   ->  ~Foo() override;
- virtual void Foo() override;        ->  void Foo() override;
- virtual void Foo() override final;  ->  void Foo() final;

This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.

BUG=417463
R=nasko@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#301534}
2014-10-28 01:13:59 +00:00
avi@chromium.org
95f861e7fc Use a direct include of the message_loop header in content/, part 1.
BUG=260807
TEST=none
TBR=ben@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212206 0039d316-1c4b-4281-b951-d872f2087c98
2013-07-18 02:07:17 +00:00
brettw@chromium.org
7ccb707107 Update includes of message_loop_proxy.
This keeps the forwarding header, just updates all current callers.

BUG=
R=avi@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205306 0039d316-1c4b-4281-b951-d872f2087c98
2013-06-10 20:56:28 +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
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
thestig@chromium.org
2b9eb38700 Cleanup: Remove unused content::BrowserThread::DeleteOnWebKitThread.
Review URL: https://chromiumcodereview.appspot.com/13168005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191536 0039d316-1c4b-4281-b951-d872f2087c98
2013-03-30 18:58:30 +00:00
jam@chromium.org
e97882f3de Move test_browser_thread.h from content\test to content\public\test. This way we can enforce that internal content headers don't leak to embedders.
BUG=98716
TBR=phajdan.jr
Review URL: https://chromiumcodereview.appspot.com/10500016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140254 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-04 02:23:17 +00:00
rsleevi@chromium.org
fb90c94fa3 RefCounted types should not have public destructors, content/browser part 1
BUG=123295
TEST=none


Review URL: http://codereview.chromium.org/10068037

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134395 0039d316-1c4b-4281-b951-d872f2087c98
2012-04-27 23:40:50 +00:00
ajwong@chromium.org
c694427c13 Remove task.h and finish base::Bind() migration.
Over 341 CLs, in ~3 months, touching 3251 unique files!

Top 5 most CLs:
(121) jhawkins
( 45)   dcheng
( 24)  achuith
( 23)    csilv
( 12)  tfarina
( 12)    groby

~1000 files touched:
(918) jhawkins

100+ files touched:
(486)   ajwong
(385) willchan
(372)   dcheng
(126)    csilv
(123) fischman
(112)  sergeyu

49+ files touched:
(65)   tfarina
(57)  acolwell
(52)     adamk
(49)      tzik

BUG=35223
TEST=existing

Review URL: http://codereview.chromium.org/9114020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116748 0039d316-1c4b-4281-b951-d872f2087c98
2012-01-06 22:12:28 +00:00
jhawkins@chromium.org
e7b3a61984 base::Bind: Remove Task.
BUG=none
TEST=none
R=awong

Review URL: http://codereview.chromium.org/9086002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116439 0039d316-1c4b-4281-b951-d872f2087c98
2012-01-05 02:18:18 +00:00
joth@chromium.org
e1dd56245e Deprecate WEBKIT thread
BUG=106839
TEST=try servers pass


Review URL: http://codereview.chromium.org/8879013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115116 0039d316-1c4b-4281-b951-d872f2087c98
2011-12-20 12:28:58 +00:00
dcheng@chromium.org
d111e93688 Removing MessageLoop::QuitTask() from content/
base/task.h is going away and being replaced by base/bind.h and base/callback.h.
This CL was automatically generated by sed.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/8872030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113894 0039d316-1c4b-4281-b951-d872f2087c98
2011-12-10 00:22:59 +00:00
jhawkins@chromium.org
8075105cb6 base::Bind: Low-hanging fruit conversions of NewRunnableFunction.
BUG=none
TEST=none

R=csilv@chromium.org

Review URL: http://codereview.chromium.org/8536037

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109803 0039d316-1c4b-4281-b951-d872f2087c98
2011-11-12 17:10:58 +00:00
joi@chromium.org
c38831a108 Split BrowserThread into public API and private implementation, step 1.
Only content/ now has the ability to create BrowserThread objects,
with the exception that tests can create the
content::TestBrowserThread subclass, and (temporarily) code in chrome/
can create the DeprecatedBrowserThread subclass.

A follow-up change will make content/ take care of its own thread
creation, remove DeprecatedBrowserThread, and move all state and
non-trivial constructors from BrowserThread down to BrowserThreadImpl.

Also moved BrowserProcessSubThread into content/ namespace.  As part
of follow-up cleanup, chrome/ will stop using this class.

BUG=98716
TEST=existing

Review URL: http://codereview.chromium.org/8392042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107718 0039d316-1c4b-4281-b951-d872f2087c98
2011-10-28 12:44:49 +00:00
ajwong@chromium.org
c31af70db2 Implementation of PostTaskAndReply() in MessageLoopProxy and BrowserThread.
This ensures that the request/reply closures are always deleted on the origin
thread, or leaked if the task cannot be completed (due to message loop
shutdown).

BUG=86301
TEST=new unittests

Review URL: http://codereview.chromium.org/7210053

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97387 0039d316-1c4b-4281-b951-d872f2087c98
2011-08-18 23:13:01 +00:00
levin@chromium.org
3b63f8f451 Move some files from base to base/memory.
raw_scoped_refptr_mismatch_checker.h
ref_counted.cc
ref_counted.h
ref_counted_memory.cc
ref_counted_memory.h
ref_counted_unittest.cc
scoped_callback_factory.h
scoped_comptr_win.h
scoped_handle.h
scoped_native_library.cc
scoped_native_library.h
scoped_native_library_unittest.cc
scoped_nsobject.h
scoped_open_process.h
scoped_ptr.h
scoped_ptr_unittest.cc
scoped_temp_dir.cc
scoped_temp_dir.h
scoped_temp_dir_unittest.cc
scoped_vector.h
singleton.h
singleton_objc.h
singleton_unittest.cc
linked_ptr.h
linked_ptr_unittest.cc
weak_ptr.cc
weak_ptr.h
weak_ptr_unittest.cc

BUG=None
TEST=Compile

Review URL: http://codereview.chromium.org/6714032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
2011-03-28 01:54:15 +00:00
jam@chromium.org
df8e899b92 Move core pieces of chrome\browser. I've only gone up to "g", will do the rest in another cl.
TBR=avi
Review URL: http://codereview.chromium.org/6538100

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75652 0039d316-1c4b-4281-b951-d872f2087c98
2011-02-22 22:58:22 +00:00