New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 695727 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 678155



Sign in to add a comment

Support sequence-local storage

Project Member Reported by sa...@chromium.org, Feb 24 2017

Issue description

Sync mojo IPCs require thread-local storage. In order to migrate mojo from SingleThreadTaskRunner to SequencedTaskRunner, sequence-local storage is required.

At blinkon, the task scheduler team expressed interest in adding support for sequence-local storage.
 

Comment 1 by gab@chromium.org, Feb 24 2017

Owner: robliao@chromium.org
Status: Assigned (was: Untriaged)
Leaving at P3 but the right person to own this will be Rob (after ongoing P1/P2 TaskScheduler work that is).

Comment 2 by fdoray@chromium.org, Feb 28 2017

sammc@: I see a few uses of thread-local storage in mojo/ https://cs.chromium.org/search/?q=threadlocal+file:%5Esrc/mojo/+package:%5Echromium$&type=cs Which one(s) are you referring to when you say "Sync mojo IPCs"?

Comment 3 by sa...@chromium.org, Feb 28 2017

https://cs.chromium.org/chromium/src/mojo/public/cpp/bindings/lib/sync_handle_registry.cc?type=cs&l=16 is the one used for sync IPCs; that's where we need shared per-TaskRunner state. The others are only used for storing scoped state so should be fine as is.

Comment 4 by fdoray@chromium.org, May 31 2017

Owner: jeffreyhe@google.com
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7

commit 1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7
Author: Jeffrey He <jeffreyhe@google.com>
Date: Tue Jun 06 02:49:57 2017

Changed RunNextTask to return void instead of returning whether
the task ran.

This was done as a precursor to changing RunNextTask to return whether
the sequence became empty after popping the task.

The motivation for changing the final return value of RunNextTask is 
because of the following:

RunNextTask returns whether the task ran. 
RunNextTask also pops a task and knowing whether the sequence 
became empty after the pop is important.

For readability purposes (returning both those things is messy) 
and due to the fact that knowing whether the task ran wasn't 
that important in how we were using it, we decided to change the return value.

Bug:  695727 
Change-Id: I990dfeda06d523da5de9608acb5484d9f122114b
Reviewed-on: https://chromium-review.googlesource.com/524234
Commit-Queue: Jeffrey He <jeffreyhe@google.com>
Reviewed-by: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477162}
[modify] https://crrev.com/1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7/base/task_scheduler/scheduler_worker.cc
[modify] https://crrev.com/1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7/base/task_scheduler/task_tracker.cc
[modify] https://crrev.com/1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7/base/task_scheduler/task_tracker.h
[modify] https://crrev.com/1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7/base/task_scheduler/task_tracker_posix_unittest.cc
[modify] https://crrev.com/1e0264fbc3ceaa70147de2f2da143eb1e9ed72b7/base/task_scheduler/task_tracker_unittest.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Jun 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ec72312483fad38715331aec0ce820f313ae8057

commit ec72312483fad38715331aec0ce820f313ae8057
Author: Jeffrey He <jeffreyhe@google.com>
Date: Tue Jun 06 17:22:24 2017

Changed TaskTracker::RunTask to take a Sequence* instead of
SequenceToken.

This was necessary to implement SequenceLocalStorage.
SequenceLocalStorage is implemented as a pointer to a map owned by
Sequence and has to be stored in TLS by TaskTracker::PerformRunTask. A
prerequisite to that, fulfilled by this CL, is that 
TaskTracker::PerformRunTask has access to the Sequence.

Bug:  695727 
Change-Id: I852e8de8df9d5cc1f6f200be9cf6c653787b71e8
Reviewed-on: https://chromium-review.googlesource.com/522237
Commit-Queue: Jeffrey He <jeffreyhe@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#477311}
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/BUILD.gn
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/scheduler_worker.cc
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/task_tracker.cc
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/task_tracker.h
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/task_tracker_posix.cc
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/task_tracker_posix.h
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/task_tracker_posix_unittest.cc
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/task_tracker_unittest.cc
[add] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/test_utils.cc
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/task_scheduler/test_utils.h
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/test/scoped_task_environment.cc
[modify] https://crrev.com/ec72312483fad38715331aec0ce820f313ae8057/base/test/scoped_task_scheduler.cc

Project Member

Comment 7 by bugdroid1@chromium.org, Jun 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/108d296c7927a5f5e6e9b4d3261c1140a28c95b8

commit 108d296c7927a5f5e6e9b4d3261c1140a28c95b8
Author: Jeffrey He <jeffreyhe@google.com>
Date: Mon Jun 12 19:29:00 2017

Add SequenceLocalStorageMap

