18 Commits

Author SHA1 Message Date
Brandon DeRosier
b029ab4f73 [Impeller] Header fixes to make fml/impeller buildable against libstdc++ (flutter/engine#36240) 2022-09-19 05:49:26 -07:00
klaxxi
bec0d79eeb remove lock and use raw ptr for MessageLoopTaskQueues (flutter/engine#34249) 2022-07-18 07:08:04 +00:00
eggfly
f1fd54b45a Implementation of two or more threads merging for multiple platform views (flutter/engine#27662)
Implementation of two or more threads merging for both lightweight multiple engines and standalone multiple engines.
2021-08-06 10:31:59 -07:00
gaaclarke
8380066e70 updated the documenation for message loops a bit (flutter/engine#26257) 2021-05-19 14:49:01 -07:00
Kaushik Iska
dc0fb6e4a7 Reland "TaskSources register tasks with MessageLoopTaskQueues dispatcher" (flutter/engine#25692) 2021-04-21 14:29:02 -07:00
Kaushik Iska
17e7c26da8 Revert TaskRunner changes to fix Fuchsia Test failures (flutter/engine#25690) 2021-04-21 09:15:24 -07:00
Kaushik Iska
988c4ffb83 TaskSources register tasks with MessageLoopTaskQueues dispatcher (flutter/engine#25307) 2021-04-19 07:20:11 -07:00
Emmanuel Garcia
c34705f5dd Reland: "Fix memory leak and bug in the RunsOnCreationTaskRun" (flutter/engine#25317) 2021-03-31 15:16:38 -07:00
Ren You
4885af8ae3 Revert "Fix memory leak and bug in the RunsOnCreationTaskRunner check (#24690)" (flutter/engine#24874)
This reverts commit e0a475111216cf4775e08441100c0b6a24fd8b84.
2021-03-09 06:29:42 -08:00
Emmanuel Garcia
e0a4751112 Fix memory leak and bug in the RunsOnCreationTaskRunner check (flutter/engine#24690) 2021-03-02 12:39:02 -08:00
Chris Yang
c85f437dc9 |MessageLoopImpl::FlushTasks| runs one task at a time (flutter/engine#20771) 2020-08-27 14:18:02 -07:00
Dan Field
c8507b069f Apply lints from internal roll (flutter/engine#16509) 2020-02-10 13:53:04 -08:00
Kaushik Iska
d8390d3f38 Simplify task queues locking mechanism (flutter/engine#16477)
We now have one mutex guarding all accesses to
the underlying task heaps. This simplifies the more granular
but bug prone mechanism of having striped locks.

This also re-enables GPUThreadMerger tests that are currently
disabled due to their flaky nature. The scenario that gets fixed by this
change is as follows:

1. Thread-1: We lock `queue_meta_mutex_` and grab locks on `queue_1` and release the meta mutex.
2. Thread-1: We add an Observer on `queues` object.
3. Thread-2: We lock `queue_meta_mutex_` and grab locks on `queue_2`.
4. Thread-2: We try to dispose all the pending tasks on `queue_2` which calls `erase` on `queues`.

The above situation is not thread safe without having 1 lock.

Note: This increases the contention on one lock and could potentially be bad for perf. We are
explicitly making this trade-off towards reducing the complexity.

Fixes: https://github.com/flutter/flutter/issues/49007
2020-02-07 10:24:05 -08:00
gaaclarke
43dce83fc1 Refactor to passing functions by const ref (flutter/engine#13975)
Moved our code to passing functions by const ref
2019-11-22 12:20:02 -08:00
Chinmay Garde
395f1cda67 Remove incomplete static thread safety annotations. (flutter/engine#13151)
Fixes https://github.com/flutter/flutter/issues/42704.
2019-10-16 17:28:31 -07:00
Kaushik Iska
0d8da99a35 Make message loop task entry containers thread safe (flutter/engine#11367)
The core underlying issue is that vector push_back could re-allocate and cause us to segfault. I have switched the backing queues to a map per @jason-simmons suggestion in flutter/flutter#38778.

I've also added a test to capture the aforementioned bug. I've run internal tests several times to validate that this is fixed.

General threading note for this class is that only the following operations take a write lock on the meta mutex:

1. Create
2. Dispose

The rest of the operations take read lock on the meta mutex and acquire finer grained locks for the duration of the operation. We can not grab read lock for the entire duration of NotifyObservers for example because observer can in-turn create other queues -- Which we should not block.

Additional changes:

1. Make as many methods as possible const. Unlocked methods are all const.
2. Migrate all the queue members to a struct, and have a map.
3. Get rid of the un-used Swap functionality.
2019-08-22 23:27:25 -07:00
Kaushik Iska
419d1b9cae Add the functionality to merge and unmerge MessageLoopTaskQueues (flutter/engine#9436)
- Add the functionality to merge and unmerge MessageLoopTaskQueues

This introduces a notion of a "owning" and "subsumed" queue ids.
Owning queue will take care of the tasks submitted to both that and it's
subsumed queue.

- The tasks submitted still maintain the queue affinity
- Same for the task observers

- Also adds MergedQueuesRunner which grabs both the locks owner
  and subsumed queues in RAII fashion.

- Also use task queue id to verify if we are running
  in the same thread.

- This is to enable merging the backed message loop task
  queues to enable dynamic thread merging in IOS.
2019-07-12 16:55:33 -07:00
Kaushik Iska
5baec7447f Message loop task heaps are shared (flutter/engine#9335) 2019-06-19 14:03:14 -07:00