44 Commits

Author SHA1 Message Date
Chinmay Garde
c2992b3273 Remove shared mutex from FML and use the C++17 variants. (flutter/engine#54482)
We used to require this only on iOS because the standard library till iOS 9 didn't have support for this. We have moved past that version. No change on other platforms.
2024-08-09 22:59:58 +00:00
Chinmay Garde
e83e23a6c5 Delete //flutter/fml/compiler_specific.h (flutter/engine#54330)
There were two macros for doing identical things and you can do the thing using standard C++17.
2024-08-03 01:47:49 +00:00
John O'Neil
e76e0548bc Fix #150515 Provide required headers for build with Clang-16 and GCC … (flutter/engine#53479)
Fixes Impeller engine build with `clang-16` and GCC 14 C++Stdlib does not implicitly include `<algorithm>`.

Fixes issue: #150515 

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-27 20:07:19 +00:00
Matan Lurey
da57416cbe Re-land "Make fml/... compatible with .clang_tidy (flutter/engine#48030)
Reverts flutter/engine#48004
2023-11-16 00:09:24 +00:00
auto-submit[bot]
a934a9bcd8 Reverts "Make fml/... compatible with .clang_tidy." (flutter/engine#48004)
Reverts flutter/engine#47992
Initiated by: bdero
This change reverts the following previous change:
Original Description:
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-14 00:17:26 +00:00
Matan Lurey
e47c5864ef Make fml/... compatible with .clang_tidy. (flutter/engine#47992)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-13 22:52:51 +00:00
Jia Hao
ff7829558f Add missing import (flutter/engine#47083)
Fixes the following:

c8aa0844f2 results in the following error appearing internally when compiling for Android:

```
In file included from fml/synchronization/sync_switch.cc:5:
./fml/synchronization/sync_switch.h:74:34: error: implicit instantiation of undefined template 'std::vector<fml::SyncSwitch::Observer *>'
  mutable std::vector<Observer*> observers_;
                                 ^
<...>: note: template is declared here
class _LIBCPP_TEMPLATE_VIS vector;
                           ^
1 error generated.
```

*List which issues are fixed by this PR. You must list at least one issue.*
b/306266542

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-19 16:47:20 +00:00
gaaclarke
c8aa0844f2 [Impeller] implements a retry mechanism for dart:ui/Image.toByteData. (flutter/engine#46840)
Design doc: [link](https://docs.google.com/document/d/1Uuiw3pdQxNFTA8OQuZ-kuvYg1NB42XgccQCZeqr4oII/edit#heading=h.hn6wreyrz6fm)
fixes: https://github.com/flutter/flutter/issues/135245

One slight deviation from the design doc is that I decided to make ContextMTL respond to changes to the SyncSwitch instead of having it observe the app state directly.  The benefits are:
1) This keeps that functionality in one location
1) It makes writing tests much easier
1) There's no need of conditional compilation between macos and ios
1) There is no need to add an objc class

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-16 18:31:13 +00:00
Chris Bracken
1404722d05 Add doc comment to Pipeline (flutter/engine#40388)
Add doc comment to Pipeline
2023-03-17 20:38:55 +00:00
gaaclarke
e41c775200 Removed instances of unnecessary values (flutter/engine#36221) 2022-09-26 21:28:04 +00:00
Chris Bracken
b693201c04 [lint] Update local variable names in fml (#36136) (flutter/engine#36147)
This updates local variable names to use clang `lower_case` style in the
fml directory. This is one of several patches to update our variable
names to a consistent style before enabling enforcement in our
clang-tidy rules.

This is a formatting-only change with no intended semantic change.
2022-09-14 15:47:25 -07:00
Chris Bracken
53a9648da9 [lint] Merge impeller .clang-tidy into main config (flutter/engine#33692)
Merges most (but not all) of the impeller .clang-tidy rules into the
main .clang-tidy config. Merges:

readability-identifier-naming.PrivateMemberSuffix (_)
readability-identifier-naming.EnumConstantPrefix (k)
modernize-use-default-member-init.UseAssignment
Does not merge:

readability-identifier-naming.PublicMethodCase (CamelCase)
readability-identifier-naming.PrivateMethodCase (CamelCase)
These last two are not merged due to the non-trivial number of existing
field accessors that use field_name() methods to directly return
field_name_. While these are permitted by the C++ style guide, we may
want to move to a single, simple rule and name everything in CamelCase.
These can be enabled in a followup patch.

No new tests added, since this change is style-only.
2022-06-21 11:52:42 -07:00
ColdPaleLight
eb3479dd86 Replace 'std::mutex' inside 'SyncSwitch' to 'fml::SharedMutex' (flutter/engine#32773) 2022-04-19 09:44:04 -07:00
Zachary Anderson
eca60c0b90 Add clang-analyzer-* and clang-diagnostic-* to .clang-tidy (flutter/engine#31291) 2022-02-09 12:26:34 -08:00
Brandon DeRosier
925224a9ee Prefix remaining OS defines with FML_ namespace (flutter/engine#31172) 2022-01-31 14:31:44 -08:00
Brandon DeRosier
2d4f908b9d Add FML_ prefix to fml/build_config.h macros (flutter/engine#31141) 2022-01-31 11:53:51 -08:00
Dan Field
e7431e6a1f Re-enable Fuchsia CanWait test (flutter/engine#31095) 2022-01-26 15:10:08 -08:00
Chinmay Garde
35a2ccb79a Add unconditional waits on fml::Semaphore. (flutter/engine#30165) 2021-12-07 12:49:01 -08:00
Zachary Anderson
78d9e276e2 Fix some clang-tidy lints for Linux host_debug (flutter/engine#29734) 2021-11-18 13:08:01 -08:00
Zachary Anderson
03c0f7e453 Add 'explicit' to header files (flutter/engine#29741) 2021-11-17 12:49:16 -08:00
Dan Field
22da76000a Refactor GPU access switch (flutter/engine#24356) 2021-04-06 22:16:06 -07:00
Chris Bracken
2586db3b22 Clean up C++ includes (flutter/engine#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00
Chris Bracken
d03692449b Prefer C++ standard headers to their C counterpart (flutter/engine#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their
C++ variants (e.g. climits). This migrates to a consistent style for all
cases where the C++ variants are acceptable, but leaves the C
equivalents in place where they are required, such as in the embedder
API and other headers that may be used from C.
2020-09-11 17:10:00 -07:00
Greg Spencer
d9b08f5411 Lint fixes for fml, tools subdirs (flutter/engine#19990)
This does lint fixes for the fml and tools subdirs.
2020-07-30 12:40:31 -07:00
gaaclarke
ee0e1788d9 Made the linter print out more information in its output and fixed bugs (flutter/engine#19895) 2020-07-22 15:38:09 -07:00
Chinmay Garde
8f5f888826 Use the standard [[nodiscard]] attribute instead of an FML macro. (flutter/engine#17100) 2020-03-11 13:36:01 -07:00
George Wright
86f501cbd8 Disable flakey CountDownLatchTest.CanWait unit test on Fuchsia (flutter/engine#15982) 2020-01-24 19:21:20 -08:00
gaaclarke
ec5cf813f6 Made a way to turn off the OpenGL operations on the IO thread for backgrounded apps (flutter/engine#13908) 2019-11-22 14:08:33 -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
liyuqian
94d453d7d2 Update timeout_microseconds to timeout in docs (flutter/engine#13179) 2019-10-16 16:39:30 -07:00
Chinmay Garde
5f5821e8c1 Replace lock_guard with scoped_lock and use class template argument deduction. (flutter/engine#9338) 2019-06-17 10:08:45 -07:00
liyuqian
30a6b323b4 Add missing ifndef guard for count_down_latch.h (flutter/engine#9143)
I discovered this while experimenting with the timing API.
2019-05-30 14:17:08 -07:00
Matthew Dempsky
0bca459e28 Replace ararysize macro with fml::size function (flutter/engine#8975)
This is forward compatible with std::size and similar to how Chromium
removed use of the arraysize macro.
2019-05-15 12:43:47 -07:00
Chinmay Garde
2b4e6ce82b Merge flutter/synchronization contents into fml. (flutter/engine#8525)
When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides).
2019-04-09 19:18:51 -07:00
Chinmay Garde
c20c3c47f4 Remove redundant thread checker in FML. (flutter/engine#8053)
There is already fml/memory/thread_checker.h
2019-03-05 20:07:10 -08:00
Alexander Aprelev
839fd8348a Guard the service protocol's global handlers list with a reader/writer lock. (flutter/engine#6900)
* Revert "Revert "Guard the service protocol's global handlers list with a reader/writer lock (#6888) #6895" (#6899)"

This reverts commit bcf5e1eae123478564468b77251a2674bd0e773e and applies fix for tests on Windows.

* Reland guard the service protocol's global handlers list with a reader/writer lock.

* Remove blank line
2018-11-18 14:36:15 -08:00
Todd Volkert
bcf5e1eae1 Revert "Guard the service protocol's global handlers list with a reader/writer lock (#6888) #6895" (flutter/engine#6899) 2018-11-18 09:28:26 -08:00
Jason Simmons
f5496c0977 Guard the service protocol's global handlers list with a reader/writer lock (#6888) (flutter/engine#6895)
The service protocol holds the lock while waiting for completion of service
RPC tasks.  These tasks (specifically hot restart/RunInView) may need to
modify a handler's description data.

Task execution and ServiceProtocol::SetHandlerDescription will obtain a shared
lock to make this possible.  AddHandler and RemoveHandler will obtain an
exclusive lock in order to guard against a handler being deleted while a
service task is running.
2018-11-17 22:04:37 -08:00
Jason Simmons
7449dc427e Revert "Guard the service protocol's global handlers list with a reader/writer lock (#6888)" (flutter/engine#6893)
This reverts commit e740d7f1dbdb69dc4fd38e39c887dd3cccae7c3d.

(shared_timed_mutex is unavailable in the iOS build)
2018-11-17 12:27:06 -08:00
Jason Simmons
e740d7f1db Guard the service protocol's global handlers list with a reader/writer lock (flutter/engine#6888)
The service protocol holds the lock while waiting for completion of service
RPC tasks.  These tasks (specifically hot restart/RunInView) may need to
modify a handler's description data.

Task execution and ServiceProtocol::SetHandlerDescription will obtain a shared
lock to make this possible.  AddHandler and RemoveHandler will obtain an
exclusive lock in order to guard against a handler being deleted while a
service task is running.
2018-11-17 10:53:26 -08:00
Michael Goderbauer
0def82ddb0 Unify copyright lines (flutter/engine#6757) 2018-11-07 12:24:35 -08:00
Chinmay Garde
9e7967d181 Add a CountDownLatch to fml with tests. (flutter/engine#6574) 2018-10-17 17:20:44 -07:00
Ben Konyi
a3b839a0bf IsolateNameServer reland (flutter/engine#5519)
* Reland "Added IsolateNameServer functionality (#5410)"

This reverts commit 1598c7ad7b830b298647c17a0c85f3648f6b737d.

* Fixed issue with isolate_name_server_test which caused test to timeout

* Disabled thread_annotations on Android as they aren't supported in the
NDK headers for std::mutex. Readded thread annotations to
IsolateNameServer.
2018-06-13 11:57:10 -07:00
Chinmay Garde
407cfd2aa9 Import synchronization utilities into FML. (flutter/engine#5312) 2018-05-18 16:25:29 -07:00