SequenceLocalStorageMap allows storing and then retrieving arbitrary values to/from a sequence.
It stores the values itself and their destructors. When the SequenceLocalStorageMap object is
destroyed, the values are also destroyed by their associated destructors.

This change will make it easier to migrate from SingleThreadTaskRunner
to SequencedTaskRunner for components that use thread-local-storage.

Reference: https://chromium-review.googlesource.com/c/525834/

Bug:  695727 
Change-Id: I4f8558cd21aa30e7932bdd039ca618c6ff9c6de9
Reviewed-on: https://chromium-review.googlesource.com/527299
Commit-Queue: Jeffrey He <jeffreyhe@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478717}
[modify] https://crrev.com/108d296c7927a5f5e6e9b4d3261c1140a28c95b8/base/BUILD.gn
[add] https://crrev.com/108d296c7927a5f5e6e9b4d3261c1140a28c95b8/base/threading/sequence_local_storage_map.cc
[add] https://crrev.com/108d296c7927a5f5e6e9b4d3261c1140a28c95b8/base/threading/sequence_local_storage_map.h
[add] https://crrev.com/108d296c7927a5f5e6e9b4d3261c1140a28c95b8/base/threading/sequence_local_storage_map_unittest.cc

Project Member

Comment 8 by bugdroid1@chromium.org, Jun 13 2017

Project Member

Comment 9 by bugdroid1@chromium.org, Jun 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c42cc0088ff6f336ba708cd576cdecf422b5a1a8

commit c42cc0088ff6f336ba708cd576cdecf422b5a1a8
Author: Jeffrey He <jeffreyhe@google.com>
Date: Tue Jun 13 16:50:32 2017

Integrate SequenceLocalStorageMap into Sequence

TaskTracker::PerformRunTask now instantiates
ScopedSetSequenceLocalStorageMap with the SequenceLocalStorageMap
held by Sequence. This allows SequenceLocalStorageSlots to be used
within tasks ran by a Sequence.

Bug:  695727 
Change-Id: If2a3c32f914a3554edb73347e8c857283c474f1e
Reviewed-on: https://chromium-review.googlesource.com/528223
Commit-Queue: Jeffrey He <jeffreyhe@google.com>
Reviewed-by: Robert Liao <robliao@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479052}
[modify] https://crrev.com/c42cc0088ff6f336ba708cd576cdecf422b5a1a8/base/task_scheduler/sequence.h
[modify] https://crrev.com/c42cc0088ff6f336ba708cd576cdecf422b5a1a8/base/task_scheduler/task_scheduler_impl_unittest.cc
[modify] https://crrev.com/c42cc0088ff6f336ba708cd576cdecf422b5a1a8/base/task_scheduler/task_tracker.cc
[modify] https://crrev.com/c42cc0088ff6f336ba708cd576cdecf422b5a1a8/docs/task_scheduler_migration.md

Project Member

Comment 10 by bugdroid1@chromium.org, Jun 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ebe0c685c86dd20cf520e7a76d9139ba891745ba

commit ebe0c685c86dd20cf520e7a76d9139ba891745ba
Author: Jeffrey He <jeffreyhe@google.com>
Date: Wed Jun 14 19:03:54 2017

Integrate SequenceLocalStorageMap into MessageLoop

MessageLoop::BindToCurrentThread() now sets up a SequenceLocalStorageMap
on the thread running the MessageLoop. This allows SequenceLocalStorage
to be used by tasks running on a MessageLoop as well as by code within
the scope of a MessageLoop.

Bug:  695727 
Change-Id: If0d1eb06cd936e1d032d8bb70bbdb994f080a3fe
Reviewed-on: https://chromium-review.googlesource.com/533394
Commit-Queue: Jeffrey He <jeffreyhe@google.com>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479458}
[modify] https://crrev.com/ebe0c685c86dd20cf520e7a76d9139ba891745ba/base/message_loop/message_loop.cc
[modify] https://crrev.com/ebe0c685c86dd20cf520e7a76d9139ba891745ba/base/message_loop/message_loop.h
[modify] https://crrev.com/ebe0c685c86dd20cf520e7a76d9139ba891745ba/base/message_loop/message_loop_unittest.cc
[modify] https://crrev.com/ebe0c685c86dd20cf520e7a76d9139ba891745ba/base/threading/sequence_local_storage_map.cc
[modify] https://crrev.com/ebe0c685c86dd20cf520e7a76d9139ba891745ba/base/threading/sequence_local_storage_map.h
[modify] https://crrev.com/ebe0c685c86dd20cf520e7a76d9139ba891745ba/base/threading/sequence_local_storage_slot.h

Comment 11 by gab@chromium.org, Jun 14 2017

Status: Fixed (was: Assigned)
Awesome, thanks, marking fixed and pinging the mojo folks on the blocked bug :)

Sign in to add a comment