252 Commits

Author SHA1 Message Date
Dan Field
5a2244c581
Reland path volatility tracker, disabling it if deterministic rendering is requested (#23226)
* Reland path volatility tracker (#23063)" (#23220)

This reverts commit fceef3aaa9d156e8ec3f4a079c142921882f70d8.

* allow disabling based on whether deterministic rendering is needed
2020-12-22 08:25:20 -08:00
Dan Field
fceef3aaa9
Revert "Reland path volatility tracker (#23063)" (#23220)
This reverts commit 205d2b8e188be518c313c9b537429b566d36fa35.
2020-12-21 13:53:18 -08:00
Dan Field
205d2b8e18
Reland path volatility tracker (#23063)
* Revert "Revert "Set SkPath::setIsVolatile based on whether the path survives at least two frames (#22620)" (#23044)"

This reverts commit 4f914253bd7cd2a5cca3fd97213df37494e9bf37.

* Fix tracing
2020-12-14 17:21:55 -08:00
freiling
3105db8ee8
SKP based shader warmup (#20643) 2020-11-04 23:19:02 -08:00
Chinmay Garde
cac04c4cfa
Add FML_UNREACHABLE to declare points in code that should never be reached. (#21941)
A version of this macro is present in most code-bases. The use of this macro
must satisfy two requirements:

1: If reached, the process must be terminated in all runtime modes and at all
   optimization levels.
2: If the compiler requires a value to be returned from the function,
   encountering this macro should not make the compiler insist on a return value
  (since the process is about to die anyway).

We used to have a version of this macro that wasn't widely used and didn't
satisfy the two requirements. I have removed the same and another unused macro
in fml/logging.h

Fixes https://github.com/flutter/flutter/issues/68164.
2020-10-16 20:47:43 -07:00
Chinmay Garde
5bd7260a1e
Enable loading snapshots with sound null safety enabled. (#21820)
Snapshots compiled with sound null-safety enabled require changes to the way in
which isolates are launched. Specifically, the `Dart_IsolateFlags::null_safety`
field needs to be known upfront. The value of this field can only be determined
once the kernel snapshot is available. This poses a problem in the engine
because the engine used to launch the isolate at shell initialization and only
need the kernel mappings later at isolate launch (when transitioning the root
isolate to the `DartIsolate::Phase::Running` phase). This patch delays launch of
the isolate on the UI task runner till a kernel mapping is available. The side
effects of this delay (callers no longer having access to the non-running
isolate handle) have been addressed in this patch. The DartIsolate API has also
been amended to hide the method that could return a non-running isolate to the
caller.  Instead, it has been replaced with a method that requires a valid
isolate configuration that returns a running root isolate. The isolate will be
launched by asking the isolate configuration for its null-safety
characteristics.

A side effect of enabling null-safety is that Dart APIs that work with legacy
types will now terminate the process if used with an isolate that has sound
null-safety enabled. These APIs may no longer be used in the engine. This
primarily affects the Dart Convertors in Tonic that convert certain C++ objects
into the Dart counterparts. All known Dart Converters have been updated to
convert C++ objects to non-nullable Dart types inferred using type traits of the
corresponding C++ object. The few spots in the engine that used the old Dart
APIs directly have been manually updated. To ensure that no usage of the legacy
APIs remain in the engine (as these would cause runtime process terminations),
the legacy APIs were prefixed with the `DART_LEGACY_API` macro and the macro
defined to `[[deprecated]]` in all engine translation units. While the engine
now primarily works with non-nullable Dart types, callers can still use
`Dart_TypeToNonNullableType` to acquire nullable types for use directly or with
Tonic. One use case that is not addressed with the Tonic Dart Convertors is the
creation of non-nullable lists of nullable types. This hasn’t come up so far in
the engine.

A minor related change is reworking tonic to define a single library target.
This allows the various tonic subsystems to depend on one another. Primarily,
this is used to make the Dart convertors use the logging utilities. This now
allows errors to be more descriptive as the presence of error handles is caught
(and logged) earlier.

Fixes https://github.com/flutter/flutter/issues/59879
2020-10-16 14:53:26 -07:00
Dan Field
612acf349e
Fix windows popup (#21522) 2020-09-30 14:38:44 -07:00
Chinmay Garde
f3d7a76e97
Make scoped_nsprotocol::release() private. (#21467)
This is not used anywhere in the engine. However, this API is easy to misuse as
one might incorrectly assume that it releases the reference on the underlying
object. Callers must use `reset` for this purpose.
2020-09-28 14:02:21 -07:00
Chris Bracken
08dabe9601
Clean up C++ includes (#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
16b900b63e
Prefer C++ standard headers to their C counterpart (#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
Emmanuel Garcia
efb339f300
Only clear GL context after changing the thread configuration (#20965) 2020-09-02 22:10:02 -07:00
Emmanuel Garcia
1b0c684326
Add ability to disable the raster thread merger (#20800) 2020-08-28 17:25:00 -07:00
Chris Yang
2d3e1c58c5
|MessageLoopImpl::FlushTasks| runs one task at a time (#20771) 2020-08-27 14:18:02 -07:00
Emmanuel Garcia
8107b36c7b
Ensure loop is woken up at the right time (#20721) 2020-08-24 13:09:44 -07:00
Chris Yang
e7136c3f59
Ensure threads are merged when tearing down the Rasterizer (#19919) 2020-08-19 08:31:01 -07:00
David Worsham
6381b1511b
Fix broken shell_unittests on Fuchsia (#20422)
Fixes https://github.com/flutter/flutter/issues/53399
2020-08-11 17:31:25 -07:00
Zachary Anderson
d986b8d606
Enable linting in several files (#20134) 2020-07-31 21:28:36 -07:00
Greg Spencer
e23e4775ae
Lint fixes for fml, tools subdirs (#19990)
This does lint fixes for the fml and tools subdirs.
2020-07-30 12:40:31 -07:00
Siva
b955e15ee9
Manual roll of Dart from 24c7666def...40fd1c456e (#20092)
* Manual roll of Dart from 24c7666def...40fd1c456e

dart-lang/sdk@40fd1c456e Revert "[dart:io] Add Abort() on HttpClientRequest"
dart-lang/sdk@17d7296a42 [vm/nnbd/bytecode] Fix reuse of type arguments in bytecode
dart-lang/sdk@58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
dart-lang/sdk@fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
dart-lang/sdk@0689ec527a Move "test.dart" (well, most of its contents) into pkg/test_runner.
dart-lang/sdk@1094b3c61d Prepare static error test updater tool to handle web tests.
dart-lang/sdk@b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
dart-lang/sdk@dfe1d9b682 Disable OverrideContributor for Cider.
dart-lang/sdk@aea99b2f5c scope debug property assist to Diagnosticables
dart-lang/sdk@4b96f20a79 [dart:io] Add Abort() on HttpClientRequest
dart-lang/sdk@1b1a39708c [build] Use frameworks instead of libs
dart-lang/sdk@3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
dart-lang/sdk@8c664d4f3f Revert "Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns."
dart-lang/sdk@2efb5bebc7 [ dart:_http ] Fix typo in HTTP response timeline event
dart-lang/sdk@0884dae36c Revert "Fix the #include path for ICU headers"
dart-lang/sdk@5171534e81 Scope tweaks. Report REFERENCED_BEFORE_DECLARATION in more places.
dart-lang/sdk@6bba75079a Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns.
dart-lang/sdk@b4ebbb7f5c [build] Update gn to match Fuchsia
dart-lang/sdk@cb428a7a02 [dart2js] Remove old bug work around in collector.
dart-lang/sdk@08663c20ab Change flutter patch to match existing DEPS on master branch
dart-lang/sdk@146ad014d9 update js/meta for the 2.10 dev sdk
dart-lang/sdk@488c718793 [co19] Roll co19 to d79951e06e443213243e54c2c32694b79a221b65
dart-lang/sdk@ba20edd7be Add patch for flutter-engine when changing to version 2.10

* Rev buildroot to latest version.

* Update license.

* update.

* Update gn revision.

* Format BUILD.gn files as the gn revision has been updated.
2020-07-29 13:10:15 -07:00
gaaclarke
21efd7325e
Made the linter print out more information in its output and fixed bugs (#19895) 2020-07-22 15:38:09 -07:00
David Worsham
bf9d2eadb7
fuchsia: Allow setting thread-name (#19792) 2020-07-16 12:43:53 -07:00
David Worsham
9353692cdb
fuchsia: Enable most unittests (#19583)
Tweak the primary flutter build rule so that fuchsia is more similar to
other platforms in how tests and the shell are built.

Only embedder_unittests and GLFW tests are disabled on Fuchsia now.

TEST: Ran unittests on host/fuchsia; workstation on fuchsia
BUG: fxb/53847, fxb/54056
2020-07-13 17:36:19 -07:00
Emmanuel Garcia
b990ad11bd
Implement external view embedder on Android (#19033)
The external view embedder allows to embed Android views in a Flutter app.
2020-06-20 12:51:55 -07:00
Michael Goderbauer
486f26fbf9
Rename trace-whitelist to trace-allowlist (#19047) 2020-06-15 20:52:43 -07:00
Chinmay Garde
db7f226c5e
Include the memory header as unique_ptr is used in ASCII Trie. (#18978) 2020-06-10 17:25:04 -07:00
Jason Simmons
e8c13aa012
Disable event tracing templates in release mode (#18855) 2020-06-09 10:58:05 -07:00
zljj0818
fb1e5cfa25
fix AttachCurrentThread override thread name issue (#18815) 2020-06-08 12:03:03 -07:00
George Wright
80093aaa4b
Implement WriteAtomically using write/fsync on all platforms, and enable (#18320) 2020-05-21 12:07:03 -07:00
David Worsham
1429534707
fuchsia: Fix runtime_tests and shell_tests (#18492) 2020-05-20 18:47:02 -07:00
George Wright
cdc5ed3ad9
Set caches directory on Fuchsia (#18321) 2020-05-20 11:05:55 -07:00
Chris Yang
9ce1e5c5c7
Introduce TaskRunnerAffineWeakPtrFactory to generate TaskRunnerAffineWeakPtrs (#18346) 2020-05-19 16:36:17 -07:00
liyuqian
a4fb3de207
Automatically remove old persistent cache dir (#18244)
Fixes https://github.com/flutter/flutter/issues/53445
2020-05-15 14:15:59 -07:00
Chris Yang
4a1f9fa959
refactor the task_runner and task_runner_checker (#18238) 2020-05-11 13:58:08 -07:00
Kaushik Iska
ede658e2d1
[profiling] CPU Profiling support for iOS (#18087)
See flutter.dev/go/engine-cpu-profiling for details
2020-05-07 08:11:07 -07:00
Chris Yang
2622cb9c33
Introduce TaskRunnerChecker, TaskRunnerAffineWeakPtr (#17649) 2020-05-01 11:28:20 -07:00
liyuqian
a8af96da66
Read SkSLs from asset (#17601)
Fixes https://github.com/flutter/flutter/issues/53117

Test added:
- ShellTest.CanLoadSkSLsFromAsset
2020-04-10 00:16:33 -07:00
gaaclarke
8f6590cbbc
Added "unrecognized-selector" errors to match g3 builds (#17566)
Added "unrecognized-selector" errors to match g3 builds, added
"overriding-method-mismatch" to catch a common error.
2020-04-07 13:28:42 -07:00
Chris Bracken
b2cc00f078
Revert "Added errors to match g3 builds and simple errors (#17536)" (#17564)
Test failure:

    [ RUN      ] FlutterStringCodec.CanEncodeAndDecodeNil
    2020-04-07 10:21:25.091 flutter_channels_unittests[26965:163315] *** Assertion failure in -[FlutterStringCodec encode:], ../../flutter/shell/platform/darwin/common/framework/Source/FlutterCodecs.mm:36
    2020-04-07 10:21:25.118 flutter_channels_unittests[26965:163315] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ''
    *** First throw call stack:
    (
    	0   CoreFoundation                      0x00007fff2ccabcf9 __exceptionPreprocess + 256
    	1   libobjc.A.dylib                     0x00007fff5785ea17 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff2ccc6a16 +[NSException raise:format:arguments:] + 98
    	3   Foundation                          0x00007fff2ef58e11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    	4   flutter_channels_unittests          0x0000000105f1cce2 -[FlutterStringCodec encode:] + 290
    	5   flutter_channels_unittests          0x0000000105f01bbb _ZN45FlutterStringCodec_CanEncodeAndDecodeNil_Test8TestBodyEv + 107
    	6   flutter_channels_unittests          0x00000001081d1732 _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc + 146
    	7   flutter_channels_unittests          0x00000001081a76b0 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc + 128
    	8   flutter_channels_unittests          0x00000001081a75c1 _ZN7testing4Test3RunEv + 209
    	9   flutter_channels_unittests          0x00000001081a8415 _ZN7testing8TestInfo3RunEv + 229
    	10  flutter_channels_unittests          0x00000001081a95aa _ZN7testing9TestSuite3RunEv + 266
    	11  flutter_channels_unittests          0x00000001081b4e43 _ZN7testing8internal12UnitTestImpl11RunAllTestsEv + 995
    	12  flutter_channels_unittests          0x00000001081d8572 _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc + 146
    	13  flutter_channels_unittests          0x00000001081b49b3 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc + 131
    	14  flutter_channels_unittests          0x00000001081b4835 _ZN7testing8UnitTest3RunEv + 197
    	15  flutter_channels_unittests          0x0000000105f22e73 _Z13RUN_ALL_TESTSv + 35
    	16  flutter_channels_unittests          0x0000000105f22d79 main + 553
    	17  libdyld.dylib                       0x00007fff5908c3d5 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    [ERROR:flutter/fml/backtrace.cc(110)] Caught signal SIGABRT during program execution.
    Frame 0: 0x7fff591316a6 abort
    Frame 1: 0x7fff560ea641 __cxa_bad_cast
    Frame 2: 0x7fff560ea7df default_unexpected_handler()�
    Frame 3: 0x7fff57860ee3 _objc_terminate()�
    Frame 4: 0x7fff560f619e std::__terminate(void (*)())�
    Frame 5: 0x7fff560f5f86 __cxa_get_exception_ptr
    Frame 6: 0x7fff560e8f99 __cxa_get_globals
    Frame 7: 0x7fff5785eb51 objc_exception_throw
    Frame 8: 0x7fff2ccc6a16 +[NSException raise:format:arguments:]
    Frame 9: 0x7fff2ef58e11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
    Frame 10: 0x105f1cce2 -[FlutterStringCodec encode:]
    Frame 11: 0x105f01bbb FlutterStringCodec_CanEncodeAndDecodeNil_Test::TestBody()�
    Frame 12: 0x1081d1732 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)�
    Frame 13: 0x1081a76b0 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)�
    Frame 14: 0x1081a75c1 testing::Test::Run()�
    Frame 15: 0x1081a8415 testing::TestInfo::Run()�
    Frame 16: 0x1081a95aa testing::TestSuite::Run()�
    Frame 17: 0x1081b4e43 testing::internal::UnitTestImpl::RunAllTests()�
    Frame 18: 0x1081d8572 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)�
    Frame 19: 0x1081b49b3 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)�
    Frame 20: 0x1081b4835 testing::UnitTest::Run()�
    Frame 21: 0x105f22e73 RUN_ALL_TESTS()�
    Frame 22: 0x105f22d79 main
    Frame 23: 0x7fff5908c3d5 start

This reverts commit d1c90b4284282f9745ecd7c65aa72c612df671c1.
2020-04-07 10:32:38 -07:00
gaaclarke
d1c90b4284
Added errors to match g3 builds and simple errors (#17536)
"unrecognized-selector" and "overriding-method-mismatch" added as errors.
2020-04-07 10:03:49 -07:00
Kaushik Iska
abc72933e7
[pipeline] Add trace event for lag between target and display times (#17384)
This change also adds TimeRecorder which records time at the start
of each frame to capture the latest vsync target display time and
wires it in to the rasterizer to add trace events when there is a lag.
2020-04-02 17:15:45 -07:00
liyuqian
f003d9b41a
GPU to raster rename, patch 2 (#17428) 2020-03-31 15:16:11 -07:00
liyuqian
807ca8543c
More rename from GPU thread to raster thread (#17408)
This PR touches variable names, class names, and file names so it's significantly more risky than its predecessor https://github.com/flutter/engine/pull/17329

Due to file name changes, this PR is expected to change the license files.

We haven't rename `shell/gpu` to `shell/raster` yet. It should be optional but I think it's better to have `raster_surface_software.cc` than `gpu_surface_software.cc`.
2020-03-31 14:05:28 -07:00
liyuqian
b3075b3091
Rename GPU thread to raster thread in code comments (#17329)
1. Simple "GPU thread" to "raster thread" replacement.

2. Regex replace "GPU([\n\r\s]+//+ thread)" with "raster$1".

3. Regex replace "// gpu$" with "// raster".

4. Simple test change.

5. Run ci/format.sh
2020-03-25 22:49:59 -07:00
Chinmay Garde
518c9e09cc
Remove checks for the always true using_fuchsia_sdk flag in all GN files. (#17261) 2020-03-23 18:31:02 -07:00
Chinmay Garde
e56b335ade
Allow external texture sources when using the Metal backend. (#17154) 2020-03-22 22:36:03 -07:00
gaaclarke
fddb0c272e
Made it so you can whitelist what events you want to listen to (#17108) 2020-03-16 11:00:03 -07:00
Chinmay Garde
2844d4480b
Remove unused or unnecessary compiler specific marcos in FML. (#17101)
Macros to control inlining are not used and we explicitly recommending against
playing with compiler inlining. The macros for alignment became part of the
standard in C++11 and we already use the standard variants over these macros
(see `PointerData`). The formatters are unused as well and we use the stream
based variants for formatting.
2020-03-11 16:31:50 -07:00
Chinmay Garde
a37560a074
Use the standard [[nodiscard]] attribute instead of an FML macro. (#17100) 2020-03-11 13:36:01 -07:00
Chinmay Garde
7c2d975b55
Gather demangled stack traces and report the same to console on crashes. (#16450)
These should only be used on host binaries for more detailed crash reports.
Installing the handler on targets (iOS/Android) may cause use to break existing
crash reporting mechanisms users may have installed themselves in the process.

This should work on Darwin & Linux for now.

Doing something like int* a = nullptr; *a = 12; or abort or tripping an
assertion should print something the following before program termination. We
can tweak the report further if necessary.

```
[ERROR:flutter/fml/backtrace.cc(110)] Caught signal SIGSEGV during program execution.
Frame 0: 0x10658342c void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
Frame 1: 0x106555070 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
Frame 2: 0x106554f81 testing::Test::Run()
Frame 3: 0x106555dc3 testing::TestInfo::Run()
Frame 4: 0x1065570a1 testing::TestSuite::Run()
Frame 5: 0x106562a55 testing::internal::UnitTestImpl::RunAllTests()
Frame 6: 0x10658c22c bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
Frame 7: 0x1065625c3 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)
Frame 8: 0x106562445 testing::UnitTest::Run()
Frame 9: 0x105c8dc33 RUN_ALL_TESTS()
Frame 10: 0x105c8dbe6 main
Frame 11: 0x7fff7c2dc3d5 start
```

Known issue: This routines that generate the stack trace are not signal safe.
But since we only use the same before the process is terminating, this ought to
be fine. I’ll work in a separate patch to convert all the internals to be signal
safe. In the meantime, this will help us better identify the causes of flakes on
our bots.

Fixes https://github.com/flutter/flutter/issues/50244
2020-03-10 16:31:06 -07:00
Chinmay Garde
92abb22c64
Reland "Lift restriction that embedders may not trample the render thread OpenGL context in composition callbacks." (#16711)
This reverts commit ef9e7b1a1365c07ab0df2e2016c4442c3963c2c7 with the following changes to accommodate an embedder for whom the original optimizations caused issues:

* Ensure stable order in the backing stores presented to the embedder. This is a pessimization that will be reverted when the embedder migrates. Tracked in  https://github.com/flutter/flutter/issues/51228
* Forego the optimization where the unused layers would be collected before allocation of new layers needs to happen. This is a pessimization that will be reverted when the embedder migrates. Tracked in  https://github.com/flutter/flutter/issues/51229

More context in b/146142979.
2020-02-24 11:48:32 -08:00